From dd8e21da62492519bc46bc11826bb192909c004b Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 24 Oct 2017 15:57:30 +0200 Subject: [PATCH] fix get play position Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/b610e48cdbae8eccf0fc9ba1c3170cde5a3deaf1 Author: Jacek Jendrzej Date: 2017-10-24 (Tue, 24 Oct 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/playback_gst.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libarmbox/playback_gst.cpp b/libarmbox/playback_gst.cpp index 548d22f..ae01cc1 100644 --- a/libarmbox/playback_gst.cpp +++ b/libarmbox/playback_gst.cpp @@ -748,13 +748,18 @@ bool cPlayback::GetPosition(int &position, int &duration) { //position GstFormat fmt = GST_FORMAT_TIME; //Returns time in nanosecs - gint64 pts = 0; - unsigned long long int sec = 0; - - gst_element_query_position(m_gst_playbin, fmt, &pts); + if (audioSink || videoSink) + { + 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; - // duration GstFormat fmt_d = GST_FORMAT_TIME; //Returns time in nanosecs double length = 0;