Changeset 561 for trunk/src/3rdparty/phonon/ds9/qpin.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/3rdparty/phonon/ds9/qpin.cpp
r2 r561 29 29 { 30 30 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}; 45 32 46 33 class QEnumMediaTypes : public IEnumMediaTypes … … 105 92 } 106 93 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()) { 109 96 //the caller will deallocate the memory 110 97 *out = static_cast<AM_MEDIA_TYPE *>(::CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))); … … 159 146 160 147 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) 164 151 { 165 152 Q_ASSERT(m_parent); … … 274 261 if (FAILED(hr)) { 275 262 setConnected(0); 276 setConnectedType(defaultMediaType ());263 setConnectedType(defaultMediaType); 277 264 } else { 278 265 ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); … … 316 303 317 304 setConnected(0); 318 setConnectedType(defaultMediaType()); 319 if (m_direction == PINDIR_INPUT) { 320 setMemoryAllocator(0); 321 } 305 setConnectedType(defaultMediaType); 306 setMemoryAllocator(0); 322 307 return S_OK; 323 308 } … … 339 324 STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type) 340 325 { 341 Q ReadLocker locker(&m_lock);326 QMutexLocker locker(&m_mutex); 342 327 if (!type) { 343 328 return E_POINTER; … … 354 339 STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info) 355 340 { 356 QReadLocker locker(&m_lock);357 341 if (!info) { 358 342 return E_POINTER; … … 362 346 info->pFilter = m_parent; 363 347 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; 366 349 return S_OK; 367 350 } … … 369 352 STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir) 370 353 { 371 QReadLocker locker(&m_lock);372 354 if (!dir) { 373 355 return E_POINTER; … … 380 362 STDMETHODIMP QPin::QueryId(LPWSTR *id) 381 363 { 382 QReadLocker locker(&m_lock);383 364 if (!id) { 384 365 return E_POINTER; 385 366 } 386 367 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; 390 370 return S_OK; 391 371 } … … 393 373 STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type) 394 374 { 395 Q ReadLocker locker(&m_lock);375 QMutexLocker locker(&m_mutex); 396 376 if (!type) { 397 377 return E_POINTER; … … 440 420 STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) 441 421 { 442 Q ReadLocker locker(&m_lock);422 QMutexLocker locker(&m_mutex); 443 423 if (m_direction == PINDIR_OUTPUT && m_connected) { 444 424 //we deliver this downstream … … 457 437 HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin) 458 438 { 459 IEnumMediaTypes *emt = 0;460 HRESULT hr = pin->EnumMediaTypes( &emt);439 ComPointer<IEnumMediaTypes> emt; 440 HRESULT hr = pin->EnumMediaTypes(emt.pparam()); 461 441 if (hr != S_OK) { 462 442 return hr; … … 471 451 return S_OK; 472 452 } else { 473 setConnectedType(defaultMediaType ());453 setConnectedType(defaultMediaType); 474 454 freeMediaType(type); 475 455 } … … 521 501 void QPin::setConnectedType(const AM_MEDIA_TYPE &type) 522 502 { 523 Q WriteLocker locker(&m_lock);503 QMutexLocker locker(&m_mutex); 524 504 525 505 //1st we free memory … … 531 511 const AM_MEDIA_TYPE &QPin::connectedType() const 532 512 { 533 Q ReadLocker locker(&m_lock);513 QMutexLocker locker(&m_mutex); 534 514 return m_connectedType; 535 515 } … … 537 517 void QPin::setConnected(IPin *pin) 538 518 { 539 Q WriteLocker locker(&m_lock);519 QMutexLocker locker(&m_mutex); 540 520 if (pin) { 541 521 pin->AddRef(); … … 549 529 IPin *QPin::connected(bool addref) const 550 530 { 551 Q ReadLocker locker(&m_lock);531 QMutexLocker locker(&m_mutex); 552 532 if (addref && m_connected) { 553 533 m_connected->AddRef(); … … 558 538 bool QPin::isFlushing() const 559 539 { 560 Q ReadLocker locker(&m_lock);540 QMutexLocker locker(&m_mutex); 561 541 return m_flushing; 562 542 } … … 564 544 FILTER_STATE QPin::filterState() const 565 545 { 566 QReadLocker locker(&m_lock);567 546 FILTER_STATE fstate = State_Stopped; 568 547 m_parent->GetState(0, &fstate); … … 572 551 QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const 573 552 { 574 Q ReadLocker locker(&m_lock);553 QMutexLocker locker(&m_mutex); 575 554 return m_mediaTypes; 576 555 } … … 608 587 void QPin::setMemoryAllocator(IMemAllocator *alloc) 609 588 { 610 Q WriteLocker locker(&m_lock);589 QMutexLocker locker(&m_mutex); 611 590 if (alloc) { 612 591 alloc->AddRef(); … … 620 599 IMemAllocator *QPin::memoryAllocator(bool addref) const 621 600 { 622 Q ReadLocker locker(&m_lock);601 QMutexLocker locker(&m_mutex); 623 602 if (addref && m_memAlloc) { 624 603 m_memAlloc->AddRef();
Note:
See TracChangeset
for help on using the changeset viewer.