diff options
Diffstat (limited to 'lib/ffmpeg/libavcodec/dv.c')
-rw-r--r-- | lib/ffmpeg/libavcodec/dv.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ffmpeg/libavcodec/dv.c b/lib/ffmpeg/libavcodec/dv.c index 9f53562328..6a4914768d 100644 --- a/lib/ffmpeg/libavcodec/dv.c +++ b/lib/ffmpeg/libavcodec/dv.c @@ -948,7 +948,7 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg) int mb_x, mb_y, c_offset, linesize, y_stride; uint8_t* y_ptr; uint8_t* dif; - uint8_t scratch[64]; + LOCAL_ALIGNED_8(uint8_t, scratch, [64]); EncBlockInfo enc_blks[5*DV_MAX_BPM]; PutBitContext pbs[5*DV_MAX_BPM]; PutBitContext* pb; @@ -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 */ @@ -1280,7 +1290,7 @@ static int dvvideo_close(AVCodecContext *c) #if CONFIG_DVVIDEO_ENCODER -AVCodec dvvideo_encoder = { +AVCodec ff_dvvideo_encoder = { "dvvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_DVVIDEO, @@ -1293,7 +1303,7 @@ AVCodec dvvideo_encoder = { #endif // CONFIG_DVVIDEO_ENCODER #if CONFIG_DVVIDEO_DECODER -AVCodec dvvideo_decoder = { +AVCodec ff_dvvideo_decoder = { "dvvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_DVVIDEO, |