summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/ds9/qmeminputpin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/phonon/ds9/qmeminputpin.cpp')
-rw-r--r--src/3rdparty/phonon/ds9/qmeminputpin.cpp100
1 files changed, 29 insertions, 71 deletions
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
{