just kick off another build
[moon.git] / src / asf / asf-generated.cpp
bloba4330ff42355b6e8f3db4991ca60fb432dc8b6ed
1 /*
2 * asf-generated.cpp:
4 * Contact:
5 * Moonlight List (moonlight-list@lists.ximian.com)
7 * Copyright 2008 Novell, Inc. (http://www.novell.com)
9 * See the LICENSE file included with the distribution for details.
12 #include <config.h>
13 #include "asf.h"
15 void print_sizes () {
16 printf ("sizeof (asf_header) = %i.\n", sizeof (asf_header));
17 printf ("sizeof (asf_file_properties) = %i.\n", sizeof (asf_file_properties));
18 printf ("sizeof (asf_stream_properties) = %i.\n", sizeof (asf_stream_properties));
19 printf ("sizeof (asf_header_extension) = %i.\n", sizeof (asf_header_extension));
20 printf ("sizeof (asf_codec_list) = %i.\n", sizeof (asf_codec_list));
21 printf ("sizeof (asf_script_command) = %i.\n", sizeof (asf_script_command));
22 printf ("sizeof (asf_marker) = %i.\n", sizeof (asf_marker));
23 printf ("sizeof (asf_bitrate_mutual_exclusion) = %i.\n", sizeof (asf_bitrate_mutual_exclusion));
24 printf ("sizeof (asf_error_correction) = %i.\n", sizeof (asf_error_correction));
25 printf ("sizeof (asf_content_description) = %i.\n", sizeof (asf_content_description));
26 printf ("sizeof (asf_extended_content_description) = %i.\n", sizeof (asf_extended_content_description));
27 printf ("sizeof (asf_stream_bitrate_properties) = %i.\n", sizeof (asf_stream_bitrate_properties));
28 printf ("sizeof (asf_data) = %i.\n", sizeof (asf_data));
29 printf ("sizeof (asf_extended_stream_properties) = %i.\n", sizeof (asf_extended_stream_properties));
30 printf ("sizeof (asf_object) = %i.\n", sizeof (asf_object));
33 bool asf_object_validate_exact (const asf_object* obj, ASFParser* parser)
35 switch (asf_get_guid_type (&obj->id)) {
36 case ASF_HEADER:
37 return asf_header_validate ((asf_header*) obj, parser);
38 case ASF_FILE_PROPERTIES:
39 return asf_file_properties_validate ((asf_file_properties*) obj, parser);
40 case ASF_STREAM_PROPERTIES:
41 return asf_stream_properties_validate ((asf_stream_properties*) obj, parser);
42 case ASF_HEADER_EXTENSION:
43 return asf_header_extension_validate ((asf_header_extension*) obj, parser);
44 case ASF_CODEC_LIST:
45 return asf_codec_list_validate ((asf_codec_list*) obj, parser);
46 case ASF_SCRIPT_COMMAND:
47 return asf_script_command_validate ((asf_script_command*) obj, parser);
48 case ASF_MARKER:
49 return asf_marker_validate ((asf_marker*) obj, parser);
50 case ASF_BITRATE_MUTUAL_EXCLUSION:
51 return asf_bitrate_mutual_exclusion_validate ((asf_bitrate_mutual_exclusion*) obj, parser);
52 case ASF_ERROR_CORRECTION:
53 return asf_error_correction_validate ((asf_error_correction*) obj, parser);
54 case ASF_CONTENT_DESCRIPTION:
55 return asf_content_description_validate ((asf_content_description*) obj, parser);
56 case ASF_EXTENDED_CONTENT_DESCRIPTION:
57 return asf_extended_content_description_validate ((asf_extended_content_description*) obj, parser);
58 case ASF_STREAM_BITRATE_PROPERTIES:
59 return asf_stream_bitrate_properties_validate ((asf_stream_bitrate_properties*) obj, parser);
60 case ASF_DATA:
61 return asf_data_validate ((asf_data*) obj, parser);
62 case ASF_EXTENDED_STREAM_PROPERTIES:
63 return asf_extended_stream_properties_validate ((asf_extended_stream_properties*) obj, parser);
64 case ASF_NONE:
65 case ASF_LANGUAGE_LIST:
66 case ASF_METADATA:
67 case ASF_PADDING:
68 case ASF_ADVANCED_MUTUAL_EXCLUSION:
69 case ASF_STREAM_PRIORITIZATION:
70 case ASF_INDEX_PARAMETERS:
71 return true; // Do nothing, we don't use these objects at all, so there's no need to validate either.
72 default:
73 #if DEBUG
74 printf ("ASF warning: No validation implemented for %s.\n", asf_guid_get_name (&obj->id));
75 #endif
76 return true;
80 /* Debug functions */
81 void asf_header_dump (const asf_header* obj)
83 ASF_DUMP ("ASF_HEADER\n");
84 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
85 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
86 ASF_DUMP ("\tobject_count = %u\n", (asf_dword) obj->object_count);
87 ASF_DUMP ("\treserved1 = %u\n", (asf_dword) obj->reserved1);
88 ASF_DUMP ("\treserved2 = %u\n", (asf_dword) obj->reserved2);
91 void asf_file_properties_dump (const asf_file_properties* obj)
93 ASF_DUMP ("ASF_FILE_PROPERTIES\n");
94 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
95 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
96 ASF_DUMP ("\tfile_id = %s\n", asf_guid_tostring (&obj->file_id));
97 ASF_DUMP ("\tfile_size = %" G_GUINT64_FORMAT "\n", obj->file_size);
98 ASF_DUMP ("\tcreation_date = %" G_GUINT64_FORMAT "\n", obj->creation_date);
99 ASF_DUMP ("\tdata_packet_count = %" G_GUINT64_FORMAT "\n", obj->data_packet_count);
100 ASF_DUMP ("\tplay_duration = %" G_GUINT64_FORMAT "\n", obj->play_duration);
101 ASF_DUMP ("\tsend_duration = %" G_GUINT64_FORMAT "\n", obj->send_duration);
102 ASF_DUMP ("\tpreroll = %" G_GUINT64_FORMAT "\n", obj->preroll);
103 ASF_DUMP ("\tflags = %u\n", (asf_dword) obj->flags);
104 ASF_DUMP ("\tmin_packet_size = %u\n", (asf_dword) obj->min_packet_size);
105 ASF_DUMP ("\tmax_packet_size = %u\n", (asf_dword) obj->max_packet_size);
106 ASF_DUMP ("\tmax_bitrate = %u\n", (asf_dword) obj->max_bitrate);
109 void asf_stream_properties_dump (const asf_stream_properties* obj)
111 ASF_DUMP ("ASF_STREAM_PROPERTIES\n");
112 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
113 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
114 ASF_DUMP ("\tstream_type = %s\n", asf_guid_tostring (&obj->stream_type));
115 ASF_DUMP ("\terror_correction_type = %s\n", asf_guid_tostring (&obj->error_correction_type));
116 ASF_DUMP ("\ttime_offset = %" G_GUINT64_FORMAT "\n", obj->time_offset);
117 ASF_DUMP ("\ttype_specific_data_length = %u\n", (asf_dword) obj->type_specific_data_length);
118 ASF_DUMP ("\terror_correction_data_length = %u\n", (asf_dword) obj->error_correction_data_length);
119 ASF_DUMP ("\tflags = %u\n", (asf_dword) obj->flags);
120 ASF_DUMP ("\treserved = %u\n", (asf_dword) obj->reserved);
123 void asf_codec_list_dump (const asf_codec_list* obj)
125 ASF_DUMP ("ASF_CODEC_LIST\n");
126 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
127 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
128 ASF_DUMP ("\treserved = %s\n", asf_guid_tostring (&obj->reserved));
129 ASF_DUMP ("\tentries_count = %u\n", (asf_dword) obj->entries_count);
132 void asf_bitrate_mutual_exclusion_dump (const asf_bitrate_mutual_exclusion* obj)
134 ASF_DUMP ("ASF_BITRATE_MUTUAL_EXCLUSION\n");
135 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
136 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
137 ASF_DUMP ("\texclusion_type = %s\n", asf_guid_tostring (&obj->exclusion_type));
138 ASF_DUMP ("\tstream_count = %u\n", (asf_dword) obj->stream_count);
141 void asf_error_correction_dump (const asf_error_correction* obj)
143 ASF_DUMP ("ASF_ERROR_CORRECTION\n");
144 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
145 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
146 ASF_DUMP ("\terror_correction_type = %s\n", asf_guid_tostring (&obj->error_correction_type));
147 ASF_DUMP ("\terror_correction_data_length = %u\n", (asf_dword) obj->error_correction_data_length);
150 void asf_content_description_dump (const asf_content_description* obj)
152 ASF_DUMP ("ASF_CONTENT_DESCRIPTION\n");
153 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
154 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
155 ASF_DUMP ("\ttitle_length = %u\n", (asf_dword) obj->title_length);
156 ASF_DUMP ("\tauthor_length = %u\n", (asf_dword) obj->author_length);
157 ASF_DUMP ("\tcopyright_length = %u\n", (asf_dword) obj->copyright_length);
158 ASF_DUMP ("\tdescription_length = %u\n", (asf_dword) obj->description_length);
159 ASF_DUMP ("\trating_length = %u\n", (asf_dword) obj->rating_length);
162 void asf_extended_content_description_dump (const asf_extended_content_description* obj)
164 ASF_DUMP ("ASF_EXTENDED_CONTENT_DESCRIPTION\n");
165 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
166 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
167 ASF_DUMP ("\tcontent_descriptors_count = %u\n", (asf_dword) obj->content_descriptors_count);
170 void asf_stream_bitrate_properties_dump (const asf_stream_bitrate_properties* obj)
172 ASF_DUMP ("ASF_STREAM_BITRATE_PROPERTIES\n");
173 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
174 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
175 ASF_DUMP ("\tbitrate_records_count = %u\n", (asf_dword) obj->bitrate_records_count);
178 void asf_data_dump (const asf_data* obj)
180 ASF_DUMP ("ASF_DATA\n");
181 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
182 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
183 ASF_DUMP ("\tfile_id = %s\n", asf_guid_tostring (&obj->file_id));
184 ASF_DUMP ("\tdata_packet_count = %" G_GUINT64_FORMAT "\n", obj->data_packet_count);
185 ASF_DUMP ("\treserved = %u\n", (asf_dword) obj->reserved);
188 void asf_object_dump (const asf_object* obj)
190 ASF_DUMP ("ASF_OBJECT\n");
191 ASF_DUMP ("\tid = %s\n", asf_guid_tostring (&obj->id));
192 ASF_DUMP ("\tsize = %" G_GUINT64_FORMAT "\n", obj->size);
195 void WAVEFORMATEX_dump (const WAVEFORMATEX* obj)
197 ASF_DUMP ("WAVEFORMATEX\n");
198 ASF_DUMP ("\tcodec_id = %u\n", (asf_dword) obj->codec_id);
199 ASF_DUMP ("\tchannels = %u\n", (asf_dword) obj->channels);
200 ASF_DUMP ("\tsamples_per_second = %u\n", (asf_dword) obj->samples_per_second);
201 ASF_DUMP ("\tbytes_per_second = %u\n", (asf_dword) obj->bytes_per_second);
202 ASF_DUMP ("\tblock_alignment = %u\n", (asf_dword) obj->block_alignment);
203 ASF_DUMP ("\tbits_per_sample = %u\n", (asf_dword) obj->bits_per_sample);
204 ASF_DUMP ("\tcodec_specific_data_size = %u\n", (asf_dword) obj->codec_specific_data_size);
207 void BITMAPINFOHEADER_dump (const BITMAPINFOHEADER* obj)
209 ASF_DUMP ("BITMAPINFOHEADER\n");
210 ASF_DUMP ("\tsize = %u\n", (asf_dword) obj->size);
211 ASF_DUMP ("\timage_width = %u\n", (asf_dword) obj->image_width);
212 ASF_DUMP ("\timage_height = %u\n", (asf_dword) obj->image_height);
213 ASF_DUMP ("\treserved = %u\n", (asf_dword) obj->reserved);
214 ASF_DUMP ("\tbits_per_pixel = %u\n", (asf_dword) obj->bits_per_pixel);
215 ASF_DUMP ("\tcompression_id = %u\n", (asf_dword) obj->compression_id);
216 ASF_DUMP ("\timage_size = %u\n", (asf_dword) obj->image_size);
217 ASF_DUMP ("\thor_pixels_per_meter = %u\n", (asf_dword) obj->hor_pixels_per_meter);
218 ASF_DUMP ("\tver_pixels_per_meter = %u\n", (asf_dword) obj->ver_pixels_per_meter);
219 ASF_DUMP ("\tcolors_used = %u\n", (asf_dword) obj->colors_used);
220 ASF_DUMP ("\timportant_colors_used = %u\n", (asf_dword) obj->important_colors_used);
223 void asf_video_stream_data_dump (const asf_video_stream_data* obj)
225 ASF_DUMP ("ASF_VIDEO_STREAM_DATA\n");
226 ASF_DUMP ("\timage_width = %u\n", (asf_dword) obj->image_width);
227 ASF_DUMP ("\timage_height = %u\n", (asf_dword) obj->image_height);
228 ASF_DUMP ("\tflags = %u\n", (asf_dword) obj->flags);
229 ASF_DUMP ("\tformat_data_size = %u\n", (asf_dword) obj->format_data_size);
233 void asf_object_dump_exact (const asf_object* obj)
235 switch (asf_get_guid_type (&obj->id)) {
236 case ASF_HEADER:
237 asf_header_dump ((asf_header*) obj); break;
238 case ASF_FILE_PROPERTIES:
239 asf_file_properties_dump ((asf_file_properties*) obj); break;
240 case ASF_STREAM_PROPERTIES:
241 asf_stream_properties_dump ((asf_stream_properties*) obj); break;
242 case ASF_HEADER_EXTENSION:
243 asf_header_extension_dump ((asf_header_extension*) obj); break;
244 case ASF_CODEC_LIST:
245 asf_codec_list_dump ((asf_codec_list*) obj); break;
246 case ASF_MARKER:
247 asf_marker_dump ((asf_marker*) obj); break;
248 case ASF_BITRATE_MUTUAL_EXCLUSION:
249 asf_bitrate_mutual_exclusion_dump ((asf_bitrate_mutual_exclusion*) obj); break;
250 case ASF_ERROR_CORRECTION:
251 asf_error_correction_dump ((asf_error_correction*) obj); break;
252 case ASF_CONTENT_DESCRIPTION:
253 asf_content_description_dump ((asf_content_description*) obj); break;
254 case ASF_EXTENDED_CONTENT_DESCRIPTION:
255 asf_extended_content_description_dump ((asf_extended_content_description*) obj); break;
256 case ASF_STREAM_BITRATE_PROPERTIES:
257 asf_stream_bitrate_properties_dump ((asf_stream_bitrate_properties*) obj); break;
258 case ASF_DATA:
259 asf_data_dump ((asf_data*) obj); break;
260 case ASF_EXTENDED_STREAM_PROPERTIES:
261 asf_extended_stream_properties_dump ((asf_extended_stream_properties*) obj); break;
262 default:
263 asf_object_dump (obj); break;
268 Some almost read to use copy-and-paste code.
271 bool asf_header_validate (const asf_header* obj, ASFParser* parser)
273 if (!(asf_guid_validate (&obj->id, &asf_guids_header, parser))) {
274 return false;
276 // FIXME: Verify that this size is correct.
277 if (obj->size < 54) {
278 parser->AddError (g_strdup_printf ("Invalid size (expected >= 54, got %" G_GUINT64_FORMAT ").", obj->size));
279 return false;
281 // TODO: More verifications?
282 return true;
285 bool asf_file_properties_validate (const asf_file_properties* obj, ASFParser* parser)
287 if (!(asf_guid_validate (&obj->id, &asf_guids_file_properties, parser))) {
288 return false;
290 // FIXME: Verify that this size is correct.
291 if (obj->size < 128) {
292 parser->AddError (g_strdup_printf ("Invalid size (expected >= 128, got %" G_GUINT64_FORMAT ").", obj->size));
293 return false;
295 // TODO: More verifications?
296 return true;
299 bool asf_stream_properties_validate (const asf_stream_properties* obj, ASFParser* parser)
301 if (!(asf_guid_validate (&obj->id, &asf_guids_stream_properties, parser))) {
302 return false;
304 // FIXME: Verify that this size is correct.
305 if (obj->size < 102) {
306 parser->AddError (g_strdup_printf ("Invalid size (expected >= 102, got %" G_GUINT64_FORMAT ").", obj->size));
307 return false;
309 // TODO: More verifications?
310 return true;
313 bool asf_header_extension_validate (const asf_header_extension* obj, ASFParser* parser)
315 if (!(asf_guid_validate (&obj->id, &asf_guids_header_extension, parser))) {
316 return false;
318 // FIXME: Verify that this size is correct.
319 if (obj->size < 70) {
320 parser->AddError (g_strdup_printf ("Invalid size (expected >= 70, got %" G_GUINT64_FORMAT ").", obj->size));
321 return false;
323 // TODO: More verifications?
324 return true;
327 bool asf_codec_list_validate (const asf_codec_list* obj, ASFParser* parser)
329 if (!(asf_guid_validate (&obj->id, &asf_guids_codec_list, parser))) {
330 return false;
332 // FIXME: Verify that this size is correct.
333 if (obj->size < 68) {
334 parser->AddError (g_strdup_printf ("Invalid size (expected >= 68, got %" G_GUINT64_FORMAT ").", obj->size));
335 return false;
337 // TODO: More verifications?
338 return true;
341 bool asf_script_command_validate (const asf_script_command* obj, ASFParser* parser)
343 if (!(asf_guid_validate (&obj->id, &asf_guids_script_command, parser))) {
344 return false;
346 // FIXME: Verify that this size is correct.
347 if (obj->size < 68) {
348 parser->AddError (g_strdup_printf ("Invalid size (expected >= 68, got %" G_GUINT64_FORMAT ").", obj->size));
349 return false;
351 // TODO: More verifications?
352 return true;
355 bool asf_marker_validate (const asf_marker* obj, ASFParser* parser)
357 if (!(asf_guid_validate (&obj->id, &asf_guids_marker, parser))) {
358 return false;
360 // FIXME: Verify that this size is correct.
361 if (obj->size < 72) {
362 parser->AddError (g_strdup_printf ("Invalid size (expected >= 72, got %" G_GUINT64_FORMAT ").", obj->size));
363 return false;
365 // TODO: More verifications?
366 return true;
369 bool asf_bitrate_mutual_exclusion_validate (const asf_bitrate_mutual_exclusion* obj, ASFParser* parser)
371 if (!(asf_guid_validate (&obj->id, &asf_guids_bitrate_mutual_exclusion, parser))) {
372 return false;
374 // FIXME: Verify that this size is correct.
375 if (obj->size < 66) {
376 parser->AddError (g_strdup_printf ("Invalid size (expected >= 66, got %" G_GUINT64_FORMAT ").", obj->size));
377 return false;
379 // TODO: More verifications?
380 return true;
383 bool asf_error_correction_validate (const asf_error_correction* obj, ASFParser* parser)
385 if (!(asf_guid_validate (&obj->id, &asf_guids_error_correction, parser))) {
386 return false;
388 // FIXME: Verify that this size is correct.
389 if (obj->size < 68) {
390 parser->AddError (g_strdup_printf ("Invalid size (expected >= 68, got %" G_GUINT64_FORMAT ").", obj->size));
391 return false;
393 // TODO: More verifications?
394 return true;
397 bool asf_content_description_validate (const asf_content_description* obj, ASFParser* parser)
399 if (!(asf_guid_validate (&obj->id, &asf_guids_content_description, parser))) {
400 return false;
402 // FIXME: Verify that this size is correct.
403 if (obj->size < 58) {
404 parser->AddError (g_strdup_printf ("Invalid size (expected >= 58, got %" G_GUINT64_FORMAT ").", obj->size));
405 return false;
407 // TODO: More verifications?
408 return true;
411 bool asf_extended_content_description_validate (const asf_extended_content_description* obj, ASFParser* parser)
413 if (!(asf_guid_validate (&obj->id, &asf_guids_extended_content_description, parser))) {
414 return false;
416 // FIXME: Verify that this size is correct.
417 if (obj->size < 50) {
418 parser->AddError (g_strdup_printf ("Invalid size (expected >= 50, got %" G_GUINT64_FORMAT ").", obj->size));
419 return false;
421 // TODO: More verifications?
422 return true;
425 bool asf_stream_bitrate_properties_validate (const asf_stream_bitrate_properties* obj, ASFParser* parser)
427 if (!(asf_guid_validate (&obj->id, &asf_guids_stream_bitrate_properties, parser))) {
428 return false;
430 // FIXME: Verify that this size is correct.
431 if (obj->size < 50) {
432 parser->AddError (g_strdup_printf ("Invalid size (expected >= 50, got %" G_GUINT64_FORMAT ").", obj->size));
433 return false;
435 // TODO: More verifications?
436 return true;
439 bool asf_data_validate (const asf_data* obj, ASFParser* parser)
441 if (!(asf_guid_validate (&obj->id, &asf_guids_data, parser))) {
442 return false;
444 // FIXME: Verify that this size is correct.
445 if (obj->size < 74) {
446 parser->AddError (g_strdup_printf ("Invalid size (expected >= 74, got %" G_GUINT64_FORMAT ").", obj->size));
447 return false;
449 // TODO: More verifications?
450 return true;
453 bool asf_extended_stream_properties_validate (const asf_extended_stream_properties* obj, ASFParser* parser)
455 if (!(asf_guid_validate (&obj->id, &asf_guids_extended_stream_properties, parser))) {
456 return false;
458 // FIXME: Verify that this size is correct.
459 if (obj->size < 112) {
460 parser->AddError (g_strdup_printf ("Invalid size (expected >= 112, got %" G_GUINT64_FORMAT ").", obj->size));
461 return false;
463 // TODO: More verifications?
464 return true;
467 bool asf_object_validate (const asf_object* obj, ASFParser* parser)
469 if (!(asf_guid_validate (&obj->id, &asf_guids_object, parser))) {
470 return false;
472 // FIXME: Verify that this size is correct.
473 if (obj->size < 48) {
474 parser->AddError (g_strdup_printf ("Invalid size (expected >= 48, got %" G_GUINT64_FORMAT ").", obj->size));
475 return false;
477 // TODO: More verifications?
478 return true;