From 2c3d93648768cf2c00ea1731e096f698c0fae7f6 Mon Sep 17 00:00:00 2001 From: Burt P Date: Wed, 5 Oct 2016 12:52:56 -0500 Subject: af_hdcd: disable auto-convert by default As all known valid HDCD sample formats and sample rates are now handled by the filter, remove the scan that "invades the privacy" of the filter graph and turn off autoconvert by default as requested by Nicolas George. http://ffmpeg.org/pipermail/ffmpeg-devel/2016-August/197571.html Signed-off-by: Burt P --- libavfilter/af_hdcd.c | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) (limited to 'libavfilter/af_hdcd.c') diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 47543298a4..91f84aea22 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -985,7 +985,7 @@ typedef struct HDCDContext { #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption hdcd_options[] = { { "disable_autoconvert", "Disable any format conversion or resampling in the filter graph.", - OFFSET(disable_autoconvert), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, A }, + OFFSET(disable_autoconvert), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, A }, { "process_stereo", "Process stereo channels together. Only apply target_gain when both channels match.", OFFSET(process_stereo), AV_OPT_TYPE_BOOL, { .i64 = HDCD_PROCESS_STEREO_DEFAULT }, 0, 1, A }, { "cdt_ms", "Code detect timer period in ms.", @@ -1710,7 +1710,6 @@ static av_cold int init(AVFilterContext *ctx) static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; HDCDContext *s = ctx->priv; - AVFilterLink *lk; int c; av_log(ctx, AV_LOG_VERBOSE, "Auto-convert: %s\n", @@ -1751,24 +1750,6 @@ static int config_input(AVFilterLink *inlink) { av_log(ctx, AV_LOG_VERBOSE, "Analyze mode: [%d] %s\n", s->analyze_mode, ana_mode_str[s->analyze_mode] ); - lk = inlink; - while(lk != NULL) { - AVFilterContext *nextf = lk->src; - if (lk->type == AVMEDIA_TYPE_AUDIO) { - int sfok = (lk->format == AV_SAMPLE_FMT_S16 || - lk->format == AV_SAMPLE_FMT_S16P); - if ( !sfok || lk->sample_rate != 44100) { - av_log(ctx, AV_LOG_WARNING, "An input format is %s@%dHz at %s. It will truncated/resampled to s16@44100Hz.\n", - av_get_sample_fmt_name(lk->format), lk->sample_rate, - (nextf->name) ? nextf->name : "" - ); - s->bad_config = 1; - break; - } - } - lk = (nextf->inputs) ? nextf->inputs[0] : NULL; - } - /* more warning will appear after config_output() */ return 0; } @@ -1782,36 +1763,10 @@ static const AVFilterPad avfilter_af_hdcd_inputs[] = { { NULL } }; -static int config_output(AVFilterLink *outlink) { - static const char hdcd_baduse[] = - "The HDCD filter is unlikely to produce a desirable result in this context."; - AVFilterContext *ctx = outlink->src; - HDCDContext *s = ctx->priv; - AVFilterLink *lk = outlink; - while(lk != NULL) { - AVFilterContext *nextf = lk->dst; - if (lk->type == AVMEDIA_TYPE_AUDIO) { - if (lk->format == AV_SAMPLE_FMT_S16 || lk->format == AV_SAMPLE_FMT_U8) { - av_log(ctx, AV_LOG_WARNING, "s24 output is being truncated to %s at %s.\n", - av_get_sample_fmt_name(lk->format), - (nextf->name) ? nextf->name : "" - ); - s->bad_config = 1; - break; - } - } - lk = (nextf->outputs) ? nextf->outputs[0] : NULL; - } - if (s->bad_config) - av_log(ctx, AV_LOG_WARNING, "%s\n", hdcd_baduse); - return 0; -} - static const AVFilterPad avfilter_af_hdcd_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .config_props = config_output, }, { NULL } }; -- cgit v1.2.3