Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/phonon/ds9/qmeminputpin.cpp

    r2 r561  
    2929    {
    3030
    31         QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) :
    32             QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform)
     31        QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform, QPin *output) :
     32            QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform), m_output(output)
    3333        {
    3434        }
     
    6767            //this allows to serialize with Receive calls
    6868            QMutexLocker locker(&m_mutexReceive);
    69             for(int i = 0; i < m_outputs.count(); ++i) {
    70                 IPin *conn = m_outputs.at(i)->connected();
    71                 if (conn) {
    72                     conn->EndOfStream();
    73                 }
     69            IPin *conn = m_output ? m_output->connected() : 0;
     70            if (conn) {
     71                conn->EndOfStream();
    7472            }
    7573            return S_OK;
     
    7977        {
    8078            //pass downstream
    81             for(int i = 0; i < m_outputs.count(); ++i) {
    82                 IPin *conn = m_outputs.at(i)->connected();
    83                 if (conn) {
    84                     conn->BeginFlush();
    85                 }
    86             }
    87             QWriteLocker locker(&m_lock);
     79            IPin *conn = m_output ? m_output->connected() : 0;
     80            if (conn) {
     81                conn->BeginFlush();
     82            }
     83            QMutexLocker locker(&m_mutex);
    8884            m_flushing = true;
    8985            return S_OK;
     
    9389        {
    9490            //pass downstream
    95             for(int i = 0; i < m_outputs.count(); ++i) {
    96                 IPin *conn = m_outputs.at(i)->connected();
    97                 if (conn) {
    98                     conn->EndFlush();
    99                 }
    100             }
    101             QWriteLocker locker(&m_lock);
     91            IPin *conn = m_output ? m_output->connected() : 0;
     92            if (conn) {
     93                conn->EndFlush();
     94            }
     95            QMutexLocker locker(&m_mutex);
    10296            m_flushing = false;
    10397            return S_OK;
     
    106100        STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
    107101        {
    108             for(int i = 0; i < m_outputs.count(); ++i) {
    109                 m_outputs.at(i)->NewSegment(start, stop, rate);
    110             }
     102            if (m_output)
     103                m_output->NewSegment(start, stop, rate);
    111104            return S_OK;
    112105        }
     
    120113                mt->majortype != MEDIATYPE_NULL &&
    121114                mt->subtype != MEDIASUBTYPE_NULL &&
    122                 mt->formattype != GUID_NULL) {
    123                     //we tell the output pins that they should connect with this type
    124                     for(int i = 0; i < m_outputs.count(); ++i) {
    125                         hr = m_outputs.at(i)->setAcceptedMediaType(connectedType());
    126                         if (FAILED(hr)) {
    127                             break;
    128                         }
    129                     }
     115                mt->formattype != GUID_NULL && m_output) {
     116                    //we tell the output pin that it should connect with this type
     117                    hr = m_output->setAcceptedMediaType(connectedType());
    130118            }
    131119            return hr;
     
    138126            }
    139127
    140             if (*alloc = memoryAllocator(true)) {
     128            *alloc = memoryAllocator(true);
     129            if (*alloc) {
    141130                return S_OK;
    142131            }
     
    152141
    153142            {
    154                 QWriteLocker locker(&m_lock);
     143                QMutexLocker locker(&m_mutex);
    155144                m_shouldDuplicateSamples = m_transform && readonly;
    156145            }
     
    158147            setMemoryAllocator(alloc);
    159148
    160             for(int i = 0; i < m_outputs.count(); ++i) {
    161                 IPin *pin = m_outputs.at(i)->connected();
    162                 if (pin) {
    163                     ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
    164                     input->NotifyAllocator(alloc, m_shouldDuplicateSamples);
    165                 }
     149            if (m_output) {
     150                ComPointer<IMemInputPin> input(m_output, IID_IMemInputPin);
     151                input->NotifyAllocator(alloc, m_shouldDuplicateSamples);
    166152            }
    167153
     
    202188            }
    203189
    204             for (int i = 0; i < m_outputs.count(); ++i) {
    205                 QPin *current = m_outputs.at(i);
    206                 IMediaSample *outSample = m_shouldDuplicateSamples ?
    207                     duplicateSampleForOutput(sample, current->memoryAllocator())
     190            if (m_output) {
     191                IMediaSample *outSample = m_shouldDuplicateSamples ?
     192                    duplicateSampleForOutput(sample, m_output->memoryAllocator())
    208193                    : sample;
    209194
     
    212197                }
    213198
    214                 IPin *pin = current->connected();
    215                 if (pin) {
    216                     ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
    217                     if (input) {
    218                         input->Receive(outSample);
    219                     }
     199                ComPointer<IMemInputPin> input(m_output->connected(), IID_IMemInputPin);
     200                if (input) {
     201                    input->Receive(outSample);
    220202                }
    221203
     
    248230        STDMETHODIMP QMemInputPin::ReceiveCanBlock()
    249231        {
    250             //we test the output to see if they can block
    251             for(int i = 0; i < m_outputs.count(); ++i) {
    252                 IPin *input = m_outputs.at(i)->connected();
    253                 if (input) {
    254                     ComPointer<IMemInputPin> meminput(input, IID_IMemInputPin);
    255                     if (meminput && meminput->ReceiveCanBlock() != S_FALSE) {
    256                         return S_OK;
    257                     }
     232            //we test the output to see if it can block
     233            if (m_output) {
     234                ComPointer<IMemInputPin> meminput(m_output->connected(), IID_IMemInputPin);
     235                if (meminput && meminput->ReceiveCanBlock() != S_FALSE) {
     236                    return S_OK;
    258237                }
    259238            }
     
    261240        }
    262241
    263         //addition
    264         //this should be used by the filter to tell it's input pins to which output they should route the samples
    265 
    266         void QMemInputPin::addOutput(QPin *output)
    267         {
    268             QWriteLocker locker(&m_lock);
    269             m_outputs += output;
    270         }
    271 
    272         void QMemInputPin::removeOutput(QPin *output)
    273         {
    274             QWriteLocker locker(&m_lock);
    275             m_outputs.removeOne(output);
    276         }
    277 
    278         QList<QPin*> QMemInputPin::outputs() const
    279         {
    280             QReadLocker locker(&m_lock);
    281             return m_outputs;
    282         }
    283242
    284243        ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const
     
    295254
    296255            HRESULT hr = alloc->Commit();
    297             if (hr == VFW_E_SIZENOTSET) {
     256            if (hr == HRESULT(VFW_E_SIZENOTSET)) {
    298257                ALLOCATOR_PROPERTIES prop = getDefaultAllocatorProperties();
    299258                prop.cbBuffer = qMax(prop.cbBuffer, length);
     
    325284                LONGLONG start, end;
    326285                hr = sample->GetMediaTime(&start, &end);
    327                 if (hr != VFW_E_MEDIA_TIME_NOT_SET) {
     286                if (hr != HRESULT(VFW_E_MEDIA_TIME_NOT_SET)) {
    328287                    hr = out->SetMediaTime(&start, &end);
    329288                    Q_ASSERT(SUCCEEDED(hr));
Note: See TracChangeset for help on using the changeset viewer.