1 #include "funcprotos.h"
5 void quicktime_elst_table_init(quicktime_elst_table_t
*table
)
12 void quicktime_elst_table_delete(quicktime_elst_table_t
*table
)
16 void quicktime_read_elst_table(quicktime_t
*file
, quicktime_elst_table_t
*table
)
18 table
->duration
= quicktime_read_int32(file
);
19 table
->time
= quicktime_read_int32(file
);
20 table
->rate
= quicktime_read_fixed32(file
);
23 void quicktime_write_elst_table(quicktime_t
*file
, quicktime_elst_table_t
*table
, long duration
)
25 table
->duration
= duration
;
26 quicktime_write_int32(file
, table
->duration
);
27 quicktime_write_int32(file
, table
->time
);
28 quicktime_write_fixed32(file
, table
->rate
);
31 void quicktime_elst_table_dump(quicktime_elst_table_t
*table
)
33 printf(" edit list table\n");
34 printf(" duration %ld\n", table
->duration
);
35 printf(" time %ld\n", table
->time
);
36 printf(" rate %f\n", table
->rate
);
39 void quicktime_elst_init(quicktime_elst_t
*elst
)
43 elst
->total_entries
= 0;
47 void quicktime_elst_init_all(quicktime_elst_t
*elst
)
49 if(!elst
->total_entries
)
51 elst
->total_entries
= 1;
52 elst
->table
= (quicktime_elst_table_t
*)calloc(1, sizeof(quicktime_elst_table_t
) * elst
->total_entries
);
53 quicktime_elst_table_init(&(elst
->table
[0]));
57 void quicktime_elst_delete(quicktime_elst_t
*elst
)
60 if(elst
->total_entries
)
62 for(i
= 0; i
< elst
->total_entries
; i
++)
63 quicktime_elst_table_delete(&(elst
->table
[i
]));
66 elst
->total_entries
= 0;
69 void quicktime_elst_dump(quicktime_elst_t
*elst
)
72 printf(" edit list (elst)\n");
73 printf(" version %d\n", elst
->version
);
74 printf(" flags %d\n", elst
->flags
);
75 printf(" total_entries %d\n", elst
->total_entries
);
77 for(i
= 0; i
< elst
->total_entries
; i
++)
79 quicktime_elst_table_dump(&(elst
->table
[i
]));
83 void quicktime_read_elst(quicktime_t
*file
, quicktime_elst_t
*elst
)
86 quicktime_atom_t leaf_atom
;
88 elst
->version
= quicktime_read_char(file
);
89 elst
->flags
= quicktime_read_int24(file
);
90 elst
->total_entries
= quicktime_read_int32(file
);
91 elst
->table
= (quicktime_elst_table_t
*)calloc(1, sizeof(quicktime_elst_table_t
) * elst
->total_entries
);
92 for(i
= 0; i
< elst
->total_entries
; i
++)
94 quicktime_elst_table_init(&(elst
->table
[i
]));
95 quicktime_read_elst_table(file
, &(elst
->table
[i
]));
99 void quicktime_write_elst(quicktime_t
*file
, quicktime_elst_t
*elst
, long duration
)
101 quicktime_atom_t atom
;
103 quicktime_atom_write_header(file
, &atom
, "elst");
105 quicktime_write_char(file
, elst
->version
);
106 quicktime_write_int24(file
, elst
->flags
);
107 quicktime_write_int32(file
, elst
->total_entries
);
108 for(i
= 0; i
< elst
->total_entries
; i
++)
110 quicktime_write_elst_table(file
, elst
->table
, duration
);
113 quicktime_atom_write_footer(file
, &atom
);