[FFmpeg-devel] [PATCH] movenc: byteswap codec_tag in mov_write_ms_tag

Janne Grunau janne-ffmpeg
Thu Jan 27 18:18:30 CET 2011


On Thu, Jan 27, 2011 at 04:50:22PM +0000, M?ns Rullg?rd wrote:
> Janne Grunau <janne-ffmpeg at jannau.net> writes:
> 
> > based on Alex Converse's "Fix ADPCM MS in mov muxing" patch
> > ---
> >  libavformat/movenc.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index 6061701..1279853 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -318,8 +318,8 @@ static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track)
> >  {
> >      int64_t pos = url_ftell(pb);
> >      put_be32(pb, 0);
> > -    put_le32(pb, track->tag);
> > -    track->enc->codec_tag = track->tag >> 16;
> > +    put_le32(pb, track->tag); // store it byteswapped
> > +    track->enc->codec_tag = ((track->tag >> 8) & 0xFF00) + ((track->tag >> 24) & 0xFF);
> >      ff_put_wav_header(pb, track->enc);
> >      return updateSize(pb, pos);
> >  }
> 
> There is a newer version of that patch in the same thread.

bah, /me blames patchwork

Janne
-- 8< --
based on Alex Converse's "Fix ADPCM MS in mov muxing" patch
---
 libavformat/movenc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6061701..0949d29 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -318,8 +318,8 @@ static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track)
 {
     int64_t pos = url_ftell(pb);
     put_be32(pb, 0);
-    put_le32(pb, track->tag);
-    track->enc->codec_tag = track->tag >> 16;
+    put_le32(pb, track->tag); // store it byteswapped
+    track->enc->codec_tag = av_bswap16(track->tag >> 16);
     ff_put_wav_header(pb, track->enc);
     return updateSize(pb, pos);
 }
-- 
1.7.4.rc2




More information about the ffmpeg-devel mailing list