summaryrefslogtreecommitdiff
path: root/libavcodec/alacenc.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/alacenc.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/alacenc.c')
-rw-r--r--libavcodec/alacenc.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c
index 8a94f81bb4..4857338e9c 100644
--- a/libavcodec/alacenc.c
+++ b/libavcodec/alacenc.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/opt.h"
+
#include "avcodec.h"
#include "put_bits.h"
#include "internal.h"
@@ -57,6 +59,7 @@ typedef struct AlacLPCContext {
} AlacLPCContext;
typedef struct AlacEncodeContext {
+ AVCodecContext *avctx;
int frame_size; /**< current frame size */
int verbatim; /**< current frame verbatim mode flag */
int compression_level;
@@ -73,7 +76,6 @@ typedef struct AlacEncodeContext {
RiceContext rc;
AlacLPCContext lpc[2];
LPCContext lpc_ctx;
- AVCodecContext *avctx;
} AlacEncodeContext;
@@ -544,7 +546,8 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
AV_WB8(alac_extradata+20, s->rc.k_modifier);
}
- s->min_prediction_order = DEFAULT_MIN_PRED_ORDER;
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->min_prediction_order >= 0) {
if (avctx->min_prediction_order < MIN_LPC_ORDER ||
avctx->min_prediction_order > ALAC_MAX_LPC_ORDER) {
@@ -557,7 +560,6 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->min_prediction_order = avctx->min_prediction_order;
}
- s->max_prediction_order = DEFAULT_MAX_PRED_ORDER;
if (avctx->max_prediction_order >= 0) {
if (avctx->max_prediction_order < MIN_LPC_ORDER ||
avctx->max_prediction_order > ALAC_MAX_LPC_ORDER) {
@@ -569,6 +571,8 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->max_prediction_order = avctx->max_prediction_order;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (s->max_prediction_order < s->min_prediction_order) {
av_log(avctx, AV_LOG_ERROR,
@@ -634,12 +638,29 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return 0;
}
+#define OFFSET(x) offsetof(AlacEncodeContext, x)
+#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MIN_PRED_ORDER }, MIN_LPC_ORDER, ALAC_MAX_LPC_ORDER, AE },
+ { "max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MAX_PRED_ORDER }, MIN_LPC_ORDER, ALAC_MAX_LPC_ORDER, AE },
+
+ { NULL },
+};
+
+static const AVClass alacenc_class = {
+ .class_name = "alacenc",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_alac_encoder = {
.name = "alac",
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
.type = AVMEDIA_TYPE_AUDIO,
.id = AV_CODEC_ID_ALAC,
.priv_data_size = sizeof(AlacEncodeContext),
+ .priv_class = &alacenc_class,
.init = alac_encode_init,
.encode2 = alac_encode_frame,
.close = alac_encode_close,