libsaria: Change meaning of audio::seek_to()

It used to seek to a percentage of the pipeline, but now is seeks to an
absolute position in nanoseconds.
This commit is contained in:
Bryan Schumaker 2011-11-06 20:25:13 -05:00
parent 6b58311e9e
commit c1332133a9
2 changed files with 6 additions and 13 deletions

View File

@ -23,7 +23,7 @@ namespace libsaria
/* Position related functions */
bool seek(int);
bool seek_to(double);
void seek_to(double);
gint64 duration();
gint64 position();
string posstr();

View File

@ -24,19 +24,12 @@ static bool get_position(gint64 &position)
namespace libsaria
{
bool audio::seek_to(double prcnt)
void audio::seek_to(double pos)
{
bool ret;
gint64 duration;
ret = get_duration(duration);
if (ret == true) {
gst_element_seek_simple(GST_ELEMENT(get_player()),
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
duration * prcnt);
}
return ret;
gst_element_seek_simple(GST_ELEMENT(get_player()),
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
pos);
}
/* Use to seek forward or backward in a song */