[SCM] libav/experimental: In dv decoder, set sample aspect aspect ratio, fix issue #1612

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:16:25 UTC 2013


The following commit has been merged in the experimental branch:
commit 2a5db1aa588eb157c35e44ca2a76a1184aa5bcf4
Author: Baptiste Coudurier <baptiste.coudurier at gmail.com>
Date:   Mon Sep 27 21:31:29 2010 +0000

    In dv decoder, set sample aspect aspect ratio, fix issue #1612
    
    Originally committed as revision 25232 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 63b1f02..564ccb3 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -1081,6 +1081,8 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     DVVideoContext *s = avctx->priv_data;
+    const uint8_t* vsc_pack;
+    int apt, is16_9;
 
     s->sys = ff_dv_frame_profile(s->sys, buf, buf_size);
     if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
@@ -1114,6 +1116,14 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = s->picture;
 
+    /* Determine the codec's sample_aspect ratio from the packet */
+    vsc_pack = buf + 80*5 + 48 + 5;
+    if ( *vsc_pack == dv_video_control ) {
+        apt = buf[4] & 0x07;
+        is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07)));
+        avctx->sample_aspect_ratio = s->sys->sar[is16_9];
+    }
+
     return s->sys->frame_size;
 }
 #endif /* CONFIG_DVVIDEO_DECODER */

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list