1 /* libasf - An Advanced Systems Format media file parser
2 * Copyright (C) 2006-2010 Juho Vähä-Herttua
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 static const asf_guid_t asf_guid_null
=
25 {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
27 /* top level object guids */
29 static const asf_guid_t asf_guid_header
=
30 {0x75B22630, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
32 static const asf_guid_t asf_guid_data
=
33 {0x75B22636, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
35 static const asf_guid_t asf_guid_index
=
36 {0x33000890, 0xE5B1, 0x11CF, {0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB}};
38 /* header level object guids */
40 static const asf_guid_t asf_guid_file_properties
=
41 {0x8cabdca1, 0xa947, 0x11cf, {0x8E, 0xe4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
43 static const asf_guid_t asf_guid_stream_properties
=
44 {0xB7DC0791, 0xA9B7, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
46 static const asf_guid_t asf_guid_content_description
=
47 {0x75B22633, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
49 static const asf_guid_t asf_guid_header_extension
=
50 {0x5FBF03B5, 0xA92E, 0x11CF, {0x8E, 0xE3, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
52 static const asf_guid_t asf_guid_marker
=
53 {0xF487CD01, 0xA951, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
55 static const asf_guid_t asf_guid_codec_list
=
56 {0x86D15240, 0x311D, 0x11D0, {0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
59 static const asf_guid_t asf_guid_stream_bitrate_properties
=
60 {0x7BF875CE, 0x468D, 0x11D1, {0x8D, 0x82, 0x00, 0x60, 0x97, 0xC9, 0xA2, 0xB2}};
62 static const asf_guid_t asf_guid_padding
=
63 {0x1806D474, 0xCADF, 0x4509, {0xA4, 0xBA, 0x9A, 0xAB, 0xCB, 0x96, 0xAA, 0xE8}};
65 static const asf_guid_t asf_guid_extended_content_description
=
66 {0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}};
68 /* header extension level object guids */
70 static const asf_guid_t asf_guid_metadata
=
71 {0xC5F8CBEA, 0x5BAF, 0x4877, {0x84, 0x67, 0xAA, 0x8C, 0x44, 0xFA, 0x4C, 0xCA}};
74 static const asf_guid_t asf_guid_language_list
=
75 {0x7C4346A9, 0xEFE0, 0x4BFC, {0xB2, 0x29, 0x39, 0x3E, 0xDE, 0x41, 0x5C, 0x85}};
77 static const asf_guid_t asf_guid_extended_stream_properties
=
78 {0x14E6A5CB, 0xC672, 0x4332, {0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A}};
80 static const asf_guid_t asf_guid_advanced_mutual_exclusion
=
81 {0xA08649CF, 0x4775, 0x4670, {0x8A, 0x16, 0x6E, 0x35, 0x35, 0x75, 0x66, 0xCD}};
83 static const asf_guid_t asf_guid_stream_prioritization
=
84 {0xD4FED15B, 0x88D3, 0x454F, {0x81, 0xF0, 0xED, 0x5C, 0x45, 0x99, 0x9E, 0x24}};
86 /* stream type guids */
88 static const asf_guid_t asf_guid_stream_type_audio
=
89 {0xF8699E40, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
91 static const asf_guid_t asf_guid_stream_type_video
=
92 {0xbc19efc0, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
94 static const asf_guid_t asf_guid_stream_type_command
=
95 {0x59DACFC0, 0x59E6, 0x11D0, {0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
97 static const asf_guid_t asf_guid_stream_type_extended
=
98 {0x3AFB65E2, 0x47EF, 0x40F2, {0xAC, 0x2C, 0x70, 0xA9, 0x0D, 0x71, 0xD3, 0x43}};
100 static const asf_guid_t asf_guid_stream_type_extended_audio
=
101 {0x31178C9D, 0x03E1, 0x4528, {0xB5, 0x82, 0x3D, 0xF9, 0xDB, 0x22, 0xF5, 0x03}};
106 asf_guid_equals(const asf_guid_t
*guid1
, const asf_guid_t
*guid2
)
108 if((guid1
->v1
!= guid2
->v1
) ||
109 (guid1
->v2
!= guid2
->v2
) ||
110 (guid1
->v3
!= guid2
->v3
) ||
111 (memcmp(guid1
->v4
, guid2
->v4
, 8))) {
119 asf_guid_get_object_type(const asf_guid_t
*guid
)
121 guid_type_t ret
= GUID_UNKNOWN
;
123 if (asf_guid_equals(guid
, &asf_guid_header
))
125 else if (asf_guid_equals(guid
, &asf_guid_data
))
127 else if (asf_guid_equals(guid
, &asf_guid_index
))
130 else if (asf_guid_equals(guid
, &asf_guid_file_properties
))
131 ret
= GUID_FILE_PROPERTIES
;
132 else if (asf_guid_equals(guid
, &asf_guid_stream_properties
))
133 ret
= GUID_STREAM_PROPERTIES
;
134 else if (asf_guid_equals(guid
, &asf_guid_content_description
))
135 ret
= GUID_CONTENT_DESCRIPTION
;
136 else if (asf_guid_equals(guid
, &asf_guid_header_extension
))
137 ret
= GUID_HEADER_EXTENSION
;
138 else if (asf_guid_equals(guid
, &asf_guid_marker
))
140 else if (asf_guid_equals(guid
, &asf_guid_codec_list
))
141 ret
= GUID_CODEC_LIST
;
142 else if (asf_guid_equals(guid
, &asf_guid_stream_bitrate_properties
))
143 ret
= GUID_STREAM_BITRATE_PROPERTIES
;
144 else if (asf_guid_equals(guid
, &asf_guid_padding
))
146 else if (asf_guid_equals(guid
, &asf_guid_extended_content_description
))
147 ret
= GUID_EXTENDED_CONTENT_DESCRIPTION
;
149 else if (asf_guid_equals(guid
, &asf_guid_metadata
))
151 else if (asf_guid_equals(guid
, &asf_guid_language_list
))
152 ret
= GUID_LANGUAGE_LIST
;
153 else if (asf_guid_equals(guid
, &asf_guid_extended_stream_properties
))
154 ret
= GUID_EXTENDED_STREAM_PROPERTIES
;
155 else if (asf_guid_equals(guid
, &asf_guid_advanced_mutual_exclusion
))
156 ret
= GUID_ADVANCED_MUTUAL_EXCLUSION
;
157 else if (asf_guid_equals(guid
, &asf_guid_stream_prioritization
))
158 ret
= GUID_STREAM_PRIORITIZATION
;
164 asf_guid_get_stream_type(const asf_guid_t
*guid
)
166 guid_type_t ret
= GUID_UNKNOWN
;
168 if (asf_guid_equals(guid
, &asf_guid_stream_type_audio
))
169 ret
= GUID_STREAM_TYPE_AUDIO
;
170 else if (asf_guid_equals(guid
, &asf_guid_stream_type_video
))
171 ret
= GUID_STREAM_TYPE_VIDEO
;
172 else if (asf_guid_equals(guid
, &asf_guid_stream_type_command
))
173 ret
= GUID_STREAM_TYPE_COMMAND
;
174 else if (asf_guid_equals(guid
, &asf_guid_stream_type_extended
))
175 ret
= GUID_STREAM_TYPE_EXTENDED
;
176 else if (asf_guid_equals(guid
, &asf_guid_stream_type_extended_audio
))
177 ret
= GUID_STREAM_TYPE_EXTENDED_AUDIO
;
183 asf_guid_get_type(const asf_guid_t
*guid
)
187 ret
= asf_guid_get_object_type(guid
);
188 if (ret
== GUID_UNKNOWN
) {
189 ret
= asf_guid_get_stream_type(guid
);