diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-08-23 11:06:32 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-09-05 08:02:28 +0200 |
commit | d1ba5d883ef95489fe59d035dd71105dc1184e84 (patch) | |
tree | 5e3cddaa264e2de0a1d530ce552a40851af50be0 /libavcodec/dvenc.c | |
parent | b62d41df07c627a677c69da139fd7e3710495a3a (diff) |
lavc/dv: remove ff_dvvideo_init()
The function contains only two assignments, setting DVVideoContext.avctx
and AVCodecContext.chroma_sample_location. However, the decoder does not
use the former, and the encoder should not be setting the latter.
Therefore move the first assignment to dvenc and the second to dvdec.
Make the encoder warn if the user-signalled chroma sample location does
not match the supported one, and return an error on higher compliance
levels.
Diffstat (limited to 'libavcodec/dvenc.c')
-rw-r--r-- | libavcodec/dvenc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index 78328f544c..7ae2c0c3d5 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -55,6 +55,16 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) PixblockDSPContext pdsp; int ret; + s->avctx = avctx; + + if (avctx->chroma_sample_location != AVCHROMA_LOC_TOPLEFT) { + const char *name = av_chroma_location_name(avctx->chroma_sample_location); + av_log(avctx, AV_LOG_WARNING, "Only top-left chroma location is supported " + "in DV, input value is: %s\n", name ? name : "unknown"); + if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) + return AVERROR(EINVAL); + } + s->sys = av_dv_codec_profile2(avctx->width, avctx->height, avctx->pix_fmt, avctx->time_base); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " @@ -91,7 +101,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) } #endif - return ff_dvvideo_init(avctx); + return 0; } /* bit budget for AC only in 5 MBs */ |