1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
18 //////////////////////////////////////////////////////////////////////////////////
20 // File: pvgsmamrdecoderinterface.h //
22 //////////////////////////////////////////////////////////////////////////////////
24 #ifndef _PVGSMAMR_DECODER_INTERFACE_H
25 #define _PVGSMAMR_DECODER_INTERFACE_H
27 #include "oscl_base.h"
29 /*----------------------------------------------------------------------------
30 ; ENUMERATED TYPEDEF'S
31 ----------------------------------------------------------------------------*/
36 * One word (2-byte) to indicate type of frame type.
37 * One word (2-byte) to indicate frame type.
38 * One word (2-byte) to indicate mode.
39 * N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
41 ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
44 * One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
45 * One word (2-byte) for frame length N.
46 * N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
48 ITU, /* AMR-Wideband */
51 * AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
55 WMF, /* AMR-Narrowband */
57 IF2 /* AMR-Narrowband */
63 /*----------------------------------------------------------------------------
64 ; STRUCTURES TYPEDEF'S
65 ----------------------------------------------------------------------------*/
73 typedef struct tPVAmrDecoderExternal
77 * Pointer to the input buffer that contains the encoded bistream data.
78 * The data is filled in such that the first bit transmitted is
79 * the most-significant bit (MSB) of the first array element.
80 * The buffer is accessed in a linear fashion for speed, and the number of
81 * bytes consumed varies frame to frame. This is use for mime/ietf data
87 * Pointer to the input buffer that contains the encoded stream data.
88 * The data is filled such that the first bit transmitted is
89 * in the first int16 element.
90 * The buffer is accessed in a linear fashion for speed, and the number of
91 * bytes consumed varies frame to frame.
93 int16 *pInputSampleBuffer;
96 * INPUT: (but what is pointed to is an output)
97 * Pointer to the output buffer to hold the 16-bit PCM audio samples.
103 * Number of requested output audio channels. This relieves the calling
104 * environment from having to perform stereo-to-mono or mono-to-stereo
107 int32 desiredChannels;
111 * Format type of the encoded bitstream.
113 bitstream_format input_format;
117 * The sampling rate decoded from the bitstream, in units of
118 * samples/second. For this release of the library this value does
119 * not change from frame to frame, but future versions will.
125 * This value is the bitrate in units of bits/second. IT
126 * is calculated using the number of bits consumed for the current frame,
127 * and then multiplying by the sampling_rate, divided by points in a frame.
128 * This value can changes frame to frame.
134 * The number of channels decoded from the bitstream. The output data
135 * will have be the amount specified in the variable desiredChannels,
136 * this output is informative only, and can be ignored.
138 int32 encodedChannels;
142 * This value is the number of output PCM samples per channel.
149 * This value is the quality indicator. 1 (good) 0 (bad)
156 * GSM AMR NB and WB mode (i.e. bit-rate )
163 * GSM AMR NB and WB frame type ( speech_good, speech_bad, sid, etc.)
168 int16 reset_flag_old;
182 } tPVAmrDecoderExternal;
184 // CDecoder_AMRInterface
188 class CDecoder_AMRInterface
191 virtual ~CDecoder_AMRInterface() {};
192 OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt,
193 bool aAllocateInputBuffer = false,
194 bool aAllocateOutputBuffer = false) = 0;
196 OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt) = 0;
198 OSCL_IMPORT_REF virtual int32 ResetDecoderL() = 0;
199 OSCL_IMPORT_REF virtual void StopL() = 0;
200 OSCL_IMPORT_REF virtual void TerminateDecoderL() = 0;