annotate Plugins/Input/aac/libmp4v2/atom_trun.cpp @ 553:82346a6312c2 trunk

[svn] make WMA plugin strings translatable
author nenolod
date Wed, 01 Feb 2006 13:09:00 -0800
parents fa848bd484d8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * The contents of this file are subject to the Mozilla Public
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 * License Version 1.1 (the "License"); you may not use this file
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * except in compliance with the License. You may obtain a copy of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * the License at http://www.mozilla.org/MPL/
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * Software distributed under the License is distributed on an "AS
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 * implied. See the License for the specific language governing
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * rights and limitations under the License.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * The Original Code is MPEG4IP.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 * The Initial Developer of the Original Code is Cisco Systems Inc.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 * Portions created by Cisco Systems Inc. are
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 * Contributor(s):
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 * Dave Mackie dmackie@cisco.com
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 #include "mp4common.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24 MP4TrunAtom::MP4TrunAtom()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 : MP4Atom("trun")
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27 AddVersionAndFlags(); /* 0, 1 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 AddProperty( /* 2 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 new MP4Integer32Property("sampleCount"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 void MP4TrunAtom::AddProperties(u_int32_t flags)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34 if (flags & 0x01) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 // Note this is a signed 32 value
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 new MP4Integer32Property("dataOffset"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 if (flags & 0x04) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 new MP4Integer32Property("firstSampleFlags"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 MP4TableProperty* pTable =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 new MP4TableProperty("samples",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 (MP4Integer32Property *)m_pProperties[2]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 AddProperty(pTable);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 if (flags & 0x100) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 pTable->AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 new MP4Integer32Property("sampleDuration"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 if (flags & 0x200) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 pTable->AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 new MP4Integer32Property("sampleSize"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 if (flags & 0x400) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 pTable->AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 new MP4Integer32Property("sampleFlags"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 if (flags & 0x800) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 pTable->AddProperty(
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 new MP4Integer32Property("sampleCompositionTimeOffset"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 void MP4TrunAtom::Read()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 /* read atom version, flags, and sampleCount */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 ReadProperties(0, 3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 /* need to create the properties based on the atom flags */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 AddProperties(GetFlags());
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 /* now we can read the remaining properties */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 ReadProperties(3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 Skip(); // to end of atom
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 }