Changeset 846 for trunk/src/3rdparty/phonon/gstreamer/backend.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/phonon/gstreamer/backend.cpp
r561 r846 19 19 #include "backend.h" 20 20 #include "audiooutput.h" 21 #include "audiodataoutput.h" 21 22 #include "audioeffect.h" 22 23 #include "mediaobject.h" … … 27 28 #include "volumefadereffect.h" 28 29 #include <gst/interfaces/propertyprobe.h> 30 #include <phonon/pulsesupport.h> 29 31 30 32 #include <QtCore/QSet> … … 50 52 , m_isValid(false) 51 53 { 54 // Initialise PulseAudio support 55 PulseSupport *pulse = PulseSupport::getInstance(); 56 pulse->enable(); 57 connect(pulse, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), SIGNAL(objectDescriptionChanged(ObjectDescriptionType))); 58 52 59 // In order to support reloading, we only set the app name once... 53 60 static bool first = true; … … 56 63 g_set_application_name(qApp->applicationName().toUtf8()); 57 64 } 58 59 65 GError *err = 0; 60 66 bool wasInit = gst_init_check(0, 0, &err); //init gstreamer: must be called before any gst-related functions … … 93 99 Backend::~Backend() 94 100 { 101 delete m_effectManager; 102 delete m_deviceManager; 103 PulseSupport::shutdown(); 95 104 } 96 105 … … 120 129 return new MediaObject(this, parent); 121 130 122 case AudioOutputClass: { 123 AudioOutput *ao = new AudioOutput(this, parent); 124 m_audioOutputs.append(ao); 125 return ao; 126 } 131 case AudioOutputClass: 132 return new AudioOutput(this, parent); 133 127 134 #ifndef QT_NO_PHONON_EFFECT 128 135 case EffectClass: … … 130 137 #endif //QT_NO_PHONON_EFFECT 131 138 case AudioDataOutputClass: 132 logMessage("createObject() : AudioDataOutput not implemented"); 133 break; 139 return new AudioDataOutput(this, parent); 134 140 135 141 #ifndef QT_NO_PHONON_VIDEO … … 215 221 QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)); 216 222 217 if (klass == QLatin1String("Codec/Decoder") || 218 klass == QLatin1String("Codec/Decoder/Audio") || 219 klass == QLatin1String("Codec/Decoder/Video") || 220 klass == QLatin1String("Codec/Demuxer") || 221 klass == QLatin1String("Codec/Demuxer/Audio") || 222 klass == QLatin1String("Codec/Demuxer/Video") || 223 klass == QLatin1String("Codec/Parser") || 224 klass == QLatin1String("Codec/Parser/Audio") || 223 if (klass == QLatin1String("Codec/Decoder") || 224 klass == QLatin1String("Codec/Decoder/Audio") || 225 klass == QLatin1String("Codec/Decoder/Video") || 226 klass == QLatin1String("Codec/Demuxer") || 227 klass == QLatin1String("Codec/Demuxer/Audio") || 228 klass == QLatin1String("Codec/Demuxer/Video") || 229 klass == QLatin1String("Codec/Parser") || 230 klass == QLatin1String("Codec/Parser/Audio") || 225 231 klass == QLatin1String("Codec/Parser/Video")) { 226 232 … … 235 241 236 242 if (caps) { 237 const GstStructure* capsStruct = gst_caps_get_structure (caps, 0); 238 QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); 239 if (!availableMimeTypes.contains(mime)) 240 availableMimeTypes.append(mime); 243 for (unsigned int struct_idx = 0; struct_idx < gst_caps_get_size (caps); struct_idx++) { 244 245 const GstStructure* capsStruct = gst_caps_get_structure (caps, struct_idx); 246 QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); 247 if (!availableMimeTypes.contains(mime)) 248 availableMimeTypes.append(mime); 249 } 241 250 } 242 251 } … … 245 254 } 246 255 g_list_free(factoryList); 256 if (availableMimeTypes.contains("audio/x-vorbis") 257 && availableMimeTypes.contains("application/x-ogm-audio")) { 258 if (!availableMimeTypes.contains("audio/x-vorbis+ogg")) 259 availableMimeTypes.append("audio/x-vorbis+ogg"); 260 if (!availableMimeTypes.contains("application/ogg")) /* *.ogg */ 261 availableMimeTypes.append("application/ogg"); 262 if (!availableMimeTypes.contains("audio/ogg")) /* *.oga */ 263 availableMimeTypes.append("audio/ogg"); 264 } 247 265 availableMimeTypes.sort(); 248 266 return availableMimeTypes; … … 294 312 switch (type) { 295 313 case Phonon::AudioOutputDeviceType: { 296 QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices(); 297 foreach(const AudioDevice &device, audioDevices) { 298 if (device.id == index) { 299 ret.insert("name", device.gstId); 300 ret.insert("description", device.description); 301 ret.insert("icon", QLatin1String("audio-card")); 302 break; 303 } 314 AudioDevice* ad; 315 if ((ad = deviceManager()->audioDevice(index))) { 316 ret.insert("name", ad->gstId); 317 ret.insert("description", ad->description); 318 ret.insert("icon", ad->icon); 304 319 } 305 320 } … … 430 445 /** 431 446 * Returns a debuglevel that is determined by the 432 * PHONON_GST REAMER_DEBUG environment variable.447 * PHONON_GST_DEBUG environment variable. 433 448 * 434 449 * Warning - important warnings
Note:
See TracChangeset
for help on using the changeset viewer.