r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / quicktime / avi_movi.c
blobb2677e0ee3a8ac903e01eab9f67c7d962ad51fb1
1 #include "funcprotos.h"
2 #include "quicktime.h"
4 void quicktime_delete_movi(quicktime_t *file, quicktime_movi_t *movi)
6 int i;
7 for(i = 0; i < file->moov.total_tracks; i++)
9 if(movi->ix[i]) quicktime_delete_ix(movi->ix[i]);
13 void quicktime_init_movi(quicktime_t *file, quicktime_riff_t *riff)
15 int i;
16 quicktime_riff_t *first_riff = file->riff[0];
17 quicktime_movi_t *movi = &riff->movi;
19 quicktime_atom_write_header(file, &movi->atom, "LIST");
20 quicktime_write_char32(file, "movi");
22 // Initialize partial indexes and relative positions for ix entries
23 for(i = 0; i < file->moov.total_tracks; i++)
25 quicktime_strl_t *strl = first_riff->hdrl.strl[i];
26 quicktime_trak_t *trak = file->moov.trak[i];
27 quicktime_ix_t *ix =
28 movi->ix[i] =
29 quicktime_new_ix(file, trak, strl);
33 void quicktime_read_movi(quicktime_t *file,
34 quicktime_atom_t *parent_atom,
35 quicktime_movi_t *movi)
37 movi->atom.size = parent_atom->size;
38 // Relative to start of the movi string
39 movi->atom.start = parent_atom->start + 8;
40 quicktime_atom_skip(file, parent_atom);
43 void quicktime_finalize_movi(quicktime_t *file, quicktime_movi_t *movi)
45 int i;
46 // Pad movi to get an even number of bytes
47 char temp[2] = { 0, 0 };
48 quicktime_write_data(file,
49 temp,
50 (quicktime_position(file) - movi->atom.start) % 2);
52 for(i = 0; i < file->moov.total_tracks; i++)
54 quicktime_ix_t *ix = movi->ix[i];
55 // Write partial indexes and update super index
56 quicktime_write_ix(file, ix, i);
59 quicktime_atom_write_footer(file, &movi->atom);