[FFmpeg-devel] [PATCH] Fix ADPCM MS in mov muxing

Måns Rullgård mans
Sat Jan 22 14:04:02 CET 2011


Alex Converse <alex.converse at gmail.com> writes:

> ---
>  libavformat/movenc.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
>
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 5230938..a464238 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -339,6 +339,13 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
>          mov_write_ac3_tag(pb, track);
>      } else if (track->enc->codec_id == CODEC_ID_ALAC) {
>          mov_write_extradata_tag(pb, track);
> +    } else if (track->enc->codec_id == CODEC_ID_ADPCM_MS) {
> +        int64_t pos = url_ftell(pb);
> +        put_be32(pb, 0);
> +        put_le32(pb, track->tag); // store it byteswapped
> +        track->enc->codec_tag = ((track->tag >> 8) & 0xFF00) + ((track->tag >> 24) & 0xFF);

av_bswap16(track->tag >> 16) would be easier to understand at a glance.

> +        ff_put_wav_header(pb, track->enc);
> +        updateSize(pb, pos);
>      }
>  
>      put_be32(pb, 8);     /* size */
[...]
> @@ -2108,6 +2118,7 @@ static int mov_write_header(AVFormatContext *s)
>              if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
>                  av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
>                  goto error;
> +            }else if(st->codec->codec_id == CODEC_ID_ADPCM_MS) {
>              }else if(st->codec->frame_size > 1){ /* assume compressed audio */
>                  track->audio_vbr = 1;
>              }else{

This looks a bit odd.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list