Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] lavf/dash: Forward strict flag to component demuxers
@ 2024-05-20 20:11 Frank Plowman
  2024-05-20 20:41 ` Andreas Rheinhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Plowman @ 2024-05-20 20:11 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Frank Plowman

Before the patch, opening a DASH file containing streams which require
experimental decoders was problematic.  No matter where the -strict -2
was put on the command line, the option was not passed to the demuxer
for that component.  This resulted in an error, prompting the user to
add the -strict -2 flag, which is already present.  Decoding appeared to
continue correctly however.

Patch removes the error message by creating an options object for the
demuxer created for the component, which inherits from the parent
demuxer.

Signed-off-by: Frank Plowman <post@frankplowman.com>
---
PS: Can anyone think of other options which should be propagated to the
    component demuxers?

 libavformat/dashdec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 555e21bf69..40abb5ebba 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1911,13 +1911,18 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation
     if (ret < 0)
         goto fail;
     if (pls->n_fragments) {
+        AVDictionary *stream_info_opts = NULL;
+
 #if FF_API_R_FRAME_RATE
         if (pls->framerate.den) {
             for (i = 0; i < pls->ctx->nb_streams; i++)
                 pls->ctx->streams[i]->r_frame_rate = pls->framerate;
         }
 #endif
-        ret = avformat_find_stream_info(pls->ctx, NULL);
+
+        av_dict_set_int(&stream_info_opts, "strict", s->strict_std_compliance, 0);
+
+        ret = avformat_find_stream_info(pls->ctx, &stream_info_opts);
         if (ret < 0)
             goto fail;
     }
-- 
2.44.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavf/dash: Forward strict flag to component demuxers
  2024-05-20 20:11 [FFmpeg-devel] [PATCH] lavf/dash: Forward strict flag to component demuxers Frank Plowman
@ 2024-05-20 20:41 ` Andreas Rheinhardt
  2024-05-22  9:10   ` Frank Plowman
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Rheinhardt @ 2024-05-20 20:41 UTC (permalink / raw)
  To: ffmpeg-devel

Frank Plowman:
> Before the patch, opening a DASH file containing streams which require
> experimental decoders was problematic.  No matter where the -strict -2
> was put on the command line, the option was not passed to the demuxer
> for that component.  This resulted in an error, prompting the user to
> add the -strict -2 flag, which is already present.  Decoding appeared to
> continue correctly however.
> 
> Patch removes the error message by creating an options object for the
> demuxer created for the component, which inherits from the parent
> demuxer.
> 
> Signed-off-by: Frank Plowman <post@frankplowman.com>
> ---
> PS: Can anyone think of other options which should be propagated to the
>     component demuxers?
> 
>  libavformat/dashdec.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 555e21bf69..40abb5ebba 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1911,13 +1911,18 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation
>      if (ret < 0)
>          goto fail;
>      if (pls->n_fragments) {
> +        AVDictionary *stream_info_opts = NULL;
> +
>  #if FF_API_R_FRAME_RATE
>          if (pls->framerate.den) {
>              for (i = 0; i < pls->ctx->nb_streams; i++)
>                  pls->ctx->streams[i]->r_frame_rate = pls->framerate;
>          }
>  #endif
> -        ret = avformat_find_stream_info(pls->ctx, NULL);
> +
> +        av_dict_set_int(&stream_info_opts, "strict", s->strict_std_compliance, 0);
> +
> +        ret = avformat_find_stream_info(pls->ctx, &stream_info_opts);
>          if (ret < 0)
>              goto fail;
>      }

The loop over pls->ctx indicates that pls->ctx->nb_streams can be > 1
before avformat_find_stream_info(). But then using a single AVDictionary
is wrong, as avformat_find_stream_info() expects an array of
pls->ctx->nb_streams AVDictionary*.

Furthermore, the mixing between AVFormatContext and AVCodecContext
options here does not seem good (e.g. for ordinary demuxers setting
strict_std_compliance does not affect the AVCodecContext's values at all).

- Andreas

_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] lavf/dash: Forward strict flag to component demuxers
  2024-05-20 20:41 ` Andreas Rheinhardt
@ 2024-05-22  9:10   ` Frank Plowman
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Plowman @ 2024-05-22  9:10 UTC (permalink / raw)
  To: ffmpeg-devel

Thanks for your review Andreas.

On 20/05/2024 21:41, Andreas Rheinhardt wrote:
> Frank Plowman:
>> Before the patch, opening a DASH file containing streams which require
>> experimental decoders was problematic.  No matter where the -strict -2
>> was put on the command line, the option was not passed to the demuxer
>> for that component.  This resulted in an error, prompting the user to
>> add the -strict -2 flag, which is already present.  Decoding appeared to
>> continue correctly however.
>>
>> Patch removes the error message by creating an options object for the
>> demuxer created for the component, which inherits from the parent
>> demuxer.
>>
>> Signed-off-by: Frank Plowman <post@frankplowman.com>
>> ---
>> PS: Can anyone think of other options which should be propagated to the
>>     component demuxers?
>>
>>  libavformat/dashdec.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index 555e21bf69..40abb5ebba 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -1911,13 +1911,18 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation
>>      if (ret < 0)
>>          goto fail;
>>      if (pls->n_fragments) {
>> +        AVDictionary *stream_info_opts = NULL;
>> +
>>  #if FF_API_R_FRAME_RATE
>>          if (pls->framerate.den) {
>>              for (i = 0; i < pls->ctx->nb_streams; i++)
>>                  pls->ctx->streams[i]->r_frame_rate = pls->framerate;
>>          }
>>  #endif
>> -        ret = avformat_find_stream_info(pls->ctx, NULL);
>> +
>> +        av_dict_set_int(&stream_info_opts, "strict", s->strict_std_compliance, 0);
>> +
>> +        ret = avformat_find_stream_info(pls->ctx, &stream_info_opts);
>>          if (ret < 0)
>>              goto fail;
>>      }
> 
> The loop over pls->ctx indicates that pls->ctx->nb_streams can be > 1
> before avformat_find_stream_info(). But then using a single AVDictionary
> is wrong, as avformat_find_stream_info() expects an array of
> pls->ctx->nb_streams AVDictionary*.

Thanks, v2 sent which addresses this.

> 
> Furthermore, the mixing between AVFormatContext and AVCodecContext
> options here does not seem good (e.g. for ordinary demuxers setting
> strict_std_compliance does not affect the AVCodecContext's values at all).

Can you see an alternative?  In the case of fftools, the -strict flag is
always set for both the codec_opts and format_opts but yes I see the
concern assuming this logic in libav*.

-- 
Frank
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2024-05-22  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-20 20:11 [FFmpeg-devel] [PATCH] lavf/dash: Forward strict flag to component demuxers Frank Plowman
2024-05-20 20:41 ` Andreas Rheinhardt
2024-05-22  9:10   ` Frank Plowman

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git