diff options
author | waker <wakeroid@gmail.com> | 2012-08-28 22:38:22 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-08-28 22:38:22 +0200 |
commit | 217c29ee38b46fa8472db8b2e17a42fd0f1155d3 (patch) | |
tree | 18f2cf1fc0dead5945dc52885db6c03dfe9c9eb8 /plugins/libmp4ff/mp4ff.c | |
parent | 7381e57f7ab86c8611d04b876bf428bd5eafb276 (diff) |
aac: added chunk and sample index creation
Diffstat (limited to 'plugins/libmp4ff/mp4ff.c')
-rw-r--r-- | plugins/libmp4ff/mp4ff.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/plugins/libmp4ff/mp4ff.c b/plugins/libmp4ff/mp4ff.c index 311746f2..41e0b391 100644 --- a/plugins/libmp4ff/mp4ff.c +++ b/plugins/libmp4ff/mp4ff.c @@ -33,6 +33,9 @@ #include <stdio.h> #include "mp4ffint.h" +#define trace(...) { fprintf(stderr, __VA_ARGS__); } +//#define trace(fmt,...) + mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f) { mp4ff_t *ff = malloc(sizeof(mp4ff_t)); @@ -59,6 +62,43 @@ mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f) return ff; } +void mp4ff_track_free (mp4ff_track_t *trk) { + if (trk->chunk_sample_first) { + free (trk->chunk_sample_first); + } + if (trk->chunk_first_dts) { + free (trk->chunk_first_dts); + } + if (trk->chunk_last_dts) { + free (trk->chunk_last_dts); + } + if (trk->p_sample_count_dts) { + for (int i = 0; i < trk->stsc_entry_count; i++) { + free (trk->p_sample_count_dts[i]); + } + free (trk->p_sample_count_dts); + } + if (trk->p_sample_delta_dts) { + for (int i = 0; i < trk->stsc_entry_count; i++) { + free (trk->p_sample_delta_dts[i]); + } + free (trk->p_sample_delta_dts); + } + if (trk->p_sample_count_pts) { + for (int i = 0; i < trk->stsc_entry_count; i++) { + free (trk->p_sample_count_pts[i]); + } + free (trk->p_sample_count_pts); + } + if (trk->p_sample_offset_pts) { + for (int i = 0; i < trk->stsc_entry_count; i++) { + free (trk->p_sample_offset_pts[i]); + } + free (trk->p_sample_offset_pts); + } + free (trk); +} + void mp4ff_close(mp4ff_t *ff) { int32_t i; @@ -91,7 +131,7 @@ void mp4ff_close(mp4ff_t *ff) if (ff->track[i]->p_drms) drms_free(ff->track[i]->p_drms); #endif - free(ff->track[i]); + mp4ff_track_free (ff->track[i]); } } @@ -176,6 +216,13 @@ int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only) } else { mp4ff_atom_read(f, (uint32_t)size, atom_type); } + if (atom_type == ATOM_TRAK) + { + trace ("mp4ff_track_create_chunks_index\n"); + mp4ff_track_create_chunks_index (f, f->track[f->total_tracks-1]); + trace ("mp4ff_track_create_samples_index\n"); + mp4ff_track_create_samples_index (f, f->track[f->total_tracks-1]); + } } return 0; |