comparison Input/aac/libmp4v2/atom_tfhd.cpp @ 2:6efb9e514224 trunk

[svn] Import AAC stuff.
author nenolod
date Mon, 24 Oct 2005 10:44:27 -0700
parents
children
comparison
equal deleted inserted replaced
1:cc6293c827ec 2:6efb9e514224
1 /*
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is MPEG4IP.
13 *
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
15 * Portions created by Cisco Systems Inc. are
16 * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
17 *
18 * Contributor(s):
19 * Dave Mackie dmackie@cisco.com
20 */
21
22 #include "mp4common.h"
23
24 MP4TfhdAtom::MP4TfhdAtom()
25 : MP4Atom("tfhd")
26 {
27 AddVersionAndFlags(); /* 0, 1 */
28 AddProperty( /* 2 */
29 new MP4Integer32Property("trackId"));
30 }
31
32 void MP4TfhdAtom::AddProperties(u_int32_t flags)
33 {
34 if (flags & 0x01) {
35 // note this property is signed 64!
36 AddProperty(
37 new MP4Integer64Property("baseDataOffset"));
38 }
39 if (flags & 0x02) {
40 AddProperty(
41 new MP4Integer32Property("sampleDescriptionIndex"));
42 }
43 if (flags & 0x08) {
44 AddProperty(
45 new MP4Integer32Property("defaultSampleDuration"));
46 }
47 if (flags & 0x10) {
48 AddProperty(
49 new MP4Integer32Property("defaultSampleSize"));
50 }
51 if (flags & 0x20) {
52 AddProperty(
53 new MP4Integer32Property("defaultSampleFlags"));
54 }
55 }
56
57 void MP4TfhdAtom::Read()
58 {
59 /* read atom version, flags, and trackId */
60 ReadProperties(0, 3);
61
62 /* need to create the properties based on the atom flags */
63 AddProperties(GetFlags());
64
65 /* now we can read the remaining properties */
66 ReadProperties(3);
67
68 Skip(); // to end of atom
69 }