changeset 252:4aa51913d0b2 libavformat

provisions for raw PCM audio
author tmmm
date Thu, 18 Sep 2003 04:25:41 +0000
parents 300c94a708f7
children 408f620eed8c
files ipmovie.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ipmovie.c	Tue Sep 16 20:29:19 2003 +0000
+++ b/ipmovie.c	Thu Sep 18 04:25:41 2003 +0000
@@ -133,6 +133,12 @@
 
     if (s->audio_chunk_offset) {
 
+        /* adjust for PCM audio by skipping chunk header */
+        if (s->audio_type != CODEC_ID_INTERPLAY_DPCM) {
+            s->audio_chunk_offset += 6;
+            s->audio_chunk_size -= 6;
+        }
+
         url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
         s->audio_chunk_offset = 0;
 
@@ -568,8 +574,9 @@
     st->codec.sample_rate = ipmovie->audio_sample_rate;
     st->codec.bits_per_sample = ipmovie->audio_bits;
     st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
-        st->codec.bits_per_sample / 
-        (st->codec.codec_id == CODEC_ID_INTERPLAY_DPCM) ? 2 : 1;
+        st->codec.bits_per_sample;
+    if (st->codec.codec_id == CODEC_ID_INTERPLAY_DPCM)
+        st->codec.bit_rate /= 2;
     st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
 
     return 0;