From 52fc572b04afb0003f0c4548a7065ab312c62da8 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Feb 15 2011 21:08:12 +0000 Subject: upstream patch for better(working) dvd playback --- diff --git a/phonon-backend-gstreamer-4.4.4-dvd_playback.patch b/phonon-backend-gstreamer-4.4.4-dvd_playback.patch new file mode 100644 index 0000000..3d427ba --- /dev/null +++ b/phonon-backend-gstreamer-4.4.4-dvd_playback.patch @@ -0,0 +1,181 @@ +From: Trever Fischer +Date: Mon, 14 Feb 2011 06:05:45 +0000 +Subject: Fix audio playback with DVDs +X-Git-Url: http://quickgit.kde.org/?p=phonon-gstreamer.git&a=commitdiff&h=a2aed0f998e45b6c98a9827aeae17120ef86b269 +--- +Fix audio playback with DVDs +--- + + +--- a/gstreamer/mediaobject.cpp ++++ b/gstreamer/mediaobject.cpp +@@ -412,6 +412,8 @@ void MediaObject::connectVideo(GstPad *p + m_hasVideo = m_videoStreamFound; + emit hasVideoChanged(m_hasVideo); + } ++ } else { ++ m_backend->logMessage("Could not connect video track"); + } + gst_object_unref (videopad); + } else { +@@ -465,6 +467,84 @@ bool MediaObject::createV4lPipe(const De + return true; + } + ++bool MediaObject::createPipefromDVD(const MediaSource &source) ++{ ++ // Remove any existing data source ++ if (m_datasource) { ++ gst_bin_remove(GST_BIN(m_pipeline), m_datasource); ++ // m_pipeline has the only ref to datasource ++ m_datasource = 0; ++ } ++ ++ ++ // For a good overview of what a 'subpicture' is, read up on them here: ++ // http://www.mediachance.com/dvdmenu/Help/basics.htm ++ // ++ // The graph we build here takes the video, audio, and subpicture streams ++ // from the dvd device via the rsndvdbin element. The video and subpicture ++ // streams are then combined in the dvdspu element, creating one single ++ // video output stream. The audio and video streams are then funneled into ++ // the audioGraph and videoGraph bins by way of connectAudio and decodebin, ++ // respectively. ++ ++ m_datasource = gst_bin_new(NULL); ++ gst_bin_add(GST_BIN(m_pipeline), m_datasource); ++ ++ GstElement *dvdsrc = gst_element_factory_make("rsndvdbin", NULL); ++ gst_bin_add(GST_BIN(m_datasource), dvdsrc); ++ ++ QByteArray mediaDevice = QFile::encodeName(source.deviceName()); ++ if (!mediaDevice.isEmpty()) ++ g_object_set (G_OBJECT (m_datasource), "device", mediaDevice.constData(), (const char*)NULL); ++ ++ // Video pipeline ++ GstElement *convert = gst_element_factory_make("ffmpegcolorspace", NULL); ++ GstElement *videoQueue = gst_element_factory_make("queue", NULL); ++ GstElement *spu = gst_element_factory_make("dvdspu", NULL); ++ gst_bin_add_many(GST_BIN(m_datasource), convert, videoQueue, spu, NULL); ++ gst_element_link_many(convert, videoQueue, spu, NULL); ++ ++ // Audio pipeline ++ GstElement *audioOut = gst_element_factory_make("queue", NULL); ++ ++ gst_bin_add(GST_BIN(m_datasource), audioOut); ++ ++ GstPad *convertSink = gst_element_get_static_pad(convert, "sink"); ++ GstPad *spuSink = gst_element_get_static_pad(spu, "subpicture"); ++ GstPad *audioSink = gst_element_get_static_pad(audioOut, "sink"); ++ g_signal_connect(dvdsrc, "pad-added", G_CALLBACK(cb_pad_added), convertSink); ++ g_signal_connect(dvdsrc, "pad-added", G_CALLBACK(cb_pad_added), spuSink); ++ g_signal_connect(dvdsrc, "pad-added", G_CALLBACK(cb_pad_added), audioSink); ++ gst_object_unref(convertSink); ++ gst_object_unref(spuSink); ++ gst_object_unref(audioSink); ++ ++ ++ GstPad *audioOutPad = gst_element_get_static_pad(audioOut, "src"); ++ GstPad *audioOutGhostPad = gst_ghost_pad_new("audio", audioOutPad); ++ gst_element_add_pad(m_datasource, audioOutGhostPad); ++ // We do this manually, since the decodebin can only accept one input. And ++ // besides, rsndvdbin only sends audio/x-raw-*, which is supported by the ++ // downstream elements ++ connectAudio(audioOutGhostPad); ++ gst_object_unref(audioOutPad); ++ ++ GstPad *videoOutPad = gst_element_get_static_pad(spu, "src"); ++ GstPad *videoOutGhostPad = gst_ghost_pad_new("src", videoOutPad); ++ gst_element_add_pad(m_datasource, videoOutGhostPad); ++ gst_object_unref(videoOutPad); ++ ++ // Keeping it in the pipeline would otherwise cause it all to stall. ++ // dvdspu outputs video/x-raw-yuv since rsndvdbin outputs that, so ++ // connecting it to the decodebin is technically a waste of CPU cycles. ++ // The alternative however, is to remove decodebin from the pipeline and ++ // remember to restore it later. Without any inputs, decodebin will hang up ++ // the pipeline. ++ gst_pad_link(videoOutGhostPad, gst_element_get_static_pad(m_decodebin, "sink")); ++ ++ return true; ++} ++ + bool MediaObject::createPipefromDevice(const MediaSource &source) + { + foreach(DeviceAccess access, source.deviceAccessList()) { +@@ -517,14 +597,7 @@ bool MediaObject::createPipefromURL(cons + + // Set the device for MediaSource::Disc + 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 ++ // 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); +@@ -1115,26 +1188,28 @@ void MediaObject::setSource(const MediaS + + case MediaSource::Disc: + { +- QString mediaUrl; +- switch (source.discType()) { +- 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 (source.discType() == Phonon::Dvd) { ++ if (!createPipefromDVD(source)) ++ setError(tr("Could not open DVD.")); ++ } else { ++ QString mediaUrl; ++ switch (source.discType()) { ++ 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::Vcd: ++ mediaUrl = QLatin1String("vcd://"); ++ break; ++ default: ++ qWarning() << "media " << source.discType() << " not implemented"; ++ return; ++ } ++ if (mediaUrl.isEmpty() || !createPipefromURL(QUrl(mediaUrl))) ++ setError(tr("Could not open media source.")); + } +- if (mediaUrl.isEmpty() || !createPipefromURL(QUrl(mediaUrl))) +- setError(tr("Could not open media source.")); + } + break; + + +--- a/gstreamer/mediaobject.h ++++ b/gstreamer/mediaobject.h +@@ -204,6 +204,7 @@ protected: + bool createPipefromURL(const QUrl &url); + bool createPipefromStream(const MediaSource &); + bool createPipefromDevice(const MediaSource &); ++ bool createPipefromDVD(const MediaSource &); + bool createV4lPipe(const DeviceAccess &access, const MediaSource &); + + GstElement *audioElement() + diff --git a/phonon-backend-gstreamer.spec b/phonon-backend-gstreamer.spec index 8b0e4f0..87b95c6 100644 --- a/phonon-backend-gstreamer.spec +++ b/phonon-backend-gstreamer.spec @@ -5,7 +5,7 @@ Summary: Gstreamer phonon backend Name: phonon-backend-gstreamer Epoch: 2 Version: 4.4.4 -Release: 2%{?dist} +Release: 3%{?dist} Group: System Environment/Libraries License: LGPLv2+ URL: http://phonon.kde.org/ @@ -25,6 +25,8 @@ Patch52: phonon-4.3.50-gstreamer-fix-seekable-query-failed.patch Patch60: phonon-4.4.3-flac_mimetype.patch ## Upstream patches +# http://quickgit.kde.org/?p=phonon-gstreamer.git&a=commitdiff_plain&h=a2aed0f998e45b6c98a9827aeae17120ef86b269&hp=3ba6bf43bfe4ed0a5d8437e17b1e3a6be2778689 +Patch100: phonon-backend-gstreamer-4.4.4-dvd_playback.patch BuildRequires: automoc4 BuildRequires: cmake @@ -58,6 +60,7 @@ Requires: qt4%{?_isa} >= %{_qt4_version} %patch52 -p1 -b .gstreamer-fix-seekable-query-failed %patch60 -p1 -b .flac_mimetype +%patch100 -p1 -b .dvd_playback %build @@ -104,6 +107,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null ||: %changelog +* Tue Feb 15 2011 Rex Dieter 2:4.4.4-3 +- upstream patch for better(working) dvd playback + * Wed Feb 09 2011 Fedora Release Engineering - 2:4.4.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild