QList<InputPin> BackendNode::pins(const Filter &filter, PIN_DIRECTION wantedDirection) { QList<InputPin> ret; if (filter) { ComPointer<IEnumPins> enumPin; HRESULT hr = filter->EnumPins(enumPin.pparam()); Q_UNUSED(hr); Q_ASSERT( SUCCEEDED(hr)); InputPin pin; while (enumPin->Next(1, pin.pparam(), 0) == S_OK) { PIN_DIRECTION dir; hr = pin->QueryDirection(&dir); Q_ASSERT( SUCCEEDED(hr)); if (dir == wantedDirection) { ret.append(pin); } } } return ret; }
QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { QMutexLocker locker(&m_directShowMutex); QList<int> ret; switch(type) { case Phonon::AudioOutputDeviceType: { #ifdef Q_OS_WINCE ret << 0; // only one audio device with index 0 #else ComPointer<ICreateDevEnum> devEnum(CLSID_SystemDeviceEnum, IID_ICreateDevEnum); if (!devEnum) { return ret; //it is impossible to enumerate the devices } ComPointer<IEnumMoniker> enumMon; HRESULT hr = devEnum->CreateClassEnumerator(CLSID_AudioRendererCategory, enumMon.pparam(), 0); if (FAILED(hr)) { break; } AudioMoniker mon; //let's reorder the devices so that directshound appears first int nbds = 0; //number of directsound devices while (S_OK == enumMon->Next(1, mon.pparam(), 0)) { LPOLESTR str = 0; mon->GetDisplayName(0,0,&str); const QString name = QString::fromUtf16((const unsigned short*) str); ComPointer<IMalloc> alloc; ::CoGetMalloc(1, alloc.pparam()); alloc->Free(str); int insert_pos = 0; if (!m_audioOutputs.contains(mon)) { insert_pos = m_audioOutputs.count(); m_audioOutputs.append(mon); } else { insert_pos = m_audioOutputs.indexOf(mon); } if (name.contains(QLatin1String("DirectSound"))) { ret.insert(nbds++, insert_pos); } else { ret.append(insert_pos); } } #endif break; } #ifndef QT_NO_PHONON_EFFECT case Phonon::EffectType: { m_audioEffects.clear(); ComPointer<IEnumDMO> enumDMO; HRESULT hr = ::DMOEnum(DMOCATEGORY_AUDIO_EFFECT, DMO_ENUMF_INCLUDE_KEYED, 0, 0, 0, 0, enumDMO.pparam()); if (SUCCEEDED(hr)) { CLSID clsid; while (S_OK == enumDMO->Next(1, &clsid, 0, 0)) { ret += m_audioEffects.count(); m_audioEffects.append(clsid); } } break; } break; #endif //QT_NO_PHONON_EFFECT default: break; } return ret; }