diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-07-02 15:09:27 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-07-02 15:09:27 +0000 |
commit | d01144b9d3f592f1140b9f8418e76a126b3a17b0 (patch) | |
tree | 01253e91841d80c41423c3261024ea9526df388d /libavformat/avidec.c | |
parent | 79042a6eb150e5d80a0e7bf242d9945d1246703b (diff) | |
download | ffmpeg-d01144b9d3f592f1140b9f8418e76a126b3a17b0.tar.gz |
Duplicate rounding that MS does in one of their implementations of an avi demuxer.
Fixes issue740
Based on patch by Cory Fields theuni-nospam- >xbmc @org
Originally committed as revision 23999 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r-- | libavformat/avidec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 9037650f1d..0341f18e37 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -48,6 +48,7 @@ typedef struct AVIStream { int prefix_count; uint32_t pal[256]; int has_pal; + int block_align; ///< AVCodecContext.block_align copied here for easier access } AVIStream; typedef struct { @@ -92,6 +93,8 @@ static void print_tag(const char *str, unsigned int tag, int size) static inline int get_duration(AVIStream *ast, int len){ if(ast->sample_size){ return len; + }else if (ast->block_align){ + return (len + ast->block_align - 1)/ast->block_align; }else return 1; } @@ -569,6 +572,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) break; case AVMEDIA_TYPE_AUDIO: ff_get_wav_header(pb, st->codec, size); + ast->block_align= st->codec->block_align; if(ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align){ av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size= st->codec->block_align; |