mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
fix get play position
This commit is contained in:
committed by
TangoCash
parent
95ff777250
commit
cb33592f3c
@@ -747,13 +747,18 @@ bool cPlayback::GetPosition(int &position, int &duration)
|
|||||||
{
|
{
|
||||||
//position
|
//position
|
||||||
GstFormat fmt = GST_FORMAT_TIME; //Returns time in nanosecs
|
GstFormat fmt = GST_FORMAT_TIME; //Returns time in nanosecs
|
||||||
|
|
||||||
gint64 pts = 0;
|
gint64 pts = 0;
|
||||||
unsigned long long int sec = 0;
|
if (audioSink || videoSink)
|
||||||
|
{
|
||||||
gst_element_query_position(m_gst_playbin, fmt, &pts);
|
g_signal_emit_by_name(audioSink ? audioSink : videoSink, "get-decoder-time", &pts);
|
||||||
|
if (!GST_CLOCK_TIME_IS_VALID(pts)){
|
||||||
|
lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(!gst_element_query_position(m_gst_playbin, fmt, &pts))
|
||||||
|
lt_info( "%s - %d failed\n", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
position = pts / 1000000.0;
|
position = pts / 1000000.0;
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
GstFormat fmt_d = GST_FORMAT_TIME; //Returns time in nanosecs
|
GstFormat fmt_d = GST_FORMAT_TIME; //Returns time in nanosecs
|
||||||
double length = 0;
|
double length = 0;
|
||||||
|
Reference in New Issue
Block a user