diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-24 20:20:56 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-24 20:20:56 (GMT) |
commit | e4002434bfde5c8206463ea3a0d4140835619944 (patch) | |
tree | f199a1e233867ab4e85d22aa138391585af75fca /src/3rdparty | |
parent | 3f183debfd677b952b015f6950131dd25bd4768b (diff) | |
parent | 5a7c14af3c27089b0b8698da3c689637ffaa9cfa (diff) | |
download | Qt-e4002434bfde5c8206463ea3a0d4140835619944.zip Qt-e4002434bfde5c8206463ea3a0d4140835619944.tar.gz Qt-e4002434bfde5c8206463ea3a0d4140835619944.tar.bz2 |
Merge branch '4.6'
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/ds9/backend.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/backend.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/ds9.desktop | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/mediaobject.cpp | 1 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/qmeminputpin.cpp | 100 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/qmeminputpin.h | 9 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/qpin.cpp | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/qpin.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/videorenderer_soft.cpp | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/volumeeffect.cpp | 5 |
10 files changed, 48 insertions, 88 deletions
diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp index 6007020..6ed0145 100644 --- a/src/3rdparty/phonon/ds9/backend.cpp +++ b/src/3rdparty/phonon/ds9/backend.cpp @@ -64,6 +64,11 @@ namespace Phonon ::CoUninitialize(); } + QMutex *Backend::directShowMutex() + { + return &qobject_cast<Backend*>(qt_plugin_instance())->m_directShowMutex; + } + QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) { switch (c) @@ -131,6 +136,7 @@ namespace Phonon QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { + QMutexLocker locker(&m_directShowMutex); QList<int> ret; switch(type) @@ -204,6 +210,7 @@ namespace Phonon QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const { + QMutexLocker locker(&m_directShowMutex); QHash<QByteArray, QVariant> ret; switch (type) { diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index ad638f2..9b2c2a2 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -23,6 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/phononnamespace.h> #include <QtCore/QList> +#include <QtCore/QMutex> #include "compointer.h" #include "backendnode.h" @@ -63,6 +64,8 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; + static QMutex *Backend::directShowMutex(); + Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); @@ -74,6 +77,7 @@ namespace Phonon }; mutable QVector<AudioMoniker> m_audioOutputs; mutable QVector<CLSID> m_audioEffects; + mutable QMutex m_directShowMutex; }; } } diff --git a/src/3rdparty/phonon/ds9/ds9.desktop b/src/3rdparty/phonon/ds9/ds9.desktop index 370011e..ece3c9c 100644 --- a/src/3rdparty/phonon/ds9/ds9.desktop +++ b/src/3rdparty/phonon/ds9/ds9.desktop @@ -5,7 +5,7 @@ MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;app X-KDE-Library=phonon_ds9 X-KDE-PhononBackendInfo-InterfaceVersion=1 X-KDE-PhononBackendInfo-Version=0.1 -X-KDE-PhononBackendInfo-Website=http://www.trolltech.com/ +X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/ InitialPreference=15 Name=DirectShow9 diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 39fcaa0..579517f 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -177,6 +177,7 @@ namespace Phonon void WorkerThread::handleTask() { + QMutexLocker locker(Backend::directShowMutex()); { QMutexLocker locker(&m_mutex); if (m_finished || m_queue.isEmpty()) { diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.cpp b/src/3rdparty/phonon/ds9/qmeminputpin.cpp index 630cfb4..a21fbe7 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.cpp +++ b/src/3rdparty/phonon/ds9/qmeminputpin.cpp @@ -28,8 +28,8 @@ namespace Phonon namespace DS9 { - QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) : - QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform) + QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform, QPin *output) : + QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform), m_output(output) { } @@ -66,11 +66,9 @@ namespace Phonon { //this allows to serialize with Receive calls QMutexLocker locker(&m_mutexReceive); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndOfStream(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndOfStream(); } return S_OK; } @@ -78,11 +76,9 @@ namespace Phonon STDMETHODIMP QMemInputPin::BeginFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->BeginFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->BeginFlush(); } QMutexLocker locker(&m_mutex); m_flushing = true; @@ -92,11 +88,9 @@ namespace Phonon STDMETHODIMP QMemInputPin::EndFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndFlush(); } QMutexLocker locker(&m_mutex); m_flushing = false; @@ -105,9 +99,8 @@ namespace Phonon STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - for(int i = 0; i < m_outputs.count(); ++i) { - m_outputs.at(i)->NewSegment(start, stop, rate); - } + if (m_output) + m_output->NewSegment(start, stop, rate); return S_OK; } @@ -119,14 +112,9 @@ namespace Phonon if (hr == S_OK && mt->majortype != MEDIATYPE_NULL && mt->subtype != MEDIASUBTYPE_NULL && - mt->formattype != GUID_NULL) { - //we tell the output pins that they should connect with this type - for(int i = 0; i < m_outputs.count(); ++i) { - hr = m_outputs.at(i)->setAcceptedMediaType(connectedType()); - if (FAILED(hr)) { - break; - } - } + mt->formattype != GUID_NULL && m_output) { + //we tell the output pin that it should connect with this type + hr = m_output->setAcceptedMediaType(connectedType()); } return hr; } @@ -158,12 +146,9 @@ namespace Phonon setMemoryAllocator(alloc); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *pin = m_outputs.at(i)->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - input->NotifyAllocator(alloc, m_shouldDuplicateSamples); - } + if (m_output) { + ComPointer<IMemInputPin> input(m_output, IID_IMemInputPin); + input->NotifyAllocator(alloc, m_shouldDuplicateSamples); } return S_OK; @@ -202,22 +187,18 @@ namespace Phonon } } - for (int i = 0; i < m_outputs.count(); ++i) { - QPin *current = m_outputs.at(i); + if (m_output) { IMediaSample *outSample = m_shouldDuplicateSamples ? - duplicateSampleForOutput(sample, current->memoryAllocator()) + duplicateSampleForOutput(sample, m_output->memoryAllocator()) : sample; if (m_shouldDuplicateSamples) { m_parent->processSample(outSample); } - IPin *pin = current->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - if (input) { - input->Receive(outSample); - } + ComPointer<IMemInputPin> input(m_output->connected(), IID_IMemInputPin); + if (input) { + input->Receive(outSample); } if (m_shouldDuplicateSamples) { @@ -248,39 +229,16 @@ namespace Phonon STDMETHODIMP QMemInputPin::ReceiveCanBlock() { - //we test the output to see if they can block - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *input = m_outputs.at(i)->connected(); - if (input) { - ComPointer<IMemInputPin> meminput(input, IID_IMemInputPin); - if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { - return S_OK; - } + //we test the output to see if it can block + if (m_output) { + ComPointer<IMemInputPin> meminput(m_output->connected(), IID_IMemInputPin); + if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { + return S_OK; } } return S_FALSE; } - //addition - //this should be used by the filter to tell its input pins to which output they should route the samples - - void QMemInputPin::addOutput(QPin *output) - { - QMutexLocker locker(&m_mutex); - m_outputs += output; - } - - void QMemInputPin::removeOutput(QPin *output) - { - QMutexLocker locker(&m_mutex); - m_outputs.removeOne(output); - } - - QList<QPin*> QMemInputPin::outputs() const - { - QMutexLocker locker(&m_mutex); - return m_outputs; - } ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const { diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.h b/src/3rdparty/phonon/ds9/qmeminputpin.h index c449721..d74c451 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.h +++ b/src/3rdparty/phonon/ds9/qmeminputpin.h @@ -37,7 +37,7 @@ namespace Phonon class QMemInputPin : public QPin, public IMemInputPin { public: - QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform); + QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output); ~QMemInputPin(); //reimplementation from IUnknown @@ -60,18 +60,13 @@ namespace Phonon STDMETHODIMP ReceiveMultiple(IMediaSample **,long,long *); STDMETHODIMP ReceiveCanBlock(); - //addition - void addOutput(QPin *output); - void removeOutput(QPin *output); - QList<QPin*> outputs() const; - private: IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *); ALLOCATOR_PROPERTIES getDefaultAllocatorProperties() const; bool m_shouldDuplicateSamples; const bool m_transform; //defines if the pin is transforming the samples - QList<QPin*> m_outputs; + QPin* const m_output; QMutex m_mutexReceive; }; } diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp index 55c952c..b4afd10 100644 --- a/src/3rdparty/phonon/ds9/qpin.cpp +++ b/src/3rdparty/phonon/ds9/qpin.cpp @@ -338,7 +338,6 @@ namespace Phonon STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info) { - QMutexLocker locker(&m_mutex); if (!info) { return E_POINTER; } @@ -352,7 +351,6 @@ namespace Phonon STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir) { - QMutexLocker locker(&m_mutex); if (!dir) { return E_POINTER; } @@ -363,7 +361,6 @@ namespace Phonon STDMETHODIMP QPin::QueryId(LPWSTR *id) { - QMutexLocker locker(&m_mutex); if (!id) { return E_POINTER; } @@ -546,7 +543,6 @@ namespace Phonon FILTER_STATE QPin::filterState() const { - QMutexLocker locker(&m_mutex); FILTER_STATE fstate = State_Stopped; m_parent->GetState(0, &fstate); return fstate; diff --git a/src/3rdparty/phonon/ds9/qpin.h b/src/3rdparty/phonon/ds9/qpin.h index 9af6077..280ad61 100644 --- a/src/3rdparty/phonon/ds9/qpin.h +++ b/src/3rdparty/phonon/ds9/qpin.h @@ -86,7 +86,7 @@ namespace Phonon protected: //this can be used by sub-classes mutable QMutex m_mutex; - QBaseFilter *m_parent; + QBaseFilter * const m_parent; bool m_flushing; private: diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index cf5ce96..82d6235 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -365,7 +365,7 @@ namespace Phonon { public: VideoRendererSoftPin(VideoRendererSoftFilter *parent) : - QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/), + QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/, 0), m_renderer(parent) { } diff --git a/src/3rdparty/phonon/ds9/volumeeffect.cpp b/src/3rdparty/phonon/ds9/volumeeffect.cpp index b9a5fce..a93b074 100644 --- a/src/3rdparty/phonon/ds9/volumeeffect.cpp +++ b/src/3rdparty/phonon/ds9/volumeeffect.cpp @@ -76,7 +76,7 @@ namespace Phonon class VolumeMemInputPin : public QMemInputPin { public: - VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt) : QMemInputPin(parent, mt, true /*transform*/) + VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, QPin *output) : QMemInputPin(parent, mt, true /*transform*/, output) { } @@ -139,8 +139,7 @@ namespace Phonon //then creating the input mt << audioMediaType(); - m_input = new VolumeMemInputPin(this, mt); - m_input->addOutput(m_output); //make the connection here + m_input = new VolumeMemInputPin(this, mt, m_output); } void VolumeEffectFilter::treatOneSamplePerChannel(BYTE **buffer, int sampleSize, int channelCount, int frequency) |