[FFmpeg-cvslog] pngenc: write sample aspect ratio

Paul B Mahol git at videolan.org
Sat Oct 13 18:08:08 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Oct 13 09:26:09 2012 +0000| [f58f90238fc63090da34c9fdb1d06d724d929f6d] | committer: Paul B Mahol

pngenc: write sample aspect ratio

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f58f90238fc63090da34c9fdb1d06d724d929f6d
---

 libavcodec/pngenc.c |    5 +++++
 tests/ref/lavf/png  |   12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 87d18d4..c91f289 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -335,6 +335,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
     png_write_chunk(&s->bytestream, MKTAG('I', 'H', 'D', 'R'), s->buf, 13);
 
+    AV_WB32(s->buf, avctx->sample_aspect_ratio.num);
+    AV_WB32(s->buf + 4, avctx->sample_aspect_ratio.den);
+    s->buf[8] = 0; /* unit specifier is unknown */
+    png_write_chunk(&s->bytestream, MKTAG('p', 'H', 'Y', 's'), s->buf, 9);
+
     /* put the palette if needed */
     if (color_type == PNG_COLOR_TYPE_PALETTE) {
         int has_alpha, alpha, i;
diff --git a/tests/ref/lavf/png b/tests/ref/lavf/png
index 4e64628..40e7cca 100644
--- a/tests/ref/lavf/png
+++ b/tests/ref/lavf/png
@@ -1,9 +1,9 @@
-c162094e51dc1a3203de43e496086dfd *./tests/data/images/png/02.png
+2af72da4468e61a37c220b25cb28618a *./tests/data/images/png/02.png
 ./tests/data/images/png/%02d.png CRC=0x6da01946
-248612 ./tests/data/images/png/02.png
-63805114b3723490833789277246276f *./tests/data/images/png/02.png
+248633 ./tests/data/images/png/02.png
+62b26c9582ba37dd37b76191338f3770 *./tests/data/images/png/02.png
 ./tests/data/images/png/%02d.png CRC=0x831a2963
-41666 ./tests/data/images/png/02.png
-b4c1f0b706a296ba6e791d436757dc5f *./tests/data/images/png/02.png
+41687 ./tests/data/images/png/02.png
+b4e38244c97debe3f528e7d1adb283ef *./tests/data/images/png/02.png
 ./tests/data/images/png/%02d.png CRC=0x5984c023
-511879 ./tests/data/images/png/02.png
+511900 ./tests/data/images/png/02.png



More information about the ffmpeg-cvslog mailing list