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 |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
16 |
* (CAriAmrNbEncMmfCodec). |
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 |
|
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 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
23 |
#include "ariamrnbencwrapper.h" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
24 |
#include "ariamrnbencmmfcodec.h" |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
25 |
#include "ariamrnbencmmfcodec_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 |
//Minimum bytes that contain 160 samples that has to be encoded at a time |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
29 |
const TUint KMinBytesInput = 320; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
30 |
const TUint KMinDstLen = 32; |
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 |
// -------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
34 |
// Two-phased constructor. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
35 |
// Creates an instance of CAriAmrNbEncMmfCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
36 |
// Instance is not left on cleanup stack. |
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* CAriAmrNbEncMmfCodec::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 |
CAriAmrNbEncMmfCodec* self = new ( ELeave ) CAriAmrNbEncMmfCodec(); |
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 encoder 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 |
CAriAmrNbEncMmfCodec::~CAriAmrNbEncMmfCodec() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
55 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
56 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
57 |
if ( iInternalInputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
58 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
59 |
delete iInternalInputBuffer; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
60 |
iInternalInputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
61 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
62 |
if ( iInternalOutputBuffer ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
63 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
64 |
delete iInternalOutputBuffer; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
65 |
iInternalOutputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
66 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
67 |
if ( iCodec ) |
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 |
delete iCodec; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
70 |
iCodec = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
71 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
72 |
iConfigured = EFalse; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
73 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
74 |
} |
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 |
// 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 CAriAmrNbEncMmfCodec::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 |
if ( !iConfigured ) |
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 |
TInt encMode = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
92 |
TInt dtx = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
93 |
TInt offset = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
94 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
95 |
Mem::Copy( &encMode, aParam.Ptr() + offset, sizeof( TInt ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
96 |
offset += sizeof(TInt); |
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 |
Mem::Copy( &dtx, aParam.Ptr() + offset, sizeof( TInt ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
99 |
offset += sizeof(TInt); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
100 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
101 |
iParam.iMode = ( TInt16 )encMode; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
102 |
iParam.iDtx = ( TInt16 )dtx; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
103 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
104 |
PRINT_MSG( LEVEL_HIGH, ( "Mode: %d", iParam.iMode ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
105 |
PRINT_MSG( LEVEL_HIGH, ( "DTX: %d", iParam.iDtx ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
106 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
107 |
User::LeaveIfError( iCodec->Reset( &iParam ) ); |
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 |
iConfigured = ETrue; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
110 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
111 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
112 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
113 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
114 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
115 |
// From class CMMFCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
116 |
// 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
|
117 |
// reposition occurs. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
118 |
// 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
|
119 |
// --------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
120 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
121 |
void CAriAmrNbEncMmfCodec::ResetL() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
122 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
123 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
124 |
User::LeaveIfError( iCodec->Reset( &iParam ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
125 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
126 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
127 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
128 |
|
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 |
// From class CMMFCodec. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
131 |
// This function is used to encode the given source and fill the destination |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
132 |
// buffer with the encode data. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
133 |
// 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
|
134 |
// there is no guarantee that all the source buffer can be processed to fill |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
135 |
// the destination buffer or that the all the source buffer may be processed |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
136 |
// before the destination is full. Therefore the ProcessL needs to return a |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
137 |
// TCodecProcessResult returing the number of source bytes processed and the |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
138 |
// number of destination bytes processed along with a process result code |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
139 |
// defined thus: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
140 |
// - 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
|
141 |
// sink buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
142 |
// - 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
|
143 |
// buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
144 |
// was processed |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
145 |
// - 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
|
146 |
// buffer was not filled |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
147 |
// - EEndOfData: the codec detected the end data - all source data is |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
148 |
// processed but sink may not be full |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
149 |
// - EProcessError: the codec process error condition |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
150 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
151 |
// 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
|
152 |
// 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
|
153 |
// from its iPosition. |
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 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
156 |
TCodecProcessResult CAriAmrNbEncMmfCodec::ProcessL( const CMMFBuffer& aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
157 |
CMMFBuffer& aDst ) |
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 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
160 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
161 |
// total encoded bytes added to the dst buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
162 |
TInt totalDstBytesAdded = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
163 |
// total src bytes added to the internal src buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
164 |
TInt totalSrcBytesCopied = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
165 |
// 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
|
166 |
TInt numberOfBytesCopied = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
167 |
TInt dstBufferRemainingBytes = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
168 |
TInt srcBufferRemainingBytes = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
169 |
|
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 |
* Process the dst buffer, update the dstBufferPos and check |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
172 |
* whether dst buffer is NULL or not. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
173 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
174 |
CMMFDataBuffer* dst = static_cast<CMMFDataBuffer*>( &aDst ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
175 |
const TInt dstMaxLen = dst->Data().MaxLength(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
176 |
TUint8* dstPtr = const_cast<TUint8*>( dst->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
177 |
TInt dstBufferPos = dst->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
178 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
179 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
180 |
* Process the src buffer, update srcbuffer length, position and |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
181 |
* 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
|
182 |
* and check src buffer contains any data |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
183 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
184 |
const CMMFDataBuffer* src = static_cast<const CMMFDataBuffer*>( &aSrc ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
185 |
TUint8* srcPtr = const_cast <TUint8*>( src->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
186 |
TInt srcBufferLen = src->Data().Length(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
187 |
TInt srcBufferPos = src->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
188 |
TBool lastFrame = src->LastBuffer(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
189 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
190 |
PRINT_MSG( LEVEL_HIGH, ( "Src Buffer Pos: %d", srcBufferPos ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
191 |
PRINT_MSG( LEVEL_HIGH, ( "Dst Buffer Pos: %d", dstBufferPos ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
192 |
PRINT_MSG( LEVEL_HIGH, ( "Residue in internal output buffer: %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
193 |
iInternalOutputBufferResidueLen - iInternalOutputBufferPos ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
194 |
PRINT_MSG( LEVEL_HIGH, ( "Residue in internal input buffer: %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
195 |
iInternalInputBufferResidueLen ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
196 |
|
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 |
* 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
|
199 |
* 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
|
200 |
* 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
|
201 |
* in the internal destination buffer. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
202 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
203 |
if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
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 |
numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
206 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
207 |
if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos > 0 ) |
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 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
210 |
return Result( TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
211 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
212 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
213 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
214 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
215 |
if ( lastFrame && ( srcBufferLen - srcBufferPos == 0 ) && |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
216 |
( iInternalInputBufferResidueLen == 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
217 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
218 |
totalSrcBytesCopied = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
219 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
220 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
221 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
222 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
223 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
224 |
totalSrcBytesCopied, totalDstBytesAdded ); |
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 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
227 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
228 |
} |
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 |
* 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
|
233 |
* 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
|
234 |
* ensures that internal source buffer holds KMinBytesInput. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
235 |
* 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
|
236 |
* buffer. |
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 |
if ( ( iSrclenToProcess - iInternalInputBufferResidueLen > 0 ) && |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
239 |
( srcBufferLen - srcBufferPos > 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
240 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
241 |
numberOfBytesCopied = CopyFromSrcBuffer( src, totalSrcBytesCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
242 |
} |
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 |
if ( ( iSrclenToProcess > iInternalInputBufferResidueLen ) && |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
245 |
( !lastFrame ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
246 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
247 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
248 |
return Result( TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
249 |
srcBufferLen - srcBufferPos, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
250 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
251 |
srcBufferRemainingBytes = srcBufferLen - srcBufferPos - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
252 |
totalSrcBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
253 |
dstBufferRemainingBytes = dstMaxLen - dstBufferPos - totalDstBytesAdded; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
254 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
255 |
if ( lastFrame && ( ( iSrclenToProcess > iInternalInputBufferResidueLen ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
256 |
&& ( iSrclenToProcess > srcBufferRemainingBytes ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
257 |
&& ( iInternalOutputBufferResidueLen - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
258 |
iInternalOutputBufferPos == 0 ) ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
259 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
260 |
totalSrcBytesCopied = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
261 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
262 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
263 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
264 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
265 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
266 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
267 |
} |
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 |
if ( iInternalOutputBufferResidueLen - iInternalOutputBufferPos == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
270 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
271 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
272 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
273 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
274 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
275 |
* process the src buffer till destination buffer or source buffer or |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
276 |
* both buffers are exhausted. |
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 |
do |
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 |
srcBufferRemainingBytes = srcBufferLen - srcBufferPos - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
281 |
totalSrcBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
282 |
dstBufferRemainingBytes = dstMaxLen - dstBufferPos - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
283 |
totalDstBytesAdded; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
284 |
TInt internalInputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
285 |
|
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 |
* initialize the variables like srcUsed and dstLen accordingly. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
288 |
* call encode. |
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 |
TInt index; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
291 |
TInt srcUsed = iSrclenToProcess; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
292 |
TInt dstLen = KMinDstLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
293 |
TInt* tempIn = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
294 |
TInt len = KMinBytesInput / sizeof( TInt ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
295 |
tempIn = ( TInt* ) ( ( iInternalInputBuffer + |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
296 |
internalInputBufferPos ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
297 |
for ( index = 0; index < len; index++ ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
298 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
299 |
tempIn[index] &= 0xfff8fff8; |
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 |
TInt error = iCodec->Encode( tempIn, srcUsed, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
303 |
iInternalOutputBuffer, dstLen ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
304 |
if ( error != 0 ) |
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 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
307 |
totalSrcBytesCopied = srcBufferLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
308 |
PRINT_ERR( error ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
309 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
310 |
TCodecProcessResult::EProcessError, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
311 |
totalSrcBytesCopied, totalDstBytesAdded + dstBufferPos ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
312 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
313 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
314 |
/** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
315 |
* Fill Destination Buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
316 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
317 |
iInternalOutputBufferResidueLen = dstLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
318 |
numberOfBytesCopied = CopyToDstBuffer( dst, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
319 |
dstBufferRemainingBytes -= numberOfBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
320 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
321 |
/*** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
322 |
* Fill Source Buffer |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
323 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
324 |
internalInputBufferPos += srcUsed ; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
325 |
ShiftData( internalInputBufferPos, 0 ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
326 |
numberOfBytesCopied = CopyFromSrcBuffer( src, totalSrcBytesCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
327 |
srcBufferRemainingBytes -= numberOfBytesCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
328 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
329 |
/*** |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
330 |
* 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
|
331 |
*/ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
332 |
// src has available bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
333 |
if ( srcBufferRemainingBytes > 0 || iInternalInputBufferResidueLen >= |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
334 |
iSrclenToProcess ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
335 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
336 |
if( dstBufferRemainingBytes == 0 ) |
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 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
339 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
340 |
TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
341 |
totalSrcBytesCopied, totalDstBytesAdded ); |
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 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
344 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
345 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
346 |
// dst buffer has availabe space for encoded bytes |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
347 |
if ( dstBufferRemainingBytes > 0 ) |
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 |
if ( lastFrame ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
350 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
351 |
if ( iInternalInputBufferResidueLen == 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
352 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
353 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
354 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
355 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
356 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
357 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
358 |
totalSrcBytesCopied, totalDstBytesAdded ); |
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 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
361 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
362 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
363 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
364 |
return Result( TCodecProcessResult::EDstNotFilled, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
365 |
totalSrcBytesCopied, totalDstBytesAdded ); |
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 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
369 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
370 |
if ( iInternalOutputBufferResidueLen - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
371 |
iInternalOutputBufferPos > 0 ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
372 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
373 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
374 |
return Result( TCodecProcessResult::EProcessIncomplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
375 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
376 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
377 |
else |
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 |
if ( lastFrame && |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
380 |
( iInternalInputBufferResidueLen == 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 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
383 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
384 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
385 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
386 |
return Result( TCodecProcessResult::EEndOfData, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
387 |
totalSrcBytesCopied, totalDstBytesAdded ); |
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 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
390 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
391 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
392 |
return Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
393 |
TCodecProcessResult::EProcessComplete, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
394 |
totalSrcBytesCopied, totalDstBytesAdded ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
395 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
396 |
} |
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 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
399 |
}while ( 1 ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
400 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
401 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
402 |
|
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 |
// Default constructor for performing 1st stage construction. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
405 |
// Should not contain any code that could leave. |
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 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
408 |
CAriAmrNbEncMmfCodec::CAriAmrNbEncMmfCodec() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
409 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
410 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
411 |
iCodec = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
412 |
iConfigured = EFalse; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
413 |
iSrclenToProcess = KMinBytesInput; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
414 |
iInternalInputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
415 |
iInternalOutputBufferResidueLen = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
416 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
417 |
iInternalInputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
418 |
iInternalOutputBuffer = NULL; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
419 |
//default Parameters |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
420 |
iParam.iMode = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
421 |
iParam.iDtx = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
422 |
iParam.iFileFormat = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
423 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
424 |
} |
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 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
427 |
// -------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
428 |
// Second phase of the two-phased constructor. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
429 |
// Creates an instance of encoder |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
430 |
// -------------------------------------------------------------------------- |
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 |
void CAriAmrNbEncMmfCodec::ConstructL() |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
433 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
434 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
435 |
iCodec = CAriAmrNbEncWrapper::NewL(); |
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 |
iInternalInputBuffer = ( TUint8* ) User::AllocZL( KMinBytesInput ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
438 |
iInternalOutputBuffer = ( TUint8* ) User::AllocZL( KMinDstLen ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
439 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
440 |
PRINT_MSG( LEVEL_HIGH, ( "Default mode: %d", iParam.iMode ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
441 |
PRINT_MSG( LEVEL_HIGH, ( "Default DTX: %d", iParam.iDtx ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
442 |
//Reset encoder with default parameters |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
443 |
User::LeaveIfError( iCodec->Reset( &iParam ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
444 |
PRINT_EXIT; |
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 |
|
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 |
// Updates the result of the processing |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
449 |
//---------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
450 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
451 |
TCodecProcessResult CAriAmrNbEncMmfCodec::Result( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
452 |
TCodecProcessResult::TCodecProcessResultStatus aStatus, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
453 |
TInt aSrcBytesConsumed, TInt aDstBytesAdded ) |
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 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
456 |
TCodecProcessResult result; |
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 |
result.iDstBytesAdded = aDstBytesAdded; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
459 |
result.iSrcBytesProcessed = aSrcBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
460 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
461 |
switch ( aStatus ) |
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 |
case TCodecProcessResult::EProcessComplete: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
464 |
result.iStatus = TCodecProcessResult::EProcessComplete; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
465 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
466 |
case TCodecProcessResult::EProcessIncomplete: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
467 |
result.iStatus = TCodecProcessResult::EProcessIncomplete; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
468 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
469 |
case TCodecProcessResult::EEndOfData: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
470 |
result.iStatus = TCodecProcessResult::EEndOfData; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
471 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
472 |
case TCodecProcessResult::EDstNotFilled: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
473 |
result.iStatus = TCodecProcessResult::EDstNotFilled; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
474 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
475 |
case TCodecProcessResult::EProcessError: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
476 |
result.iStatus = TCodecProcessResult::EProcessError; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
477 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
478 |
default: |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
479 |
result.iStatus = TCodecProcessResult::EProcessError; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
480 |
break; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
481 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
482 |
PRINT_MSG( LEVEL_HIGH, ( "result.iSrcBytesProcessed = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
483 |
result.iSrcBytesProcessed ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
484 |
PRINT_MSG( LEVEL_HIGH, ( "result.iDstBytesAdded = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
485 |
result.iDstBytesAdded ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
486 |
PRINT_MSG( LEVEL_HIGH, ( "result.iStatus = %d", |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
487 |
result.iStatus ) ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
488 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
489 |
return result; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
490 |
} |
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 |
// 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
|
494 |
// 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
|
495 |
// destination buffer reamining bytes and internal input internal remaining |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
496 |
// remaining bytes and then copies that many bytes. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
497 |
//---------------------------------------------------------------------------- |
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 |
TInt CAriAmrNbEncMmfCodec::CopyToDstBuffer( CMMFDataBuffer* aDst, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
500 |
TInt &aDstBytesConsumed ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
501 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
502 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
503 |
TInt numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
504 |
const TInt dstMaxLen = aDst->Data().MaxLength(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
505 |
TUint8* dstPtr = const_cast<TUint8*>( aDst->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
506 |
TInt dstBufferPos = aDst->Position(); |
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 |
TInt dstBufferRemainingBytes = dstMaxLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
509 |
- dstBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
510 |
- aDstBytesConsumed; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
511 |
TInt internalOutputBufferRemainingBytes = |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
512 |
iInternalOutputBufferResidueLen |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
513 |
- iInternalOutputBufferPos; |
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 |
if ( internalOutputBufferRemainingBytes > dstBufferRemainingBytes ) |
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 |
numberOfBytesToBeCopied = dstBufferRemainingBytes; |
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 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
520 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
521 |
numberOfBytesToBeCopied = internalOutputBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
522 |
iInternalOutputBufferResidueLen = 0; |
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 |
Mem::Copy( dstPtr + dstBufferPos + aDstBytesConsumed, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
526 |
iInternalOutputBuffer + iInternalOutputBufferPos, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
527 |
numberOfBytesToBeCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
528 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
529 |
if( iInternalOutputBufferResidueLen ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
530 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
531 |
iInternalOutputBufferPos += dstBufferRemainingBytes; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
532 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
533 |
else |
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 |
iInternalOutputBufferPos = 0; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
536 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
537 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
538 |
aDstBytesConsumed += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
539 |
aDst->Data().SetLength( dstBufferPos + aDstBytesConsumed ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
540 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
541 |
return numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
542 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
543 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
544 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
545 |
// 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
|
546 |
// 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
|
547 |
// 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
|
548 |
// that many bytes. |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
549 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
550 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
551 |
TInt CAriAmrNbEncMmfCodec::CopyFromSrcBuffer(const CMMFDataBuffer* aSrc, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
552 |
TInt &aSrcBytesConsumed ) |
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_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
555 |
TInt numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
556 |
TUint8* srcPtr = const_cast <TUint8*>( aSrc->Data().Ptr() ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
557 |
TInt srcBufferLen = aSrc->Data().Length(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
558 |
TInt srcBufferPos = aSrc->Position(); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
559 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
560 |
TInt srcBufferRemainingBytes = srcBufferLen - srcBufferPos |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
561 |
- aSrcBytesConsumed; |
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 |
TInt internalInputBufferRemaingBytes = KMinBytesInput |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
564 |
- iInternalInputBufferResidueLen; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
565 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
566 |
if ( internalInputBufferRemaingBytes > srcBufferRemainingBytes ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
567 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
568 |
numberOfBytesToBeCopied = srcBufferRemainingBytes; |
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 |
else |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
571 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
572 |
numberOfBytesToBeCopied = internalInputBufferRemaingBytes; |
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 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
575 |
Mem::Copy( iInternalInputBuffer + iInternalInputBufferResidueLen, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
576 |
srcPtr + srcBufferPos + aSrcBytesConsumed, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
577 |
numberOfBytesToBeCopied ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
578 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
579 |
iInternalInputBufferResidueLen += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
580 |
aSrcBytesConsumed += numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
581 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
582 |
return numberOfBytesToBeCopied; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
583 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
584 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
585 |
//--------------------------------------------------------------------------- |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
586 |
// 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
|
587 |
//--------------------------------------------------------------------------- |
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 |
void CAriAmrNbEncMmfCodec::ShiftData( TInt aFromPos, TInt aToPos ) |
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 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
592 |
for ( TInt i = aFromPos; i < ( iInternalInputBufferResidueLen - |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
593 |
aFromPos ); i++ ) |
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 |
iInternalInputBuffer[i] = |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
596 |
iInternalInputBuffer[i + aFromPos]; |
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 |
iInternalInputBufferResidueLen -= aFromPos; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
599 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
600 |
} |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
601 |
|
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
602 |
|
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 |
// Exported proxy for instantiation method resolution |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
605 |
// Define the interface UIDs |
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 |
// |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
608 |
const TImplementationProxy ImplementationTable[] = |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
609 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
610 |
IMPLEMENTATION_PROXY_ENTRY( KUidAmrNbEncMmfImplUid, |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
611 |
CAriAmrNbEncMmfCodec::NewL ) |
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 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
615 |
TInt& aTableCount ) |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
616 |
{ |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
617 |
PRINT_ENTRY; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
618 |
aTableCount = sizeof( ImplementationTable ) / |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
619 |
sizeof( TImplementationProxy ); |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
620 |
PRINT_EXIT; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
621 |
return ImplementationTable; |
bb31fbe78861
Initial commit of Aricent codec contribution.
Pat Downey <patd@symbian.org>
parents:
diff
changeset
|
622 |
} |