• 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 #define IMPLEMENT_MovieFragmentRandomAccessOffsetAtom
19 
20 #include "moviefragmentrandomaccessoffsetatom.h"
21 
22 // constructor
PVA_FF_MfroAtom()23 PVA_FF_MfroAtom::PVA_FF_MfroAtom()
24         : PVA_FF_FullAtom(MOVIE_FRAGMENT_RANDOM_ACCESS_OFFSET_ATOM, (uint8)0, (uint32)0)
25 {
26     _atomSize = 0;
27 
28     recomputeSize();
29 
30 }
31 
32 
33 // destructor
~PVA_FF_MfroAtom()34 PVA_FF_MfroAtom::~PVA_FF_MfroAtom()
35 {
36     // do nothing
37 }
38 
39 
40 void
setSize(uint32 size)41 PVA_FF_MfroAtom::setSize(uint32 size)
42 {
43     _atomSize = size;
44 
45 }
46 
47 
48 // recompute size of atom
49 void
recomputeSize()50 PVA_FF_MfroAtom::recomputeSize()
51 {
52     int32 size = getDefaultSize();
53 
54     size += 4;  // atom size
55 
56     _size = size;
57 
58     // Update the parent atom size
59     if (_pparent != NULL)
60     {
61         _pparent->recomputeSize();
62     }
63 }
64 
65 
66 // write atom to target file
67 bool
renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP * fp)68 PVA_FF_MfroAtom::renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP* fp)
69 {
70     uint32 rendered = 0;
71 
72     if (!renderAtomBaseMembers(fp))
73     {
74         return false;
75     }
76     rendered += getDefaultSize();
77 
78     if (!PVA_FF_AtomUtils::render32(fp, _atomSize))
79     {
80         return false;
81     }
82     rendered += 4;
83 
84     return true;
85 }
86