# HG changeset patch # User michael # Date 1278083367 0 # Node ID b9bf2d18f51e0ae17f3be96c986fd68ee1b1df81 # Parent 9b579e53bd0301e75c1163f7807bb66b810a786a 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 diff -r 9b579e53bd03 -r b9bf2d18f51e avidec.c --- a/avidec.c Fri Jul 02 12:50:19 2010 +0000 +++ b/avidec.c Fri Jul 02 15:09:27 2010 +0000 @@ -48,6 +48,7 @@ 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 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 @@ 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;