Changeset 561 for trunk/src/3rdparty/phonon/gstreamer/mediaobject.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/3rdparty/phonon/gstreamer/mediaobject.cpp
r2 r561 88 88 89 89 if (!m_backend->isValid()) { 90 setError(tr("Cannot start playback. \n\nCheck your G streamer installation and make sure you "90 setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you " 91 91 "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError); 92 92 } else { … … 96 96 connect(m_tickTimer, SIGNAL(timeout()), SLOT(emitTick())); 97 97 } 98 connect(this, SIGNAL(stateChanged(Phonon::State, 99 this, SLOT(notifyStateChange(Phonon::State, 98 connect(this, SIGNAL(stateChanged(Phonon::State,Phonon::State)), 99 this, SLOT(notifyStateChange(Phonon::State,Phonon::State))); 100 100 101 101 } … … 227 227 228 228 // These functions require GStreamer > 0.10.12 229 #ifndef QT_NO_LIBRARY 229 230 static Ptr_gst_pb_utils_init p_gst_pb_utils_init = 0; 230 231 static Ptr_gst_pb_utils_get_codec_description p_gst_pb_utils_get_codec_description = 0; … … 240 241 value = QString::fromUtf8(codecName); 241 242 g_free (codecName); 242 } else { 243 } else 244 #endif //QT_NO_LIBRARY 245 { 243 246 // For GStreamer versions < 0.10.12 244 247 GstStructure *str = gst_caps_get_structure (caps, 0); 245 248 value = QString::fromUtf8(gst_structure_get_name (str)); 249 246 250 } 247 251 media->addMissingCodecName(value); … … 341 345 GstPad *decodepad = static_cast<GstPad*>(data); 342 346 gst_pad_link (pad, decodepad); 343 gst_object_unref (decodepad);347 //gst_object_unref (decodepad); 344 348 } 345 349 … … 369 373 if (!m_datasource) 370 374 return false; 375 376 // Set the device for MediaSource::Disc 377 if (m_source.type() == MediaSource::Disc) { 378 379 if (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "device")) { 380 QByteArray mediaDevice = QFile::encodeName(m_source.deviceName()); 381 if (!mediaDevice.isEmpty()) 382 g_object_set (G_OBJECT (m_datasource), "device", mediaDevice.constData(), (const char*)NULL); 383 } 384 385 // Also Set optical disc speed to 2X for Audio CD 386 if (m_source.discType() == Phonon::Cd 387 && (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "read-speed"))) { 388 g_object_set (G_OBJECT (m_datasource), "read-speed", 2, (const char*)NULL); 389 m_backend->logMessage(QString("new device speed : 2X"), Backend::Info, this); 390 } 391 } 371 392 372 393 // Link data source into pipeline … … 388 409 bool MediaObject::createPipefromStream(const MediaSource &source) 389 410 { 411 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM 390 412 // Remove any existing data source 391 413 if (m_datasource) { … … 409 431 } 410 432 return true; 433 #else //QT_NO_PHONON_ABSTRACTMEDIASTREAM 434 Q_UNUSED(source); 435 return false; 436 #endif 411 437 } 412 438 … … 903 929 break; 904 930 905 case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4931 case MediaSource::Disc: 906 932 { 907 QUrl cdurl(QLatin1String("cdda://")); 908 if (createPipefromURL(cdurl)) 933 QString mediaUrl; 934 switch (source.discType()) { 935 case Phonon::NoDisc: 936 qWarning() << "I should never get to see a MediaSource that is a disc but doesn't specify which one"; 937 return; 938 case Phonon::Cd: // CD tracks can be specified by setting the url in the following way uri=cdda:4 939 mediaUrl = QLatin1String("cdda://"); 940 break; 941 case Phonon::Dvd: 942 mediaUrl = QLatin1String("dvd://"); 943 break; 944 case Phonon::Vcd: 945 mediaUrl = QLatin1String("vcd://"); 946 break; 947 default: 948 qWarning() << "media " << source.discType() << " not implemented"; 949 return; 950 } 951 if (!mediaUrl.isEmpty() && createPipefromURL(QUrl(mediaUrl))) 909 952 m_loading = true; 910 953 else … … 966 1009 GstFormat format = gst_format_get_by_nick("track"); 967 1010 if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { 968 int oldAvailableTitles = m_availableTitles; 969 m_availableTitles = (int)titleCount; 970 if (m_availableTitles != oldAvailableTitles) { 971 emit availableTitlesChanged(m_availableTitles); 972 m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); 1011 //check if returned format is still "track", 1012 //gstreamer sometimes returns the total time, if tracks information is not available. 1013 if (qstrcmp(gst_format_get_name(format), "track") == 0) { 1014 int oldAvailableTitles = m_availableTitles; 1015 m_availableTitles = (int)titleCount; 1016 if (m_availableTitles != oldAvailableTitles) { 1017 emit availableTitlesChanged(m_availableTitles); 1018 m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); 1019 } 973 1020 } 974 1021 }
Note:
See TracChangeset
for help on using the changeset viewer.