Changeset 846 for trunk/src/3rdparty/phonon/gstreamer/devicemanager.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/devicemanager.cpp
r561 r846 25 25 #include "x11renderer.h" 26 26 #include "artssink.h" 27 #include "pulsesupport.h" 27 28 28 29 #ifdef USE_ALSASINK2 … … 45 46 : gstId(gstId) 46 47 { 47 //get an id 48 static int counter = 0; 49 id = counter++; 48 // This should never be called when PulseAudio is active. 49 Q_ASSERT(!PulseSupport::getInstance()->isActive()); 50 51 id = manager->allocateDeviceId(); 52 icon = "audio-card"; 53 50 54 //get name from device 51 55 if (gstId == "default") { … … 72 76 : QObject(backend) 73 77 , m_backend(backend) 74 { 75 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); 76 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); 77 78 #ifndef QT_NO_SETTINGS 78 , m_audioDeviceCounter(0) 79 { 79 80 QSettings settings(QLatin1String("Trolltech")); 80 81 settings.beginGroup(QLatin1String("Qt")); 81 82 83 PulseSupport *pulse = PulseSupport::getInstance(); 84 m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); 82 85 if (m_audioSink.isEmpty()) { 83 86 m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower(); 84 } 85 87 if (m_audioSink == "auto" && pulse->isActive()) 88 m_audioSink = "pulsesink"; 89 } 90 if ("pulsesink" != m_audioSink) 91 pulse->enable(false); 92 93 m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); 86 94 if (m_videoSinkWidget.isEmpty()) { 87 95 m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower(); 88 96 } 89 #endif //QT_NO_SETTINGS90 97 91 98 if (m_backend->isValid()) … … 272 279 #endif //QT_NO_PHONON_VIDEO 273 280 274 /* 275 * Returns a positive device id or -1 if device 276 * does not exist 281 /** 282 * Allocate a device id for a new audio device 283 */ 284 int DeviceManager::allocateDeviceId() 285 { 286 return m_audioDeviceCounter++; 287 } 288 289 290 /** 291 * Returns a positive device id or -1 if device does not exist 277 292 * 278 293 * The gstId is typically in the format hw:1,0 … … 289 304 290 305 /** 291 * Get a human-readable description from a device id 292 */ 293 QByteArray DeviceManager::deviceDescription(int id) const 306 * Returns a gstId or "default" if device does not exist 307 * 308 * The gstId is typically in the format hw:1,0 309 */ 310 const QByteArray DeviceManager::gstId(int deviceId) 311 { 312 if (!PulseSupport::getInstance()->isActive()) { 313 AudioDevice *ad = audioDevice(deviceId); 314 if (ad) 315 return QByteArray(ad->gstId); 316 } 317 return QByteArray("default"); 318 } 319 320 /** 321 * Get the AudioDevice for a given device id 322 */ 323 AudioDevice* DeviceManager::audioDevice(int id) 294 324 { 295 325 for (int i = 0 ; i < m_audioDeviceList.size() ; ++i) { 296 if (m_audioDeviceList[i].id == id) { 297 return m_audioDeviceList[i].description; 298 } 299 } 300 return QByteArray(); 326 if (m_audioDeviceList[i].id == id) 327 return &m_audioDeviceList[i]; 328 } 329 return NULL; 301 330 } 302 331 … … 312 341 313 342 if (audioSink) { 314 list = GstHelper::extractProperties(audioSink, "device"); 315 list.prepend("default"); 343 if (!PulseSupport::getInstance()->isActive()) { 344 // If we're using pulse, the PulseSupport class takes care of things for us. 345 list = GstHelper::extractProperties(audioSink, "device"); 346 list.prepend("default"); 347 } 316 348 317 349 for (int i = 0 ; i < list.size() ; ++i) {
Note:
See TracChangeset
for help on using the changeset viewer.