diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2010-07-08 21:57:20 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2010-07-08 21:57:20 +0000 |
commit | b015be214235b5f93129be71a3613f6ab06270d1 (patch) | |
tree | 93106cce9cb808ae2c4b7c891fae45e16dd831b1 /libavformat/movenc.c | |
parent | 40fe5019ef02aa46caac05a8d8b5022fd2bb3c17 (diff) | |
download | ffmpeg-b015be214235b5f93129be71a3613f6ab06270d1.tar.gz |
In mov muxer, write pixel aspect ratio tag in mov files.
Based on a patch by Daniel Kristjansson, danielk at cuymedia dot net
Originally committed as revision 24124 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index c401862179..c0efa3a96d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -747,6 +747,19 @@ static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) 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(ByteIOContext *pb, MOVTrack *track) } 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); } |