* [FFmpeg-devel] [PATCH 2/7 v2] avformat/pcmdec: add support to set channel layout in sln demuxer
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 3/7 v2] avformat/dfpwmdec: add support to set channel layout James Almer
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
Deprecate the channels option, and ensure ch_layout has priority if set over
channels, until the latter is gone.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/pcmdec.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 962faad4a7..be45188999 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -180,7 +180,12 @@ PCMDEF(vidc, "PCM Archimedes VIDC", NULL, VIDC)
#if CONFIG_SLN_DEMUXER
static const AVOption sln_options[] = {
{ "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
- { "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+#if FF_API_OLD_CHANNEL_LAYOUT
+ { "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
+ { "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#else
+ { "ch_layout", "", offsetof(PCMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#endif
{ NULL },
};
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 3/7 v2] avformat/dfpwmdec: add support to set channel layout
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 2/7 v2] avformat/pcmdec: add support to set channel layout in sln demuxer James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 4/7 v2] avformat/test/seek: set ch_layout instead of channels James Almer
` (3 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
Deprecate the channels option, and ensure ch_layout has priority if set over
channels, until the latter is gone.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/dfpwmdec.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
index 9f935a422a..685b95148c 100644
--- a/libavformat/dfpwmdec.c
+++ b/libavformat/dfpwmdec.c
@@ -31,7 +31,10 @@
typedef struct DFPWMAudioDemuxerContext {
AVClass *class;
int sample_rate;
+#if FF_API_OLD_CHANNEL_LAYOUT
int channels;
+#endif
+ AVChannelLayout ch_layout;
} DFPWMAudioDemuxerContext;
static int dfpwm_read_header(AVFormatContext *s)
@@ -39,6 +42,7 @@ static int dfpwm_read_header(AVFormatContext *s)
DFPWMAudioDemuxerContext *s1 = s->priv_data;
AVCodecParameters *par;
AVStream *st;
+ int ret;
st = avformat_new_stream(s, NULL);
if (!st)
@@ -48,7 +52,16 @@ static int dfpwm_read_header(AVFormatContext *s)
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = s->iformat->raw_codec_id;
par->sample_rate = s1->sample_rate;
- par->ch_layout.nb_channels = s1->channels;
+#if FF_API_OLD_CHANNEL_LAYOUT
+ if (s1->ch_layout.nb_channels) {
+#endif
+ ret = av_channel_layout_copy(&par->ch_layout, &s1->ch_layout);
+ if (ret < 0)
+ return ret;
+#if FF_API_OLD_CHANNEL_LAYOUT
+ } else
+ par->ch_layout.nb_channels = s1->channels;
+#endif
par->bits_per_coded_sample = 1;
par->block_align = 1;
@@ -58,7 +71,12 @@ static int dfpwm_read_header(AVFormatContext *s)
static const AVOption dfpwm_options[] = {
{ "sample_rate", "", offsetof(DFPWMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
- { "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+#if FF_API_OLD_CHANNEL_LAYOUT
+ { "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
+ { "ch_layout", "", offsetof(DFPWMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#else
+ { "ch_layout", "", offsetof(DFPWMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#endif
{ NULL },
};
static const AVClass dfpwm_demuxer_class = {
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 4/7 v2] avformat/test/seek: set ch_layout instead of channels
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 2/7 v2] avformat/pcmdec: add support to set channel layout in sln demuxer James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 3/7 v2] avformat/dfpwmdec: add support to set channel layout James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 5/7 v2] ffmpeg: replace custom channel_layout code with an SpecifierOpt based one James Almer
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
No changes since last version.
libavformat/tests/seek.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c
index e0067a64fc..94a72d9422 100644
--- a/libavformat/tests/seek.c
+++ b/libavformat/tests/seek.c
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
}
}
- av_dict_set(&format_opts, "channels", "1", 0);
+ av_dict_set(&format_opts, "ch_layout", "mono", 0);
av_dict_set(&format_opts, "sample_rate", "22050", 0);
if (argc < 2) {
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 5/7 v2] ffmpeg: replace custom channel_layout code with an SpecifierOpt based one
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
` (2 preceding siblings ...)
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 4/7 v2] avformat/test/seek: set ch_layout instead of channels James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 6/7] ffmpeg: add a ch_layout option as an alias to channel_layout James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option James Almer
5 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
This is cleaner and allows fine tuning which stream the option is applied to.
Signed-off-by: James Almer <jamrial@gmail.com>
---
No changes since last version.
fftools/ffmpeg.h | 2 ++
fftools/ffmpeg_opt.c | 84 ++++++++++++++++++--------------------------
2 files changed, 36 insertions(+), 50 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 6a19dc9c7c..1e14bf9fa9 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -96,6 +96,8 @@ typedef struct OptionsContext {
SpecifierOpt *codec_names;
int nb_codec_names;
+ SpecifierOpt *audio_ch_layouts;
+ int nb_audio_ch_layouts;
SpecifierOpt *audio_channels;
int nb_audio_channels;
SpecifierOpt *audio_sample_rate;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 70e6502f22..f5c759c6d1 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -55,6 +55,7 @@
static const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
static const char *const opt_name_audio_channels[] = {"ac", NULL};
+static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", NULL};
static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
static const char *const opt_name_frame_rates[] = {"r", NULL};
static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL};
@@ -1124,6 +1125,15 @@ static int open_input_file(OptionsContext *o, const char *filename)
av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
}
}
+ if (o->nb_audio_ch_layouts) {
+ const AVClass *priv_class;
+ if (file_iformat && (priv_class = file_iformat->priv_class) &&
+ av_opt_find(&priv_class, "ch_layout", NULL, 0,
+ AV_OPT_SEARCH_FAKE_OBJ)) {
+ av_dict_set(&o->g->format_opts, "ch_layout", o->audio_ch_layouts[o->nb_audio_ch_layouts - 1].u.str, 0);
+ }
+
+ }
if (o->nb_frame_rates) {
const AVClass *priv_class;
/* set the format-level framerate option;
@@ -1946,6 +1956,7 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
if (!ost->stream_copy) {
int channels = 0;
+ char *layout = NULL;
char *sample_fmt = NULL;
MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st);
@@ -1954,6 +1965,27 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
audio_enc->ch_layout.nb_channels = channels;
}
+ MATCH_PER_STREAM_OPT(audio_ch_layouts, str, layout, oc, st);
+ if (layout) {
+ if (av_channel_layout_from_string(&audio_enc->ch_layout, layout) < 0) {
+#if FF_API_OLD_CHANNEL_LAYOUT
+ uint64_t mask;
+ AV_NOWARN_DEPRECATED({
+ mask = av_get_channel_layout(layout);
+ })
+ if (!mask) {
+#endif
+ av_log(NULL, AV_LOG_FATAL, "Unknown channel layout: %s\n", layout);
+ exit_program(1);
+#if FF_API_OLD_CHANNEL_LAYOUT
+ }
+ av_log(NULL, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
+ layout);
+ av_channel_layout_from_mask(&audio_enc->ch_layout, mask);
+#endif
+ }
+ }
+
MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
if (sample_fmt &&
(audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) {
@@ -3235,54 +3267,6 @@ static int opt_timecode(void *optctx, const char *opt, const char *arg)
return ret;
}
-static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
-{
- OptionsContext *o = optctx;
- char layout_str[32];
- char *stream_str;
- char *ac_str;
- int ret, ac_str_size;
- AVChannelLayout layout = { 0 };
-
- ret = av_channel_layout_from_string(&layout, arg);
- if (ret < 0) {
-#if FF_API_OLD_CHANNEL_LAYOUT
- uint64_t mask;
- AV_NOWARN_DEPRECATED({
- mask = av_get_channel_layout(arg);
- })
- if (!mask) {
-#endif
- av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
- return AVERROR(EINVAL);
-#if FF_API_OLD_CHANNEL_LAYOUT
- }
- av_log(NULL, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
- arg);
- av_channel_layout_from_mask(&layout, mask);
-#endif
- }
-
- ret = opt_default_new(o, opt, arg);
- if (ret < 0)
- return ret;
-
- /* set 'ac' option based on channel layout */
- snprintf(layout_str, sizeof(layout_str), "%d", layout.nb_channels);
- stream_str = strchr(opt, ':');
- ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
- ac_str = av_mallocz(ac_str_size);
- if (!ac_str)
- return AVERROR(ENOMEM);
- av_strlcpy(ac_str, "ac", 3);
- if (stream_str)
- av_strlcat(ac_str, stream_str, ac_str_size);
- ret = parse_option(o, ac_str, layout_str, options);
- av_free(ac_str);
-
- return ret;
-}
-
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
{
OptionsContext *o = optctx;
@@ -3827,8 +3811,8 @@ const OptionDef options[] = {
{ "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(sample_fmts) },
"set sample format", "format" },
- { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
- OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_channel_layout },
+ { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
+ OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
"set audio filters", "filter_graph" },
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 6/7] ffmpeg: add a ch_layout option as an alias to channel_layout
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
` (3 preceding siblings ...)
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 5/7 v2] ffmpeg: replace custom channel_layout code with an SpecifierOpt based one James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option James Almer
5 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
This ensures it's parsed as a CLI option instead of the AVCodecContext AVOption.
Signed-off-by: James Almer <jamrial@gmail.com>
---
fftools/ffmpeg_opt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f5c759c6d1..720a3cc46a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -55,7 +55,7 @@
static const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
static const char *const opt_name_audio_channels[] = {"ac", NULL};
-static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", NULL};
+static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", "ch_layout", NULL};
static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
static const char *const opt_name_frame_rates[] = {"r", NULL};
static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL};
@@ -3814,6 +3814,9 @@ const OptionDef options[] = {
{ "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
"set channel layout", "layout" },
+ { "ch_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
+ OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
+ "set channel layout", "layout" },
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
"set audio filters", "filter_graph" },
{ "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) },
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option
2022-03-20 19:36 [FFmpeg-devel] [PATCH 1/7] avformat/pcmdec: deprecate channels option James Almer
` (4 preceding siblings ...)
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 6/7] ffmpeg: add a ch_layout option as an alias to channel_layout James Almer
@ 2022-03-20 19:36 ` James Almer
2022-03-20 19:44 ` Nicolas George
5 siblings, 1 reply; 14+ messages in thread
From: James Almer @ 2022-03-20 19:36 UTC (permalink / raw)
To: ffmpeg-devel
Same as the AVCodecContext option.
Signed-off-by: James Almer <jamrial@gmail.com>
---
fftools/ffmpeg.h | 2 ++
fftools/ffmpeg_opt.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1e14bf9fa9..d0bc4b6afb 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -98,8 +98,10 @@ typedef struct OptionsContext {
int nb_codec_names;
SpecifierOpt *audio_ch_layouts;
int nb_audio_ch_layouts;
+#if FF_API_OLD_CHANNEL_LAYOUT
SpecifierOpt *audio_channels;
int nb_audio_channels;
+#endfi
SpecifierOpt *audio_sample_rate;
int nb_audio_sample_rate;
SpecifierOpt *frame_rates;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 720a3cc46a..4b8de9f2c3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -54,7 +54,9 @@
#define SPECIFIER_OPT_FMT_dbl "%lf"
static const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
+#if FF_API_OLD_CHANNEL_LAYOUT
static const char *const opt_name_audio_channels[] = {"ac", NULL};
+#endif
static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", "ch_layout", NULL};
static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
static const char *const opt_name_frame_rates[] = {"r", NULL};
@@ -1114,6 +1116,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
if (o->nb_audio_sample_rate) {
av_dict_set_int(&o->g->format_opts, "sample_rate", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i, 0);
}
+#if FF_API_OLD_CHANNEL_LAYOUT
if (o->nb_audio_channels) {
const AVClass *priv_class;
/* because we set audio_channels based on both the "ac" and
@@ -1125,6 +1128,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
}
}
+#endif
if (o->nb_audio_ch_layouts) {
const AVClass *priv_class;
if (file_iformat && (priv_class = file_iformat->priv_class) &&
@@ -1959,11 +1963,13 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
char *layout = NULL;
char *sample_fmt = NULL;
+#if FF_API_OLD_CHANNEL_LAYOUT
MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st);
if (channels) {
audio_enc->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
audio_enc->ch_layout.nb_channels = channels;
}
+#endif
MATCH_PER_STREAM_OPT(audio_ch_layouts, str, layout, oc, st);
if (layout) {
@@ -3795,9 +3801,11 @@ const OptionDef options[] = {
{ "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_sample_rate) },
"set audio sampling rate (in Hz)", "rate" },
+#if FF_API_OLD_CHANNEL_LAYOUT
{ "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC |
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) },
"set number of audio channels", "channels" },
+#endfi
{ "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) },
"disable audio" },
{ "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE |
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option
2022-03-20 19:36 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option James Almer
@ 2022-03-20 19:44 ` Nicolas George
2022-03-20 20:05 ` James Almer
2022-03-20 20:06 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption James Almer
0 siblings, 2 replies; 14+ messages in thread
From: Nicolas George @ 2022-03-20 19:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 483 bytes --]
James Almer (12022-03-20):
> Same as the AVCodecContext option.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> fftools/ffmpeg.h | 2 ++
> fftools/ffmpeg_opt.c | 8 ++++++++
> 2 files changed, 10 insertions(+)
I do not like this: it requires more typing from the user, even with the
"short" alias in the previous patch.
Also, there are many occurrences of "-ac" in the documentation, they
need to be updated too.
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] ffmpeg: deprecate the ac option
2022-03-20 19:44 ` Nicolas George
@ 2022-03-20 20:05 ` James Almer
2022-03-20 20:06 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption James Almer
1 sibling, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-20 20:05 UTC (permalink / raw)
To: ffmpeg-devel
On 3/20/2022 4:44 PM, Nicolas George wrote:
> James Almer (12022-03-20):
>> Same as the AVCodecContext option.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> fftools/ffmpeg.h | 2 ++
>> fftools/ffmpeg_opt.c | 8 ++++++++
>> 2 files changed, 10 insertions(+)
>
> I do not like this: it requires more typing from the user, even with the
> "short" alias in the previous patch.
Ok, patch dropped then. Will map it to set ch_layout on the underlying
demuxer instead.
>
> Also, there are many occurrences of "-ac" in the documentation, they
> need to be updated too.
>
> Regards,
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption
2022-03-20 19:44 ` Nicolas George
2022-03-20 20:05 ` James Almer
@ 2022-03-20 20:06 ` James Almer
2022-03-20 20:09 ` Nicolas George
1 sibling, 1 reply; 14+ messages in thread
From: James Almer @ 2022-03-20 20:06 UTC (permalink / raw)
To: ffmpeg-devel
channels is deprecated on all supported raw demuxers.
Signed-off-by: James Almer <jamrial@gmail.com>
---
fftools/ffmpeg_opt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 720a3cc46a..b3edbf9885 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1122,7 +1122,11 @@ static int open_input_file(OptionsContext *o, const char *filename)
if (file_iformat && (priv_class = file_iformat->priv_class) &&
av_opt_find(&priv_class, "channels", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
- av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
+ AVBPrint bp;
+ av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
+ av_bprintf(&bp, "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
+ av_dict_set(&o->g->format_opts, "ch_layout", bp.str, 0);
+ av_bprint_finalize(&bp, NULL);
}
}
if (o->nb_audio_ch_layouts) {
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption
2022-03-20 20:06 ` [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption James Almer
@ 2022-03-20 20:09 ` Nicolas George
2022-03-20 20:15 ` James Almer
0 siblings, 1 reply; 14+ messages in thread
From: Nicolas George @ 2022-03-20 20:09 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1388 bytes --]
James Almer (12022-03-20):
> channels is deprecated on all supported raw demuxers.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> fftools/ffmpeg_opt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
I like this version much better.
Thanks.
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 720a3cc46a..b3edbf9885 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -1122,7 +1122,11 @@ static int open_input_file(OptionsContext *o, const char *filename)
> if (file_iformat && (priv_class = file_iformat->priv_class) &&
> av_opt_find(&priv_class, "channels", NULL, 0,
> AV_OPT_SEARCH_FAKE_OBJ)) {
> - av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
> + AVBPrint bp;
> + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
> + av_bprintf(&bp, "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
> + av_dict_set(&o->g->format_opts, "ch_layout", bp.str, 0);
> + av_bprint_finalize(&bp, NULL);
You do not need a BPrint for that, the size of the expansion of %d is
very limited, especially the values that can be relevant here.
> }
> }
> if (o->nb_audio_ch_layouts) {
Regards,
--
Nicolas George
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption
2022-03-20 20:09 ` Nicolas George
@ 2022-03-20 20:15 ` James Almer
2022-03-21 21:12 ` Andreas Rheinhardt
0 siblings, 1 reply; 14+ messages in thread
From: James Almer @ 2022-03-20 20:15 UTC (permalink / raw)
To: ffmpeg-devel
channels is deprecated on all supported raw demuxers.
Signed-off-by: James Almer <jamrial@gmail.com>
---
fftools/ffmpeg_opt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 720a3cc46a..213a34eadc 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1122,7 +1122,9 @@ static int open_input_file(OptionsContext *o, const char *filename)
if (file_iformat && (priv_class = file_iformat->priv_class) &&
av_opt_find(&priv_class, "channels", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ)) {
- av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
+ char buf[32] = "";
+ av_strlcatf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
+ av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
}
}
if (o->nb_audio_ch_layouts) {
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption
2022-03-20 20:15 ` James Almer
@ 2022-03-21 21:12 ` Andreas Rheinhardt
2022-03-21 21:27 ` James Almer
0 siblings, 1 reply; 14+ messages in thread
From: Andreas Rheinhardt @ 2022-03-21 21:12 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
> channels is deprecated on all supported raw demuxers.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> fftools/ffmpeg_opt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index 720a3cc46a..213a34eadc 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -1122,7 +1122,9 @@ static int open_input_file(OptionsContext *o, const char *filename)
> if (file_iformat && (priv_class = file_iformat->priv_class) &&
> av_opt_find(&priv_class, "channels", NULL, 0,
> AV_OPT_SEARCH_FAKE_OBJ)) {
> - av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
> + char buf[32] = "";
> + av_strlcatf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
snprintf; it also avoids the initialization.
> + av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
> }
> }
> if (o->nb_audio_ch_layouts) {
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] ffmpeg: make the ac option set the demuxer's ch_layout AVOption
2022-03-21 21:12 ` Andreas Rheinhardt
@ 2022-03-21 21:27 ` James Almer
0 siblings, 0 replies; 14+ messages in thread
From: James Almer @ 2022-03-21 21:27 UTC (permalink / raw)
To: ffmpeg-devel
On 3/21/2022 6:12 PM, Andreas Rheinhardt wrote:
> James Almer:
>> channels is deprecated on all supported raw demuxers.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> fftools/ffmpeg_opt.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
>> index 720a3cc46a..213a34eadc 100644
>> --- a/fftools/ffmpeg_opt.c
>> +++ b/fftools/ffmpeg_opt.c
>> @@ -1122,7 +1122,9 @@ static int open_input_file(OptionsContext *o, const char *filename)
>> if (file_iformat && (priv_class = file_iformat->priv_class) &&
>> av_opt_find(&priv_class, "channels", NULL, 0,
>> AV_OPT_SEARCH_FAKE_OBJ)) {
>> - av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
>> + char buf[32] = "";
>> + av_strlcatf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
>
> snprintf; it also avoids the initialization.
Changed locally.
>
>> + av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
>> }
>> }
>> if (o->nb_audio_ch_layouts) {
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 14+ messages in thread