diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-11-30 12:17:31 -0500 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-12-07 11:01:22 -0500 |
commit | be00ec832c519427cd92218abac77dafdc1d5487 (patch) | |
tree | 970ca330447b69c3dc6b1efc734cbdffd613e4eb /libavcodec/libschroedingerenc.c | |
parent | f1ccd076801444ab7f524cb13e0886faaf10fd50 (diff) |
lavc: Deprecate coder_type and its symbols
Most option values are simply unused or ignored and in practice the
majory of codecs only need to check whether to enable rle or not.
Add appropriate codec private options which better expose the allowed
features.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/libschroedingerenc.c')
-rw-r--r-- | libavcodec/libschroedingerenc.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index f390e4690e..e7c158aeaf 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -33,6 +33,7 @@ #include "libavutil/attributes.h" #include "libavutil/imgutils.h" +#include "libavutil/opt.h" #include "avcodec.h" #include "internal.h" @@ -71,6 +72,9 @@ typedef struct SchroEncoderParams { /* counter for frames submitted to encoder, used as dts */ int64_t dts; + + /** enable noarith */ + int noarith; } SchroEncoderParams; /** @@ -165,9 +169,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); @@ -442,6 +452,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", @@ -449,6 +473,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, |