From 1d36fb13b088f55ece155153fb6ca8ea278fc837 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Mon, 8 Aug 2011 23:41:50 -0700 Subject: [PATCH 1/6] lavc: fix parentheses placement in avcodec_open2(). Signed-off-by: Anton Khirnov --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 64f623c161..0abab9a83d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -513,7 +513,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD av_opt_set_defaults(avctx->priv_data); } } - if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp) < 0)) + if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; From d271d5b2152cafe540f3ab71d3be6ce8636d2fd6 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 10 Aug 2011 14:07:35 -0400 Subject: [PATCH 2/6] Remove incorrect info in documentation of AVCodecContext.bits_per_raw_sample. bits_per_raw_sample is used in video as well, where sample_fmt is not used. --- libavcodec/avcodec.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 702e775d9d..5bc1878fd0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2587,7 +2587,6 @@ typedef struct AVCodecContext { /** * Bits per sample/pixel of internal libavcodec pixel/sample format. - * This field is applicable only when sample_fmt is AV_SAMPLE_FMT_S32. * - encoding: set by user. * - decoding: set by libavcodec. */ From 069083a419fc1a267ee997817c4e368fa67ca154 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 7 Aug 2011 17:12:49 -0400 Subject: [PATCH 3/6] ac3enc: clip coupling coordinates during calculation This is faster than using the clip_coefficients() function. Also, clipping the coordinates before determining reuse is better since it will compare coordinates that are closer to their final encoded values. --- libavcodec/ac3enc_template.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 7a6d72ff48..943a55a133 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -126,7 +126,7 @@ static inline float calc_cpl_coord(float energy_ch, float energy_cpl) float coord = 0.125; if (energy_cpl > 0) coord *= sqrtf(energy_ch / energy_cpl); - return coord; + return FFMIN(coord, COEF_MAX); } @@ -291,7 +291,6 @@ static void apply_channel_coupling(AC3EncodeContext *s) if (!block->cpl_in_use) continue; - clip_coefficients(&s->dsp, cpl_coords[blk][1], s->fbw_channels * 16); s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1], cpl_coords[blk][1], s->fbw_channels * 16); From 4a71da0f3ab7f5542decd11c81994f849d5b2c78 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 10 Aug 2011 18:52:11 +0100 Subject: [PATCH 4/6] cavs: fix some crashes with invalid bitstreams This removes all valgrind-reported invalid writes with one specific test file. Fixes http://www.ocert.org/advisories/ocert-2011-002.html Signed-off-by: Mans Rullgard --- libavcodec/cavsdec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index d5a21bf2de..88034068ff 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -130,12 +130,14 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, r++; mask = -(level_code & 1); level = (level^mask) - mask; - } else { + } else if (level_code >= 0) { level = r->rltab[level_code][0]; if(!level) //end of block signal break; run = r->rltab[level_code][1]; r += r->rltab[level_code][2]; + } else { + break; } level_buf[i] = level; run_buf[i] = run; @@ -189,7 +191,8 @@ static inline int decode_residual_inter(AVSContext *h) { static int decode_mb_i(AVSContext *h, int cbp_code) { GetBitContext *gb = &h->s.gb; - int block, pred_mode_uv; + unsigned pred_mode_uv; + int block; uint8_t top[18]; uint8_t *left = NULL; uint8_t *d; @@ -445,6 +448,8 @@ static inline int check_for_slice(AVSContext *h) { if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) { skip_bits_long(gb,24+align); h->stc = get_bits(gb,8); + if (h->stc >= h->mb_height) + return 0; decode_slice_header(h,gb); return 1; } @@ -659,7 +664,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, buf_end = buf + buf_size; for(;;) { buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc); - if(stc & 0xFFFFFE00) + if((stc & 0xFFFFFE00) || buf_ptr == buf_end) return FFMAX(0, buf_ptr - buf - s->parse_context.last_index); input_size = (buf_end - buf_ptr)*8; switch(stc) { From 9542ca9fb743d3fb595ec24c23f96037b15d6b53 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 10 Aug 2011 10:21:10 -0400 Subject: [PATCH 5/6] ac3enc: fix 'channel_coupling' option to actually allow 'auto'. Use 'auto' as the default value. --- libavcodec/ac3enc.c | 8 ++++++-- libavcodec/ac3enc_opts_template.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 291a60d2da..af837c3256 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2211,8 +2211,12 @@ static av_cold void set_bandwidth(AC3EncodeContext *s) cpl_start = s->options.cpl_start; } else { cpl_start = ac3_coupling_start_tab[s->channel_mode-2][s->bit_alloc.sr_code][s->frame_size_code/2]; - if (cpl_start < 0) - s->cpl_enabled = 0; + if (cpl_start < 0) { + if (s->options.channel_coupling < 0) + s->cpl_enabled = 0; + else + cpl_start = 15; + } } } if (s->cpl_enabled) { diff --git a/libavcodec/ac3enc_opts_template.c b/libavcodec/ac3enc_opts_template.c index 7c0eead011..342dcadd03 100644 --- a/libavcodec/ac3enc_opts_template.c +++ b/libavcodec/ac3enc_opts_template.c @@ -73,7 +73,7 @@ static const AVOption eac3_options[] = { /* Other Encoding Options */ {"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM}, #if AC3ENC_TYPE != AC3ENC_TYPE_AC3_FIXED -{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM, "channel_coupling"}, +{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM, "channel_coupling"}, {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, {"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 15, AC3ENC_PARAM, "cpl_start_band"}, {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, From c766eb1ce1edb3ad03472b78c21e42c543b04937 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 9 Aug 2011 18:11:08 -0400 Subject: [PATCH 6/6] ac3enc: add macros for option names to make them more understandable. --- libavcodec/ac3enc.c | 91 ++++++++++++++++--------------- libavcodec/ac3enc.h | 17 ++++++ libavcodec/ac3enc_opts_template.c | 62 ++++++++++----------- 3 files changed, 94 insertions(+), 76 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index af837c3256..3cfbbdf969 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1664,9 +1664,9 @@ static void dprint_options(AC3EncodeContext *s) if (opt->audio_production_info) { av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); switch (opt->room_type) { - case 0: av_strlcpy(strbuf, "notindicated", 32); break; - case 1: av_strlcpy(strbuf, "large", 32); break; - case 2: av_strlcpy(strbuf, "small", 32); break; + case AC3ENC_OPT_NOT_INDICATED: av_strlcpy(strbuf, "notindicated", 32); break; + case AC3ENC_OPT_LARGE_ROOM: av_strlcpy(strbuf, "large", 32); break; + case AC3ENC_OPT_SMALL_ROOM: av_strlcpy(strbuf, "small", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); } av_dlog(avctx, "room_type: %s\n", strbuf); @@ -1678,9 +1678,9 @@ static void dprint_options(AC3EncodeContext *s) av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); if (s->channel_mode == AC3_CHMODE_STEREO) { switch (opt->dolby_surround_mode) { - case 0: av_strlcpy(strbuf, "notindicated", 32); break; - case 1: av_strlcpy(strbuf, "on", 32); break; - case 2: av_strlcpy(strbuf, "off", 32); break; + case AC3ENC_OPT_NOT_INDICATED: av_strlcpy(strbuf, "notindicated", 32); break; + case AC3ENC_OPT_MODE_ON: av_strlcpy(strbuf, "on", 32); break; + case AC3ENC_OPT_MODE_OFF: av_strlcpy(strbuf, "off", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode); } av_dlog(avctx, "dsur_mode: %s\n", strbuf); @@ -1692,9 +1692,9 @@ static void dprint_options(AC3EncodeContext *s) if (s->bitstream_id == 6) { if (opt->extended_bsi_1) { switch (opt->preferred_stereo_downmix) { - case 0: av_strlcpy(strbuf, "notindicated", 32); break; - case 1: av_strlcpy(strbuf, "ltrt", 32); break; - case 2: av_strlcpy(strbuf, "loro", 32); break; + case AC3ENC_OPT_NOT_INDICATED: av_strlcpy(strbuf, "notindicated", 32); break; + case AC3ENC_OPT_DOWNMIX_LTRT: av_strlcpy(strbuf, "ltrt", 32); break; + case AC3ENC_OPT_DOWNMIX_LORO: av_strlcpy(strbuf, "loro", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix); } av_dlog(avctx, "dmix_mode: %s\n", strbuf); @@ -1711,23 +1711,23 @@ static void dprint_options(AC3EncodeContext *s) } if (opt->extended_bsi_2) { switch (opt->dolby_surround_ex_mode) { - case 0: av_strlcpy(strbuf, "notindicated", 32); break; - case 1: av_strlcpy(strbuf, "on", 32); break; - case 2: av_strlcpy(strbuf, "off", 32); break; + case AC3ENC_OPT_NOT_INDICATED: av_strlcpy(strbuf, "notindicated", 32); break; + case AC3ENC_OPT_MODE_ON: av_strlcpy(strbuf, "on", 32); break; + case AC3ENC_OPT_MODE_OFF: av_strlcpy(strbuf, "off", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode); } av_dlog(avctx, "dsurex_mode: %s\n", strbuf); switch (opt->dolby_headphone_mode) { - case 0: av_strlcpy(strbuf, "notindicated", 32); break; - case 1: av_strlcpy(strbuf, "on", 32); break; - case 2: av_strlcpy(strbuf, "off", 32); break; + case AC3ENC_OPT_NOT_INDICATED: av_strlcpy(strbuf, "notindicated", 32); break; + case AC3ENC_OPT_MODE_ON: av_strlcpy(strbuf, "on", 32); break; + case AC3ENC_OPT_MODE_OFF: av_strlcpy(strbuf, "off", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode); } av_dlog(avctx, "dheadphone_mode: %s\n", strbuf); switch (opt->ad_converter_type) { - case 0: av_strlcpy(strbuf, "standard", 32); break; - case 1: av_strlcpy(strbuf, "hdcd", 32); break; + case AC3ENC_OPT_ADCONV_STANDARD: av_strlcpy(strbuf, "standard", 32); break; + case AC3ENC_OPT_ADCONV_HDCD: av_strlcpy(strbuf, "hdcd", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type); } av_dlog(avctx, "ad_conv_type: %s\n", strbuf); @@ -1791,7 +1791,7 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) opt->eac3_info_metadata = 0; /* determine mixing metadata / xbsi1 use */ - if (s->channel_mode > AC3_CHMODE_STEREO && opt->preferred_stereo_downmix >= 0) { + if (s->channel_mode > AC3_CHMODE_STEREO && opt->preferred_stereo_downmix != AC3ENC_OPT_NONE) { opt->extended_bsi_1 = 1; opt->eac3_mixing_metadata = 1; } @@ -1810,28 +1810,29 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) /* determine info metadata use */ if (avctx->audio_service_type != AV_AUDIO_SERVICE_TYPE_MAIN) opt->eac3_info_metadata = 1; - if (opt->copyright >= 0 || opt->original >= 0) + if (opt->copyright != AC3ENC_OPT_NONE || opt->original != AC3ENC_OPT_NONE) opt->eac3_info_metadata = 1; if (s->channel_mode == AC3_CHMODE_STEREO && - (opt->dolby_headphone_mode >= 0 || opt->dolby_surround_mode >= 0)) + (opt->dolby_headphone_mode != AC3ENC_OPT_NONE || opt->dolby_surround_mode != AC3ENC_OPT_NONE)) opt->eac3_info_metadata = 1; - if (s->channel_mode >= AC3_CHMODE_2F2R && opt->dolby_surround_ex_mode >= 0) + if (s->channel_mode >= AC3_CHMODE_2F2R && opt->dolby_surround_ex_mode != AC3ENC_OPT_NONE) opt->eac3_info_metadata = 1; - if (opt->mixing_level >= 0 || opt->room_type >= 0 || opt->ad_converter_type >= 0) { + if (opt->mixing_level != AC3ENC_OPT_NONE || opt->room_type != AC3ENC_OPT_NONE || + opt->ad_converter_type != AC3ENC_OPT_NONE) { opt->audio_production_info = 1; opt->eac3_info_metadata = 1; } } else { /* determine audio production info use */ - if (opt->mixing_level >= 0 || opt->room_type >= 0) + if (opt->mixing_level != AC3ENC_OPT_NONE || opt->room_type != AC3ENC_OPT_NONE) opt->audio_production_info = 1; /* determine xbsi2 use */ - if (s->channel_mode >= AC3_CHMODE_2F2R && opt->dolby_surround_ex_mode >= 0) + if (s->channel_mode >= AC3_CHMODE_2F2R && opt->dolby_surround_ex_mode != AC3ENC_OPT_NONE) opt->extended_bsi_2 = 1; - if (s->channel_mode == AC3_CHMODE_STEREO && opt->dolby_headphone_mode >= 0) + if (s->channel_mode == AC3_CHMODE_STEREO && opt->dolby_headphone_mode != AC3ENC_OPT_NONE) opt->extended_bsi_2 = 1; - if (opt->ad_converter_type >= 0) + if (opt->ad_converter_type != AC3ENC_OPT_NONE) opt->extended_bsi_2 = 1; } @@ -1852,8 +1853,8 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) /* validate extended bsi 1 / mixing metadata */ if (opt->extended_bsi_1 || opt->eac3_mixing_metadata) { /* default preferred stereo downmix */ - if (opt->preferred_stereo_downmix < 0) - opt->preferred_stereo_downmix = 0; + if (opt->preferred_stereo_downmix == AC3ENC_OPT_NONE) + opt->preferred_stereo_downmix = AC3ENC_OPT_NOT_INDICATED; if (!s->eac3 || s->has_center) { /* validate Lt/Rt center mix level */ validate_mix_level(avctx, "ltrt_center_mix_level", @@ -1895,35 +1896,35 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) /* validate extended bsi 2 / info metadata */ if (opt->extended_bsi_2 || opt->eac3_info_metadata) { /* default dolby headphone mode */ - if (opt->dolby_headphone_mode < 0) - opt->dolby_headphone_mode = 0; + if (opt->dolby_headphone_mode == AC3ENC_OPT_NONE) + opt->dolby_headphone_mode = AC3ENC_OPT_NOT_INDICATED; /* default dolby surround ex mode */ - if (opt->dolby_surround_ex_mode < 0) - opt->dolby_surround_ex_mode = 0; + if (opt->dolby_surround_ex_mode == AC3ENC_OPT_NONE) + opt->dolby_surround_ex_mode = AC3ENC_OPT_NOT_INDICATED; /* default A/D converter type */ - if (opt->ad_converter_type < 0) - opt->ad_converter_type = 0; + if (opt->ad_converter_type == AC3ENC_OPT_NONE) + opt->ad_converter_type = AC3ENC_OPT_ADCONV_STANDARD; } /* copyright & original defaults */ if (!s->eac3 || opt->eac3_info_metadata) { /* default copyright */ - if (opt->copyright < 0) - opt->copyright = 0; + if (opt->copyright == AC3ENC_OPT_NONE) + opt->copyright = AC3ENC_OPT_OFF; /* default original */ - if (opt->original < 0) - opt->original = 1; + if (opt->original == AC3ENC_OPT_NONE) + opt->original = AC3ENC_OPT_ON; } /* dolby surround mode default */ if (!s->eac3 || opt->eac3_info_metadata) { - if (opt->dolby_surround_mode < 0) - opt->dolby_surround_mode = 0; + if (opt->dolby_surround_mode == AC3ENC_OPT_NONE) + opt->dolby_surround_mode = AC3ENC_OPT_NOT_INDICATED; } /* validate audio production info */ if (opt->audio_production_info) { - if (opt->mixing_level < 0) { + if (opt->mixing_level == AC3ENC_OPT_NONE) { av_log(avctx, AV_LOG_ERROR, "mixing_level must be set if " "room_type is set\n"); return AVERROR(EINVAL); @@ -1934,8 +1935,8 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) return AVERROR(EINVAL); } /* default room type */ - if (opt->room_type < 0) - opt->room_type = 0; + if (opt->room_type == AC3ENC_OPT_NONE) + opt->room_type = AC3ENC_OPT_NOT_INDICATED; } /* set bitstream id for alternate bitstream syntax */ @@ -2207,12 +2208,12 @@ static av_cold void set_bandwidth(AC3EncodeContext *s) /* initialize coupling strategy */ if (s->cpl_enabled) { - if (s->options.cpl_start >= 0) { + if (s->options.cpl_start != AC3ENC_OPT_AUTO) { cpl_start = s->options.cpl_start; } else { cpl_start = ac3_coupling_start_tab[s->channel_mode-2][s->bit_alloc.sr_code][s->frame_size_code/2]; if (cpl_start < 0) { - if (s->options.channel_coupling < 0) + if (s->options.channel_coupling == AC3ENC_OPT_AUTO) s->cpl_enabled = 0; else cpl_start = 15; diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h index 98e2432cc5..65e88c9e01 100644 --- a/libavcodec/ac3enc.h +++ b/libavcodec/ac3enc.h @@ -65,6 +65,23 @@ typedef int32_t CoefType; typedef int64_t CoefSumType; #endif +/* common option values */ +#define AC3ENC_OPT_NONE -1 +#define AC3ENC_OPT_AUTO -1 +#define AC3ENC_OPT_OFF 0 +#define AC3ENC_OPT_ON 1 +#define AC3ENC_OPT_NOT_INDICATED 0 +#define AC3ENC_OPT_MODE_ON 1 +#define AC3ENC_OPT_MODE_OFF 2 + +/* specific option values */ +#define AC3ENC_OPT_LARGE_ROOM 1 +#define AC3ENC_OPT_SMALL_ROOM 2 +#define AC3ENC_OPT_DOWNMIX_LTRT 1 +#define AC3ENC_OPT_DOWNMIX_LORO 2 +#define AC3ENC_OPT_ADCONV_STANDARD 0 +#define AC3ENC_OPT_ADCONV_HDCD 1 + /** * Encoding Options used by AVOption. diff --git a/libavcodec/ac3enc_opts_template.c b/libavcodec/ac3enc_opts_template.c index 342dcadd03..fdbbd5f743 100644 --- a/libavcodec/ac3enc_opts_template.c +++ b/libavcodec/ac3enc_opts_template.c @@ -37,46 +37,46 @@ static const AVOption eac3_options[] = { {"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_6DB }, 0.0, 1.0, AC3ENC_PARAM}, #endif /* audio production information */ -{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 111, AC3ENC_PARAM}, -{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "room_type"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, - {"large", "Large Room", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, - {"small", "Small Room", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, +{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 111, AC3ENC_PARAM}, +{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_SMALL_ROOM, AC3ENC_PARAM, "room_type"}, + {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, + {"large", "Large Room", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_LARGE_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, + {"small", "Small Room", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_SMALL_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, /* other metadata options */ -{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM}, +{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, {"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, {.dbl = -31 }, -31, -1, AC3ENC_PARAM}, -{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dsur_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, - {"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, - {"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, -{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM}, +{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsur_mode"}, + {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, + {"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, + {"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, +{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, /* extended bitstream information */ -{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dmix_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, - {"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, - {"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, +{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_DOWNMIX_LORO, AC3ENC_PARAM, "dmix_mode"}, + {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, + {"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LTRT }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, + {"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LORO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, {"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, {"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, {"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, {"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, -{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dsurex_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, - {"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, - {"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, -{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dheadphone_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, - {"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, - {"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, -{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM, "ad_conv_type"}, - {"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, - {"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, +{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsurex_mode"}, + {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, + {"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, + {"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, +{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dheadphone_mode"}, + {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, + {"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, + {"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, +{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_ADCONV_HDCD, AC3ENC_PARAM, "ad_conv_type"}, + {"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_STANDARD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, + {"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_HDCD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, /* Other Encoding Options */ -{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM}, +{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_ON }, AC3ENC_OPT_OFF, AC3ENC_OPT_ON, AC3ENC_PARAM}, #if AC3ENC_TYPE != AC3ENC_TYPE_AC3_FIXED -{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM, "channel_coupling"}, - {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, -{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 15, AC3ENC_PARAM, "cpl_start_band"}, - {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, +{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, AC3ENC_OPT_ON, AC3ENC_PARAM, "channel_coupling"}, + {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, +{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, 15, AC3ENC_PARAM, "cpl_start_band"}, + {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, #endif {NULL} };