|
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 * Implementation of member functions of Plugin class (CAriAmrNbDecMmfCodec). |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes |
|
20 #include <ecom.h> |
|
21 #include <implementationproxy.h> |
|
22 // User includes |
|
23 #include "ariamrnbdecwrapper.h" |
|
24 #include "ariamrnbdecmmfcodec.h" |
|
25 #include "ariamrnbdecmmfcodec_uid.hrh" |
|
26 #include "ariprint.h" |
|
27 |
|
28 // Maximum input and output buffer length |
|
29 const TUint KAMRNBMinOutBufLength = 320; |
|
30 |
|
31 |
|
32 //--------------------------------------------------------------------------- |
|
33 // Two-phased constructor. |
|
34 // Creates an instance of CAriHeAacDecMmfCodec. |
|
35 // Instance is not left on cleanup stack. |
|
36 //--------------------------------------------------------------------------- |
|
37 // |
|
38 CMMFCodec* CAriAmrNbDecMmfCodec::NewL() |
|
39 { |
|
40 PRINT_ENTRY; |
|
41 CAriAmrNbDecMmfCodec* self = new (ELeave) CAriAmrNbDecMmfCodec(); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 PRINT_EXIT; |
|
46 return ( CMMFCodec* )self; |
|
47 } |
|
48 |
|
49 //--------------------------------------------------------------------------- |
|
50 // Destructor;Destroys the decoder instance and any internal buffers |
|
51 //--------------------------------------------------------------------------- |
|
52 // |
|
53 CAriAmrNbDecMmfCodec::~CAriAmrNbDecMmfCodec() |
|
54 { |
|
55 PRINT_ENTRY; |
|
56 |
|
57 if ( iInternalInputBuffer ) |
|
58 { |
|
59 delete iInternalInputBuffer; |
|
60 iInternalInputBuffer = NULL; |
|
61 } |
|
62 if ( iInternalOutputBuffer ) |
|
63 { |
|
64 delete iInternalOutputBuffer; |
|
65 iInternalOutputBuffer = NULL; |
|
66 } |
|
67 if ( iCodec ) |
|
68 { |
|
69 delete iCodec; |
|
70 iCodec = NULL; |
|
71 } |
|
72 |
|
73 PRINT_EXIT; |
|
74 } |
|
75 |
|
76 //--------------------------------------------------------------------------- |
|
77 // From class CMMFCodec. |
|
78 // The function Sets codec configuration. |
|
79 // The value used for aConfigType must be KUidMmfCodecAudioSettings |
|
80 // (defined in include\mmf\plugins\mmfCodecImplementationUIDs.hrh) |
|
81 //--------------------------------------------------------------------------- |
|
82 // |
|
83 void CAriAmrNbDecMmfCodec::ConfigureL( TUid /* aConfigType */, |
|
84 const TDesC8& /*aParam*/ ) |
|
85 { |
|
86 PRINT_ENTRY; |
|
87 |
|
88 TInt configParam = 0; // Hardcoded to RTP |
|
89 TDecParam lParam; |
|
90 lParam.iMediatype = configParam; |
|
91 |
|
92 User::LeaveIfError( iCodec->Reset( lParam ) ); |
|
93 |
|
94 PRINT_EXIT; |
|
95 } |
|
96 |
|
97 //--------------------------------------------------------------------------- |
|
98 // From class CMMFCodec. |
|
99 // This function is used to flush out status information when a |
|
100 // reposition occurs. |
|
101 // This is used if the codec requires resetting prior to use. |
|
102 //--------------------------------------------------------------------------- |
|
103 // |
|
104 void CAriAmrNbDecMmfCodec::ResetL() |
|
105 { |
|
106 PRINT_ENTRY; |
|
107 iInternalInputBufferResidueLen = 0; |
|
108 iInternalOutputBufferPos = 0; |
|
109 iInternalOutputBufferResidueLen = 0; |
|
110 PRINT_EXIT; |
|
111 } |
|
112 |
|
113 |
|
114 //--------------------------------------------------------------------------- |
|
115 // From class CMMFCodec. |
|
116 // This function is used to decode the given source and fill the destination |
|
117 // buffer with the decode data. |
|
118 // The buffers can be of any size. Since the buffers can be of any size there |
|
119 // is no guarantee that all the source buffer can be processed to fill the |
|
120 // destination buffer or that the all the source buffer may be processed |
|
121 // before the destination is full. Therefore the ProcessL needs to return a |
|
122 // TCodecProcessResult returing the number of source bytes processed and the |
|
123 // number of destination bytes processed along with a process result code |
|
124 // defined thus: |
|
125 // - EProcessComplete: the codec processed all the source data into the sink |
|
126 // buffer |
|
127 // - EProcessIncomplete: the codec filled sink buffer before all the source |
|
128 // buffer was processed |
|
129 // - EDstNotFilled: the codec processed the source buffer but the sink buffer |
|
130 // was not filled |
|
131 // - EEndOfData: the codec detected the end data - all source data in |
|
132 // processed but sink may not be full |
|
133 // - EProcessError: the codec process error condition |
|
134 // |
|
135 // The ProcessL should start processing the source buffer from the iPosition |
|
136 // data member of the source data and start filling the destination buffer |
|
137 // from its iPosition. |
|
138 //--------------------------------------------------------------------------- |
|
139 // |
|
140 TCodecProcessResult CAriAmrNbDecMmfCodec::ProcessL( const CMMFBuffer& aSrc, |
|
141 CMMFBuffer& aDst ) |
|
142 { |
|
143 PRINT_ENTRY; |
|
144 // total decoded bytes added to the dst buffer |
|
145 TInt totalDstBytesAdded = 0; |
|
146 // total src bytes added to the internal src buffer |
|
147 TInt totalSrcBytesCopied = 0; |
|
148 // temporary variable to use for copying the sorce or destination data |
|
149 TInt numberOfBytesCopied; |
|
150 // Flag for finding valid sync |
|
151 TBool syncFound = EFalse; |
|
152 |
|
153 /** |
|
154 * Process the dst buffer, update the dstBufferPos and check |
|
155 * whether dst buffer is NULL or not. |
|
156 */ |
|
157 CMMFDataBuffer* dst = static_cast<CMMFDataBuffer*>( &aDst ); |
|
158 |
|
159 const TInt dstMaxLen = dst->Data().MaxLength(); |
|
160 TUint8* dstPtr = const_cast<TUint8*>( dst->Data().Ptr() ); |
|
161 TInt dstBufferPos = dst->Position(); |
|
162 |
|
163 /** |
|
164 * Process the src buffer, update srcbuffer length, position and |
|
165 * flag for last frame. check whether src buffer is NULL or not |
|
166 * and check src buffer contains any data |
|
167 */ |
|
168 const CMMFDataBuffer* src = static_cast<const CMMFDataBuffer*>( &aSrc ); |
|
169 |
|
170 TUint8* srcPtr = const_cast <TUint8*>( src->Data().Ptr() ); |
|
171 TInt srcBufferLen = src->Data().Length(); |
|
172 TInt srcBufferPos = src->Position(); |
|
173 TBool lastFrame = src->LastBuffer(); |
|
174 |
|
175 if ( srcBufferLen == 0 && iInternalInputBufferResidueLen == 0 ) |
|
176 { |
|
177 PRINT_ERR( "source buffer length is zero" ); |
|
178 User::Leave( KErrArgument ); |
|
179 } |
|
180 |
|
181 /** |
|
182 * if any destination bytes from internal destination buffer is not |
|
183 * given to the dst buffer from the previous call, give it to the |
|
184 * dst buffer. After this block, it ensures that no bytes are remaining |
|
185 * in the internal destination buffer. |
|
186 */ |
|
187 if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
|
188 { |
|
189 numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
|
190 |
|
191 if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
|
192 { |
|
193 PRINT_EXIT; |
|
194 return Result( TCodecProcessResult::EProcessIncomplete, |
|
195 totalSrcBytesCopied, totalDstBytesAdded ); |
|
196 } |
|
197 else |
|
198 { |
|
199 if ( ( lastFrame ) && ( srcBufferLen - srcBufferPos == 0 )&& |
|
200 ( iInternalInputBufferResidueLen == 0 ) ) |
|
201 { |
|
202 iInternalOutputBufferResidueLen = 0; |
|
203 iInternalInputBufferResidueLen = 0; |
|
204 iInternalOutputBufferPos = 0; |
|
205 PRINT_EXIT; |
|
206 return Result( TCodecProcessResult::EEndOfData, |
|
207 totalSrcBytesCopied, totalDstBytesAdded ); |
|
208 } |
|
209 iInternalOutputBufferPos = 0; |
|
210 iInternalOutputBufferResidueLen = 0; |
|
211 } |
|
212 } |
|
213 |
|
214 /** |
|
215 * copy the src buffer data into the internal buffer till internal buffer |
|
216 * holds minimum bytes to process i.e KMinBytesInput. After this block, it |
|
217 * ensures that internal source buffer holds KMinBytesInput. |
|
218 * if it is a last frame, treat remaining residual buffer as internal |
|
219 * buffer. |
|
220 */ |
|
221 if ( ( KAMRNBMinOutBufLength - iInternalInputBufferResidueLen > 0 ) |
|
222 && ( srcBufferLen - srcBufferPos > 0 ) ) |
|
223 { |
|
224 numberOfBytesCopied = CopyFromSrcBuffer( src, totalSrcBytesCopied ); |
|
225 } |
|
226 |
|
227 if ( ( KAMRNBMinOutBufLength > iInternalInputBufferResidueLen ) |
|
228 && ( !lastFrame ) ) |
|
229 { |
|
230 PRINT_EXIT; |
|
231 return Result( TCodecProcessResult::EDstNotFilled, |
|
232 srcBufferLen - srcBufferPos, totalDstBytesAdded ); |
|
233 } |
|
234 |
|
235 /** |
|
236 * process the src buffer till destination buffer or source buffer |
|
237 * or both buffers are exhausted. |
|
238 */ |
|
239 do |
|
240 { |
|
241 TInt srcBufferRemainingBytes = srcBufferLen |
|
242 - srcBufferPos |
|
243 - totalSrcBytesCopied; |
|
244 TInt dstBufferRemainingBytes = dstMaxLen |
|
245 - dstBufferPos |
|
246 - totalDstBytesAdded; |
|
247 TInt internalInputBufferPos = 0; |
|
248 |
|
249 |
|
250 /** |
|
251 * initialize the variables like srcUsed and dstLen accordingly. |
|
252 * call Decode. |
|
253 */ |
|
254 |
|
255 TInt srcUsed = iInternalInputBufferResidueLen |
|
256 - internalInputBufferPos; |
|
257 TInt dstLen = KAMRNBMinOutBufLength; |
|
258 |
|
259 TInt error = |
|
260 iCodec->Decode( &iInternalInputBuffer[internalInputBufferPos], |
|
261 srcUsed, ( TInt* )iInternalOutputBuffer, dstLen ); |
|
262 |
|
263 if ( KErrNone != error ) |
|
264 { |
|
265 iInternalInputBufferResidueLen = 0; |
|
266 PRINT_ERR( "Amr Nb Decoder decodes fails" ); |
|
267 return Result( |
|
268 TCodecProcessResult::EProcessError, |
|
269 totalSrcBytesCopied, totalDstBytesAdded ); |
|
270 } |
|
271 |
|
272 /** |
|
273 * Fill Destination Buffer |
|
274 */ |
|
275 |
|
276 iInternalOutputBufferResidueLen = dstLen; |
|
277 numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
|
278 dstBufferRemainingBytes -= numberOfBytesCopied; |
|
279 |
|
280 /*** |
|
281 * Fill Sorce Buffer |
|
282 */ |
|
283 |
|
284 internalInputBufferPos += srcUsed ; |
|
285 ShiftData( internalInputBufferPos, 0 ); |
|
286 numberOfBytesCopied = CopyFromSrcBuffer( src, totalSrcBytesCopied ); |
|
287 srcBufferRemainingBytes -= numberOfBytesCopied; |
|
288 internalInputBufferPos = 0; |
|
289 |
|
290 /*** |
|
291 * check four conditions if else for src and if else for dst |
|
292 */ |
|
293 |
|
294 // src buffer has available bytes to decode |
|
295 if ( srcBufferRemainingBytes > 0 ) |
|
296 { |
|
297 if ( dstBufferRemainingBytes == 0 ) |
|
298 { |
|
299 PRINT_EXIT; |
|
300 return Result( TCodecProcessResult::EProcessIncomplete, |
|
301 totalSrcBytesCopied, totalDstBytesAdded ); |
|
302 } |
|
303 } |
|
304 |
|
305 else |
|
306 { |
|
307 // dst buffer has availabe space for decoded bytes |
|
308 if ( dstBufferRemainingBytes > 0 ) |
|
309 { |
|
310 // last frame of the input stream |
|
311 if ( lastFrame ) |
|
312 { |
|
313 if ( iInternalInputBufferResidueLen == 0 ) |
|
314 { |
|
315 PRINT_EXIT; |
|
316 return Result( TCodecProcessResult::EEndOfData, |
|
317 totalSrcBytesCopied, totalDstBytesAdded ); |
|
318 } |
|
319 } |
|
320 else |
|
321 { |
|
322 PRINT_EXIT; |
|
323 return Result( TCodecProcessResult::EDstNotFilled, |
|
324 totalSrcBytesCopied, totalDstBytesAdded ); |
|
325 } |
|
326 } |
|
327 else |
|
328 { |
|
329 /** |
|
330 *internal output buffer has decoded bytes which is not |
|
331 *given to dst buffer. |
|
332 */ |
|
333 if ( iInternalOutputBufferResidueLen |
|
334 - iInternalOutputBufferPos > 0 ) |
|
335 { |
|
336 PRINT_EXIT; |
|
337 return Result( TCodecProcessResult::EProcessIncomplete, |
|
338 totalSrcBytesCopied, totalDstBytesAdded ); |
|
339 } |
|
340 // last frame of the input stream |
|
341 else if ( lastFrame ) |
|
342 { |
|
343 // if internal buffer has available bytes to decode |
|
344 if ( iInternalInputBufferResidueLen > 0 ) |
|
345 { |
|
346 PRINT_EXIT; |
|
347 return Result( |
|
348 TCodecProcessResult::EProcessIncomplete, |
|
349 totalSrcBytesCopied, totalDstBytesAdded ); |
|
350 } |
|
351 else |
|
352 { |
|
353 iInternalInputBufferResidueLen = 0; |
|
354 PRINT_EXIT; |
|
355 return Result( TCodecProcessResult::EEndOfData, |
|
356 totalSrcBytesCopied, totalDstBytesAdded ); |
|
357 } |
|
358 } |
|
359 else |
|
360 { |
|
361 PRINT_EXIT; |
|
362 return Result( TCodecProcessResult::EProcessComplete, |
|
363 totalSrcBytesCopied, totalDstBytesAdded ); |
|
364 } |
|
365 } |
|
366 } |
|
367 }while ( 1 ); |
|
368 } |
|
369 |
|
370 //--------------------------------------------------------------------------- |
|
371 // Default constructor for performing 1st stage construction. |
|
372 // Should not contain any code that could leave. |
|
373 //--------------------------------------------------------------------------- |
|
374 // |
|
375 CAriAmrNbDecMmfCodec::CAriAmrNbDecMmfCodec(): |
|
376 iCodec( NULL ), iInternalInputBufferResidueLen( 0 ), |
|
377 iInternalOutputBufferResidueLen( 0 ), iInternalInputBuffer( NULL ), |
|
378 iInternalOutputBuffer( NULL ), iInternalOutputBufferPos( 0 ) |
|
379 { |
|
380 PRINT_ENTRY; |
|
381 PRINT_EXIT; |
|
382 } |
|
383 |
|
384 //--------------------------------------------------------------------------- |
|
385 // Destructor;Destroys the decoder instance and any internal buffers |
|
386 //--------------------------------------------------------------------------- |
|
387 // |
|
388 void CAriAmrNbDecMmfCodec::ConstructL() |
|
389 { |
|
390 PRINT_ENTRY; |
|
391 |
|
392 iCodec = CAriAmrNbDecWrapper::NewL(); |
|
393 |
|
394 if ( !iCodec ) |
|
395 { |
|
396 PRINT_ERR( "Amr Nb Decoder creation is failed" ); |
|
397 User::Leave( KErrGeneral ); |
|
398 } |
|
399 |
|
400 TInt configParam = 0; // Hardcoded to RTP |
|
401 TDecParam lParam; |
|
402 lParam.iMediatype = configParam; |
|
403 User::LeaveIfError( iCodec->Reset( lParam ) ); |
|
404 |
|
405 iInternalInputBuffer = new( ELeave ) TUint8[KAMRNBMinOutBufLength]; |
|
406 if ( !iInternalInputBuffer ) |
|
407 { |
|
408 PRINT_ERR( "internal input buffer creation is failed" ); |
|
409 User::Leave( KErrNoMemory ); |
|
410 } |
|
411 |
|
412 iInternalOutputBuffer = new( ELeave ) TUint8[KAMRNBMinOutBufLength]; |
|
413 if ( !iInternalOutputBuffer ) |
|
414 { |
|
415 PRINT_ERR( "internal output buffer creation is failed" ); |
|
416 User::Leave( KErrNoMemory ); |
|
417 } |
|
418 |
|
419 PRINT_EXIT; |
|
420 } |
|
421 |
|
422 //---------------------------------------------------------------------------- |
|
423 // Updates the result of the processing |
|
424 //---------------------------------------------------------------------------- |
|
425 // |
|
426 TCodecProcessResult CAriAmrNbDecMmfCodec::Result( |
|
427 TCodecProcessResult::TCodecProcessResultStatus aStatus, |
|
428 TInt aSrcBytesConsumed, TInt aDstBytesAdded ) |
|
429 |
|
430 { |
|
431 PRINT_ENTRY; |
|
432 TCodecProcessResult result; |
|
433 // update destination bytes |
|
434 result.iDstBytesAdded = aDstBytesAdded; |
|
435 // update source bytes |
|
436 result.iSrcBytesProcessed = aSrcBytesConsumed; |
|
437 |
|
438 // update status |
|
439 switch ( aStatus ) |
|
440 { |
|
441 case TCodecProcessResult::EProcessComplete: |
|
442 result.iStatus = TCodecProcessResult::EProcessComplete; |
|
443 break; |
|
444 case TCodecProcessResult::EProcessIncomplete: |
|
445 result.iStatus = TCodecProcessResult::EProcessIncomplete; |
|
446 break; |
|
447 case TCodecProcessResult::EEndOfData: |
|
448 result.iStatus = TCodecProcessResult::EEndOfData; |
|
449 break; |
|
450 case TCodecProcessResult::EDstNotFilled: |
|
451 result.iStatus = TCodecProcessResult::EDstNotFilled; |
|
452 break; |
|
453 case TCodecProcessResult::EProcessError: |
|
454 result.iStatus = TCodecProcessResult::EProcessError; |
|
455 break; |
|
456 default: |
|
457 result.iStatus = TCodecProcessResult::EProcessError; |
|
458 break; |
|
459 } |
|
460 PRINT_MSG( LEVEL_HIGH, ( "result.iSrcBytesProcessed = %d", |
|
461 result.iSrcBytesProcessed ) ); |
|
462 PRINT_MSG( LEVEL_HIGH, ( "result.iDstBytesAdded = %d", |
|
463 result.iDstBytesAdded ) ); |
|
464 PRINT_MSG( LEVEL_HIGH, ( "result.iStatus = %d", |
|
465 result.iStatus ) ); |
|
466 PRINT_EXIT; |
|
467 return result; |
|
468 } |
|
469 |
|
470 //---------------------------------------------------------------------------- |
|
471 // Copy the bytes to destination buffer from the internal buffer |
|
472 // first checks whether the number of bytes to be copied is lesser of the |
|
473 // destination buffer reamining bytes and internal input internal remaining |
|
474 // remaining bytes and then copies that many bytes. |
|
475 //---------------------------------------------------------------------------- |
|
476 // |
|
477 TInt CAriAmrNbDecMmfCodec::CopyToDstBuffer( CMMFDataBuffer* aDst, |
|
478 TInt &aDstBytesConsumed ) |
|
479 { |
|
480 PRINT_ENTRY; |
|
481 TInt numberOfBytesToBeCopied; |
|
482 const TInt dstMaxLen = aDst->Data().MaxLength(); |
|
483 TUint8* dstPtr = const_cast<TUint8*>(aDst->Data().Ptr() ); |
|
484 TInt dstBufferPos = aDst->Position(); |
|
485 |
|
486 // destination buffer remaining bytes |
|
487 TInt dstBufferRemainingBytes = dstMaxLen |
|
488 - dstBufferPos |
|
489 - aDstBytesConsumed; |
|
490 // internal output buffer remaining bytes |
|
491 TInt internalOutputBufferRemainingBytes = |
|
492 iInternalOutputBufferResidueLen |
|
493 - iInternalOutputBufferPos; |
|
494 |
|
495 if ( internalOutputBufferRemainingBytes > dstBufferRemainingBytes ) |
|
496 { |
|
497 numberOfBytesToBeCopied = dstBufferRemainingBytes; |
|
498 } |
|
499 else |
|
500 { |
|
501 numberOfBytesToBeCopied = internalOutputBufferRemainingBytes; |
|
502 iInternalOutputBufferResidueLen = 0; |
|
503 } |
|
504 |
|
505 // copy data to destination buffer from internal ouput buffer |
|
506 Mem::Copy( dstPtr + dstBufferPos + aDstBytesConsumed, |
|
507 iInternalOutputBuffer + iInternalOutputBufferPos, |
|
508 numberOfBytesToBeCopied ); |
|
509 |
|
510 // update internal output buffer position |
|
511 if( iInternalOutputBufferResidueLen ) |
|
512 { |
|
513 iInternalOutputBufferPos += dstBufferRemainingBytes; |
|
514 } |
|
515 else |
|
516 { |
|
517 iInternalOutputBufferPos = 0; |
|
518 } |
|
519 |
|
520 aDstBytesConsumed += numberOfBytesToBeCopied; |
|
521 aDst->Data().SetLength( dstBufferPos + aDstBytesConsumed ); |
|
522 PRINT_EXIT; |
|
523 return numberOfBytesToBeCopied; |
|
524 } |
|
525 |
|
526 //--------------------------------------------------------------------------- |
|
527 // Copy the bytes from the source buffer to the internal input buffer. |
|
528 // first it checks number of bytes to be copied is lesser of the source buffer |
|
529 // remaining bytes or internal input buffer remaining bytes and then copies |
|
530 // that many bytes. |
|
531 //--------------------------------------------------------------------------- |
|
532 // |
|
533 TInt CAriAmrNbDecMmfCodec::CopyFromSrcBuffer( const CMMFDataBuffer* aSrc, |
|
534 TInt &aSrcBytesConsumed ) |
|
535 { |
|
536 PRINT_ENTRY; |
|
537 TInt numberOfBytesToBeCopied; |
|
538 TUint8* srcPtr = const_cast <TUint8*>( aSrc->Data().Ptr() ); |
|
539 TInt srcBufferLen = aSrc->Data().Length(); |
|
540 TInt srcBufferPos = aSrc->Position(); |
|
541 |
|
542 // calculate the source buffer remaining bytes |
|
543 TInt srcBufferRemainingBytes = srcBufferLen - srcBufferPos |
|
544 - aSrcBytesConsumed; |
|
545 |
|
546 // calculate internal input buffer remaining bytes |
|
547 TInt internalInputBufferRemaingBytes = KAMRNBMinOutBufLength |
|
548 - iInternalInputBufferResidueLen; |
|
549 |
|
550 if ( internalInputBufferRemaingBytes > srcBufferRemainingBytes ) |
|
551 { |
|
552 numberOfBytesToBeCopied = srcBufferRemainingBytes; |
|
553 } |
|
554 else |
|
555 { |
|
556 numberOfBytesToBeCopied = internalInputBufferRemaingBytes; |
|
557 } |
|
558 |
|
559 // copy data from source buffer to internal input buffer |
|
560 Mem::Copy( iInternalInputBuffer + iInternalInputBufferResidueLen, |
|
561 srcPtr + srcBufferPos + aSrcBytesConsumed, |
|
562 numberOfBytesToBeCopied ); |
|
563 |
|
564 // update internal input buffer residue length |
|
565 iInternalInputBufferResidueLen += numberOfBytesToBeCopied; |
|
566 aSrcBytesConsumed += numberOfBytesToBeCopied; |
|
567 PRINT_EXIT; |
|
568 return numberOfBytesToBeCopied; |
|
569 } |
|
570 //--------------------------------------------------------------------------- |
|
571 // Moves the data of the internal input buffer to the start position |
|
572 //--------------------------------------------------------------------------- |
|
573 // |
|
574 void CAriAmrNbDecMmfCodec::ShiftData( TInt aFromPos, TInt aToPos ) |
|
575 { |
|
576 PRINT_ENTRY; |
|
577 for ( TInt i = aToPos; i < ( iInternalInputBufferResidueLen - aFromPos ); |
|
578 i++ ) |
|
579 { |
|
580 iInternalInputBuffer[i] = iInternalInputBuffer[i + aFromPos]; |
|
581 } |
|
582 iInternalInputBufferResidueLen -= aFromPos; |
|
583 PRINT_EXIT; |
|
584 } |
|
585 |
|
586 // __________________________________________________________________________ |
|
587 // ********************* ECOM Instantiation ********************* |
|
588 // __________________________________________________________________________ |
|
589 |
|
590 const TImplementationProxy ImplementationTable[] = |
|
591 { |
|
592 IMPLEMENTATION_PROXY_ENTRY( KUidAMRNBDecImplUid, |
|
593 CAriAmrNbDecMmfCodec::NewL ) |
|
594 }; |
|
595 |
|
596 EXPORT_C const TImplementationProxy* |
|
597 ImplementationGroupProxy( TInt& aTableCount ) |
|
598 { |
|
599 PRINT_ENTRY; |
|
600 aTableCount = sizeof( ImplementationTable ) / |
|
601 sizeof( TImplementationProxy ); |
|
602 PRINT_EXIT; |
|
603 return ImplementationTable; |
|
604 } |