1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
Andreas Rheinhardt
2451e06f19 all: Use "" instead of <> to include internal headers
Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-04 22:20:58 +02:00
Marvin Scholz
05094c1749 fftools/textformat: remove unreachable code in tf_mermaid
Integer writing is impossible here as the first branch was dead code,
so remove it completely.

Fix CID 1646948

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-07-05 02:35:00 +02:00
Nicolas Gaullier
18c62245d7 fftools/textformat: renamings in print_unit_int for consistency (cosmetic)
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:24:35 +02:00
Nicolas Gaullier
2b25a66238 fftools/textformat: fix print 64 bit integers
Regression in ffprobe since textformat introduction
in d7a3f68fea.

Fixes #11638

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-27 00:23:57 +02:00
Marvin Scholz
5c1e10d995 fftools/textformat: do not return early
This would make the goto dead code and also would not properly
call avtext_context_close.

Fix CID 1646939

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
564a0784bb fftools/textformat: remove noop free
The tctx->hash was freed already right before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
8430b8f9a9 fftools/textformat: narrow variable scopes
Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:40:42 +02:00
Marvin Scholz
7771a4eecb fftools/textformat: remove leftover comments in mermaid_print_value
Remove some leftover commented code and an extraneous semicolon.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
Marvin Scholz
0578d4ad2f fftools/textformat: exit early in mermaid_print_value
Doesn't change the logic, instead of exiting in each of the two
branches below, just exit before.

Reviewed-by: softworkz <softworkz@hotmail.com>
2025-06-26 23:23:35 +02:00
Andreas Rheinhardt
6f452ad1ac fftools/textformat/avtextformat: Fix races when initializing formatters
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:47:33 +02:00
Andreas Rheinhardt
b4c5397642 fftools/textformat/avtextformat: Avoid relocations
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:45:13 +02:00
Andreas Rheinhardt
0742239289 fftools/graph/graphprint: Fix races when initializing graphprint
Setting print_graphs_format (in case no -print_graphs_format
option was specified) is racy, as is using av_strtok()
to split it. Both have been removed.

Notice that using av_strtok() was destructive: In the absence
of races the options would only have been applied for the
first initialization.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-02 00:44:44 +02:00
softworkz
b7d44dde3b fftools/tf_mermaid: Add missing uninit and fix leaks
- merge forgotten uninit from work branch
- add set_str() function to free before overwriting
- fix some other leaks

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-28 01:02:55 +02:00
Marton Balint
0d6ef6f545 fftools/textformat: correctly propagate uninit error codes
This allows catching IO errors occuring at file close.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-05-16 20:43:58 +02:00
Marton Balint
a124c9a580 Revert "fftools/textformat/avtextformat: Make close functions return void"
This reverts commit 7684243fbe and
a888975a3c.
2025-05-16 20:43:58 +02:00
softworkz
45926bc09a fftools/graphprint: Add execution graph printing
The key benefits are:

- Different to other graph printing methods, this is outputting:
  - all graphs with runtime state
    (including auto-inserted filters)
  - each graph with its inputs and outputs
  - all filters with their in- and output pads
  - all connections between all input- and output pads
  - for each connection:
    - the runtime-negotiated format and media type
    - the hw context
    - if video hw context, both: hw pixfmt + sw pixfmt
- Output can either be printed to stdout or written to specified file
- Output is machine-readable
- Use the same output implementation as ffprobe, supporting multiple
  formats

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:09:17 +02:00
softworkz
b71b444a3a fftools/textformat: Add flags param to function avtext_print_integer()
Make this function work analog to avtext_print_string() which already
has a flags parameter.

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
bb3a14489e fftools/tf_internal: Use av_default_item_name
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
cee7b8a051 fftools/textformat: Introduce common header and deduplicate code
Also change writer_printf signature in AVTextWriter to use va_list,
so that it can be called by the new function writer_printf()
in tf_internal.h.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
e4830b8c5e fftools/textformat: Introduce AVTextFormatOptions for avtext_context_open()
This allows future addition of options without
changes to the signature of avtext_context_open().

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
4ff90f05c7 fftools/avtextformat: Re-use BPrint in loop
Instead of initializing a new BPrint in case of UTF decode error,
re-use the same BPrint struct and just clear it
for each iteration.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
d225928703 fftools/textformat: Rename name param to key for API consistency
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
4baeb9ffe9 fftools/textformat: Remove unused print_rational() pointer from AVTextFormatter
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
5f90eea8a8 fftools/textformat: Apply quality improvements
Perform multiple improvements to increase code robustness.
In particular:
- favor unsigned counters for loops
- add missing checks
- avoid possible leaks
- move variable declarations to inner scopes when feasible
- provide explicit type-casting when needed

Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
softworkz
8f42d90413 fftools/textformat: Apply formatting and whitespace changes
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-05-15 23:04:44 +02:00
Andreas Rheinhardt
7684243fbe fftools/textformat/avtextformat: Remove unused variable
Forgotten in a888975a3c.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-17 01:49:04 +02:00
Andreas Rheinhardt
a888975a3c fftools/textformat/avtextformat: Make close functions return void
Just like normal close functions.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:13:13 +02:00
Andreas Rheinhardt
37635d31cb fftools/textformat/avtextformat: Add missing AVERROR()
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:13:03 +02:00
Andreas Rheinhardt
f873734f84 fftools/textformat/avtextformat: Initialize stuff earlier
avtext_context_close() calls av_opt_free() on an AVTextFormatContext
as well as av_bprint_finalize() on the containing section_pbuf
AvBPrints, yet it can happen that the AVBPrints have not been
initialized (only zeroed) and that av_opt_set_defaults() has
not been called. This works, but it is not really documented to do so.
So ensure that the options and the AVBPrints have been initialized
when avtext_context_close() is called.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:12:54 +02:00
Andreas Rheinhardt
50ef4b2a6b fftools/textformat/avtextformat: Fix segfault upon allocation error
Would happen if an AVTextFormatContext's private context
could not be allocated.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:12:48 +02:00
Andreas Rheinhardt
7ee7632cb8 fftools/textformat/avtextformat: Fix segfault upon allocation error
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:12:41 +02:00
Andreas Rheinhardt
b9450583bc textformat/tw_avio: Remove close_on_uninit param from create_file
avtextwriter_create_file() creates an AVIOContext whose pointer
resides in its private context. If it were not always closed on
uninit, the AVIOContext would leak, so it makes no sense
to have this parameter.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:12:09 +02:00
Andreas Rheinhardt
f73badbf47 fftools/textformat/tw_avio: Use avio_closep()
Avoids leaving dangling pointers behind.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:12:05 +02:00
Andreas Rheinhardt
79fa31d159 fftools/textformat/tw_avio: Don't flush unnecessarily
avio_close() automatically flushes the AVIOContext.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:11:58 +02:00
Andreas Rheinhardt
395c91347f fftools/textformat/tw_avio: Remove unused private class
This AVTextWriter does not have any options.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:11:52 +02:00
Andreas Rheinhardt
c9dc6ca02b fftools/textformat: Use "", not <> for lavu headers
Also remove unused headers.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:11:45 +02:00
Andreas Rheinhardt
2ab1021264 fftools/textformat/avtextformat: Simplify avtext_print_rational()
Use snprintf() directly instead of initializing an AVBPrint
just for this.

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-16 06:05:58 +02:00
softworkz
97d680d450 fftools/textformat: Extract and generalize textformat api from ffprobe.c
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-04-11 03:06:47 +02:00