[FFmpeg-devel] [PATCH] adpcm-ima-wav fix bytespersec field in wav header

Michael Niedermayer michaelni
Tue Nov 13 19:05:44 CET 2007


On Tue, Nov 13, 2007 at 05:00:25PM +0300, Timofei V. Bondarenko wrote:
> Hi,
>
> The patch does write correct bitrate/bytespersecond field in the WAV header 
> for adpcm-ima-wav codec.
>
> Regards,
> 	Tim.
>
> PS
> I've already sent this patch one week ago but didn't received any comments.

> Index: libavformat/riff.c
> ===================================================================
> --- libavformat/riff.c	(revision 10939)
> +++ libavformat/riff.c	(working copy)
> @@ -280,6 +280,8 @@
>          enc->codec_id == CODEC_ID_PCM_S32LE ||
>          enc->codec_id == CODEC_ID_PCM_S16LE) {
>          bytespersec = enc->sample_rate * blkalign;
> +    } else if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
> +        bytespersec = enc->sample_rate * enc->block_align / enc->frame_size;
>      } else {
>          bytespersec = enc->bit_rate / 8;
>      }

does the following work as well?

 if (enc->codec_id == CODEC_ID_PCM_U8 ||
        enc->codec_id == CODEC_ID_PCM_S24LE ||
        enc->codec_id == CODEC_ID_PCM_S32LE ||
        enc->codec_id == CODEC_ID_PCM_S16LE ||
+       enc->enc->block_align
        ) {
        bytespersec = enc->sample_rate * blkalign;
    } else {

if so, i think it would be preferable as its more general, your solution
would need a check per codec

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071113/52945c4c/attachment.pgp>



More information about the ffmpeg-devel mailing list