[FFmpeg-cvslog] r24124 - trunk/libavformat/movenc.c

bcoudurier subversion
Thu Jul 8 23:57:20 CEST 2010


Author: bcoudurier
Date: Thu Jul  8 23:57:20 2010
New Revision: 24124

Log:
In mov muxer, write pixel aspect ratio tag in mov files.
Based on a patch by Daniel Kristjansson, danielk at cuymedia dot net

Modified:
   trunk/libavformat/movenc.c

Modified: trunk/libavformat/movenc.c
==============================================================================
--- trunk/libavformat/movenc.c	Thu Jul  8 22:15:54 2010	(r24123)
+++ trunk/libavformat/movenc.c	Thu Jul  8 23:57:20 2010	(r24124)
@@ -747,6 +747,19 @@ static int mov_write_subtitle_tag(ByteIO
     return updateSize(pb, pos);
 }
 
+static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track)
+{
+    AVRational sar;
+    av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num,
+              track->enc->sample_aspect_ratio.den, INT_MAX);
+
+    put_be32(pb, 16);
+    put_tag(pb, "pasp");
+    put_be32(pb, track->enc->sample_aspect_ratio.num);
+    put_be32(pb, track->enc->sample_aspect_ratio.den);
+    return 16;
+}
+
 static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
 {
     int64_t pos = url_ftell(pb);
@@ -808,6 +821,12 @@ static int mov_write_video_tag(ByteIOCon
     } else if(track->vosLen > 0)
         mov_write_glbl_tag(pb, track);
 
+    if (track->mode == MODE_MOV &&
+        track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num &&
+        track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) {
+        mov_write_pasp_tag(pb, track);
+    }
+
     return updateSize(pb, pos);
 }
 



More information about the ffmpeg-cvslog mailing list