annotate Plugins/Input/aac/libmp4v2/atom_avcC.cpp @ 184:740c072f8e23 trunk

[svn] List sndfile extensions in the plugin configuration table.
author chainsaw
date Sun, 13 Nov 2005 14:27:07 -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. 2004. 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 * Bill May wmay@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 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 * SizeTableProperty is a special version of the MP4TableProperty -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 * the BytesProperty will need to set the value before it can read
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27 * from the file
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 class SizeTableProperty : public MP4TableProperty
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 public:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 SizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) :
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 MP4TableProperty(name, pCountProperty) {};
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34 protected:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 void ReadEntry(MP4File *pFile, u_int32_t index) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 // Each table has a size, followed by the length field
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 // first, read the length
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 m_pProperties[0]->Read(pFile, index);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 MP4IntegerProperty *pIntProp = (MP4IntegerProperty *)m_pProperties[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 // set the size in the bytes property
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 MP4BytesProperty *pBytesProp = (MP4BytesProperty *)m_pProperties[1];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 pBytesProp->SetValueSize(pIntProp->GetValue(index), index);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 // And read the bytes
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 m_pProperties[1]->Read(pFile, index);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 MP4AvcCAtom::MP4AvcCAtom()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 : MP4Atom("avcC")
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 MP4BitfieldProperty *pCount;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52 MP4TableProperty *pTable;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 AddProperty( new MP4Integer8Property("configurationVersion")); /* 0 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 AddProperty( new MP4Integer8Property("AVCProfileIndication")); /* 1 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 AddProperty( new MP4Integer8Property("profile_compatibility")); /* 2 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 AddProperty( new MP4Integer8Property("AVCLevelIndication")); /* 3 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 AddProperty( new MP4BitfieldProperty("reserved", 6)); /* 4 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 AddProperty( new MP4BitfieldProperty("lengthSizeMinusOne", 2)); /* 5 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 AddProperty( new MP4BitfieldProperty("reserved1", 3)); /* 6 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 pCount = new MP4BitfieldProperty("numOfSequenceParameterSets", 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 AddProperty(pCount); /* 7 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 pTable = new SizeTableProperty("sequenceEntries", pCount);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 AddProperty(pTable); /* 8 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 pTable->AddProperty(new MP4Integer16Property("sequenceParameterSetLength"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 pTable->AddProperty(new MP4BytesProperty("sequenceParameterSetNALUnit"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 MP4Integer8Property *pCount2 = new MP4Integer8Property("numOfPictureParameterSets");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 AddProperty(pCount2); /* 9 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 pTable = new SizeTableProperty("pictureEntries", pCount2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77 AddProperty(pTable); /* 10 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 pTable->AddProperty(new MP4Integer16Property("pictureParameterSetLength"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 pTable->AddProperty(new MP4BytesProperty("pictureParameterSetNALUnit"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 void MP4AvcCAtom::Generate()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 MP4Atom::Generate();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86 ((MP4Integer8Property*)m_pProperties[0])->SetValue(1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88 m_pProperties[4]->SetReadOnly(false);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 ((MP4BitfieldProperty*)m_pProperties[4])->SetValue(0x3f);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90 m_pProperties[4]->SetReadOnly(true);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 m_pProperties[6]->SetReadOnly(false);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0x7);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 m_pProperties[6]->SetReadOnly(true);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 // property reserved4 has non-zero fixed values
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 static u_int8_t reserved4[4] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 0x00, 0x18, 0xFF, 0xFF,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100 m_pProperties[7]->SetReadOnly(false);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 ((MP4BytesProperty*)m_pProperties[7])->
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 SetValue(reserved4, sizeof(reserved4));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103 m_pProperties[7]->SetReadOnly(true);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106