1 #include "funcprotos.h"
5 void quicktime_mdia_init(quicktime_mdia_t
*mdia
)
7 quicktime_mdhd_init(&(mdia
->mdhd
));
8 quicktime_hdlr_init(&(mdia
->hdlr
));
9 quicktime_minf_init(&(mdia
->minf
));
12 void quicktime_mdia_init_video(quicktime_t
*file
,
13 quicktime_mdia_t
*mdia
,
19 //printf("quicktime_mdia_init_video 1\n");
20 quicktime_mdhd_init_video(file
, &(mdia
->mdhd
), frame_w
, frame_h
, frame_rate
);
21 //printf("quicktime_mdia_init_video 1 %d %f\n", mdia->mdhd.time_scale, frame_rate);
22 quicktime_minf_init_video(file
, &(mdia
->minf
), frame_w
, frame_h
, mdia
->mdhd
.time_scale
, frame_rate
, compressor
);
23 //printf("quicktime_mdia_init_video 1\n");
24 quicktime_hdlr_init_video(&(mdia
->hdlr
));
25 //printf("quicktime_mdia_init_video 2\n");
28 void quicktime_mdia_init_audio(quicktime_t
*file
,
29 quicktime_mdia_t
*mdia
,
35 quicktime_mdhd_init_audio(&(mdia
->mdhd
),
37 quicktime_minf_init_audio(file
,
43 quicktime_hdlr_init_audio(&(mdia
->hdlr
));
46 void quicktime_mdia_delete(quicktime_mdia_t
*mdia
)
48 quicktime_mdhd_delete(&(mdia
->mdhd
));
49 quicktime_hdlr_delete(&(mdia
->hdlr
));
50 quicktime_minf_delete(&(mdia
->minf
));
53 void quicktime_mdia_dump(quicktime_mdia_t
*mdia
)
56 quicktime_mdhd_dump(&(mdia
->mdhd
));
57 quicktime_hdlr_dump(&(mdia
->hdlr
));
58 quicktime_minf_dump(&(mdia
->minf
));
61 int quicktime_read_mdia(quicktime_t
*file
, quicktime_mdia_t
*mdia
, quicktime_atom_t
*trak_atom
)
63 quicktime_atom_t leaf_atom
;
67 quicktime_atom_read_header(file
, &leaf_atom
);
68 //printf("quicktime_read_mdia %llx\n", quicktime_position(file));
71 if(quicktime_atom_is(&leaf_atom
, "mdhd"))
72 { quicktime_read_mdhd(file
, &(mdia
->mdhd
)); }
74 if(quicktime_atom_is(&leaf_atom
, "hdlr"))
76 quicktime_read_hdlr(file
, &(mdia
->hdlr
));
77 /* Main Actor doesn't write component name */
78 quicktime_atom_skip(file
, &leaf_atom
);
81 if(quicktime_atom_is(&leaf_atom
, "minf"))
82 { quicktime_read_minf(file
, &(mdia
->minf
), &leaf_atom
); }
84 quicktime_atom_skip(file
, &leaf_atom
);
85 }while(quicktime_position(file
) < trak_atom
->end
);
90 void quicktime_write_mdia(quicktime_t
*file
, quicktime_mdia_t
*mdia
)
92 quicktime_atom_t atom
;
93 quicktime_atom_write_header(file
, &atom
, "mdia");
95 quicktime_write_mdhd(file
, &(mdia
->mdhd
));
96 quicktime_write_hdlr(file
, &(mdia
->hdlr
));
97 quicktime_write_minf(file
, &(mdia
->minf
));
99 quicktime_atom_write_footer(file
, &atom
);