Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:aapgorilla:kde4
phonon
phonon-4.3.80-pulsecleanup.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File phonon-4.3.80-pulsecleanup.patch of Package phonon
diff --git a/gstreamer/backend.cpp b/gstreamer/backend.cpp index 1f07236..97804fa 100644 --- a/gstreamer/backend.cpp +++ b/gstreamer/backend.cpp @@ -53,6 +53,7 @@ Backend::Backend(QObject *parent, const QVariantList &) { // Initialise PulseAudio support PulseSupport *pulse = PulseSupport::getInstance(); + pulse->enable(); connect(pulse, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), SIGNAL(objectDescriptionChanged(ObjectDescriptionType))); // In order to support reloading, we only set the app name once... @@ -244,15 +245,6 @@ QStringList Backend::availableMimeTypes() const } } g_list_free(factoryList); - if (availableMimeTypes.contains("audio/x-vorbis") - && availableMimeTypes.contains("application/x-ogm-audio")) { - if (!availableMimeTypes.contains("audio/x-vorbis+ogg")) - availableMimeTypes.append("audio/x-vorbis+ogg"); - if (!availableMimeTypes.contains("application/ogg")) /* *.ogg */ - availableMimeTypes.append("application/ogg"); - if (!availableMimeTypes.contains("audio/ogg")) /* *.oga */ - availableMimeTypes.append("audio/ogg"); - } availableMimeTypes.sort(); return availableMimeTypes; } @@ -267,10 +259,6 @@ QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const if (!isValid()) return list; - PulseSupport *pulse = PulseSupport::getInstance(); - if (pulse->isActive() && (Phonon::AudioOutputDeviceType == type || Phonon::AudioCaptureDeviceType == type)) - return pulse->objectDescriptionIndexes(type); - switch (type) { case Phonon::AudioOutputDeviceType: { QList<AudioDevice> deviceList = deviceManager()->audioOutputDevices(); @@ -304,10 +292,6 @@ QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescripti if (!isValid()) return ret; - PulseSupport *pulse = PulseSupport::getInstance(); - if (pulse->isActive() && (Phonon::AudioOutputDeviceType == type || Phonon::AudioCaptureDeviceType == type)) - return pulse->objectDescriptionProperties(type, index); - switch (type) { case Phonon::AudioOutputDeviceType: { AudioDevice* ad; diff --git a/gstreamer/devicemanager.cpp b/gstreamer/devicemanager.cpp index e62d281..d8b9b3a 100644 --- a/gstreamer/devicemanager.cpp +++ b/gstreamer/devicemanager.cpp @@ -88,7 +88,7 @@ DeviceManager::DeviceManager(Backend *backend) m_audioSink = "pulsesink"; } if ("pulsesink" != m_audioSink) - pulse->disable(); + pulse->enable(false); m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); if (m_videoSinkWidget.isEmpty()) { diff --git a/phonon/audiooutput.cpp b/phonon/audiooutput.cpp index 89b24bd..e99c394 100644 --- a/phonon/audiooutput.cpp +++ b/phonon/audiooutput.cpp @@ -101,9 +101,6 @@ void AudioOutputPrivate::init(Phonon::Category c) streamUuid = QUuid::createUuid().toString(); PulseSupport::getInstance()->setStreamPropList(category, streamUuid); - // select hardware device according to the category - device = AudioOutputDevice::fromIndex(GlobalConfig().audioOutputDeviceFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices)); - createBackendObject(); q->connect(Factory::sender(), SIGNAL(availableAudioOutputDevicesChanged()), SLOT(_k_deviceListChanged())); @@ -120,6 +117,7 @@ void AudioOutputPrivate::createBackendObject() return; Q_Q(AudioOutput); m_backendObject = Factory::createAudioOutput(q); + device = AudioOutputDevice::fromIndex(GlobalConfig().audioOutputDeviceFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices)); if (m_backendObject) { setupBackendObject(); } diff --git a/phonon/globalconfig.cpp b/phonon/globalconfig.cpp index 44bf49a..1ac43af 100644 --- a/phonon/globalconfig.cpp +++ b/phonon/globalconfig.cpp @@ -64,7 +64,11 @@ static void filter(ObjectDescriptionType type, BackendInterface *backendIface, Q { QMutableListIterator<int> it(*list); while (it.hasNext()) { - const QHash<QByteArray, QVariant> properties = backendIface->objectDescriptionProperties(type, it.next()); + QHash<QByteArray, QVariant> properties; + if (backendIface) + properties = backendIface->objectDescriptionProperties(type, it.next()); + else + properties = PulseSupport::getInstance()->objectDescriptionProperties(type, it.next()); QVariant var; if (whatToFilter & FilterAdvancedDevices) { var = properties.value("isAdvanced"); @@ -280,10 +284,20 @@ QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int : static_cast<bool>(override & HideAdvancedDevices)); QList<int> defaultList; - BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); + + PulseSupport *pulse = PulseSupport::getInstance(); + if (pulse->isActive()) { + defaultList = pulse->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); + if (hide || (override & HideUnavailableDevices)) { + filter(AudioOutputDeviceType, NULL, &defaultList, + (hide ? FilterAdvancedDevices : 0) + | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) + ); + } + } else { + BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); #ifndef QT_NO_PHONON_PLATFORMPLUGIN - if (!backendIface || !PulseSupport::getInstance()->isActive()) { if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) { // the platform plugin lists the audio devices for the platform // this list already is in default order (as defined by the platform plugin) @@ -299,22 +313,22 @@ QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int } } } - } #endif //QT_NO_PHONON_PLATFORMPLUGIN - // lookup the available devices directly from the backend - if (backendIface) { - // this list already is in default order (as defined by the backend) - QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); - if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { - filter(AudioOutputDeviceType, backendIface, &list, - (hide ? FilterAdvancedDevices : 0) - // the platform plugin already provided the hardware devices - | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) - | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) - ); + // lookup the available devices directly from the backend + if (backendIface) { + // this list already is in default order (as defined by the backend) + QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioOutputDeviceType); + if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { + filter(AudioOutputDeviceType, backendIface, &list, + (hide ? FilterAdvancedDevices : 0) + // the platform plugin maybe already provided the hardware devices? + | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) + | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) + ); + } + defaultList += list; } - defaultList += list; } const QSettingsGroup backendConfig(&d->config, QLatin1String("AudioOutputDevice")); // + Factory::identifier()); @@ -360,10 +374,20 @@ QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, in : static_cast<bool>(override & HideAdvancedDevices)); QList<int> defaultList; - BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); + + PulseSupport *pulse = PulseSupport::getInstance(); + if (pulse->isActive()) { + defaultList = pulse->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); + if (hide || (override & HideUnavailableDevices)) { + filter(AudioCaptureDeviceType, NULL, &defaultList, + (hide ? FilterAdvancedDevices : 0) + | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) + ); + } + } else { + BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()); #ifndef QT_NO_PHONON_PLATFORMPLUGIN - if (!backendIface || !PulseSupport::getInstance()->isActive()) { if (PlatformPlugin *platformPlugin = Factory::platformPlugin()) { // the platform plugin lists the audio devices for the platform // this list already is in default order (as defined by the platform plugin) @@ -379,22 +403,22 @@ QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, in } } } - } #endif //QT_NO_PHONON_PLATFORMPLUGIN - // lookup the available devices directly from the backend - if (backendIface) { - // this list already is in default order (as defined by the backend) - QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); - if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { - filter(AudioCaptureDeviceType, backendIface, &list, - (hide ? FilterAdvancedDevices : 0) - // the platform plugin already provided the hardware devices - | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) - | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) - ); + // lookup the available devices directly from the backend + if (backendIface) { + // this list already is in default order (as defined by the backend) + QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType); + if (hide || !defaultList.isEmpty() || (override & HideUnavailableDevices)) { + filter(AudioCaptureDeviceType, backendIface, &list, + (hide ? FilterAdvancedDevices : 0) + // the platform plugin maybe already provided the hardware devices? + | (defaultList.isEmpty() ? 0 : FilterHardwareDevices) + | ((override & HideUnavailableDevices) ? FilterUnavailableDevices : 0) + ); + } + defaultList += list; } - defaultList += list; } const QSettingsGroup backendConfig(&d->config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); diff --git a/phonon/objectdescription.cpp b/phonon/objectdescription.cpp index 4afd9dd..55e74b5 100644 --- a/phonon/objectdescription.cpp +++ b/phonon/objectdescription.cpp @@ -109,12 +109,21 @@ bool ObjectDescriptionData::isValid() const ObjectDescriptionData *ObjectDescriptionData::fromIndex(ObjectDescriptionType type, int index) { - BackendInterface *iface = qobject_cast<BackendInterface *>(Factory::backend()); + bool is_audio_device = (AudioOutputDeviceType == type || AudioCaptureDeviceType == type); - // prefer to get the ObjectDescriptionData from the platform plugin for audio devices + PulseSupport *pulse = PulseSupport::getInstance(); + if (is_audio_device && pulse->isActive()) { + QList<int> indexes = pulse->objectDescriptionIndexes(type); + if (indexes.contains(index)) { + QHash<QByteArray, QVariant> properties = pulse->objectDescriptionProperties(type, index); + return new ObjectDescriptionData(index, properties); + } + } else { + BackendInterface *iface = qobject_cast<BackendInterface *>(Factory::backend()); + + // prefer to get the ObjectDescriptionData from the platform plugin for audio devices #ifndef QT_NO_PHONON_PLATFORMPLUGIN - if (!iface || !PulseSupport::getInstance()->isActive()) { - if (type == AudioOutputDeviceType || type == AudioCaptureDeviceType) { + if (is_audio_device) { PlatformPlugin *platformPlugin = Factory::platformPlugin(); if (platformPlugin) { QList<int> indexes = platformPlugin->objectDescriptionIndexes(type); @@ -124,14 +133,14 @@ ObjectDescriptionData *ObjectDescriptionData::fromIndex(ObjectDescriptionType ty } } } - } #endif //QT_NO_PHONON_PLATFORMPLUGIN - if (iface) { - QList<int> indexes = iface->objectDescriptionIndexes(type); - if (indexes.contains(index)) { - QHash<QByteArray, QVariant> properties = iface->objectDescriptionProperties(type, index); - return new ObjectDescriptionData(index, properties); + if (iface) { + QList<int> indexes = iface->objectDescriptionIndexes(type); + if (indexes.contains(index)) { + QHash<QByteArray, QVariant> properties = iface->objectDescriptionProperties(type, index); + return new ObjectDescriptionData(index, properties); + } } } return new ObjectDescriptionData(0); // invalid diff --git a/phonon/pulsesupport.cpp b/phonon/pulsesupport.cpp index 497e6a2..f102177 100644 --- a/phonon/pulsesupport.cpp +++ b/phonon/pulsesupport.cpp @@ -673,7 +673,7 @@ void PulseSupport::shutdown() } PulseSupport::PulseSupport() - : QObject() + : QObject(), mEnabled(false) { #ifdef HAVE_PULSEAUDIO // Initialise our map (is there a better way to do this?) @@ -736,17 +736,15 @@ PulseSupport::~PulseSupport() bool PulseSupport::isActive() { #ifdef HAVE_PULSEAUDIO - return s_pulseActive; + return mEnabled && s_pulseActive; #else return false; #endif } -void PulseSupport::disable() +void PulseSupport::enable(bool enabled) { -#ifdef HAVE_PULSEAUDIO - s_pulseActive = false; -#endif + mEnabled = enabled; } QList<int> PulseSupport::objectDescriptionIndexes(ObjectDescriptionType type) const diff --git a/phonon/pulsesupport.h b/phonon/pulsesupport.h index ad711ed..bba5fd5 100644 --- a/phonon/pulsesupport.h +++ b/phonon/pulsesupport.h @@ -43,7 +43,7 @@ namespace Phonon static void shutdown(); bool isActive(); - void disable(); + void enable(bool enabled = true); QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const; QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const; @@ -64,6 +64,8 @@ namespace Phonon private: PulseSupport(); ~PulseSupport(); + + bool mEnabled; }; } // namespace Phonon diff --git a/xine/backend.cpp b/xine/backend.cpp index 5d48522..1fc3c68 100644 --- a/xine/backend.cpp +++ b/xine/backend.cpp @@ -71,6 +71,7 @@ Backend::Backend(QObject *parent, const QVariantList &) { // Initialise PulseAudio support PulseSupport *pulse = PulseSupport::getInstance(); + pulse->enable(); connect(pulse, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), SLOT(emitObjectDescriptionChanged(ObjectDescriptionType))); Q_ASSERT(s_instance == 0); @@ -208,10 +209,6 @@ QStringList Backend::availableMimeTypes() const QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const { - PulseSupport *pulse = PulseSupport::getInstance(); - if (pulse->isActive() && (Phonon::AudioOutputDeviceType == type || Phonon::AudioCaptureDeviceType == type)) - return pulse->objectDescriptionIndexes(type); - QList<int> list; switch(type) { @@ -264,10 +261,6 @@ QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const { - PulseSupport *pulse = PulseSupport::getInstance(); - if (pulse->isActive() && (Phonon::AudioOutputDeviceType == type || Phonon::AudioCaptureDeviceType == type)) - return pulse->objectDescriptionProperties(type, index); - //debug() << Q_FUNC_INFO << type << index; QHash<QByteArray, QVariant> ret; switch (type) { @@ -637,7 +630,7 @@ void Backend::checkAudioOutputs() } // We cannot find the output plugin, so let the support class know. - pulse->disable(); + pulse->enable(false); } for (int i = 0; outputPlugins[i]; ++i) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor