|
1 /* |
|
2 * Copyright (c) 2009 Aricent and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Aricent - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Plugin class for AmrWb decoder. This class inherits CMMFCodec |
|
16 * class and implements the pure virtual functions of CMMFCodec. |
|
17 * The class also has a few private funtions. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef ARIAMRWBDECMMFCODEC_H |
|
23 #define ARIAMRWBDECMMFCODEC_H |
|
24 |
|
25 // User includes |
|
26 #include <mmfcodec.h> |
|
27 // Forward declaration |
|
28 class CAriAmrWbDecWrapper; |
|
29 |
|
30 // Class declaration |
|
31 class CAriAmrWbDecMmfCodec:public CMMFCodec |
|
32 { |
|
33 public: //constructors and destructors |
|
34 /** |
|
35 * Two-phased constructor. |
|
36 * @return an instance of CMMFCodec |
|
37 */ |
|
38 static CMMFCodec* NewL(); |
|
39 |
|
40 /**> Destructor */ |
|
41 ~CAriAmrWbDecMmfCodec(); |
|
42 |
|
43 public: // From CMMFCodec |
|
44 |
|
45 /** |
|
46 * From CMMFCodec |
|
47 * Sets codec configuration. |
|
48 * The configuration data is passed in as a descriptor of type TDesC8. |
|
49 * @param aConfigType |
|
50 * The UID of the configuration data. |
|
51 * @param aParam |
|
52 * Descriptor with frame info parameters in the form of RArray |
|
53 */ |
|
54 virtual void ConfigureL(TUid aConfigType, const TDesC8& aParam); |
|
55 |
|
56 |
|
57 /** |
|
58 * From CMMFCodec |
|
59 * Codec reset function used to flush out status information when a |
|
60 * reposition occurs. |
|
61 * This is used if the codec requires resetting prior to use. |
|
62 */ |
|
63 virtual void ResetL(); |
|
64 |
|
65 |
|
66 /** |
|
67 * From CMMFCodec |
|
68 * Processes the data in the specified source buffer and writes the |
|
69 * processed data to the specified destination buffer. |
|
70 * This function is synchronous, when the function returns the data |
|
71 * has been processed. The source buffer is converted to the appropriate |
|
72 * coding type in the destination buffer. The buffers can be of any |
|
73 * size, therefore there is no guarantee that all the source buffer can |
|
74 * be processed to fill the destination buffer or that all the source |
|
75 * buffer may be processed before the destination is full. This function |
|
76 * therefore returns the number of source, and destination, bytes |
|
77 * processed along with a process result code indicating completion |
|
78 * status.This function is synchronous, when the function returns the |
|
79 * data has been processed. The source buffer is converted to the |
|
80 * appropriate coding type in the destination buffer. The buffers can be |
|
81 * of any size, therefore there is no guarantee that all the source |
|
82 * buffer can be processed to fill the destination buffer or that all |
|
83 * the source buffer may be processed before the destination is full. |
|
84 * This function therefore returns the number of source,and destination, |
|
85 * bytes processed along with a process result code indicating completion |
|
86 * status.The aSource and aSink buffers passed in are derived from |
|
87 * CMMFBuffer. The buffer type (e.g. a CMMFDataBuffer) passed in should |
|
88 * be supported by the codec otherwise this function should leave with |
|
89 * KErrNotSupported. The position of the source buffer should be checked |
|
90 * by calling the source buffer's Position() member which indicates the |
|
91 * current source read position in bytes. The codec should start |
|
92 * processing from the current source buffer read position. The position |
|
93 * of the destination buffer should be checked by calling the destination |
|
94 * buffer's Position() method which indicates the current destination |
|
95 * write position in bytes. The codec should start writing to the |
|
96 * destination buffer at the current destination buffer write position. |
|
97 * This is a virtual function that each derived class must implement. |
|
98 * @see enum TCodecProcessResult |
|
99 * @param aSource |
|
100 * The source buffer containing data to encode or decode. |
|
101 * @param aDestination |
|
102 * The destination buffer to hold the data after encoding or |
|
103 * decoding. |
|
104 * @return The result of the processing. |
|
105 * @pre The function ConfigureL() should have been called. |
|
106 */ |
|
107 |
|
108 virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, |
|
109 CMMFBuffer& aDestination); |
|
110 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * Default Constructor |
|
115 */ |
|
116 CAriAmrWbDecMmfCodec(); |
|
117 /** |
|
118 * Symbian 2nd phase constructor . |
|
119 */ |
|
120 void ConstructL(); |
|
121 /** |
|
122 * Update the result with result status, source bytes consumed |
|
123 * and destination bytes added. |
|
124 * @param aStatus |
|
125 * status of the result like EProcessComplete |
|
126 * @param aSrcBytesConsumed |
|
127 * total bytes consumed from the source buffer |
|
128 * @param aDstBytesAdded |
|
129 * total bytes added to the destination buffer |
|
130 * @return result of the processing |
|
131 */ |
|
132 TCodecProcessResult Result( |
|
133 TCodecProcessResult::TCodecProcessResultStatus aStatus, |
|
134 TInt aSrcBytesConsumed,TInt aDstBytesAdded); |
|
135 |
|
136 /** |
|
137 * Copy the bytes from internal output buffer to destination buffer |
|
138 * @param aDst |
|
139 * pointer to the destination buffer |
|
140 * @param aDstBytesConsumed |
|
141 * total bytes added to the destination buffer |
|
142 * @return number of bytes copied to the destination buffer. |
|
143 */ |
|
144 TInt CopyToDstBuffer( CMMFDataBuffer* aDst, TInt& aDstBytesConsumed); |
|
145 |
|
146 /** |
|
147 * Copy the bytes from the source buffer to the internal input burrer |
|
148 * @param aSrc |
|
149 * pointer to the source buffer |
|
150 * @param aSrcBytesConsumed |
|
151 * total bytes consumed from the source buffer |
|
152 * @return number bytes copied from the source buffer |
|
153 */ |
|
154 TInt CopyFromSrcBuffer(const CMMFDataBuffer* aSrc, |
|
155 TInt& aSrcBytesConsumed); |
|
156 /** |
|
157 * Shifts the data in the input internal buffer to start position |
|
158 * @param aFromPos |
|
159 * position from where data has to shift |
|
160 * @param aToPos |
|
161 * position to where data has to shift |
|
162 */ |
|
163 void ShiftData( TInt aFromPos, TInt aToPos ); |
|
164 private: |
|
165 |
|
166 // wrapper instance handle |
|
167 CAriAmrWbDecWrapper* iCodec; |
|
168 // internal input buffer |
|
169 TUint8* iInternalInputBuffer; |
|
170 // internal output buffer |
|
171 TUint8* iInternalOutputBuffer; |
|
172 // internal input residual length |
|
173 TInt iInternalInputBufferResidueLen; |
|
174 // internal output residual length |
|
175 TInt iInternalOutputBufferResidueLen; |
|
176 // internal output buffer position |
|
177 TInt iInternalOutputBufferPos; |
|
178 |
|
179 }; |
|
180 |
|
181 |
|
182 #endif /* ARIAMRWBDECMMFCODEC_H */ |