diff options
Diffstat (limited to 'src/3rdparty/phonon/gstreamer/mediaobject.cpp')
-rw-r--r-- | src/3rdparty/phonon/gstreamer/mediaobject.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5713263..eafaeec 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -344,7 +344,7 @@ void MediaObject::cb_pad_added(GstElement *decodebin, Q_UNUSED(decodebin); GstPad *decodepad = static_cast<GstPad*>(data); gst_pad_link (pad, decodepad); - gst_object_unref (decodepad); + //gst_object_unref (decodepad); } /** @@ -374,9 +374,21 @@ bool MediaObject::createPipefromURL(const QUrl &url) return false; // Set the device for MediaSource::Disc - QByteArray mediaDevice = QFile::encodeName(m_source.deviceName()); - if (!mediaDevice.isEmpty()) - g_object_set (m_datasource, "device", mediaDevice.constData(), (const char*)NULL); + if (m_source.type() == MediaSource::Disc) { + + if (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "device")) { + QByteArray mediaDevice = QFile::encodeName(m_source.deviceName()); + if (!mediaDevice.isEmpty()) + g_object_set (G_OBJECT (m_datasource), "device", mediaDevice.constData(), (const char*)NULL); + } + + // Also Set optical disc speed to 2X for Audio CD + if (m_source.discType() == Phonon::Cd + && (g_object_class_find_property (G_OBJECT_GET_CLASS (m_datasource), "read-speed"))) { + g_object_set (G_OBJECT (m_datasource), "read-speed", 2, (const char*)NULL); + m_backend->logMessage(QString("new device speed : 2X"), Backend::Info, this); + } + } // Link data source into pipeline gst_bin_add(GST_BIN(m_pipeline), m_datasource); @@ -916,23 +928,27 @@ void MediaObject::setSource(const MediaSource &source) setError(tr("Could not open media source.")); break; - case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4 + case MediaSource::Disc: { - QUrl url; + QString mediaUrl; switch (source.discType()) { - case Phonon::Cd: - url = QUrl(QLatin1String("cdda://")); - break; - case Phonon::Dvd: - url = QUrl(QLatin1String("dvd://")); - break; - case Phonon::Vcd: - url = QUrl(QLatin1String("vcd://")); - break; - default: - break; + case Phonon::NoDisc: + qWarning() << "I should never get to see a MediaSource that is a disc but doesn't specify which one"; + return; + case Phonon::Cd: // CD tracks can be specified by setting the url in the following way uri=cdda:4 + mediaUrl = QLatin1String("cdda://"); + break; + case Phonon::Dvd: + mediaUrl = QLatin1String("dvd://"); + break; + case Phonon::Vcd: + mediaUrl = QLatin1String("vcd://"); + break; + default: + qWarning() << "media " << source.discType() << " not implemented"; + return; } - if (!url.isEmpty() && createPipefromURL(url)) + if (!mediaUrl.isEmpty() && createPipefromURL(QUrl(mediaUrl))) m_loading = true; else setError(tr("Could not open media source.")); |