diff --git a/phonon-4.3.80-old_pa.patch b/phonon-4.3.80-old_pa.patch new file mode 100644 index 0000000..9983bdc --- /dev/null +++ b/phonon-4.3.80-old_pa.patch @@ -0,0 +1,186 @@ +diff -up phonon-4.3.80/phonon/CMakeLists.txt.old_pa phonon-4.3.80/phonon/CMakeLists.txt +--- phonon-4.3.80/phonon/CMakeLists.txt.old_pa 2009-12-03 13:29:35.000000000 -0600 ++++ phonon-4.3.80/phonon/CMakeLists.txt 2010-01-22 09:52:53.195187362 -0600 +@@ -8,15 +8,21 @@ endif (PHONON_BUILD_EXAMPLES) + + add_subdirectory(experimental) + +-set(PULSEAUDIO_MINIMUM_VERSION "0.9.21") ++set(PULSEAUDIO_MINIMUM_VERSION "0.9.15") + macro_optional_find_package(PulseAudio) ++# PULSEAUDIO_DEVICE_MANAGER feature check could be moved to FindPulseAudio.cmake, hint hint. -- Rex ++macro_ensure_version("0.9.21" "${PULSEAUDIO_VERSION}" PULSEAUDIO_DEVICE_MANAGER) + macro_log_feature(PULSEAUDIO_FOUND "PulseAudio" "A cross-platform, networked sound server." "http://www.pulseaudio.org" FALSE "" "Allows audio playback via the PulseAudio soundserver when it is running") + macro_optional_find_package(GLIB2) + macro_log_feature(GLIB2_FOUND "GLib2" "GLib 2 is required to compile the pulseaudio for Phonon" "http://www.gtk.org/download/" FALSE) + ++ + if (GLIB2_FOUND AND PULSEAUDIO_FOUND) + add_definitions(-DHAVE_PULSEAUDIO) + include_directories(${GLIB2_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR}) ++ if (PULSEAUDIO_DEVICE_MANAGER) ++ add_definitions(-DHAVE_PULSEAUDIO_DEVICE_MANAGER) ++ endif(PULSEAUDIO_DEVICE_MANAGER) + else(GLIB2_FOUND AND PULSEAUDIO_FOUND) + set(PULSEAUDIO_INCLUDE_DIR "") + set(PULSEAUDIO_LIBRARY "") +diff -up phonon-4.3.80/phonon/pulsesupport.cpp.old_pa phonon-4.3.80/phonon/pulsesupport.cpp +--- phonon-4.3.80/phonon/pulsesupport.cpp.old_pa 2009-12-03 13:29:35.000000000 -0600 ++++ phonon-4.3.80/phonon/pulsesupport.cpp 2010-01-22 09:48:15.699935986 -0600 +@@ -30,7 +30,9 @@ + #include + #include + #include +-#include ++#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER ++# include ++#endif + #endif // HAVE_PULSEAUDIO + + #include "pulsesupport_p.h" +@@ -151,7 +153,34 @@ static QMap s_captureStreamIndexMap; + static QMap s_captureStreamMoveQueue; + ++static void fakeSingleOutputDevice() ++{ ++ // OK so we don't have the device manager extension, but we can show a single device and fake it. ++ int index; ++ s_outputDeviceIndexes.clear(); ++ s_outputDevices.clear(); ++ s_outputDevicePriorities.clear(); ++ index = s_deviceIndexCounter++; ++ s_outputDeviceIndexes.insert("sink:default", index); ++ s_outputDevices.insert(index, AudioDevice("sink:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0)); ++ for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) { ++ Phonon::Category cat = static_cast(i); ++ s_outputDevicePriorities[cat].insert(0, index); ++ } ++ ++ s_captureDeviceIndexes.clear(); ++ s_captureDevices.clear(); ++ s_captureDevicePriorities.clear(); ++ index = s_deviceIndexCounter++; ++ s_captureDeviceIndexes.insert("source:default", index); ++ s_captureDevices.insert(index, AudioDevice("source:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0)); ++ for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) { ++ Phonon::Category cat = static_cast(i); ++ s_captureDevicePriorities[cat].insert(0, index); ++ } ++} + ++#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER + static void ext_device_manager_subscribe_cb(pa_context *, void *); + static void ext_device_manager_read_cb(pa_context *c, const pa_ext_device_manager_info *info, int eol, void *userdata) { + Q_ASSERT(c); +@@ -171,30 +200,7 @@ static void ext_device_manager_read_cb(p + + if (eol < 0) { + logMessage(QString("Failed to initialize device manager extension: %1").arg(pa_strerror(pa_context_errno(c)))); +- // OK so we don't have the device manager extension, but we can show a single device and fake it. +- int index; +- s_outputDeviceIndexes.clear(); +- s_outputDevices.clear(); +- s_outputDevicePriorities.clear(); +- index = s_deviceIndexCounter++; +- s_outputDeviceIndexes.insert("sink:default", index); +- s_outputDevices.insert(index, AudioDevice("sink:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0)); +- for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) { +- Phonon::Category cat = static_cast(i); +- s_outputDevicePriorities[cat].insert(0, index); +- } +- +- s_captureDeviceIndexes.clear(); +- s_captureDevices.clear(); +- s_captureDevicePriorities.clear(); +- index = s_deviceIndexCounter++; +- s_captureDeviceIndexes.insert("source:default", index); +- s_captureDevices.insert(index, AudioDevice("source:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0)); +- for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) { +- Phonon::Category cat = static_cast(i); +- s_captureDevicePriorities[cat].insert(0, index); +- } +- ++ fakeSingleOutputDevice(); + return; + } + +@@ -369,6 +375,7 @@ static void ext_device_manager_read_cb(p + } + } + } ++#endif + + static void set_output_device(QString streamUuid) + { +@@ -550,12 +557,12 @@ static void subscribe_cb(pa_context *c, + } + } + +- + static void ext_device_manager_subscribe_cb(pa_context *c, void *) { + Q_ASSERT(c); + + pa_operation *o; + PulseUserData *u = new PulseUserData; /** @todo Make some object to receive the info... */ ++#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER + if (!(o = pa_ext_device_manager_read(c, ext_device_manager_read_cb, u))) { + // We need to deal with failure on first iteration + if (s_connectionEventloop) { +@@ -566,6 +573,7 @@ static void ext_device_manager_subscribe + return; + } + pa_operation_unref(o); ++#endif + + + // Register for the stream changes... +@@ -584,6 +592,7 @@ static void context_state_callback(pa_co + { + Q_ASSERT(c); + ++ logMessage(QString("context_state_callback %1").arg(pa_context_get_state(c))); + switch (pa_context_get_state(c)) { + case PA_CONTEXT_UNCONNECTED: + case PA_CONTEXT_CONNECTING: +@@ -592,8 +601,18 @@ static void context_state_callback(pa_co + break; + + case PA_CONTEXT_READY: ++#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER + // Attempt to load things up + ext_device_manager_subscribe_cb(c, NULL); ++#else ++ s_pulseActive = true; ++ if (s_connectionEventloop) { ++ s_connectionEventloop->exit(0); ++ s_connectionEventloop = 0; ++ } ++ fakeSingleOutputDevice(); ++ ext_device_manager_subscribe_cb(c, NULL); ++#endif + break; + + case PA_CONTEXT_FAILED: +@@ -665,6 +684,7 @@ PulseSupport::PulseSupport() + if (pa_context_connect(s_context, NULL, static_cast(0), 0) >= 0) { + pa_context_set_state_callback(s_context, &context_state_callback, s_connectionEventloop); + // Now we block until we connect or otherwise... ++ logMessage("Entering eventloop..."); + s_connectionEventloop->exec(); + } + #endif +@@ -821,11 +841,13 @@ static void setDevicePriority(Category c + } + devices[list.size()] = NULL; + ++#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER + pa_operation *o; + if (!(o = pa_ext_device_manager_reorder_devices_for_role(s_context, role.toUtf8().constData(), (const char**)devices, NULL, NULL))) + logMessage(QString("pa_ext_device_manager_reorder_devices_for_role() failed")); + else + pa_operation_unref(o); ++#endif + + for (i = 0; i < list.size(); ++i) + pa_xfree(devices[i]); diff --git a/phonon.spec b/phonon.spec index 4d4828a..13ae586 100644 --- a/phonon.spec +++ b/phonon.spec @@ -4,7 +4,7 @@ Summary: Multimedia framework api Name: phonon Version: 4.3.80 -Release: 5%{?dist}.1 +Release: 5%{?dist}.2 Group: System Environment/Libraries License: LGPLv2+ URL: http://phonon.kde.org/ @@ -34,6 +34,10 @@ Patch52: phonon-4.3.50-gstreamer-fix-seekable-query-failed.patch Patch53: phonon-4.3.50-phonon-allow-stop-empty-source.patch Patch54: phonon-4.3.80-fix-gstreamer-pulseaudio-deadlock.patch +# patch adapted from http://permalink.gmane.org/gmane.comp.kde.users.multimedia/5700 +# splits out device_manager bits used only on pa >= 0.9.21 +Patch60: phonon-4.3.80-old_pa.patch + ## Upstream patches # http://bugs.kde.org/223662 Patch100: phonon-4.3.80-kde223662.patch @@ -49,8 +53,8 @@ BuildRequires: libxml2-devel BuildRequires: pkgconfig BuildRequires: qt4-devel BuildRequires: xine-lib-devel -%if 0%{?fedora} > 11 -BuildRequires: pulseaudio-libs-devel >= 0.9.21 +%if 0%{?fedora} > 10 +BuildRequires: pulseaudio-libs-devel >= 0.9.15 %else %define pa_keep_old_hacks 1 %endif @@ -105,6 +109,7 @@ Provides: %{name}-backend-gst = %{version}-%{release} %patch52 -p1 -b .gstreamer-fix-seekable-query-failed %patch53 -p1 -b .phonon-allow-stop-empty-source %patch54 -p1 -b .gstreamer-pulseaudio-deadlock +%patch60 -p1 -b .old_pa %patch100 -p3 -b .kde223662 @@ -210,6 +215,9 @@ gtk-update-icon-cache %{_kde4_iconsdir}/hicolor &> /dev/null ||: %changelog +* Fri Jan 22 2010 Rex Dieter - 4.3.80-5.2 +- F11: patch/modularize pa device-manager bits + * Fri Jan 22 2010 Kevin Kofler - 4.3.80-5.1 - F11: port the old PA device priorities patch as we don't have PA integration