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_MovieExtendsHeaderAtom
19
20 #include "movieextendsheaderatom.h"
21 #include "atomutils.h"
22 #include "atomdefs.h"
23
MovieExtendsHeaderAtom(MP4_FF_FILE * fp,uint32 size,uint32 type)24 MovieExtendsHeaderAtom ::MovieExtendsHeaderAtom(MP4_FF_FILE *fp, uint32 size, uint32 type)
25 : FullAtom(fp, size, type)
26
27 {
28 OSCL_UNUSED_ARG(type);
29
30 _fragmentDuration32 = 0;
31 _fragmentDuration64 = 0;
32
33 uint8 ver = getVersion();
34
35 _version = ver;
36 if (_success)
37 {
38 if (ver == 0)
39 {
40 if (!AtomUtils::read32(fp, _fragmentDuration32))
41 {
42 _success = false;
43 _mp4ErrorCode = READ_MOVIE_EXTENDS_HEADER_FAILED;
44 return;
45 }
46 }
47 else if (ver == 1)
48 {
49 if (!AtomUtils::read64(fp, _fragmentDuration64))
50 {
51 _success = false;
52 _mp4ErrorCode = READ_MOVIE_EXTENDS_HEADER_FAILED;
53 return;
54 }
55
56 }
57 else
58 {
59 _success = false;
60 _mp4ErrorCode = NOT_SUPPORTED;
61 return;
62
63 }
64
65 }
66 }
67 // Destructor
~MovieExtendsHeaderAtom()68 MovieExtendsHeaderAtom::~MovieExtendsHeaderAtom()
69 {
70 }
71