armbox: fix gst seeking

Origin commit data
------------------
Branch: master
Commit: 6dcf797dba
Author: TangoCash <eric@loxat.de>
Date: 2017-10-15 (Sun, 15 Oct 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2017-10-15 15:10:18 +02:00
parent 85525fd0df
commit f0ea38c2f9

View File

@@ -555,7 +555,7 @@ void cPlayback::trickSeek(int ratio)
if( GetPosition(position, duration) ) if( GetPosition(position, duration) )
{ {
validposition = true; validposition = true;
pos = position; pos = position*1000000;
} }
gst_element_set_state(m_gst_playbin, GST_STATE_PLAYING); gst_element_set_state(m_gst_playbin, GST_STATE_PLAYING);
@@ -693,10 +693,14 @@ bool cPlayback::SetPosition(int position, bool absolute)
if(m_gst_playbin) if(m_gst_playbin)
{ {
gst_element_query_position(m_gst_playbin, fmt, &pos); if (!absolute) {
time_nanoseconds = pos + (position * 1000000.0); gst_element_query_position(m_gst_playbin, fmt, &pos);
if(time_nanoseconds < 0) time_nanoseconds = pos + (position * 1000000.0);
time_nanoseconds = 0; if(time_nanoseconds < 0)
time_nanoseconds = 0;
} else {
time_nanoseconds = position * 1000000.0;
}
gst_element_seek(m_gst_playbin, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, time_nanoseconds, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); gst_element_seek(m_gst_playbin, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, time_nanoseconds, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
} }
@@ -867,7 +871,7 @@ uint64_t cPlayback::GetReadCount()
int cPlayback::GetAPid(void) int cPlayback::GetAPid(void)
{ {
lt_info("%s\n", __func__); lt_info("%s\n", __func__);
return 0; return mAudioStream;
} }
int cPlayback::GetVPid(void) int cPlayback::GetVPid(void)