annotate Plugins/Input/aac/libmp4v2/atom_sound.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. 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 MP4SoundAtom::MP4SoundAtom(const char *atomid)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 : MP4Atom(atomid)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27 AddReserved("reserved1", 6); /* 0 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 AddProperty( /* 1 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 new MP4Integer16Property("dataReferenceIndex"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 AddProperty( /* 2 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 new MP4Integer16Property("soundVersion"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 AddReserved( "reserved2", 6); /* 3 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 AddProperty( /* 4 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 new MP4Integer16Property("channels"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 AddProperty( /* 5 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 new MP4Integer16Property("sampleSize"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 AddProperty( /* 6 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 new MP4Integer16Property("packetSize"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 AddProperty( /* 7 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 new MP4Integer32Property("timeScale"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45 void MP4SoundAtom::AddProperties (uint8_t version)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 if (version > 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 AddProperty( /* 8 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 new MP4Integer32Property("samplesPerPacket"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 AddProperty( /* 9 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 new MP4Integer32Property("bytesPerPacket"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52 AddProperty( /* 10 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 new MP4Integer32Property("bytesPerFrame"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 AddProperty( /* 11 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 new MP4Integer32Property("bytesPerSample"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 void MP4SoundAtom::Generate()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 MP4Atom::Generate();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 ((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 // property reserved2 has non-zero fixed values
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 static u_int8_t reserved2[16] = {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 0x00, 0x00, 0x00, 0x00,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 0x00, 0x00, 0x00, 0x00,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 0x00, 0x02, 0x00, 0x10,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 0x00, 0x00, 0x00, 0x00,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 m_pProperties[2]->SetReadOnly(false);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 ((MP4BytesProperty*)m_pProperties[2])->
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 SetValue(reserved2, sizeof(reserved2));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 m_pProperties[2]->SetReadOnly(true);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77 void MP4SoundAtom::Read()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 ReadProperties(0, 3); // read first 3 properties
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 AddProperties(((MP4IntegerProperty *)m_pProperties[2])->GetValue());
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 ReadProperties(3); // continue
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 }