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:
parent
6b58311e9e
commit
c1332133a9
|
@ -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();
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue