aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/flacenc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-09-13 23:45:24 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-01-21 15:33:19 -0500
commit243df1351d2d928caa084a5704ed783f0b83f072 (patch)
treec808f4b0cd026cf27b9b5a099fe5c68c58b88646 /libavcodec/flacenc.c
parent936f0d98f864f9f6bb4f9e5458b78537e146bacd (diff)
downloadffmpeg-243df1351d2d928caa084a5704ed783f0b83f072.tar.gz
lavc: Move {min,max}_prediction_order to codec private options
These options are only used by alac and flac. They are very codec-specific options, so deprecate the global variants. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r--libavcodec/flacenc.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 7349f44489..e25e867b9d 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -325,9 +325,9 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
if (s->options.max_partition_order < 0)
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
- if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
- s->options.min_prediction_order = 0;
- } else if (avctx->min_prediction_order >= 0) {
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->min_prediction_order >= 0) {
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
if (avctx->min_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_WARNING,
@@ -343,9 +343,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
}
s->options.min_prediction_order = avctx->min_prediction_order;
}
- if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
- s->options.max_prediction_order = 0;
- } else if (avctx->max_prediction_order >= 0) {
+ if (avctx->max_prediction_order >= 0) {
if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
if (avctx->max_prediction_order > MAX_FIXED_ORDER) {
av_log(avctx, AV_LOG_WARNING,
@@ -361,6 +359,26 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
}
s->options.max_prediction_order = avctx->max_prediction_order;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
+ s->options.min_prediction_order = 0;
+ s->options.max_prediction_order = 0;
+ } else if (s->options.lpc_type == FF_LPC_TYPE_FIXED) {
+ if (s->options.min_prediction_order > MAX_FIXED_ORDER) {
+ av_log(avctx, AV_LOG_WARNING,
+ "invalid min prediction order %d, clamped to %d\n",
+ s->options.min_prediction_order, MAX_FIXED_ORDER);
+ s->options.min_prediction_order = MAX_FIXED_ORDER;
+ }
+ if (s->options.max_prediction_order > MAX_FIXED_ORDER) {
+ av_log(avctx, AV_LOG_WARNING,
+ "invalid max prediction order %d, clamped to %d\n",
+ s->options.max_prediction_order, MAX_FIXED_ORDER);
+ s->options.max_prediction_order = MAX_FIXED_ORDER;
+ }
+ }
+
if (s->options.max_prediction_order < s->options.min_prediction_order) {
av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
s->options.min_prediction_order, s->options.max_prediction_order);
@@ -1332,6 +1350,9 @@ static const AVOption options[] = {
{ "left_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_LEFT_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
{ "right_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_RIGHT_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
{ "mid_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_MID_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
+{ "min_prediction_order", NULL, offsetof(FlacEncodeContext, options.min_prediction_order), AV_OPT_TYPE_INT, { .i64 = 0 }, MIN_LPC_ORDER, MAX_LPC_ORDER, FLAGS },
+{ "max_prediction_order", NULL, offsetof(FlacEncodeContext, options.max_prediction_order), AV_OPT_TYPE_INT, { .i64 = 0 }, MIN_LPC_ORDER, MAX_LPC_ORDER, FLAGS },
+
{ NULL },
};