X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibschroedingerenc.c;h=d5da6fc6f21aa64df5ae6f7aaa7805ff27bd92be;hb=7d8891593c2833cdb6612828700efc2931377f76;hp=c5d6e764c78c827b5742a1f5c61a0009fc1c9a9a;hpb=6f0eb6229218a52afafb0430471729d30197b603;p=ffmpeg diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index c5d6e764c78..d5da6fc6f21 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -34,6 +34,7 @@ #include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/imgutils.h" +#include "libavutil/opt.h" #include "avcodec.h" #include "internal.h" @@ -43,6 +44,8 @@ /** libschroedinger encoder private data */ typedef struct SchroEncoderParams { + AVClass *class; + /** Schroedinger video format */ SchroVideoFormat *format; @@ -72,6 +75,9 @@ typedef struct SchroEncoderParams { /* counter for frames submitted to encoder, used as dts */ int64_t dts; + + /** enable noarith */ + int noarith; } SchroEncoderParams; /** @@ -166,9 +172,15 @@ static av_cold int libschroedinger_encode_init(AVCodecContext *avctx) "gop_structure", SCHRO_ENCODER_GOP_INTRA_ONLY); - if (avctx->coder_type == FF_CODER_TYPE_VLC) - schro_encoder_setting_set_double(p_schro_params->encoder, - "enable_noarith", 1); +#if FF_API_CODER_TYPE +FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->coder_type != FF_CODER_TYPE_VLC) + p_schro_params->noarith = 0; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + schro_encoder_setting_set_double(p_schro_params->encoder, + "enable_noarith", + p_schro_params->noarith); } else { schro_encoder_setting_set_double(p_schro_params->encoder, "au_distance", avctx->gop_size); @@ -441,6 +453,20 @@ static int libschroedinger_encode_close(AVCodecContext *avctx) return 0; } +#define OFFSET(x) offsetof(SchroEncoderParams, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM +static const AVOption options[] = { + { "noarith", "Enable noarith", OFFSET(noarith), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, + + { NULL }, +}; + +static const AVClass libschroedinger_class = { + .class_name = "libschroedinger", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_libschroedinger_encoder = { .name = "libschroedinger", @@ -448,6 +474,7 @@ AVCodec ff_libschroedinger_encoder = { .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_DIRAC, .priv_data_size = sizeof(SchroEncoderParams), + .priv_class = &libschroedinger_class, .init = libschroedinger_encode_init, .encode2 = libschroedinger_encode_frame, .close = libschroedinger_encode_close,