61
|
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 MP4FtypAtom::MP4FtypAtom()
|
|
25 : MP4Atom("ftyp")
|
|
26 {
|
|
27 MP4StringProperty* pProp = new MP4StringProperty("majorBrand");
|
|
28 pProp->SetFixedLength(4);
|
|
29 AddProperty(pProp); /* 0 */
|
|
30
|
|
31 AddProperty( /* 1 */
|
|
32 new MP4Integer32Property("minorVersion"));
|
|
33
|
|
34 MP4Integer32Property* pCount =
|
|
35 new MP4Integer32Property("compatibleBrandsCount");
|
|
36 pCount->SetImplicit();
|
|
37 AddProperty(pCount); /* 2 */
|
|
38
|
|
39 MP4TableProperty* pTable =
|
|
40 new MP4TableProperty("compatibleBrands", pCount);
|
|
41 AddProperty(pTable); /* 3 */
|
|
42
|
|
43 pProp = new MP4StringProperty("brand");
|
|
44 pProp->SetFixedLength(4);
|
|
45 pTable->AddProperty(pProp);
|
|
46 }
|
|
47
|
|
48 void MP4FtypAtom::Generate()
|
|
49 {
|
|
50 MP4Atom::Generate();
|
|
51
|
|
52 ((MP4StringProperty*)m_pProperties[0])->SetValue("mp42");
|
|
53
|
|
54 MP4StringProperty* pBrandProperty = (MP4StringProperty*)
|
|
55 ((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
|
|
56 ASSERT(pBrandProperty);
|
|
57 pBrandProperty->AddValue("mp42");
|
|
58 pBrandProperty->AddValue("isom");
|
|
59 ((MP4Integer32Property*)m_pProperties[2])->IncrementValue();
|
|
60 ((MP4Integer32Property*)m_pProperties[2])->IncrementValue();
|
|
61 }
|
|
62
|
|
63 void MP4FtypAtom::Read()
|
|
64 {
|
|
65 // table entry count computed from atom size
|
|
66 ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false);
|
|
67 ((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 8) / 4);
|
|
68 ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true);
|
|
69
|
|
70 MP4Atom::Read();
|
|
71 }
|