diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2009-09-16 06:55:29 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2009-09-16 06:55:29 (GMT) |
commit | 6a0ccd3477b0ddb0a550b56bdc41e8ae1cf740a6 (patch) | |
tree | 64f3f926706a4287f1156db6d6d64cded5b04bda /src/3rdparty | |
parent | e7042dea2431b8f64574d4e97eb896285b328c8b (diff) | |
download | Qt-6a0ccd3477b0ddb0a550b56bdc41e8ae1cf740a6.zip Qt-6a0ccd3477b0ddb0a550b56bdc41e8ae1cf740a6.tar.gz Qt-6a0ccd3477b0ddb0a550b56bdc41e8ae1cf740a6.tar.bz2 |
Fixes: Fixed incorrect tracks number calculation with phonon/gst
RevBy: Andrew den Exter
Details:
gst_element_query_duration(element,format,duration) doesn't always
return duration in format being asked for (tracks in this case),
it can also return duration in format it can (Time) and modify
format parameter, so check the format is still the same
as requested is necessary. This bug prevented Phonon to emit finished()
signal with some files, since it expected next tracks to exist.
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/gstreamer/mediaobject.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 74fc1b4..13f9734 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -965,11 +965,15 @@ void MediaObject::getStreamInfo() gint64 titleCount; GstFormat format = gst_format_get_by_nick("track"); if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { - int oldAvailableTitles = m_availableTitles; - m_availableTitles = (int)titleCount; - if (m_availableTitles != oldAvailableTitles) { - emit availableTitlesChanged(m_availableTitles); - m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + //check if returned format is still "track", + //gstreamer sometimes returns the total time, if tracks information is not available. + if (qstrcmp(gst_format_get_name(format), "track") == 0) { + int oldAvailableTitles = m_availableTitles; + m_availableTitles = (int)titleCount; + if (m_availableTitles != oldAvailableTitles) { + emit availableTitlesChanged(m_availableTitles); + m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + } } } |