1 #include "funcprotos.h"
4 void quicktime_mdhd_init(quicktime_mdhd_t
*mdhd
)
8 mdhd
->creation_time
= quicktime_current_time();
9 mdhd
->modification_time
= quicktime_current_time();
16 void quicktime_mdhd_init_video(quicktime_t
*file
,
17 quicktime_mdhd_t
*mdhd
,
22 mdhd
->time_scale
= quicktime_get_timescale(frame_rate
);
23 //printf("quicktime_mdhd_init_video %d %f\n", mdhd->time_scale, frame_rate);
24 mdhd
->duration
= 0; /* set this when closing */
27 void quicktime_mdhd_init_audio(quicktime_mdhd_t
*mdhd
,
30 mdhd
->time_scale
= sample_rate
;
31 mdhd
->duration
= 0; /* set this when closing */
34 void quicktime_mdhd_delete(quicktime_mdhd_t
*mdhd
)
38 void quicktime_read_mdhd(quicktime_t
*file
, quicktime_mdhd_t
*mdhd
)
40 mdhd
->version
= quicktime_read_char(file
);
41 mdhd
->flags
= quicktime_read_int24(file
);
42 mdhd
->creation_time
= quicktime_read_int32(file
);
43 mdhd
->modification_time
= quicktime_read_int32(file
);
44 mdhd
->time_scale
= quicktime_read_int32(file
);
45 mdhd
->duration
= quicktime_read_int32(file
);
46 mdhd
->language
= quicktime_read_int16(file
);
47 mdhd
->quality
= quicktime_read_int16(file
);
50 void quicktime_mdhd_dump(quicktime_mdhd_t
*mdhd
)
52 printf(" media header\n");
53 printf(" version %d\n", mdhd
->version
);
54 printf(" flags %d\n", mdhd
->flags
);
55 printf(" creation_time %u\n", mdhd
->creation_time
);
56 printf(" modification_time %u\n", mdhd
->modification_time
);
57 printf(" time_scale %d\n", mdhd
->time_scale
);
58 printf(" duration %d\n", mdhd
->duration
);
59 printf(" language %d\n", mdhd
->language
);
60 printf(" quality %d\n", mdhd
->quality
);
63 void quicktime_write_mdhd(quicktime_t
*file
, quicktime_mdhd_t
*mdhd
)
65 quicktime_atom_t atom
;
66 quicktime_atom_write_header(file
, &atom
, "mdhd");
68 quicktime_write_char(file
, mdhd
->version
);
69 quicktime_write_int24(file
, mdhd
->flags
);
70 quicktime_write_int32(file
, mdhd
->creation_time
);
71 quicktime_write_int32(file
, mdhd
->modification_time
);
72 quicktime_write_int32(file
, mdhd
->time_scale
);
73 quicktime_write_int32(file
, mdhd
->duration
);
74 quicktime_write_int16(file
, mdhd
->language
);
75 quicktime_write_int16(file
, mdhd
->quality
);
77 quicktime_atom_write_footer(file
, &atom
);