1 #include "funcprotos.h"
6 int quicktime_mvhd_init(quicktime_mvhd_t
*mvhd
)
11 mvhd
->creation_time
= quicktime_current_time();
12 mvhd
->modification_time
= quicktime_current_time();
13 mvhd
->time_scale
= 600;
15 mvhd
->preferred_rate
= 1.0;
16 mvhd
->preferred_volume
= 0.996094;
17 for(i
= 0; i
< 10; i
++) mvhd
->reserved
[i
] = 0;
18 quicktime_matrix_init(&(mvhd
->matrix
));
19 mvhd
->preview_time
= 0;
20 mvhd
->preview_duration
= 0;
21 mvhd
->poster_time
= 0;
22 mvhd
->selection_time
= 0;
23 mvhd
->selection_duration
= 0;
24 mvhd
->current_time
= 0;
25 mvhd
->next_track_id
= 1;
29 int quicktime_mvhd_delete(quicktime_mvhd_t
*mvhd
)
34 void quicktime_mvhd_dump(quicktime_mvhd_t
*mvhd
)
36 printf(" movie header\n");
37 printf(" version %d\n", mvhd
->version
);
38 printf(" flags %ld\n", mvhd
->flags
);
39 printf(" creation_time %u\n", mvhd
->creation_time
);
40 printf(" modification_time %u\n", mvhd
->modification_time
);
41 printf(" time_scale %ld\n", mvhd
->time_scale
);
42 printf(" duration %ld\n", mvhd
->duration
);
43 printf(" preferred_rate %f\n", mvhd
->preferred_rate
);
44 printf(" preferred_volume %f\n", mvhd
->preferred_volume
);
45 quicktime_print_chars(" reserved ", mvhd
->reserved
, 10);
46 quicktime_matrix_dump(&(mvhd
->matrix
));
47 printf(" preview_time %ld\n", mvhd
->preview_time
);
48 printf(" preview_duration %ld\n", mvhd
->preview_duration
);
49 printf(" poster_time %ld\n", mvhd
->poster_time
);
50 printf(" selection_time %ld\n", mvhd
->selection_time
);
51 printf(" selection_duration %ld\n", mvhd
->selection_duration
);
52 printf(" current_time %ld\n", mvhd
->current_time
);
53 printf(" next_track_id %ld\n", mvhd
->next_track_id
);
56 void quicktime_read_mvhd(quicktime_t
*file
, quicktime_mvhd_t
*mvhd
, quicktime_atom_t
*parent_atom
)
58 mvhd
->version
= quicktime_read_char(file
);
59 mvhd
->flags
= quicktime_read_int24(file
);
60 mvhd
->creation_time
= quicktime_read_int32(file
);
61 mvhd
->modification_time
= quicktime_read_int32(file
);
62 mvhd
->time_scale
= quicktime_read_int32(file
);
63 mvhd
->duration
= quicktime_read_int32(file
);
64 mvhd
->preferred_rate
= quicktime_read_fixed32(file
);
65 mvhd
->preferred_volume
= quicktime_read_fixed16(file
);
66 quicktime_read_data(file
, mvhd
->reserved
, 10);
67 quicktime_read_matrix(file
, &(mvhd
->matrix
));
68 mvhd
->preview_time
= quicktime_read_int32(file
);
69 mvhd
->preview_duration
= quicktime_read_int32(file
);
70 mvhd
->poster_time
= quicktime_read_int32(file
);
71 mvhd
->selection_time
= quicktime_read_int32(file
);
72 mvhd
->selection_duration
= quicktime_read_int32(file
);
73 mvhd
->current_time
= quicktime_read_int32(file
);
74 mvhd
->next_track_id
= quicktime_read_int32(file
);
77 void quicktime_mhvd_init_video(quicktime_t
*file
, quicktime_mvhd_t
*mvhd
, double frame_rate
)
79 mvhd
->time_scale
= quicktime_get_timescale(frame_rate
);
82 void quicktime_write_mvhd(quicktime_t
*file
, quicktime_mvhd_t
*mvhd
)
84 quicktime_atom_t atom
;
85 quicktime_atom_write_header(file
, &atom
, "mvhd");
87 quicktime_write_char(file
, mvhd
->version
);
88 quicktime_write_int24(file
, mvhd
->flags
);
89 quicktime_write_int32(file
, mvhd
->creation_time
);
90 quicktime_write_int32(file
, mvhd
->modification_time
);
91 quicktime_write_int32(file
, mvhd
->time_scale
);
92 quicktime_write_int32(file
, mvhd
->duration
);
93 quicktime_write_fixed32(file
, mvhd
->preferred_rate
);
94 quicktime_write_fixed16(file
, mvhd
->preferred_volume
);
95 quicktime_write_data(file
, mvhd
->reserved
, 10);
96 quicktime_write_matrix(file
, &(mvhd
->matrix
));
97 quicktime_write_int32(file
, mvhd
->preview_time
);
98 quicktime_write_int32(file
, mvhd
->preview_duration
);
99 quicktime_write_int32(file
, mvhd
->poster_time
);
100 quicktime_write_int32(file
, mvhd
->selection_time
);
101 quicktime_write_int32(file
, mvhd
->selection_duration
);
102 quicktime_write_int32(file
, mvhd
->current_time
);
103 quicktime_write_int32(file
, mvhd
->next_track_id
);
105 quicktime_atom_write_footer(file
, &atom
);