author | Pat Downey <patd@symbian.org> |
Fri, 23 Jul 2010 16:58:44 +0100 | |
changeset 0 | bb31fbe78861 |
permissions | -rw-r--r-- |
0
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
1 |
/* |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Aricent and/or its subsidiary(-ies). |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
8 |
* |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
10 |
* Aricent - initial contribution. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
11 |
* |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
12 |
* Contributors: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
13 |
* |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
14 |
* Description: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
15 |
* Implementation of member functions of Plugin class (CAriMp3DecMmfCodec). |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
16 |
* |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
17 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
18 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
19 |
// System includes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
20 |
#include <ecom.h> |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
21 |
#include <ImplementationProxy.h> |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
22 |
// User includes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
23 |
#include "arimp3decwrapper.h" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
24 |
#include "arimp3decmmfcodec.h" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
25 |
#include "arimp3decmmfcodec_uid.hrh" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
26 |
#include "ariprint.h" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
27 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
28 |
//Maximum size of a single input frame in an Mp3 stream |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
29 |
const TInt KMinBytesInput = 1440; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
30 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
31 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
32 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
33 |
// Two-phased constructor. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
34 |
// Creates an instance of CAriMp3DecMmfCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
35 |
// Instance is not left on cleanup stack. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
36 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
37 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
38 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
39 |
CMMFCodec* CAriMp3DecMmfCodec::NewL() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
40 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
41 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
42 |
CAriMp3DecMmfCodec* self = new ( ELeave ) CAriMp3DecMmfCodec(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
43 |
CleanupStack::PushL( self ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
44 |
self->ConstructL(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
45 |
CleanupStack::Pop( self ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
46 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
47 |
return ( CMMFCodec* )self; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
48 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
49 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
50 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
51 |
// Destructor;Destroys the decoder instance and any internal buffers |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
52 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
53 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
54 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
55 |
CAriMp3DecMmfCodec::~CAriMp3DecMmfCodec() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
56 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
57 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
58 |
if ( iInternalInputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
59 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
60 |
delete iInternalInputBuffer; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
61 |
iInternalInputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
62 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
63 |
if ( iInternalOutputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
64 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
65 |
delete iInternalOutputBuffer; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
66 |
iInternalOutputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
67 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
68 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
69 |
if ( iCodec ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
70 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
71 |
delete iCodec; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
72 |
iCodec = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
73 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
74 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
75 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
76 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
77 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
78 |
// From class CMMFCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
79 |
// The function Sets codec configuration. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
80 |
// The value used for aConfigType must be KUidMmfCodecAudioSettings |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
81 |
// (defined in include\mmf\plugins\mmfCodecImplementationUIDs.hrh) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
82 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
83 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
84 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
85 |
void CAriMp3DecMmfCodec::ConfigureL( TUid /*aConfigType*/, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
86 |
const TDesC8& /*aParam*/ ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
87 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
88 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
89 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
90 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
91 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
92 |
// -------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
93 |
// From class CMMFCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
94 |
// This function is used to flush out status information when a |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
95 |
// reposition occurs. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
96 |
// This is used if the codec requires resetting prior to use. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
97 |
// -------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
98 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
99 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
100 |
void CAriMp3DecMmfCodec::ResetL() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
101 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
102 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
103 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
104 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
105 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
106 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
107 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
108 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
109 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
110 |
// From class CMMFCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
111 |
// This function is used to decode the given source and fill the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
112 |
// destination buffer with the decode data. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
113 |
// The buffers can be of any size. Since the buffers can be of any size |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
114 |
// there is no guarantee that all the source buffer can be processed to |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
115 |
// fill the destination buffer or that the all the source buffer may be |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
116 |
// processed before the destination is full. Therefore the ProcessL needs |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
117 |
// to return a TCodecProcessResult returing the number of source bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
118 |
// processed and the number of destination bytes processed along with a |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
119 |
// process result code defined thus: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
120 |
// - EProcessComplete: the codec processed all the source data into the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
121 |
// sink buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
122 |
// - EProcessIncomplete: the codec filled sink buffer before all the source |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
123 |
// buffer was processed |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
124 |
// - EDstNotFilled: the codec processed the source buffer but the sink |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
125 |
// buffer was not filled |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
126 |
// - EEndOfData: the codec detected the end data - all source data in |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
127 |
// processed but sink may not be full |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
128 |
// - EProcessError: the codec process error condition |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
129 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
130 |
// The ProcessL should start processing the source buffer from the iPosition |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
131 |
// data member of the source data and start filling the destination buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
132 |
// from its iPosition. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
133 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
134 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
135 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
136 |
TCodecProcessResult CAriMp3DecMmfCodec::ProcessL( const CMMFBuffer& aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
137 |
CMMFBuffer& aDst ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
138 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
139 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
140 |
// total decoded bytes added to the dst buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
141 |
TInt totalDstBytesAdded = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
142 |
// total src bytes added to the internal src buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
143 |
TInt totalSrcBytesCopied = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
144 |
// temporary variable to use for copying the sorce or destination data |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
145 |
TInt numberOfBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
146 |
// Flag for finding valid sync |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
147 |
TBool syncFound = EFalse; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
148 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
149 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
150 |
* Process the dst buffer, update the dstBufferPos and check |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
151 |
* whether dst buffer is NULL or not. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
152 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
153 |
CMMFDataBuffer* dst = static_cast<CMMFDataBuffer*>( &aDst ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
154 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
155 |
const TInt dstMaxLen = dst->Data().MaxLength(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
156 |
TUint8* dstPtr = const_cast<TUint8*>( dst->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
157 |
TInt dstBufferPos = dst->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
158 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
159 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
160 |
* Process the src buffer, update srcbuffer length, position and |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
161 |
* flag for last frame. check whether src buffer is NULL or not |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
162 |
* and check src buffer contains any data |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
163 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
164 |
const CMMFDataBuffer* src = static_cast<const CMMFDataBuffer*>( &aSrc ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
165 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
166 |
TUint8* srcPtr = const_cast <TUint8*>( src->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
167 |
TInt srcBufferLen = src->Data().Length(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
168 |
TInt srcBufferPos = src->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
169 |
TBool lastFrame = src->LastBuffer(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
170 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
171 |
if ( srcBufferLen == 0 && iInternalInputBufferResidueLen == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
172 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
173 |
PRINT_ERR( "source buffer length is zero" ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
174 |
User::Leave( KErrArgument ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
175 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
176 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
177 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
178 |
* if any destination bytes from internal destination buffer is not |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
179 |
* given to the dst buffer from the previous call, give it to the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
180 |
* dst buffer. After this block, it ensures that no bytes are remaining |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
181 |
* in the internal destination buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
182 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
183 |
if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
184 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
185 |
numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
186 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
187 |
if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
188 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
189 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
190 |
return Result( TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
191 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
192 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
193 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
194 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
195 |
if ( ( lastFrame ) && ( srcBufferLen - srcBufferPos == 0 )&& |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
196 |
( iInternalInputBufferResidueLen == 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
197 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
198 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
199 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
200 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
201 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
202 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
203 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
204 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
205 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
206 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
207 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
208 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
209 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
210 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
211 |
* copy the src buffer data into the internal buffer till internal buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
212 |
* holds minimum bytes to process i.e KMinBytesInput. After this block, it |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
213 |
* ensures that internal source buffer holds KMinBytesInput. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
214 |
* if it is a last frame, treat remaining residual buffer as internal |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
215 |
* buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
216 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
217 |
if ( ( KMinBytesInput - iInternalInputBufferResidueLen > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
218 |
&& ( srcBufferLen - srcBufferPos > 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
219 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
220 |
numberOfBytesCopied = CopyFromSrcBuffer( src, totalSrcBytesCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
221 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
222 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
223 |
if ( ( KMinBytesInput > iInternalInputBufferResidueLen ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
224 |
&& ( !lastFrame ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
225 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
226 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
227 |
return Result( TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
228 |
srcBufferLen - srcBufferPos, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
229 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
230 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
231 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
232 |
* process the src buffer till destination buffer or source buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
233 |
* or both buffers are exhausted. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
234 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
235 |
do |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
236 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
237 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
238 |
* call seeksync to find the valid fram start offset i.e syncpos. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
239 |
* update internal buffer position to that offset position if it is |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
240 |
* success.if it is failed then there is no valid frame start in |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
241 |
* the available buffer. Go for new src buffer. all bytes present |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
242 |
* in the internal buffer are discarded. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
243 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
244 |
TInt syncpos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
245 |
TInt srcBufferRemainingBytes = srcBufferLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
246 |
- srcBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
247 |
- totalSrcBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
248 |
TInt dstBufferRemainingBytes = dstMaxLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
249 |
- dstBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
250 |
- totalDstBytesAdded; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
251 |
TInt internalInputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
252 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
253 |
if ( KErrNone != iCodec->SeekSync( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
254 |
&iInternalInputBuffer[internalInputBufferPos], |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
255 |
( iInternalInputBufferResidueLen - internalInputBufferPos ), |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
256 |
syncpos ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
257 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
258 |
TCodecProcessResult result = GetNewData( src, totalSrcBytesCopied, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
259 |
totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
260 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
261 |
if ( result.iStatus == TCodecProcessResult::EDstNotFilled || |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
262 |
result.iStatus == TCodecProcessResult::EEndOfData ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
263 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
264 |
return result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
265 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
266 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
267 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
268 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
269 |
syncFound = ETrue; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
270 |
internalInputBufferPos += syncpos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
271 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
272 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
273 |
* call GetFrameInfo to find whether valid frame is present in the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
274 |
* availabel buffer.if it is success and framelength is 0 then |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
275 |
* there is no valid frame is present, discard the present buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
276 |
* till sync position and add new buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
277 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
278 |
if ( syncFound ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
279 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
280 |
TInt frameLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
281 |
TMp3FrameInfo frameInfo; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
282 |
if ( KErrNone != iCodec->GetFrameInfo( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
283 |
&iInternalInputBuffer[internalInputBufferPos], |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
284 |
( iInternalInputBufferResidueLen - internalInputBufferPos ), |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
285 |
frameLen, frameInfo ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
286 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
287 |
PRINT_ERR( "Decoder Getframeinfo failed" ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
288 |
User::Leave( KErrGeneral ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
289 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
290 |
if ( frameLen == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
291 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
292 |
TCodecProcessResult result = GetNewData( src, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
293 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
294 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
295 |
if ( result.iStatus == TCodecProcessResult::EDstNotFilled || |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
296 |
result.iStatus == TCodecProcessResult::EEndOfData ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
297 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
298 |
return result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
299 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
300 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
301 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
302 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
303 |
* if the buffer has less than framelen then fill the internal |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
304 |
* sorce buffer with KMinBytesInput bytes. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
305 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
306 |
if ( frameLen > ( iInternalInputBufferResidueLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
307 |
- internalInputBufferPos ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
308 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
309 |
if( lastFrame ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
310 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
311 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
312 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
313 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
314 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
315 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
316 |
TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
317 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
318 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
319 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
320 |
ShiftData( internalInputBufferPos, 0 ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
321 |
numberOfBytesCopied = CopyFromSrcBuffer( src, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
322 |
totalSrcBytesCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
323 |
internalInputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
324 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
325 |
if ( iInternalInputBufferResidueLen < KMinBytesInput ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
326 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
327 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
328 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
329 |
TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
330 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
331 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
332 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
333 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
334 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
335 |
* initialize the variables like srcUsed and dstLen accordingly. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
336 |
* call Decode. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
337 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
338 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
339 |
TInt srcUsed = iInternalInputBufferResidueLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
340 |
- internalInputBufferPos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
341 |
TInt dstLen = iOutFrameSize; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
342 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
343 |
TInt error = iCodec->Decode( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
344 |
&iInternalInputBuffer[internalInputBufferPos], |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
345 |
srcUsed, iInternalOutputBuffer, dstLen ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
346 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
347 |
if ( KErrNone != error ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
348 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
349 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
350 |
PRINT_ERR( error ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
351 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
352 |
TCodecProcessResult::EProcessError, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
353 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
354 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
355 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
356 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
357 |
* Fill Destination Buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
358 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
359 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
360 |
iInternalOutputBufferResidueLen = dstLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
361 |
numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
362 |
dstBufferRemainingBytes -= numberOfBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
363 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
364 |
/*** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
365 |
* Fill Sorce Buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
366 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
367 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
368 |
internalInputBufferPos += srcUsed ; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
369 |
ShiftData( internalInputBufferPos, 0 ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
370 |
numberOfBytesCopied = CopyFromSrcBuffer( src, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
371 |
totalSrcBytesCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
372 |
srcBufferRemainingBytes -= numberOfBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
373 |
internalInputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
374 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
375 |
/*** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
376 |
* check four conditions if else for src and if else for dst |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
377 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
378 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
379 |
// src buffer has available bytes to decode |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
380 |
if ( srcBufferRemainingBytes > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
381 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
382 |
if ( dstBufferRemainingBytes == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
383 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
384 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
385 |
return Result( TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
386 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
387 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
388 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
389 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
390 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
391 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
392 |
// dst buffer has availabe space for decoded bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
393 |
if ( dstBufferRemainingBytes > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
394 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
395 |
// last frame of the input stream |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
396 |
if ( lastFrame ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
397 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
398 |
if ( iInternalInputBufferResidueLen == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
399 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
400 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
401 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
402 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
403 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
404 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
405 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
406 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
407 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
408 |
return Result( TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
409 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
410 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
411 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
412 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
413 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
414 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
415 |
*internal output buffer has decoded bytes which is not |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
416 |
*given to dst buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
417 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
418 |
if ( iInternalOutputBufferResidueLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
419 |
- iInternalOutputBufferPos > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
420 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
421 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
422 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
423 |
TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
424 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
425 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
426 |
// last frame of the input stream |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
427 |
else if ( lastFrame ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
428 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
429 |
// if internal buffer has available bytes to decode |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
430 |
if ( iInternalInputBufferResidueLen > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
431 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
432 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
433 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
434 |
TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
435 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
436 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
437 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
438 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
439 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
440 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
441 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
442 |
TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
443 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
444 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
445 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
446 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
447 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
448 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
449 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
450 |
TCodecProcessResult::EProcessComplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
451 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
452 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
453 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
454 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
455 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
456 |
}while ( 1 ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
457 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
458 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
459 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
460 |
// Default constructor for performing 1st stage construction. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
461 |
// Should not contain any code that could leave. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
462 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
463 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
464 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
465 |
CAriMp3DecMmfCodec::CAriMp3DecMmfCodec(): |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
466 |
iCodec( NULL ), iInternalInputBufferResidueLen( 0 ), |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
467 |
iInternalOutputBufferResidueLen( 0 ), iOutFrameSize( 0 ), |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
468 |
iInternalInputBuffer( NULL ), iInternalOutputBuffer( NULL ), |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
469 |
iInternalOutputBufferPos( 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
470 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
471 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
472 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
473 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
474 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
475 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
476 |
// Second phase of the two-phased constructor. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
477 |
// Creates an instance of decoder |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
478 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
479 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
480 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
481 |
void CAriMp3DecMmfCodec::ConstructL() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
482 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
483 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
484 |
TMp3FrameInfo frameInfo; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
485 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
486 |
TRAPD( creatErr,iCodec = CAriMp3DecWrapper::NewL() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
487 |
if( KErrNone != creatErr ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
488 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
489 |
PRINT_ERR( creatErr ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
490 |
User::Leave( creatErr ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
491 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
492 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
493 |
User::LeaveIfError( iCodec->Reset() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
494 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
495 |
TInt frameLength; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
496 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
497 |
User::LeaveIfError( iCodec->GetMaxFrameInfo( frameLength, frameInfo ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
498 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
499 |
iOutFrameSize = frameInfo.iBufferSize; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
500 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
501 |
iInternalInputBuffer = new( ELeave ) TUint8[KMinBytesInput]; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
502 |
if ( !iInternalInputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
503 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
504 |
PRINT_ERR( "iInternalInputBuffer is not created" ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
505 |
User::Leave( KErrNoMemory ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
506 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
507 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
508 |
iInternalOutputBuffer = new( ELeave ) TUint8[iOutFrameSize]; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
509 |
if ( !iInternalOutputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
510 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
511 |
PRINT_ERR( "iInternalOutputBuffer is not created" ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
512 |
User::Leave( KErrNoMemory ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
513 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
514 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
515 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
516 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
517 |
// Updates the result of the processing |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
518 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
519 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
520 |
TCodecProcessResult CAriMp3DecMmfCodec::Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
521 |
TCodecProcessResult::TCodecProcessResultStatus aStatus, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
522 |
TInt aSrcBytesConsumed, TInt aDstBytesAdded ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
523 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
524 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
525 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
526 |
TCodecProcessResult result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
527 |
// update destination bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
528 |
result.iDstBytesAdded = aDstBytesAdded; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
529 |
// update source bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
530 |
result.iSrcBytesProcessed = aSrcBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
531 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
532 |
// update status |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
533 |
switch ( aStatus ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
534 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
535 |
case TCodecProcessResult::EProcessComplete: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
536 |
result.iStatus = TCodecProcessResult::EProcessComplete; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
537 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
538 |
case TCodecProcessResult::EProcessIncomplete: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
539 |
result.iStatus = TCodecProcessResult::EProcessIncomplete; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
540 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
541 |
case TCodecProcessResult::EEndOfData: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
542 |
result.iStatus = TCodecProcessResult::EEndOfData; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
543 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
544 |
case TCodecProcessResult::EDstNotFilled: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
545 |
result.iStatus = TCodecProcessResult::EDstNotFilled; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
546 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
547 |
case TCodecProcessResult::EProcessError: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
548 |
result.iStatus = TCodecProcessResult::EProcessError; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
549 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
550 |
default: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
551 |
result.iStatus = TCodecProcessResult::EProcessError; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
552 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
553 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
554 |
PRINT_MSG( LEVEL_HIGH, ( "result.iSrcBytesProcessed = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
555 |
result.iSrcBytesProcessed ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
556 |
PRINT_MSG( LEVEL_HIGH, ( "result.iDstBytesAdded = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
557 |
result.iDstBytesAdded ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
558 |
PRINT_MSG( LEVEL_HIGH, ( "result.iStatus = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
559 |
result.iStatus ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
560 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
561 |
return result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
562 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
563 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
564 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
565 |
// Copy the bytes to destination buffer from the internal buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
566 |
// first checks whether the number of bytes to be copied is lesser of the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
567 |
// destination buffer reamining bytes and internal input internal remaining |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
568 |
// remaining bytes and then copies that many bytes. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
569 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
570 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
571 |
TInt CAriMp3DecMmfCodec::CopyToDstBuffer( CMMFDataBuffer* aDst, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
572 |
TInt &aDstBytesConsumed ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
573 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
574 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
575 |
TInt numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
576 |
const TInt dstMaxLen = aDst->Data().MaxLength(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
577 |
TUint8* dstPtr = const_cast<TUint8*>( aDst->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
578 |
TInt dstBufferPos = aDst->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
579 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
580 |
// destination buffer remaining bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
581 |
TInt dstBufferRemainingBytes = dstMaxLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
582 |
- dstBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
583 |
- aDstBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
584 |
// internal output buffer remaining bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
585 |
TInt internalOutputBufferRemainingBytes = |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
586 |
iInternalOutputBufferResidueLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
587 |
- iInternalOutputBufferPos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
588 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
589 |
if ( internalOutputBufferRemainingBytes > dstBufferRemainingBytes ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
590 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
591 |
numberOfBytesToBeCopied = dstBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
592 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
593 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
594 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
595 |
numberOfBytesToBeCopied = internalOutputBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
596 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
597 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
598 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
599 |
// copy data to destination buffer from internal ouput buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
600 |
Mem::Copy( dstPtr + dstBufferPos + aDstBytesConsumed, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
601 |
iInternalOutputBuffer + iInternalOutputBufferPos, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
602 |
numberOfBytesToBeCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
603 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
604 |
// update internal output buffer position |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
605 |
if( iInternalOutputBufferResidueLen ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
606 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
607 |
iInternalOutputBufferPos += dstBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
608 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
609 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
610 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
611 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
612 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
613 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
614 |
aDstBytesConsumed += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
615 |
aDst->Data().SetLength( dstBufferPos + aDstBytesConsumed ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
616 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
617 |
return numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
618 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
619 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
620 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
621 |
// Copy the bytes from the source buffer to the internal input buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
622 |
// first it checks number of bytes to be copied is lesser of the source buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
623 |
// remaining bytes or internal input buffer remaining bytes and then copies |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
624 |
// that many bytes. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
625 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
626 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
627 |
TInt CAriMp3DecMmfCodec::CopyFromSrcBuffer( const CMMFDataBuffer* aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
628 |
TInt &aSrcBytesConsumed ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
629 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
630 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
631 |
TInt numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
632 |
TUint8* srcPtr = const_cast <TUint8*>( aSrc->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
633 |
TInt srcBufferLen = aSrc->Data().Length(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
634 |
TInt srcBufferPos = aSrc->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
635 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
636 |
// calculate the source buffer remaining bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
637 |
TInt srcBufferRemainingBytes = srcBufferLen - srcBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
638 |
- aSrcBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
639 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
640 |
// calculate internal input buffer remaining bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
641 |
TInt internalInputBufferRemaingBytes = KMinBytesInput |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
642 |
- iInternalInputBufferResidueLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
643 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
644 |
if ( internalInputBufferRemaingBytes > srcBufferRemainingBytes ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
645 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
646 |
numberOfBytesToBeCopied = srcBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
647 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
648 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
649 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
650 |
numberOfBytesToBeCopied = internalInputBufferRemaingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
651 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
652 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
653 |
// copy data from source buffer to internal input buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
654 |
Mem::Copy( iInternalInputBuffer + iInternalInputBufferResidueLen, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
655 |
srcPtr + srcBufferPos + aSrcBytesConsumed, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
656 |
numberOfBytesToBeCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
657 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
658 |
// update internal input buffer residue length |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
659 |
iInternalInputBufferResidueLen += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
660 |
aSrcBytesConsumed += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
661 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
662 |
return numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
663 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
664 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
665 |
// Moves the data of the internal input buffer to the start position |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
666 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
667 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
668 |
void CAriMp3DecMmfCodec::ShiftData( TInt aFromPos, TInt aToPos ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
669 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
670 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
671 |
for ( TInt i = aToPos; i < ( iInternalInputBufferResidueLen - aFromPos ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
672 |
i++ ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
673 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
674 |
iInternalInputBuffer[i] = iInternalInputBuffer[i + aFromPos]; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
675 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
676 |
iInternalInputBufferResidueLen -= aFromPos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
677 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
678 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
679 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
680 |
// Gets the new data from the source buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
681 |
// checks whether it is last buffer from the source buffer and copies the data |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
682 |
// and then checks if source buffer remianing bytes are not and returns the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
683 |
// result of the processing. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
684 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
685 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
686 |
TCodecProcessResult CAriMp3DecMmfCodec::GetNewData( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
687 |
const CMMFDataBuffer* aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
688 |
TInt &aSrcBytesConsumed, TInt &aDstBytesConsumed ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
689 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
690 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
691 |
TUint8* srcPtr = const_cast <TUint8*>( aSrc->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
692 |
TInt srcBufferLen = aSrc->Data().Length(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
693 |
TInt srcBufferPos = aSrc->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
694 |
TBool lastFrame = aSrc->LastBuffer(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
695 |
// calculate source buffer remaining bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
696 |
TInt srcBufferRemainingBytes = srcBufferLen - srcBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
697 |
- aSrcBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
698 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
699 |
TCodecProcessResult result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
700 |
result.iStatus = TCodecProcessResult::EProcessError; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
701 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
702 |
// if it is last frame return end of data |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
703 |
if ( ( lastFrame ) && ( srcBufferRemainingBytes == 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
704 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
705 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
706 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
707 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
708 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
709 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
710 |
aSrcBytesConsumed, aDstBytesConsumed ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
711 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
712 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
713 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
714 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
715 |
TInt numberOfBytesToBeCopied = CopyFromSrcBuffer( aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
716 |
aSrcBytesConsumed ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
717 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
718 |
if ( iInternalInputBufferResidueLen < KMinBytesInput ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
719 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
720 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
721 |
return Result( TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
722 |
aSrcBytesConsumed, aDstBytesConsumed ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
723 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
724 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
725 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
726 |
return result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
727 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
728 |
/* __________________________________________________________________________ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
729 |
* Exported proxy for instantiation method resolution |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
730 |
* Define the interface UIDs |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
731 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
732 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
733 |
const TImplementationProxy ImplementationTable[] = |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
734 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
735 |
IMPLEMENTATION_PROXY_ENTRY( KUidMp3DecCodecImplUid, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
736 |
CAriMp3DecMmfCodec::NewL ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
737 |
}; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
738 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
739 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
740 |
TInt& aTableCount ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
741 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
742 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
743 |
aTableCount = sizeof( ImplementationTable ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
744 |
/ sizeof( TImplementationProxy ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
745 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
746 |
return ImplementationTable; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
747 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
748 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
749 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
750 |
// End of File |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
751 |
//--------------------------------------------------------------------------- |