|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: AVC Payload Format Read .. DePayloadizes incoming RTP packets |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32base.h> |
|
23 #include <mmf/common/mmffourcc.h> |
|
24 #include <Sysutil.h> |
|
25 #include "MccRtpDataSource.h" |
|
26 #include "avcpayloadformatread.h" |
|
27 #include "avcrtpstruct.h" |
|
28 #include "MccInternalDef.h" |
|
29 |
|
30 _LIT8(AVCPSC, "\x0\x0\x0\x1"); |
|
31 // ============================= LOCAL FUNCTIONS =============================== |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CAvcPayloadFormatRead::CAvcPayloadFormatRead |
|
37 // |
|
38 // CAvcPayloadFormatRead default constructor, can NOT contain any code, |
|
39 // that might leave |
|
40 // Phase #1 of 2-phase constructor |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CAvcPayloadFormatRead::CAvcPayloadFormatRead ( ) : |
|
44 iDecoder( NULL ) |
|
45 { |
|
46 iFourCC.Set( TFourCC( 'H','2','6','4' ) ); |
|
47 iUsingJitterBufferExtension = ETrue; |
|
48 } |
|
49 |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CAvcPayloadFormatRead::ConstructL |
|
53 // |
|
54 // Symbian 2nd phase constructor can leave. |
|
55 // Phase #2 of 2-phase constructor |
|
56 // Initializes the State machine and rest of the members. |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void CAvcPayloadFormatRead::ConstructL ( MDataSource* aSource ) |
|
61 { |
|
62 iRtpDataSource = aSource; |
|
63 iBufferToReadExists = EFalse; |
|
64 |
|
65 iFourCC.Set( TFourCC( 'H','2','6','4' ) ); |
|
66 |
|
67 // Initialize decoding state machine |
|
68 iStateMachine = CFormatDecodeStateMachine::NewL( this ); |
|
69 iStateMachine->ChangeState( EDecodeIdle ); |
|
70 |
|
71 iPayloadBuffer = CMMFDataBuffer::NewL(KAvcMaxRxPacketSize); |
|
72 iFrameBuffer = CMMFDataBuffer::NewL(KAvcMaxRxPacketSize + sizeof(TRTPInfo)); |
|
73 |
|
74 iCounter = 0; |
|
75 iCurDataSource = aSource; |
|
76 iUsingJitterBufferExtension = ETrue; |
|
77 iNalSent = 0; |
|
78 } |
|
79 |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CAvcPayloadFormatRead::NewL |
|
83 // |
|
84 // Two-phased constructor. |
|
85 // Static function for creating and constructing an instance of the AVC format. |
|
86 // |
|
87 // Returns: CAvcPayloadFormatRead* : pointer to created instance |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 CAvcPayloadFormatRead* CAvcPayloadFormatRead::NewL ( MDataSource* aSource ) |
|
91 { |
|
92 |
|
93 if ( NULL == aSource ) |
|
94 { |
|
95 User::Leave ( KErrArgument ); |
|
96 } |
|
97 |
|
98 if ( KRtpSourceUID != aSource->DataSourceType( ) ) |
|
99 { |
|
100 User::Leave ( KErrNotSupported ); |
|
101 } |
|
102 |
|
103 CAvcPayloadFormatRead* self = new ( ELeave ) CAvcPayloadFormatRead(); |
|
104 CleanupStack::PushL ( self ); |
|
105 self->ConstructL ( aSource ); |
|
106 CleanupStack::Pop ( ); |
|
107 return self; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CAvcPayloadFormatRead::~CAvcPayloadFormatRead |
|
112 // |
|
113 // Destructor. |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 CAvcPayloadFormatRead::~CAvcPayloadFormatRead ( ) |
|
117 { |
|
118 // commented out CreateSourceBufferL now sets aReference to ETrue. |
|
119 // datapath doesn't clean this buffer any longer. |
|
120 if ( iFrameBuffer ) |
|
121 { |
|
122 delete iFrameBuffer; |
|
123 } |
|
124 if ( iPayloadBuffer) |
|
125 delete iPayloadBuffer; |
|
126 if ( iStateMachine ) |
|
127 { |
|
128 iStateMachine->Cancel( ); |
|
129 delete iStateMachine; |
|
130 } |
|
131 |
|
132 delete iDecoder; |
|
133 iRtpDataSource = NULL; |
|
134 iSink = NULL; |
|
135 iCurDataSource = NULL; |
|
136 |
|
137 iPayloadTypes.Close(); |
|
138 } |
|
139 |
|
140 // Virtual functions from CMMFFormatDecode |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CAvcPayloadFormatRead::FrameTimeInterval |
|
144 // |
|
145 // Return the frame time interval for the given media |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 TTimeIntervalMicroSeconds CAvcPayloadFormatRead::FrameTimeInterval( TMediaId aMediaId ) const |
|
149 { |
|
150 if ( aMediaId.iMediaType == KUidMediaTypeVideo) |
|
151 { |
|
152 return TTimeIntervalMicroSeconds( 0 ); // return some correct value as required |
|
153 } |
|
154 else |
|
155 { |
|
156 return TTimeIntervalMicroSeconds( 0 ); |
|
157 } |
|
158 } |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CAvcPayloadFormatRead::Streams |
|
161 // |
|
162 // Return the frame time interval for the given media |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TUint CAvcPayloadFormatRead::Streams(TUid /*aMediaType*/) const |
|
166 { |
|
167 return 0; |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CAvcPayloadFormatRead::Duration |
|
172 // |
|
173 // Return the clip duration for the given media. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 TTimeIntervalMicroSeconds CAvcPayloadFormatRead::Duration( TMediaId /*aMediaType*/ ) const |
|
177 { |
|
178 return TTimeIntervalMicroSeconds( 1000000000 ); |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CAvcPayloadFormatRead::Initialize |
|
183 // |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CAvcPayloadFormatRead::InitializeL( ) |
|
187 { |
|
188 |
|
189 if(!iDecoder) |
|
190 iDecoder = CRFC3984Decode::NewL(); |
|
191 |
|
192 } |
|
193 |
|
194 // The following functions are virtual function implementation from MDataSource |
|
195 // ----------------------------------------------------------------------------- |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // CAvcPayloadFormatRead::FillBufferL |
|
199 // Fill Buffer |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CAvcPayloadFormatRead::FillBufferL( CMMFBuffer* aBuffer, |
|
203 MDataSink* aConsumer, |
|
204 TMediaId aMediaId ) |
|
205 { |
|
206 |
|
207 if ( aMediaId.iMediaType != KUidMediaTypeVideo ) |
|
208 { |
|
209 User::Leave( KErrNotSupported ); |
|
210 } |
|
211 |
|
212 if ( aBuffer->Type( ) != KUidMmfDataBuffer ) |
|
213 { |
|
214 User::Leave( KErrNotSupported ); |
|
215 } |
|
216 |
|
217 iSink = aConsumer; |
|
218 iMediaId = aMediaId; |
|
219 |
|
220 iFillRequested = ETrue; |
|
221 |
|
222 |
|
223 if(iNalSent < iNalCount) |
|
224 { |
|
225 CAvcRtpStruct * ptr = NULL; |
|
226 TBufC8<4> buf(AVCPSC); |
|
227 |
|
228 ptr = NULL; |
|
229 // while((ptr = iDecoder->GetNalUnit(iNalSent++)) != NULL && iCounter < 2) |
|
230 { |
|
231 ptr = iDecoder->GetNalUnit(iNalSent++); |
|
232 if(ptr) |
|
233 { |
|
234 iCounter++; |
|
235 TDes8& dataDes = STATIC_CAST( CMMFDataBuffer*, iFrameBuffer )->Data( ); |
|
236 TPtr8 pDes = ptr->iDes->Des( ); |
|
237 |
|
238 |
|
239 if(iUsingJitterBufferExtension) |
|
240 { |
|
241 TRTPInfo info; |
|
242 info.TS = (ptr->iTimeStamp*1000)/90; |
|
243 info.SN = ptr->iSeqNo; |
|
244 info.DON = ptr->iDon; |
|
245 info.PT = ptr->iPacketType; |
|
246 info.FUH = ptr->iFUHeader; // copying FU-Header |
|
247 dataDes.Copy((TUint8*)&info, sizeof(TRTPInfo)); |
|
248 if(ptr->iPacketType != PACKET_FU_A && ptr->iPacketType != PACKET_FU_B) |
|
249 dataDes.Append(AVCPSC); |
|
250 dataDes.Append(pDes.Ptr( ), pDes.Length( )); |
|
251 } |
|
252 else |
|
253 { |
|
254 dataDes.Copy(pDes.Ptr( ), pDes.Length( )); |
|
255 if(ptr->iPacketType != PACKET_FU_A && ptr->iPacketType != PACKET_FU_B) |
|
256 dataDes.Insert(0, AVCPSC);//Add PSC to each packet |
|
257 } |
|
258 |
|
259 |
|
260 iFrameBuffer->SetTimeToPlay(TTimeIntervalMicroSeconds((ptr->iTimeStamp*1000)/90));//us |
|
261 iFrameBuffer->SetFrameNumber(ptr->iSeqNo); |
|
262 |
|
263 // sending first NAL unit to the jitter buffer |
|
264 iSink->BufferFilledL(iFrameBuffer); |
|
265 } |
|
266 // else |
|
267 // break; |
|
268 |
|
269 if(iNalSent == iNalCount) |
|
270 { |
|
271 iNalSent++; |
|
272 iDecoder->ClearBuffer(); |
|
273 iNalCount = 0; |
|
274 iStateMachine->ChangeState( EWaitSourceData ); // No payload ask for it |
|
275 } |
|
276 } |
|
277 iCounter = 0; |
|
278 } |
|
279 |
|
280 |
|
281 |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CAvcPayloadFormatRead::FillSourceBufferL |
|
286 // |
|
287 // Send fill buffer request to RTP Data Soure |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CAvcPayloadFormatRead::FillSourceBufferL( ) |
|
291 { |
|
292 // iRtpDataSource->FillBufferL( iPayloadBuffer, this, iMediaId ); // RtpSourceSink doesn't really need the Media Id. |
|
293 // RTP will fill buffer when it receives a packet |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // CAvcPayloadFormatRead::SourceThreadLogon |
|
298 // |
|
299 // Log in to the source thread |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 TInt CAvcPayloadFormatRead::SourceThreadLogon( MAsyncEventHandler& aEventHandler ) |
|
303 { |
|
304 static_cast<CMCCRtpDataSource*>(iRtpDataSource)->SetPayloadSize( 1500 ); |
|
305 |
|
306 iCurDataSource->SourceThreadLogon( aEventHandler ); |
|
307 return KErrNone; |
|
308 } |
|
309 |
|
310 // ----------------------------------------------------------------------------- |
|
311 // CAvcPayloadFormatRead::NegotiateSourceL( MDataSink& aDataSink ) |
|
312 // |
|
313 // Negotiate source settings to match data sink object. |
|
314 // Re-size frame buffers if needed |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 void CAvcPayloadFormatRead::NegotiateSourceL( MDataSink& aDataSink ) |
|
318 { |
|
319 iSink = static_cast<MDataSink*>( &aDataSink );//aDataSink; |
|
320 |
|
321 iCurDataSource->NegotiateSourceL( *this ); |
|
322 |
|
323 |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CAvcPayloadFormatRead::SourceThreadLogoff |
|
328 // |
|
329 // Log out of the source thread. |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CAvcPayloadFormatRead::SourceThreadLogoff( ) |
|
333 { |
|
334 iCurDataSource->SourceThreadLogoff( ); |
|
335 } |
|
336 |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CAvcPayloadFormatRead::BufferFilledL |
|
340 // |
|
341 // Called after the data buffer is filled. Update the number of bytes read |
|
342 // and the current read position for the next read operation. |
|
343 // ----------------------------------------------------------------------------- |
|
344 // |
|
345 void CAvcPayloadFormatRead::BufferFilledL( CMMFBuffer* aBuffer, |
|
346 const TRtpRecvHeader& aRtpHeader ) |
|
347 { |
|
348 |
|
349 User::LeaveIfNull( aBuffer ); |
|
350 |
|
351 if ( KUidMmfDataBuffer != aBuffer->Type() ) |
|
352 { |
|
353 User::Leave( KErrNotSupported ); |
|
354 } |
|
355 |
|
356 //#ifdef TRACE_AVC_PAYLOAD_FORMAT_READ |
|
357 // RDebug::Print ( _L ( "start CMMFAmrWbFormatRead::BufferFilledL" ) ); |
|
358 // RDebug::Print ( _L ( "M = %d, R = %d, CSI = %d, SIT = %d, PT = %d, SN = %d, CS = %d" ), |
|
359 // aRtpHeader.iMarker, aRtpHeader.reserved, aRtpHeader.iChecksumInd, |
|
360 // aRtpHeader.iSpeechItemToggle, aRtpHeader.iPayloadType, |
|
361 // aRtpHeader.iSeqNum, aRtpHeader.iChecksum ); |
|
362 //#endif |
|
363 |
|
364 |
|
365 // Copy received buffer |
|
366 iPayloadBuffer->Data().Copy( static_cast<CMMFDataBuffer*>( aBuffer )->Data() ); |
|
367 |
|
368 iRecvHeader = aRtpHeader; |
|
369 iBufferToReadExists = ETrue; |
|
370 |
|
371 // Get a reference to the data |
|
372 TDes8& srcData = static_cast<CMMFDataBuffer*>( iPayloadBuffer )->Data(); |
|
373 |
|
374 |
|
375 |
|
376 // Decode the payload |
|
377 iNalCount = 0; |
|
378 iDecoder->DePayloadizeFrameL(srcData, iRecvHeader.iTimestamp, iRecvHeader.iTimestamp, iRecvHeader.iSeqNum |
|
379 , iRecvHeader.iMarker, iNalCount); |
|
380 |
|
381 |
|
382 // Whenever BufferFilledL is called from RtpSourceSink |
|
383 // Data has been depayloadized, now read the data and send it to the sink (DataPath) |
|
384 iStateMachine->ChangeState( EEmptyDataToSink ); |
|
385 SendDataToSinkL(); // sending data to sink |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // CAvcPayloadFormatRead::SendDataToSinkL |
|
390 // |
|
391 // Send full frame buffer to Data Path |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 |
|
395 void CAvcPayloadFormatRead::SendDataToSinkL( ) |
|
396 { |
|
397 TInt count = 0; |
|
398 CAvcRtpStruct * ptr = NULL; |
|
399 TBufC8<4> buf(AVCPSC); |
|
400 |
|
401 #ifdef TRACE_AVC_PAYLOAD_FORMAT_READ |
|
402 RDebug::Print ( _L ( "CAvcPayloadFormatRead::SendDataToSinkL( ) - START" ) ); |
|
403 #endif |
|
404 |
|
405 iFillRequested = EFalse; |
|
406 |
|
407 |
|
408 // We give data to jitter buffer through the iSink->BufferFilledL() function below. Now when the jitter |
|
409 // buffer has handled the data, it calls back FillBufferL() and there we check if all the data is given |
|
410 // and if so, delete the buffers. Otherwise give data back to it again. |
|
411 |
|
412 iNalSent = 0; // starting from 0 and going to iNalCount (in FillBuffer) |
|
413 |
|
414 |
|
415 ptr = NULL; |
|
416 ptr = iDecoder->GetNalUnit(iNalSent++); |
|
417 if(ptr) |
|
418 { |
|
419 TDes8& dataDes = STATIC_CAST( CMMFDataBuffer*, iFrameBuffer )->Data( ); |
|
420 TPtr8 pDes = ptr->iDes->Des( ); |
|
421 |
|
422 |
|
423 if(iUsingJitterBufferExtension) |
|
424 { |
|
425 TRTPInfo info; |
|
426 info.TS = (ptr->iTimeStamp*1000)/90; |
|
427 info.SN = ptr->iSeqNo; |
|
428 info.DON = ptr->iDon; |
|
429 info.PT = ptr->iPacketType; |
|
430 info.FUH = ptr->iFUHeader; // copying FU-Header |
|
431 dataDes.Copy((TUint8*)&info, sizeof(TRTPInfo)); |
|
432 if(ptr->iPacketType != PACKET_FU_A && ptr->iPacketType != PACKET_FU_B) |
|
433 dataDes.Append(AVCPSC); |
|
434 dataDes.Append(pDes.Ptr( ), pDes.Length( )); |
|
435 } |
|
436 else |
|
437 { |
|
438 dataDes.Copy(pDes.Ptr( ), pDes.Length( )); |
|
439 if(ptr->iPacketType != PACKET_FU_A && ptr->iPacketType != PACKET_FU_B) |
|
440 dataDes.Insert(0, AVCPSC);//Add PSC to each packet |
|
441 } |
|
442 |
|
443 |
|
444 iFrameBuffer->SetTimeToPlay(TTimeIntervalMicroSeconds((ptr->iTimeStamp*1000)/90));//us |
|
445 iFrameBuffer->SetFrameNumber(ptr->iSeqNo); |
|
446 |
|
447 // sending first NAL unit to the jitter buffer |
|
448 iSink->BufferFilledL(iFrameBuffer); |
|
449 } |
|
450 |
|
451 |
|
452 // Clear buffers and then reset iNalCount |
|
453 //iDecoder->ClearBuffer(); |
|
454 //iNalCount = 0; |
|
455 |
|
456 |
|
457 #ifdef TRACE_AVC_PAYLOAD_FORMAT_READ |
|
458 RDebug::Print ( _L ( "CAvcPayloadFormatRead::SendDataToSinkL( ) - DONE" ) ); |
|
459 #endif |
|
460 } |
|
461 |
|
462 /*void CAvcPayloadFormatRead::SendDataToSinkL( ) |
|
463 { |
|
464 TInt count = 0; |
|
465 CAvcRtpStruct * ptr = NULL; |
|
466 TBufC8<4> buf(AVCPSC); |
|
467 |
|
468 #ifdef TRACE_AVC_PAYLOAD_FORMAT_READ |
|
469 RDebug::Print ( _L ( "CAvcPayloadFormatRead::SendDataToSinkL( ) - START" ) ); |
|
470 #endif |
|
471 |
|
472 iFillRequested = EFalse; |
|
473 |
|
474 |
|
475 for(count = 0; count < iNalCount; count++) |
|
476 { |
|
477 ptr = NULL; |
|
478 ptr = iDecoder->GetNalUnit(count); |
|
479 if(ptr) |
|
480 { |
|
481 TDes8& dataDes = STATIC_CAST( CMMFDataBuffer*, iFrameBuffer )->Data( ); |
|
482 TPtr8 pDes = ptr->iDes->Des( ); |
|
483 |
|
484 |
|
485 if(iUsingJitterBufferExtension) |
|
486 { |
|
487 TRTPInfo info; |
|
488 info.TS = (ptr->iTimeStamp*1000)/90; |
|
489 info.SN = ptr->iSeqNo; |
|
490 info.DON = ptr->iDon; |
|
491 dataDes.Copy((TUint8*)&info, sizeof(TRTPInfo)); |
|
492 dataDes.Append(AVCPSC); |
|
493 dataDes.Append(pDes.Ptr( ), pDes.Length( )); |
|
494 } |
|
495 else |
|
496 { |
|
497 dataDes.Copy(pDes.Ptr( ), pDes.Length( )); |
|
498 dataDes.Insert(0, AVCPSC);//Add PSC to each packet |
|
499 } |
|
500 |
|
501 |
|
502 iFrameBuffer->SetTimeToPlay(TTimeIntervalMicroSeconds((ptr->iTimeStamp*1000)/90));//us |
|
503 iFrameBuffer->SetFrameNumber(ptr->iSeqNo); |
|
504 |
|
505 iSink->BufferFilledL(iFrameBuffer); |
|
506 } |
|
507 |
|
508 } |
|
509 |
|
510 |
|
511 |
|
512 // Clear buffers and then reset iNalCount |
|
513 iDecoder->ClearBuffer(); |
|
514 iNalCount = 0; |
|
515 |
|
516 |
|
517 #ifdef TRACE_AVC_PAYLOAD_FORMAT_READ |
|
518 RDebug::Print ( _L ( "CAvcPayloadFormatRead::SendDataToSinkL( ) - DONE" ) ); |
|
519 #endif |
|
520 } |
|
521 |
|
522 */ |
|
523 // ----------------------------------------------------------------------------- |
|
524 // CAvcPayloadFormatRead::SourceDataTypeCode |
|
525 // |
|
526 // Return the source data type ( four CC code ) for the given media |
|
527 // ----------------------------------------------------------------------------- |
|
528 // |
|
529 TFourCC CAvcPayloadFormatRead::SourceDataTypeCode( TMediaId aMediaId ) |
|
530 { |
|
531 if ( aMediaId.iMediaType == KUidMediaTypeVideo ) |
|
532 { |
|
533 return iFourCC; |
|
534 } |
|
535 else |
|
536 { |
|
537 return TFourCC( ); //defaults to 'NULL' fourCC |
|
538 } |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CAvcPayloadFormatRead::SetSourceDataTypeCode |
|
543 // |
|
544 // Set the source data type to the given four CC code for the given media |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 TInt CAvcPayloadFormatRead::SetSourceDataTypeCode( TFourCC aSourceFourCC, |
|
548 TMediaId aMediaId ) |
|
549 { |
|
550 if ( KUidMediaTypeVideo != aMediaId.iMediaType ) |
|
551 { |
|
552 return KErrNotSupported; |
|
553 } |
|
554 |
|
555 iFourCC = aSourceFourCC; |
|
556 iMediaId = aMediaId; |
|
557 |
|
558 return KErrNone; |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CAvcPayloadFormatRead::CreateSourceBufferL |
|
563 // |
|
564 // Create a source buffer for the given media and indicate in aReference if buffer |
|
565 // is created. |
|
566 // ----------------------------------------------------------------------------- |
|
567 // |
|
568 CMMFBuffer* CAvcPayloadFormatRead::CreateSourceBufferNowL( TMediaId aMediaId, |
|
569 TBool &aReference ) |
|
570 { |
|
571 if ( aMediaId.iMediaType != KUidMediaTypeVideo ) |
|
572 { |
|
573 User::Leave( KErrNotSupported ); |
|
574 } |
|
575 |
|
576 // the source buffers belong to AmrPayloadFormatRead not to datapath |
|
577 // aference should be set to ETrue and destried by AmrPayloadFormatRead itself. |
|
578 aReference = ETrue; |
|
579 return iFrameBuffer; |
|
580 } |
|
581 |
|
582 // ----------------------------------------------------------------------------- |
|
583 // CAvcPayloadFormatRead::CreateSourceBufferL |
|
584 // |
|
585 // Create a source buffer for the given media, setting frame size to match |
|
586 // the given sink buffer |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 CMMFBuffer* CAvcPayloadFormatRead::CreateSourceBufferL( TMediaId aMediaId, |
|
590 //CMMFBuffer& /*aSinkBuffer*/, |
|
591 TBool &aReference ) |
|
592 { |
|
593 if ( aMediaId.iMediaType != KUidMediaTypeVideo ) |
|
594 { |
|
595 User::Leave( KErrNotSupported ); |
|
596 } |
|
597 |
|
598 return CreateSourceBufferNowL( aMediaId, aReference ); |
|
599 } |
|
600 |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CAvcPayloadFormatRead::SinkDataTypeCode() |
|
604 // Returns the datatype code for this Format Decoder |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 TFourCC CAvcPayloadFormatRead::SinkDataTypeCode( TMediaId aMediaId ) |
|
608 { |
|
609 if( KUidMediaTypeVideo == aMediaId.iMediaType ) |
|
610 { |
|
611 return iFourCC; |
|
612 } |
|
613 else |
|
614 { |
|
615 return TFourCC(); |
|
616 } |
|
617 }; |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CAvcPayloadFormatRead::CancelDlRequest( ) |
|
621 // |
|
622 // ----------------------------------------------------------------------------- |
|
623 // |
|
624 void CAvcPayloadFormatRead::CancelDlRequest( ) |
|
625 { |
|
626 |
|
627 iStateMachine->Cancel( ); |
|
628 iStateMachine->ChangeState( EDecodeIdle ); |
|
629 |
|
630 |
|
631 iBufferToReadExists = EFalse; |
|
632 iFillRequested = EFalse; |
|
633 |
|
634 } |
|
635 |
|
636 |
|
637 // ----------------------------------------------------------------------------- |
|
638 // CAvcPayloadFormatRead::SourcePrimeL( ) |
|
639 // |
|
640 // ----------------------------------------------------------------------------- |
|
641 // |
|
642 void CAvcPayloadFormatRead::SourcePrimeL( ) |
|
643 { |
|
644 iCurDataSource->SourcePrimeL(); |
|
645 } |
|
646 |
|
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CAvcPayloadFormatRead::SourcePlayL( ) |
|
650 // |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CAvcPayloadFormatRead::SourcePlayL( ) |
|
654 { |
|
655 iCurDataSource->SourcePlayL(); |
|
656 } |
|
657 |
|
658 // ----------------------------------------------------------------------------- |
|
659 // CAvcPayloadFormatRead::SourcePauseL( ) |
|
660 // |
|
661 // ----------------------------------------------------------------------------- |
|
662 // |
|
663 void CAvcPayloadFormatRead::SourcePauseL( ) |
|
664 { |
|
665 iCurDataSource->SourcePauseL( ); |
|
666 } |
|
667 |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // CAvcPayloadFormatRead::SourceStopL( ) |
|
671 // |
|
672 // ----------------------------------------------------------------------------- |
|
673 // |
|
674 void CAvcPayloadFormatRead::SourceStopL( ) |
|
675 { |
|
676 //CancelDlRequest( ); |
|
677 |
|
678 |
|
679 iCurDataSource->SourceStopL( ); |
|
680 } |
|
681 |
|
682 // --------------------------------------------------------------------------- |
|
683 // CAvcPayloadFormatRead::SetPayloadType |
|
684 // Sets the payloadtype to be accepted. |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 void CAvcPayloadFormatRead::SetPayloadType( TUint8 aPayloadType ) |
|
688 { |
|
689 iPayloadTypes.Reset(); |
|
690 iPayloadTypes.Append( aPayloadType ); |
|
691 } |
|
692 |
|
693 |
|
694 // --------------------------------------------------------------------------- |
|
695 // CAvcPayloadFormatRead::FillSinkBufferL |
|
696 // Fill the sink buffer, not needed, currently sendDataToSinkL fills the sink buffers before sending. |
|
697 // ----------------------------------------------------------------------------- |
|
698 // |
|
699 |
|
700 void CAvcPayloadFormatRead::FillSinkBufferL( ) |
|
701 { |
|
702 TFourCC(); |
|
703 } |
|
704 |
|
705 |
|
706 void CAvcPayloadFormatRead::UseRTPInfoExtension() |
|
707 { |
|
708 iUsingJitterBufferExtension = EFalse; |
|
709 } |
|
710 |
|
711 // --------------------------------------------------------------------------- |
|
712 |
|
713 void CAvcPayloadFormatRead::ConfigurePayloadFormatL( const TDesC8& /*aConfigParams*/ ) |
|
714 { |
|
715 // Fill this function when integrating AVC decoder |
|
716 } |