• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 /*********************************************************************************/
19 /*     -------------------------------------------------------------------       */
20 /*                          MPEG-4 Util: AudioHintSample                         */
21 /*     -------------------------------------------------------------------       */
22 /*********************************************************************************/
23 /*
24     This DecoderSpecificInfo Class that holds the Mpeg4 VOL header for the
25     video stream
26 */
27 
28 #define __IMPLEMENT_AMRDecoderSpecificInfo3GPP__
29 
30 #include "3gpp_amrdecoderspecificinfo.h"
31 
32 #include "atom.h"
33 #include "atomutils.h"
34 
35 const int16 AMRModeSetMask[8] =
36 {
37     0x0001, 0x0002, 0x0004, 0x0008,
38     0x0010, 0x0020, 0x0040, 0x0080,
39 };
40 
41 const int32 AMRBitRates[8] =
42 {
43     4750, 5150,  5900,  6700,
44     7400, 7950, 10200, 12200,
45 };
46 
47 // Default constructor
AMRSpecificAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)48 AMRSpecificAtom::AMRSpecificAtom(MP4_FF_FILE *fp, uint32 size, uint32 type)
49         : Atom(fp, size, type)
50 {
51     _bitRate = 0;
52 
53     if (_success)
54     {
55         AtomUtils::read32(fp, _VendorCode);
56 
57         AtomUtils::read8(fp, _decoder_version);
58 
59         AtomUtils::read16(fp, _mode_set);
60 
61         AtomUtils::read8(fp, _mode_change_period);
62 
63         AtomUtils::read8(fp, _frames_per_sample);
64 
65         for (uint32 i = 0; i < 8; i++)
66         {
67             if (_mode_set & AMRModeSetMask[i])
68             {
69                 _bitRate = AMRBitRates[i];
70             }
71         }
72 
73     }
74 }
75 
76 
77