diff mbox series

[FFmpeg-devel,3/3] doc/muxers: add fifo_test

Message ID 20240312105654.342835-3-stefasab@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] lavf/fifo_test: sort options by name | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Stefano Sabatini March 12, 2024, 10:56 a.m. UTC
---
 doc/muxers.texi | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Andreas Rheinhardt March 12, 2024, 12:25 p.m. UTC | #1
Stefano Sabatini:
> ---
>  doc/muxers.texi | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 0aaef2b520..ccbb741992 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1556,6 +1556,36 @@ ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv \
>    -map 0:v -map 0:a rtmp://example.com/live/stream_name
>  @end example
>  
> +@anchor{fifo_test}
> +@section fifo_test
> +@ref{fifo} muxer test muxer.
> +
> +This is a testing muxer, it is supposed to be used only to test the
> +@ref{fifo} muxer.
> +
> +@subsection Options
> +@table @option
> +@item print_deinit_summary @var{bool}
> +print summary when deinitializing muxer, default is @code{true}
> +
> +@item write_header_ret @var{int}
> +set @code{write_header()} return value
> +
> +@item write_trailer_ret @var{int}
> +set @code{write_trailer()} return value
> +@end table
> +
> +@subsection Example
> +
> +Use @command{ffmpeg} to write to a file using the @samp{fifo} muxer
> +using the internal @samp{fifo_test} muxer, simulate a write header
> +error using the @option{write_header_ret} option:
> +@example
> +ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format fifo_test -format_opts write_header_ret=-22 \
> +  -map 0:v -map 0:a \
> +  -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 out.test
> +@end example
> +
>  @section flv
>  
>  Adobe Flash Video Format muxer.

I do not think that this muxer should be publically documented. In fact,
I think it would be better if this muxer would only exist inside the
fifo_muxer test and if it were not included in a normal libavformat at all.

- Andreas
Stefano Sabatini March 12, 2024, 4:57 p.m. UTC | #2
On date Tuesday 2024-03-12 13:25:23 +0100, Andreas Rheinhardt wrote:
> Stefano Sabatini:
> > ---
> >  doc/muxers.texi | 30 ++++++++++++++++++++++++++++++
> >  1 file changed, 30 insertions(+)
> > 
[...]
> I do not think that this muxer should be publically documented. In fact,
> I think it would be better if this muxer would only exist inside the
> fifo_muxer test and if it were not included in a normal libavformat at all.

It looks like it is not possible to register a custom muxer outside of
the list in allformats.c, or do I miss something? (OTOH it would be
useful if one wants to registers a custom component, but this seems to
be disabled at the API level).

The simple alternative is to simply not to document the muxer,
although I don't like it very much, given that is output in the muxers
list, so I think at least we want to mention that this is only used
for testing.
Andreas Rheinhardt March 12, 2024, 6:55 p.m. UTC | #3
Stefano Sabatini:
> On date Tuesday 2024-03-12 13:25:23 +0100, Andreas Rheinhardt wrote:
>> Stefano Sabatini:
>>> ---
>>>  doc/muxers.texi | 30 ++++++++++++++++++++++++++++++
>>>  1 file changed, 30 insertions(+)
>>>
> [...]
>> I do not think that this muxer should be publically documented. In fact,
>> I think it would be better if this muxer would only exist inside the
>> fifo_muxer test and if it were not included in a normal libavformat at all.
> 
> It looks like it is not possible to register a custom muxer outside of
> the list in allformats.c, or do I miss something? (OTOH it would be
> useful if one wants to registers a custom component, but this seems to
> be disabled at the API level).
> 

It is possible to use custom muxers internally: The AVOutputFormat*
pointer one passes to avformat_alloc_output_context2() need not be in
the list of output formats in the lists in allformats.c/alldevices.c. In
order to make the fifo muxer actually use a custom muxer, a slight hack
is needed. See
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-March/323314.html

> The simple alternative is to simply not to document the muxer,
> although I don't like it very much, given that is output in the muxers
> list, so I think at least we want to mention that this is only used
> for testing.

Given that this muxer is dangerous (see the above commit message) it
should not be publicly accessible at all.

- Andreas
diff mbox series

Patch

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 0aaef2b520..ccbb741992 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1556,6 +1556,36 @@  ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv \
   -map 0:v -map 0:a rtmp://example.com/live/stream_name
 @end example
 
+@anchor{fifo_test}
+@section fifo_test
+@ref{fifo} muxer test muxer.
+
+This is a testing muxer, it is supposed to be used only to test the
+@ref{fifo} muxer.
+
+@subsection Options
+@table @option
+@item print_deinit_summary @var{bool}
+print summary when deinitializing muxer, default is @code{true}
+
+@item write_header_ret @var{int}
+set @code{write_header()} return value
+
+@item write_trailer_ret @var{int}
+set @code{write_trailer()} return value
+@end table
+
+@subsection Example
+
+Use @command{ffmpeg} to write to a file using the @samp{fifo} muxer
+using the internal @samp{fifo_test} muxer, simulate a write header
+error using the @option{write_header_ret} option:
+@example
+ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format fifo_test -format_opts write_header_ret=-22 \
+  -map 0:v -map 0:a \
+  -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 out.test
+@end example
+
 @section flv
 
 Adobe Flash Video Format muxer.