[FFmpeg-devel] [PATCH 1/2] pcx: read sample aspect ratio

Paul B Mahol onemda at gmail.com
Thu Oct 11 12:59:01 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/pcx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index 06f0f0f..9168aef 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -102,6 +102,10 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     ymin = bytestream2_get_le16u(&gb);
     xmax = bytestream2_get_le16u(&gb);
     ymax = bytestream2_get_le16u(&gb);
+    avctx->sample_aspect_ratio.num = bytestream2_get_le16u(&gb);
+    avctx->sample_aspect_ratio.den = bytestream2_get_le16u(&gb);
+    if (avctx->sample_aspect_ratio.den == 0)
+        avctx->sample_aspect_ratio.den = 1;
 
     if (xmax < xmin || ymax < ymin) {
         av_log(avctx, AV_LOG_ERROR, "invalid image dimensions\n");
@@ -111,7 +115,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     w = xmax - xmin + 1;
     h = ymax - ymin + 1;
 
-    bytestream2_skipu(&gb, 53);
+    bytestream2_skipu(&gb, 49);
     nplanes            = bytestream2_get_byteu(&gb);
     bytes_per_line     = bytestream2_get_le16u(&gb);
     bytes_per_scanline = nplanes * bytes_per_line;
-- 
1.7.11.4



More information about the ffmpeg-devel mailing list