Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-05 Thread James Almer

On 3/5/2024 8:12 PM, Michael Niedermayer wrote:

On Sun, Mar 03, 2024 at 01:17:57PM +0100, Anton Khirnov wrote:

Quoting Anton Khirnov (2024-03-01 17:07:22)

Quoting Michael Niedermayer (2024-02-23 23:50:10)

Hi Anton

On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:

Will be useful in following commits.
---


breaks:

./ffmpeg -y -request_channel_layout 3 -i 
bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
file-2-mlp_5point1_downmixof6channel.wav

[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
[mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
   Duration: N/A, start: 0.00, bitrate: N/A
   Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
[mlp @ 0x55690e257900] Error setting option request_channel_layout to value 3.
[aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while opening 
decoder: Invalid argument
[aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple filtergraph
Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
Error opening output files: Invalid argument

i suspect this isnt specific to the file but i can provide it if it
doesnt reproduce with a other file


Cannot reproduce with another mlp or 5.1 ac3 file.


Cannot reproduce with your sample either. Are you sure you're using the
right code? It's branch 'avoption_list' in my tree.


it worked with "-downmix stereo" instead of "-request_channel_layout 3"
as suggested by james


Would be nice to find out why. downmix is a codec specific option 
whereas request_channel_layout is a global AVCodecContext option. 
Something here may have affected how child AVOptions are accessed. But 
if Anton can't reproduce it, then maybe your tree was dirty?




thx

[...]


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-05 Thread James Almer

On 3/5/2024 8:08 PM, Michael Niedermayer wrote:

On Sat, Feb 24, 2024 at 07:41:24PM -0300, James Almer wrote:

On 2/23/2024 7:50 PM, Michael Niedermayer wrote:

Hi Anton

On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:

Will be useful in following commits.
---


breaks:

./ffmpeg -y -request_channel_layout 3 -i 
bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
file-2-mlp_5point1_downmixof6channel.wav


fwiw, request_channel_layout will be removed in the upcoming bump. You
should use -downmix stereo.



[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
[mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.


the error message should point to the new option


The error message points to the option you tried to set. 
request_channel_layout is a valid but deprecated option separate from 
downmix.




thx

[...]


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-05 Thread Michael Niedermayer
On Sun, Mar 03, 2024 at 01:17:57PM +0100, Anton Khirnov wrote:
> Quoting Anton Khirnov (2024-03-01 17:07:22)
> > Quoting Michael Niedermayer (2024-02-23 23:50:10)
> > > Hi Anton
> > > 
> > > On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:
> > > > Will be useful in following commits.
> > > > ---
> > > 
> > > breaks:
> > > 
> > > ./ffmpeg -y -request_channel_layout 3 -i 
> > > bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
> > > file-2-mlp_5point1_downmixof6channel.wav
> > > 
> > > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to 
> > > value 3.
> > > [mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
> > > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to 
> > > value 3.
> > > Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
> > >   Duration: N/A, start: 0.00, bitrate: N/A
> > >   Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
> > > [mlp @ 0x55690e257900] Error setting option request_channel_layout to 
> > > value 3.
> > > [aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while 
> > > opening decoder: Invalid argument
> > > [aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple 
> > > filtergraph
> > > Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
> > > Error opening output files: Invalid argument
> > > 
> > > i suspect this isnt specific to the file but i can provide it if it
> > > doesnt reproduce with a other file
> > 
> > Cannot reproduce with another mlp or 5.1 ac3 file.
> 
> Cannot reproduce with your sample either. Are you sure you're using the
> right code? It's branch 'avoption_list' in my tree.

it worked with "-downmix stereo" instead of "-request_channel_layout 3"
as suggested by james

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-05 Thread Michael Niedermayer
On Sat, Feb 24, 2024 at 07:41:24PM -0300, James Almer wrote:
> On 2/23/2024 7:50 PM, Michael Niedermayer wrote:
> > Hi Anton
> > 
> > On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:
> > > Will be useful in following commits.
> > > ---
> > 
> > breaks:
> > 
> > ./ffmpeg -y -request_channel_layout 3 -i 
> > bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
> > file-2-mlp_5point1_downmixof6channel.wav
> 
> fwiw, request_channel_layout will be removed in the upcoming bump. You
> should use -downmix stereo.
> 
> > 
> > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 
> > 3.
> > [mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
> > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 
> > 3.

the error message should point to the new option

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-03 Thread Anton Khirnov
Quoting Anton Khirnov (2024-03-01 17:07:22)
> Quoting Michael Niedermayer (2024-02-23 23:50:10)
> > Hi Anton
> > 
> > On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:
> > > Will be useful in following commits.
> > > ---
> > 
> > breaks:
> > 
> > ./ffmpeg -y -request_channel_layout 3 -i 
> > bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
> > file-2-mlp_5point1_downmixof6channel.wav
> > 
> > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 
> > 3.
> > [mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
> > [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 
> > 3.
> > Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
> >   Duration: N/A, start: 0.00, bitrate: N/A
> >   Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
> > [mlp @ 0x55690e257900] Error setting option request_channel_layout to value 
> > 3.
> > [aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while 
> > opening decoder: Invalid argument
> > [aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple 
> > filtergraph
> > Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
> > Error opening output files: Invalid argument
> > 
> > i suspect this isnt specific to the file but i can provide it if it
> > doesnt reproduce with a other file
> 
> Cannot reproduce with another mlp or 5.1 ac3 file.

Cannot reproduce with your sample either. Are you sure you're using the
right code? It's branch 'avoption_list' in my tree.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-03-01 Thread Anton Khirnov
Quoting Michael Niedermayer (2024-02-23 23:50:10)
> Hi Anton
> 
> On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:
> > Will be useful in following commits.
> > ---
> 
> breaks:
> 
> ./ffmpeg -y -request_channel_layout 3 -i 
> bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
> file-2-mlp_5point1_downmixof6channel.wav
> 
> [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
> [mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
> [mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
> Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
>   Duration: N/A, start: 0.00, bitrate: N/A
>   Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
> [mlp @ 0x55690e257900] Error setting option request_channel_layout to value 3.
> [aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while 
> opening decoder: Invalid argument
> [aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple filtergraph
> Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
> Error opening output files: Invalid argument
> 
> i suspect this isnt specific to the file but i can provide it if it
> doesnt reproduce with a other file

Cannot reproduce with another mlp or 5.1 ac3 file.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-02-24 Thread James Almer

On 2/23/2024 7:50 PM, Michael Niedermayer wrote:

Hi Anton

On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:

Will be useful in following commits.
---


breaks:

./ffmpeg -y -request_channel_layout 3 -i 
bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
file-2-mlp_5point1_downmixof6channel.wav


fwiw, request_channel_layout will be removed in the upcoming bump. You 
should use -downmix stereo.




[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
[mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
   Duration: N/A, start: 0.00, bitrate: N/A
   Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
[mlp @ 0x55690e257900] Error setting option request_channel_layout to value 3.
[aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while opening 
decoder: Invalid argument
[aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple filtergraph
Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
Error opening output files: Invalid argument

i suspect this isnt specific to the file but i can provide it if it
doesnt reproduce with a other file

thx

[...]


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-02-23 Thread Michael Niedermayer
Hi Anton

On Fri, Feb 23, 2024 at 02:58:36PM +0100, Anton Khirnov wrote:
> Will be useful in following commits.
> ---

breaks:

./ffmpeg -y -request_channel_layout 3 -i 
bug/401/mlp_5point1_downmixof6channel.mlp -bitexact 
file-2-mlp_5point1_downmixof6channel.wav

[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
[mlp @ 0x55690e23ed00] Failed to open codec in avformat_find_stream_info
[mlp @ 0x55690e23ff80] Error setting option request_channel_layout to value 3.
Input #0, mlp, from 'bug/401/mlp_5point1_downmixof6channel.mlp':
  Duration: N/A, start: 0.00, bitrate: N/A
  Stream #0:0: Audio: mlp, 48000 Hz, 5.1, s32 (24 bit)
[mlp @ 0x55690e257900] Error setting option request_channel_layout to value 3.
[aist#0:0/mlp @ 0x55690e254dc0] [dec:mlp @ 0x55690e256f40] Error while opening 
decoder: Invalid argument
[aost#0:0/pcm_s16le @ 0x55690e255a80] Error initializing a simple filtergraph
Error opening output file file-2-mlp_5point1_downmixof6channel.wav.
Error opening output files: Invalid argument

i suspect this isnt specific to the file but i can provide it if it
doesnt reproduce with a other file

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 14/38] lavu/opt: factor per-type dispatch out of av_opt_set()

2024-02-23 Thread Anton Khirnov
Will be useful in following commits.
---
 libavutil/opt.c | 35 ++-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 0ca6d4d555..ebc8063dc6 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -484,13 +484,11 @@ static int set_string_channel_layout(void *obj, const 
AVOption *o,
 return av_channel_layout_from_string(channel_layout, val);
 }
 
-int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
+static int opt_set_elem(void *obj, void *target_obj, const AVOption *o,
+const char *val, void *dst)
 {
-int ret = 0;
-void *dst, *target_obj;
-const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, 
_obj);
-if (!o || !target_obj)
-return AVERROR_OPTION_NOT_FOUND;
+int ret;
+
 FF_DISABLE_DEPRECATION_WARNINGS
 if (!val && (o->type != AV_OPT_TYPE_STRING &&
  o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != 
AV_OPT_TYPE_SAMPLE_FMT &&
@@ -503,13 +501,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
 return AVERROR(EINVAL);
 FF_ENABLE_DEPRECATION_WARNINGS
 
-if (o->flags & AV_OPT_FLAG_READONLY)
-return AVERROR(EINVAL);
-
-if (o->flags & AV_OPT_FLAG_DEPRECATED)
-av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", 
name, o->help);
-
-dst = ((uint8_t *)target_obj) + o->offset;
 switch (o->type) {
 case AV_OPT_TYPE_BOOL:
 return set_string_bool(obj, o, val, dst);
@@ -589,6 +580,24 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return AVERROR(EINVAL);
 }
 
+int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
+{
+void *dst, *target_obj;
+const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, 
_obj);
+if (!o || !target_obj)
+return AVERROR_OPTION_NOT_FOUND;
+
+if (o->flags & AV_OPT_FLAG_READONLY)
+return AVERROR(EINVAL);
+
+if (o->flags & AV_OPT_FLAG_DEPRECATED)
+av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", 
name, o->help);
+
+dst = ((uint8_t *)target_obj) + o->offset;
+
+return opt_set_elem(obj, target_obj, o, val, dst);
+}
+
 #define OPT_EVAL_NUMBER(name, opttype, vartype) \
 int av_opt_eval_ ## name(void *obj, const AVOption *o,  \
  const char *val, vartype *name ## _out)\
-- 
2.42.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".