diff options
author | Mike Melanson <mike@multimedia.cx> | 2002-06-07 02:48:31 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2002-06-07 02:48:31 +0000 |
commit | 15891af86f77397a56b6a2b6e28cac2cf8ca4713 (patch) | |
tree | af47db9d37bcc8b98fcada541378a3c8c7e7645f /src | |
parent | eb4a0ced215a63478a1a941f0eecc61413eef44e (diff) | |
download | xine-lib-15891af86f77397a56b6a2b6e28cac2cf8ca4713.tar.gz xine-lib-15891af86f77397a56b6a2b6e28cac2cf8ca4713.tar.bz2 |
added hack to fix audio pts calculation...the calculation could stand to
be revised so it it not stretched out over so many places
CVS patchset: 2029
CVS date: 2002/06/07 02:48:31
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/demux_qt.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index ea89cfa9d..7adb9a24a 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.46 2002/06/07 02:40:47 miguelfreitas Exp $ + * $Id: demux_qt.c,v 1.47 2002/06/07 02:48:31 tmmm Exp $ * */ @@ -124,6 +124,7 @@ typedef struct { unsigned int size; int64_t pts; int keyframe; + unsigned int official_byte_count; } qt_frame; typedef struct { @@ -562,6 +563,7 @@ static qt_error build_frame_table(qt_sample_table *sample_table) { int64_t current_pts; unsigned int pts_index; unsigned int pts_index_countdown; + unsigned int official_audio_byte_counter = 0; /* AUDIO and OTHER frame types follow the same rules; VIDEO follows a * different set */ @@ -671,6 +673,30 @@ static qt_error build_frame_table(qt_sample_table *sample_table) { if (!sample_table->frames) return QT_NO_MEMORY; + if (sample_table->type == MEDIA_AUDIO) { + /* iterate through each start chunk in the stsc table */ + for (i = 0; i < sample_table->sample_to_chunk_count; i++) { + /* iterate from the first chunk of the current table entry to + * the first chunk of the next table entry */ + chunk_start = sample_table->sample_to_chunk_table[i].first_chunk; + if (i < sample_table->sample_to_chunk_count - 1) + chunk_end = + sample_table->sample_to_chunk_table[i + 1].first_chunk; + else + /* if the first chunk is in the last table entry, iterate to the + final chunk number (the number of offsets in stco table) */ + chunk_end = sample_table->chunk_offset_count + 1; + + /* iterate through each sample in a chunk */ + for (j = chunk_start - 1; j < chunk_end - 1; j++) { + sample_table->frames[j].official_byte_count = + official_audio_byte_counter; + official_audio_byte_counter += + sample_table->sample_to_chunk_table[i].samples_per_chunk; + } + } + } + for (i = 0; i < sample_table->frame_count; i++) { sample_table->frames[i].type = sample_table->type; sample_table->frames[i].offset = sample_table->chunk_offset_table[i]; @@ -825,7 +851,7 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) { /* .pts currently holds the total nubmer of bytes for the stream */ total_audio_bytes = info->frames[i].pts; info->frames[i].pts = audio_pts_multiplier; - info->frames[i].pts *= audio_byte_counter; + info->frames[i].pts *= info->frames[i].official_byte_count; info->frames[i].pts /= total_audio_bytes; /* figure out the audio frame size */ |