1 #include "funcprotos.h"
6 void quicktime_minf_init(quicktime_minf_t
*minf
)
8 minf
->is_video
= minf
->is_audio
= 0;
9 quicktime_vmhd_init(&(minf
->vmhd
));
10 quicktime_smhd_init(&(minf
->smhd
));
11 quicktime_hdlr_init(&(minf
->hdlr
));
12 quicktime_dinf_init(&(minf
->dinf
));
13 quicktime_stbl_init(&(minf
->stbl
));
16 void quicktime_minf_init_video(quicktime_t
*file
,
17 quicktime_minf_t
*minf
,
25 //printf("quicktime_minf_init_video 1\n");
26 quicktime_vmhd_init_video(file
, &(minf
->vmhd
), frame_w
, frame_h
, frame_rate
);
27 //printf("quicktime_minf_init_video 1 %d %f\n", time_scale, frame_rate);
28 quicktime_stbl_init_video(file
, &(minf
->stbl
), frame_w
, frame_h
, time_scale
, frame_rate
, compressor
);
29 //printf("quicktime_minf_init_video 2\n");
30 quicktime_hdlr_init_data(&(minf
->hdlr
));
31 //printf("quicktime_minf_init_video 1\n");
32 quicktime_dinf_init_all(&(minf
->dinf
));
33 //printf("quicktime_minf_init_video 2\n");
36 void quicktime_minf_init_audio(quicktime_t
*file
,
37 quicktime_minf_t
*minf
,
44 /* smhd doesn't store anything worth initializing */
45 quicktime_stbl_init_audio(file
,
51 quicktime_hdlr_init_data(&(minf
->hdlr
));
52 quicktime_dinf_init_all(&(minf
->dinf
));
55 void quicktime_minf_delete(quicktime_minf_t
*minf
)
57 quicktime_vmhd_delete(&(minf
->vmhd
));
58 quicktime_smhd_delete(&(minf
->smhd
));
59 quicktime_dinf_delete(&(minf
->dinf
));
60 quicktime_stbl_delete(&(minf
->stbl
));
61 quicktime_hdlr_delete(&(minf
->hdlr
));
64 void quicktime_minf_dump(quicktime_minf_t
*minf
)
66 printf(" media info\n");
67 printf(" is_audio %d\n", minf
->is_audio
);
68 printf(" is_video %d\n", minf
->is_video
);
69 if(minf
->is_audio
) quicktime_smhd_dump(&(minf
->smhd
));
70 if(minf
->is_video
) quicktime_vmhd_dump(&(minf
->vmhd
));
71 quicktime_hdlr_dump(&(minf
->hdlr
));
72 quicktime_dinf_dump(&(minf
->dinf
));
73 quicktime_stbl_dump(minf
, &(minf
->stbl
));
76 int quicktime_read_minf(quicktime_t
*file
, quicktime_minf_t
*minf
, quicktime_atom_t
*parent_atom
)
78 quicktime_atom_t leaf_atom
;
82 quicktime_atom_read_header(file
, &leaf_atom
);
83 //printf("quicktime_read_minf 1\n");
86 if(quicktime_atom_is(&leaf_atom
, "vmhd"))
87 { minf
->is_video
= 1; quicktime_read_vmhd(file
, &(minf
->vmhd
)); }
89 if(quicktime_atom_is(&leaf_atom
, "smhd"))
90 { minf
->is_audio
= 1; quicktime_read_smhd(file
, &(minf
->smhd
)); }
92 if(quicktime_atom_is(&leaf_atom
, "hdlr"))
94 quicktime_read_hdlr(file
, &(minf
->hdlr
));
95 /* Main Actor doesn't write component name */
96 quicktime_atom_skip(file
, &leaf_atom
);
99 if(quicktime_atom_is(&leaf_atom
, "dinf"))
100 { quicktime_read_dinf(file
, &(minf
->dinf
), &leaf_atom
); }
102 if(quicktime_atom_is(&leaf_atom
, "stbl"))
103 { quicktime_read_stbl(file
, minf
, &(minf
->stbl
), &leaf_atom
); }
105 quicktime_atom_skip(file
, &leaf_atom
);
106 }while(quicktime_position(file
) < parent_atom
->end
);
111 void quicktime_write_minf(quicktime_t
*file
, quicktime_minf_t
*minf
)
113 quicktime_atom_t atom
;
114 quicktime_atom_write_header(file
, &atom
, "minf");
116 if(minf
->is_video
) quicktime_write_vmhd(file
, &(minf
->vmhd
));
117 if(minf
->is_audio
) quicktime_write_smhd(file
, &(minf
->smhd
));
118 quicktime_write_hdlr(file
, &(minf
->hdlr
));
119 quicktime_write_dinf(file
, &(minf
->dinf
));
120 quicktime_write_stbl(file
, minf
, &(minf
->stbl
));
122 quicktime_atom_write_footer(file
, &atom
);