set block align in av_write_header if not set, fix issue #489
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Mon, 8 Sep 2008 19:37:22 +0000 (19:37 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Mon, 8 Sep 2008 19:37:22 +0000 (19:37 +0000)
Originally committed as revision 15277 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index e82324f..c124507 100644 (file)
@@ -2444,6 +2444,9 @@ int av_write_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "sample rate not set\n");
                 return -1;
             }
+            if(!st->codec->block_align)
+                st->codec->block_align = st->codec->channels *
+                    av_get_bits_per_sample(st->codec->codec_id) >> 3;
             break;
         case CODEC_TYPE_VIDEO:
             if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ //FIXME audio too?