Mercurial > libavformat.hg
changeset 6243:40f3dc7e5fcb libavformat
In mov muxer, write pixel aspect ratio tag in mov files.
Based on a patch by Daniel Kristjansson, danielk at cuymedia dot net
author | bcoudurier |
---|---|
date | Thu, 08 Jul 2010 21:57:20 +0000 |
parents | 79b5e6fa86c9 |
children | 17483b8b01e7 |
files | movenc.c |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/movenc.c Wed Jul 07 20:03:15 2010 +0000 +++ b/movenc.c Thu Jul 08 21:57:20 2010 +0000 @@ -747,6 +747,19 @@ 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 @@ } 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); }