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/qpin.cpp

    r2 r561  
    2929    {
    3030
    31         static const AM_MEDIA_TYPE defaultMediaType()
    32         {
    33             AM_MEDIA_TYPE ret;
    34             ret.majortype = MEDIATYPE_NULL;
    35             ret.subtype = MEDIASUBTYPE_NULL;
    36             ret.bFixedSizeSamples = TRUE;
    37             ret.bTemporalCompression = FALSE;
    38             ret.lSampleSize = 1;
    39             ret.formattype = GUID_NULL;
    40             ret.pUnk = 0;
    41             ret.cbFormat = 0;
    42             ret.pbFormat = 0;
    43             return ret;
    44         }
     31        static const AM_MEDIA_TYPE defaultMediaType = { MEDIATYPE_NULL, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0};
    4532
    4633        class QEnumMediaTypes : public IEnumMediaTypes
     
    10592                }
    10693
    107                 int nbFetched = 0;
    108                 while (nbFetched < int(count) && m_index < m_pin->mediaTypes().count()) {
     94                uint nbFetched = 0;
     95                while (nbFetched < count && m_index < m_pin->mediaTypes().count()) {
    10996                    //the caller will deallocate the memory
    11097                    *out = static_cast<AM_MEDIA_TYPE *>(::CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)));
     
    159146
    160147        QPin::QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt) :
    161         m_memAlloc(0), m_parent(parent), m_refCount(1),  m_connected(0),
    162             m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType()),
    163             m_flushing(false)
     148            m_parent(parent), m_flushing(false), m_refCount(1),  m_connected(0),
     149            m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType),
     150            m_memAlloc(0)
    164151        {
    165152            Q_ASSERT(m_parent);
     
    274261            if (FAILED(hr)) {
    275262                setConnected(0);
    276                 setConnectedType(defaultMediaType());
     263                setConnectedType(defaultMediaType);
    277264            } else {
    278265                ComPointer<IMemInputPin> input(pin, IID_IMemInputPin);
     
    316303
    317304            setConnected(0);
    318             setConnectedType(defaultMediaType());
    319             if (m_direction == PINDIR_INPUT) {
    320                 setMemoryAllocator(0);
    321             }
     305            setConnectedType(defaultMediaType);
     306            setMemoryAllocator(0);
    322307            return S_OK;
    323308        }
     
    339324        STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type)
    340325        {
    341             QReadLocker locker(&m_lock);
     326            QMutexLocker locker(&m_mutex);
    342327            if (!type) {
    343328                return E_POINTER;
     
    354339        STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info)
    355340        {
    356             QReadLocker locker(&m_lock);
    357341            if (!info) {
    358342                return E_POINTER;
     
    362346            info->pFilter = m_parent;
    363347            m_parent->AddRef();
    364             qMemCopy(info->achName, m_name.utf16(), qMin(MAX_FILTER_NAME, m_name.length()+1) *2);
    365 
     348            info->achName[0] = 0;
    366349            return S_OK;
    367350        }
     
    369352        STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir)
    370353        {
    371             QReadLocker locker(&m_lock);
    372354            if (!dir) {
    373355                return E_POINTER;
     
    380362        STDMETHODIMP QPin::QueryId(LPWSTR *id)
    381363        {
    382             QReadLocker locker(&m_lock);
    383364            if (!id) {
    384365                return E_POINTER;
    385366            }
    386367
    387             int nbBytes = (m_name.length()+1)*2;
    388             *id = static_cast<LPWSTR>(::CoTaskMemAlloc(nbBytes));
    389             qMemCopy(*id, m_name.utf16(), nbBytes);
     368            *id = static_cast<LPWSTR>(::CoTaskMemAlloc(2));
     369            *id[0] = 0;
    390370            return S_OK;
    391371        }
     
    393373        STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type)
    394374        {
    395             QReadLocker locker(&m_lock);
     375            QMutexLocker locker(&m_mutex);
    396376            if (!type) {
    397377                return E_POINTER;
     
    440420        STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
    441421        {
    442             QReadLocker locker(&m_lock);
     422            QMutexLocker locker(&m_mutex);
    443423            if (m_direction == PINDIR_OUTPUT && m_connected) {
    444424                //we deliver this downstream
     
    457437        HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin)
    458438        {
    459             IEnumMediaTypes *emt = 0;
    460             HRESULT hr = pin->EnumMediaTypes(&emt);
     439            ComPointer<IEnumMediaTypes> emt;
     440            HRESULT hr = pin->EnumMediaTypes(emt.pparam());
    461441            if (hr != S_OK) {
    462442                return hr;
     
    471451                        return S_OK;
    472452                    } else {
    473                         setConnectedType(defaultMediaType());
     453                        setConnectedType(defaultMediaType);
    474454                        freeMediaType(type);
    475455                    }
     
    521501        void QPin::setConnectedType(const AM_MEDIA_TYPE &type)
    522502        {
    523             QWriteLocker locker(&m_lock);
     503            QMutexLocker locker(&m_mutex);
    524504
    525505            //1st we free memory
     
    531511        const AM_MEDIA_TYPE &QPin::connectedType() const
    532512        {
    533             QReadLocker locker(&m_lock);
     513            QMutexLocker locker(&m_mutex);
    534514            return m_connectedType;
    535515        }
     
    537517        void QPin::setConnected(IPin *pin)
    538518        {
    539             QWriteLocker locker(&m_lock);
     519            QMutexLocker locker(&m_mutex);
    540520            if (pin) {
    541521                pin->AddRef();
     
    549529        IPin *QPin::connected(bool addref) const
    550530        {
    551             QReadLocker locker(&m_lock);
     531            QMutexLocker locker(&m_mutex);
    552532            if (addref && m_connected) {
    553533                m_connected->AddRef();
     
    558538        bool QPin::isFlushing() const
    559539        {
    560             QReadLocker locker(&m_lock);
     540            QMutexLocker locker(&m_mutex);
    561541            return m_flushing;
    562542        }
     
    564544        FILTER_STATE QPin::filterState() const
    565545        {
    566             QReadLocker locker(&m_lock);
    567546            FILTER_STATE fstate = State_Stopped;
    568547            m_parent->GetState(0, &fstate);
     
    572551        QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const
    573552        {
    574             QReadLocker locker(&m_lock);
     553            QMutexLocker locker(&m_mutex);
    575554            return m_mediaTypes;
    576555        }
     
    608587        void QPin::setMemoryAllocator(IMemAllocator *alloc)
    609588        {
    610             QWriteLocker locker(&m_lock);
     589            QMutexLocker locker(&m_mutex);
    611590            if (alloc) {
    612591                alloc->AddRef();
     
    620599        IMemAllocator *QPin::memoryAllocator(bool addref) const
    621600        {
    622             QReadLocker locker(&m_lock);
     601            QMutexLocker locker(&m_mutex);
    623602            if (addref && m_memAlloc) {
    624603                m_memAlloc->AddRef();
Note: See TracChangeset for help on using the changeset viewer.