changeset 4857:18acfe3fe3d5 libavformat

fix 6 channels raw pcm demuxing, raw pcm now demux a fixed number of samples
author bcoudurier
date Sun, 12 Apr 2009 00:25:37 +0000
parents c61f423b492c
children 4273f83dec05
files raw.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Sat Apr 11 22:38:00 2009 +0000
+++ b/raw.c	Sun Apr 12 00:25:37 2009 +0000
@@ -84,6 +84,9 @@
             st->codec->sample_rate = ap->sample_rate;
             if(ap->channels) st->codec->channels = ap->channels;
             else             st->codec->channels = 1;
+            st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
+            assert(st->codec->bits_per_coded_sample > 0);
+            st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
             av_set_pts_info(st, 64, 1, st->codec->sample_rate);
             break;
         case CODEC_TYPE_VIDEO:
@@ -104,13 +107,14 @@
 }
 
 #define RAW_PACKET_SIZE 1024
+#define RAW_SAMPLES     1024
 
 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret, size, bps;
     //    AVStream *st = s->streams[0];
 
-    size= RAW_PACKET_SIZE;
+    size= RAW_SAMPLES*s->streams[0]->codec->block_align;
 
     ret= av_get_packet(s->pb, pkt, size);