|
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 Mp3 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 #ifndef ARIMP3DECMMFCODEC_H |
|
22 #define ARIMP3DECMMFCODEC_H |
|
23 |
|
24 // system include files |
|
25 #include <MmfCodec.h> |
|
26 // user include files |
|
27 #include "arimp3decmmfcodec_uid.hrh" |
|
28 |
|
29 // Forward Declaration |
|
30 class CAriMp3DecWrapper; |
|
31 |
|
32 // Class declaration |
|
33 class CAriMp3DecMmfCodec :public CMMFCodec |
|
34 { |
|
35 |
|
36 public: //constructors and destructors |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 * @return Pointer to an instance of CMMFCodec |
|
40 */ |
|
41 static CMMFCodec* NewL(); |
|
42 |
|
43 /**> Destructor */ |
|
44 ~CAriMp3DecMmfCodec(); |
|
45 |
|
46 public: // From CMMFCodec |
|
47 |
|
48 /** |
|
49 * From CMMFCodec |
|
50 * Sets codec configuration. |
|
51 * The configuration data is passed in as a descriptor of type TDesC8. |
|
52 * @param aConfigType |
|
53 * The UID of the configuration data. |
|
54 * @param aParam |
|
55 * Descriptor with frame info parameters in the form of RArray |
|
56 */ |
|
57 |
|
58 virtual void ConfigureL( TUid aConfigType, const TDesC8& aParam ); |
|
59 |
|
60 /** |
|
61 * From CMMFCodec |
|
62 * Codec reset function used to flush out status information when a |
|
63 * reposition occurs. |
|
64 * This is used if the codec requires resetting prior to use. |
|
65 */ |
|
66 virtual void ResetL(); |
|
67 |
|
68 /** |
|
69 * From CMMFCodec |
|
70 * Processes the data in the specified source buffer and writes the |
|
71 * processed data to the specified destination buffer. |
|
72 * This function is synchronous, when the function returns the data |
|
73 * has been processed. The source buffer is converted to the appropriate |
|
74 * coding type in the destination buffer. The buffers can be of any |
|
75 * size, therefore there is no guarantee that all the source buffer can |
|
76 * be processed to fill the destination buffer or that all the source |
|
77 * buffer may be processed before the destination is full. This function |
|
78 * therefore returns the number of source, and destination, bytes |
|
79 * processed along with a process result code indicating completion |
|
80 * status.This function is synchronous, when the function returns the |
|
81 * data has been processed. The source buffer is converted to the |
|
82 * appropriate coding type in the destination buffer. The buffers can be |
|
83 * of any size, therefore there is no guarantee that all the source |
|
84 * buffer can be processed to fill the destination buffer or that all |
|
85 * the source buffer may be processed before the destination is full. |
|
86 * This function therefore returns the number of source,and destination, |
|
87 * bytes processed along with a process result code indicating completion |
|
88 * status.The aSource and aSink buffers passed in are derived from |
|
89 * CMMFBuffer. The buffer type (e.g. a CMMFDataBuffer) passed in should |
|
90 * be supported by the codec otherwise this function should leave with |
|
91 * KErrNotSupported. The position of the source buffer should be checked |
|
92 * by calling the source buffer's Position() member which indicates the |
|
93 * current source read position in bytes. The codec should start |
|
94 * processing from the current source buffer read position. The position |
|
95 * of the destination buffer should be checked by calling the destination |
|
96 * buffer's Position() method which indicates the current destination |
|
97 * write position in bytes. The codec should start writing to the |
|
98 * destination buffer at the current destination buffer write position. |
|
99 * This is a virtual function that each derived class must implement. |
|
100 * @see enum TCodecProcessResult |
|
101 * @param aSource |
|
102 * The source buffer containing data to encode or decode. |
|
103 * @param aDestination |
|
104 * The destination buffer to hold the data after encoding or |
|
105 * decoding. |
|
106 * @return The result of the processing. |
|
107 * @pre The function ConfigureL() should have been called. |
|
108 */ |
|
109 |
|
110 virtual TCodecProcessResult ProcessL( const CMMFBuffer& aSource, |
|
111 CMMFBuffer& aDestination ); |
|
112 |
|
113 private: |
|
114 /** |
|
115 * Default Constructor |
|
116 */ |
|
117 CAriMp3DecMmfCodec(); |
|
118 /** |
|
119 * Symbian 2nd phase constructor . |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 /** |
|
124 * Update the result with result status, source bytes consumed |
|
125 * and destination bytes added. |
|
126 * @param aStatus |
|
127 * status of the result like EProcessComplete |
|
128 * @param aSrcBytesConsumed |
|
129 * total bytes consumed from the source buffer |
|
130 * @param aDstBytesAdded |
|
131 * total bytes added to the destination buffer |
|
132 * @return result of the processing |
|
133 */ |
|
134 TCodecProcessResult Result( |
|
135 TCodecProcessResult::TCodecProcessResultStatus aStatus, |
|
136 TInt aSrcBytesConsumed,TInt aDstBytesAdded); |
|
137 |
|
138 /** |
|
139 * Copy the bytes from internal output buffer to destination buffer |
|
140 * @param aDst |
|
141 * pointer to the destination buffer |
|
142 * @param aDstBytesConsumed |
|
143 * total bytes added to the destination buffer |
|
144 * @return number of bytes copied to the destination buffer. |
|
145 */ |
|
146 TInt CopyToDstBuffer( CMMFDataBuffer* aDst, TInt& aDstBytesConsumed); |
|
147 |
|
148 /** |
|
149 * Copy the bytes from the source buffer to the internal input burrer |
|
150 * @param aSrc |
|
151 * pointer to the source buffer |
|
152 * @param aSrcBytesConsumed |
|
153 * total bytes consumed from the source buffer |
|
154 * @return number bytes copied from the source buffer |
|
155 */ |
|
156 TInt CopyFromSrcBuffer(const CMMFDataBuffer* aSrc, |
|
157 TInt& aSrcBytesConsumed); |
|
158 /** |
|
159 * Shifts the data in the input internal buffer to start position |
|
160 * @param aFromPos |
|
161 * position from where data has to shift |
|
162 * @param aToPos |
|
163 * position to where data has to shift |
|
164 */ |
|
165 void ShiftData( TInt aFromPos, TInt aToPos ); |
|
166 |
|
167 /** |
|
168 * Gets the new data from the source buffer |
|
169 * @param aSrc |
|
170 * pointer to the source buffer |
|
171 * @param aDstBytesConsumed |
|
172 * total number bytes added to the destination buffer |
|
173 * @param aSrcBytesConsumed |
|
174 * total number bytes consumed from the source buffer |
|
175 * @return returns the processin result |
|
176 */ |
|
177 TCodecProcessResult GetNewData(const CMMFDataBuffer* aSrc, |
|
178 TInt &aDstBytesConsumed, TInt &aSrcBytesConsumed); |
|
179 |
|
180 private: //Data |
|
181 |
|
182 // handle to the wrapper instance |
|
183 CAriMp3DecWrapper* iCodec; |
|
184 // Residue input buffer length |
|
185 TInt iInternalInputBufferResidueLen; |
|
186 // Residue output buffer length |
|
187 TInt iInternalOutputBufferResidueLen; |
|
188 // max output buffer size |
|
189 TInt iOutFrameSize; |
|
190 // Input internal buffer |
|
191 TUint8 *iInternalInputBuffer; |
|
192 // Output internal buffer |
|
193 TUint8 *iInternalOutputBuffer; |
|
194 // internal output buffer position |
|
195 TInt iInternalOutputBufferPos; |
|
196 |
|
197 }; |
|
198 |
|
199 #endif \\ ARIMP3DECMMFCODEC_H \\ |
|
200 |
|
201 //----------------------------------------------------------------------------- |
|
202 // End of File |
|
203 //----------------------------------------------------------------------------- |