summaryrefslogtreecommitdiffstats
path: root/libavcodec/dvdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2014-04-28 16:08:33 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2014-06-20 10:39:33 -0400
commit9e500efdbe0deeff1602500ebc229a0a6b6bb1a2 (patch)
treeab9fefcc3d3bab4d2a75f427e96587fd61ec2770 /libavcodec/dvdec.c
parentd349afb07bacccb62eb5369c38d6406d2909d792 (diff)
downloadffmpeg-streaming-9e500efdbe0deeff1602500ebc229a0a6b6bb1a2.zip
ffmpeg-streaming-9e500efdbe0deeff1602500ebc229a0a6b6bb1a2.tar.gz
Add av_image_check_sar() and use it to validate SAR
Diffstat (limited to 'libavcodec/dvdec.c')
-rw-r--r--libavcodec/dvdec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index f354b9e..89f5821 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -36,6 +36,7 @@
*/
#include "libavutil/internal.h"
+#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
@@ -347,6 +348,14 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
if (ret < 0)
return ret;
+ /* 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)));
+ ff_set_sar(avctx, s->sys->sar[is16_9]);
+ }
+
if (ff_get_buffer(avctx, s->frame, 0) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
@@ -363,14 +372,6 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
/* return image */
*got_frame = 1;
- /* 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;
}
OpenPOWER on IntegriCloud