Changeset 561 for trunk/src/3rdparty/phonon/ds9/qmeminputpin.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/qmeminputpin.cpp
r2 r561 29 29 { 30 30 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) 33 33 { 34 34 } … … 67 67 //this allows to serialize with Receive calls 68 68 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(); 74 72 } 75 73 return S_OK; … … 79 77 { 80 78 //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); 88 84 m_flushing = true; 89 85 return S_OK; … … 93 89 { 94 90 //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); 102 96 m_flushing = false; 103 97 return S_OK; … … 106 100 STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) 107 101 { 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); 111 104 return S_OK; 112 105 } … … 120 113 mt->majortype != MEDIATYPE_NULL && 121 114 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()); 130 118 } 131 119 return hr; … … 138 126 } 139 127 140 if (*alloc = memoryAllocator(true)) { 128 *alloc = memoryAllocator(true); 129 if (*alloc) { 141 130 return S_OK; 142 131 } … … 152 141 153 142 { 154 Q WriteLocker locker(&m_lock);143 QMutexLocker locker(&m_mutex); 155 144 m_shouldDuplicateSamples = m_transform && readonly; 156 145 } … … 158 147 setMemoryAllocator(alloc); 159 148 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); 166 152 } 167 153 … … 202 188 } 203 189 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()) 208 193 : sample; 209 194 … … 212 197 } 213 198 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); 220 202 } 221 203 … … 248 230 STDMETHODIMP QMemInputPin::ReceiveCanBlock() 249 231 { 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; 258 237 } 259 238 } … … 261 240 } 262 241 263 //addition264 //this should be used by the filter to tell it's input pins to which output they should route the samples265 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() const279 {280 QReadLocker locker(&m_lock);281 return m_outputs;282 }283 242 284 243 ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const … … 295 254 296 255 HRESULT hr = alloc->Commit(); 297 if (hr == VFW_E_SIZENOTSET) {256 if (hr == HRESULT(VFW_E_SIZENOTSET)) { 298 257 ALLOCATOR_PROPERTIES prop = getDefaultAllocatorProperties(); 299 258 prop.cbBuffer = qMax(prop.cbBuffer, length); … … 325 284 LONGLONG start, end; 326 285 hr = sample->GetMediaTime(&start, &end); 327 if (hr != VFW_E_MEDIA_TIME_NOT_SET) {286 if (hr != HRESULT(VFW_E_MEDIA_TIME_NOT_SET)) { 328 287 hr = out->SetMediaTime(&start, &end); 329 288 Q_ASSERT(SUCCEEDED(hr));
Note:
See TracChangeset
for help on using the changeset viewer.