00001 #include "funcprotos.h"
00002 #include "quicktime.h"
00003 #include <string.h>
00004
00005
00006
00007 void quicktime_hdlr_init(quicktime_hdlr_t *hdlr)
00008 {
00009 hdlr->version = 0;
00010 hdlr->flags = 0;
00011 hdlr->component_type[0] = 'm';
00012 hdlr->component_type[1] = 'h';
00013 hdlr->component_type[2] = 'l';
00014 hdlr->component_type[3] = 'r';
00015 hdlr->component_subtype[0] = 'v';
00016 hdlr->component_subtype[1] = 'i';
00017 hdlr->component_subtype[2] = 'd';
00018 hdlr->component_subtype[3] = 'e';
00019 hdlr->component_manufacturer = 0;
00020 hdlr->component_flags = 0;
00021 hdlr->component_flag_mask = 0;
00022 strcpy(hdlr->component_name, "Linux Media Handler");
00023 }
00024
00025 void quicktime_hdlr_init_video(quicktime_hdlr_t *hdlr)
00026 {
00027 hdlr->component_subtype[0] = 'v';
00028 hdlr->component_subtype[1] = 'i';
00029 hdlr->component_subtype[2] = 'd';
00030 hdlr->component_subtype[3] = 'e';
00031 strcpy(hdlr->component_name, "Linux Video Media Handler");
00032 }
00033
00034 void quicktime_hdlr_init_audio(quicktime_hdlr_t *hdlr)
00035 {
00036 hdlr->component_subtype[0] = 's';
00037 hdlr->component_subtype[1] = 'o';
00038 hdlr->component_subtype[2] = 'u';
00039 hdlr->component_subtype[3] = 'n';
00040 strcpy(hdlr->component_name, "Linux Sound Media Handler");
00041 }
00042
00043 void quicktime_hdlr_init_data(quicktime_hdlr_t *hdlr)
00044 {
00045 hdlr->component_type[0] = 'd';
00046 hdlr->component_type[1] = 'h';
00047 hdlr->component_type[2] = 'l';
00048 hdlr->component_type[3] = 'r';
00049 hdlr->component_subtype[0] = 'a';
00050 hdlr->component_subtype[1] = 'l';
00051 hdlr->component_subtype[2] = 'i';
00052 hdlr->component_subtype[3] = 's';
00053 strcpy(hdlr->component_name, "Linux Alias Data Handler");
00054 }
00055
00056 void quicktime_hdlr_delete(quicktime_hdlr_t *hdlr)
00057 {
00058 }
00059
00060 void quicktime_hdlr_dump(quicktime_hdlr_t *hdlr)
00061 {
00062 printf(" handler reference (hdlr)\n");
00063 printf(" version %d\n", hdlr->version);
00064 printf(" flags %d\n", hdlr->flags);
00065 printf(" component_type %c%c%c%c\n", hdlr->component_type[0], hdlr->component_type[1], hdlr->component_type[2], hdlr->component_type[3]);
00066 printf(" component_subtype %c%c%c%c\n", hdlr->component_subtype[0], hdlr->component_subtype[1], hdlr->component_subtype[2], hdlr->component_subtype[3]);
00067 printf(" component_name %s\n", hdlr->component_name);
00068 }
00069
00070 void quicktime_read_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr)
00071 {
00072 hdlr->version = quicktime_read_char(file);
00073 hdlr->flags = quicktime_read_int24(file);
00074 quicktime_read_char32(file, hdlr->component_type);
00075 quicktime_read_char32(file, hdlr->component_subtype);
00076 hdlr->component_manufacturer = quicktime_read_int32(file);
00077 hdlr->component_flags = quicktime_read_int32(file);
00078 hdlr->component_flag_mask = quicktime_read_int32(file);
00079 quicktime_read_pascal(file, hdlr->component_name);
00080 }
00081
00082 void quicktime_write_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr)
00083 {
00084 quicktime_atom_t atom;
00085 quicktime_atom_write_header(file, &atom, "hdlr");
00086
00087 quicktime_write_char(file, hdlr->version);
00088 quicktime_write_int24(file, hdlr->flags);
00089 quicktime_write_char32(file, hdlr->component_type);
00090 quicktime_write_char32(file, hdlr->component_subtype);
00091 quicktime_write_int32(file, hdlr->component_manufacturer);
00092 quicktime_write_int32(file, hdlr->component_flags);
00093 quicktime_write_int32(file, hdlr->component_flag_mask);
00094 quicktime_write_pascal(file, hdlr->component_name);
00095
00096 quicktime_atom_write_footer(file, &atom);
00097 }