[FFmpeg-cvslog] r25232 - trunk/libavcodec/dv.c

bcoudurier subversion
Mon Sep 27 23:31:30 CEST 2010


Author: bcoudurier
Date: Mon Sep 27 23:31:29 2010
New Revision: 25232

Log:
In dv decoder, set sample aspect aspect ratio, fix issue #1612

Modified:
   trunk/libavcodec/dv.c

Modified: trunk/libavcodec/dv.c
==============================================================================
--- trunk/libavcodec/dv.c	Mon Sep 27 23:30:41 2010	(r25231)
+++ trunk/libavcodec/dv.c	Mon Sep 27 23:31:29 2010	(r25232)
@@ -1081,6 +1081,8 @@ static int dvvideo_decode_frame(AVCodecC
     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(AVCodecC
     *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 */



More information about the ffmpeg-cvslog mailing list