|
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: The depayloadization part of the AVC payloadization/depayloadization plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef AVCPAYLOADFORMATREAD_H |
|
22 #define AVCPAYLOADFORMATREAD_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <E32Base.h> |
|
26 #include <e32std.h> |
|
27 #include <mmf/server/mmfdatabuffer.h> |
|
28 #include <mmf/common/mmfutilities.h> |
|
29 #include <ecom/ImplementationProxy.h> |
|
30 #include "rtpheader.h" |
|
31 #include "rfc3984decode.h" |
|
32 #include "formatstatemachine.h" |
|
33 |
|
34 |
|
35 // classes forward decleration |
|
36 |
|
37 //class CRFC3984Decode; |
|
38 class TRtpRecvHeader; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 #define KAvcMaxRxPacketSize 10000 |
|
43 |
|
44 |
|
45 /** |
|
46 * The CAvcPayloadFormatRead class implements the MMF format plugin for decoding of RTP payload |
|
47 * format for AVC codec. Refer to IETF RFC3984 for RTP Payload format for AVC codec. |
|
48 * This class receives AVC payload data from an RTP packet, depayloadizes it and passes it to the jitter buffer |
|
49 * |
|
50 * @lib ?library |
|
51 * @since Series 60 3.0 |
|
52 */ |
|
53 class CAvcPayloadFormatRead : public CPayloadFormatRead, public MPayloadFormatRead |
|
54 { |
|
55 |
|
56 public: // Constructors and destructor |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @param aSource Source of the data for the payload format plugin |
|
60 */ |
|
61 static CAvcPayloadFormatRead* NewL ( MDataSource* aSource ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CAvcPayloadFormatRead ( ); |
|
67 |
|
68 virtual void InitializeL( ); |
|
69 |
|
70 void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, |
|
71 TMediaId aMediaId ); |
|
72 |
|
73 |
|
74 virtual void CancelDlRequest( ); |
|
75 |
|
76 void SendDataToSinkL( ); |
|
77 |
|
78 |
|
79 |
|
80 void FillSourceBufferL( ); |
|
81 |
|
82 virtual void SetPayloadType( TUint8 aPayloadType ); |
|
83 |
|
84 virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ); |
|
85 virtual void SourceThreadLogoff( ); |
|
86 virtual void NegotiateSourceL( MDataSink& aDataSink ); |
|
87 |
|
88 virtual void BufferFilledL( CMMFBuffer* aBuffer, |
|
89 const TRtpRecvHeader& aRtpHeader ); |
|
90 |
|
91 TFourCC SourceDataTypeCode( TMediaId aMediaId ); |
|
92 TInt SetSourceDataTypeCode( TFourCC aSourceFourCC, |
|
93 TMediaId aMediaId ); |
|
94 |
|
95 void FillSinkBufferL( ); |
|
96 |
|
97 virtual CMMFBuffer* CreateSourceBufferL( TMediaId aMediaId, TBool &aReference ); |
|
98 |
|
99 |
|
100 void SourcePrimeL( ); |
|
101 void SourcePlayL(); |
|
102 void SourcePauseL(); |
|
103 void SourceStopL(); |
|
104 |
|
105 void UseRTPInfoExtension(); |
|
106 |
|
107 |
|
108 // from CPayloadFormatRead |
|
109 |
|
110 virtual void ConfigurePayloadFormatL( const TDesC8& aConfigParams ); |
|
111 |
|
112 |
|
113 // from CMMFFormatDecode |
|
114 |
|
115 /** |
|
116 * Return the frame time interval for the given media |
|
117 * |
|
118 * @param aMediaType KUidMediaTypeAudio or KUidMediaTypeVideo |
|
119 * |
|
120 * @return Time interval in micro seconds |
|
121 */ |
|
122 virtual TTimeIntervalMicroSeconds FrameTimeInterval( TMediaId aMediaType ) const; |
|
123 |
|
124 /** *** NOT SUPPORTED *** |
|
125 * Return the clip duration for the given media |
|
126 * |
|
127 * @param aMediaType KUidMediaTypeAudio or KUidMediaTypeVideo |
|
128 * |
|
129 * @return Clip duration in micro seconds |
|
130 */ |
|
131 virtual TTimeIntervalMicroSeconds Duration( TMediaId aMediaType ) const; |
|
132 |
|
133 virtual TUint Streams(TUid aMediaType) const; |
|
134 |
|
135 |
|
136 |
|
137 /** |
|
138 * From CMMFFormatDecode |
|
139 */ |
|
140 TFourCC SinkDataTypeCode( TMediaId aMediaId ); |
|
141 |
|
142 // From MDataSink |
|
143 |
|
144 protected: |
|
145 |
|
146 TFourCC iFourCC; |
|
147 |
|
148 private: |
|
149 |
|
150 CAvcPayloadFormatRead ( ); |
|
151 void ConstructL(MDataSource* aSource); |
|
152 CMMFBuffer* CreateSourceBufferNowL( TMediaId aMediaId, TBool &aReference ); |
|
153 |
|
154 CRFC3984Decode * iDecoder; // depayloadization class pointer |
|
155 // contains H264 |
|
156 MDataSource* iRtpDataSource; // data source |
|
157 MDataSource * iCurDataSource; // currently pointed data source, same as RTP Data Source |
|
158 |
|
159 TBool iBufferToReadExists; |
|
160 TBool iFillRequested; |
|
161 |
|
162 // Data sink who requested "FillBuffer". |
|
163 MDataSink* iSink; |
|
164 |
|
165 // RTP Header |
|
166 TRtpRecvHeader iRecvHeader; |
|
167 |
|
168 TMediaId iMediaId; |
|
169 |
|
170 // Format decoding state machine |
|
171 CFormatDecodeStateMachine* iStateMachine; |
|
172 |
|
173 // Count of depayloadized NAL units |
|
174 TInt iNalCount; |
|
175 TInt iNalSent; |
|
176 |
|
177 // DG: Use to provide several packets at a time to the jitter buffer |
|
178 TInt iCounter; |
|
179 |
|
180 |
|
181 CMMFDataBuffer * iPayloadBuffer; // Sink Buffer -- data comes into this buffer, is depacketized |
|
182 CMMFDataBuffer * iFrameBuffer; // Source Buffer -- data is put in this buffer after depacketization and given to data path |
|
183 |
|
184 // Payload types to expect including PTs for redundancy encodings |
|
185 RArray<TUint8> iPayloadTypes; |
|
186 |
|
187 TBool iUsingJitterBufferExtension; // indicates if using jitter buffer extension structure |
|
188 |
|
189 |
|
190 }; |
|
191 |
|
192 #endif |