• 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 #include "atom.h"
19 #include "atomutils.h"
20 #include "oscl_file_io.h"
21 #include "mpeg4bitrateatom.h"
22 #include "a_atomdefs.h"
23 
PVA_FF_Mpeg4Bitrate(uint32 BufferSizeDB,uint32 MaxBitRate,uint32 AvgBitRate)24 PVA_FF_Mpeg4Bitrate::PVA_FF_Mpeg4Bitrate(uint32 BufferSizeDB, uint32 MaxBitRate, uint32 AvgBitRate)
25         : PVA_FF_Atom(MPEG4_BITRATE_BOX)
26         , _bufferSizeDB(BufferSizeDB)
27         , _maxBitRate(MaxBitRate)
28         , _avgBitRate(AvgBitRate)
29 {
30     recomputeSize();
31 }
32 
renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP * fp)33 bool PVA_FF_Mpeg4Bitrate::renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp)
34 {
35     return (renderAtomBaseMembers(fp)
36             && PVA_FF_AtomUtils::render32(fp, _bufferSizeDB)
37             && PVA_FF_AtomUtils::render32(fp, _maxBitRate)
38             && PVA_FF_AtomUtils::render32(fp, _avgBitRate));
39 }
40 
recomputeSize()41 void PVA_FF_Mpeg4Bitrate::recomputeSize()
42 {
43     _size = 0x14;
44 
45     // Update size of parent
46     if (_pparent != NULL)
47     {
48         _pparent->recomputeSize();
49     }
50 }
51 
getSize()52 uint32 PVA_FF_Mpeg4Bitrate::getSize()
53 {
54     recomputeSize();
55     return (_size);
56 }
57 
58