Re: [FFmpeg-devel] [PATCH] Announce FFmpeg 8.0

2025-08-22 Thread Marton Balint via ffmpeg-devel




On Fri, 22 Aug 2025, Niklas Haas via ffmpeg-devel wrote:


On Thu, 21 Aug 2025 14:47:03 +0900 Lynne via ffmpeg-devel 
 wrote:

---
 src/index | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/src/index b/src/index
index 52829e1..a07f4b8 100644
--- a/src/index
+++ b/src/index
@@ -35,6 +35,48 @@
 News
   

+  August 23nd, 2025, FFmpeg 8.0 "Huffman"
+  
+  A new major release, FFmpeg 8.0 "Huffman",
+  is now available for download.
+  Thanks to several delays, and modernization of our entire infrastructure, 
this release ended up
+  being one of our largest releases to date. In short, its new features are:
+  
+Native decoders: APV, 
ProRes RAW, RealVideo 6.0, Sanyo LD-ADPCM, and others
+VVC decoder improvements: IBC,
+  SSC,
+  ACT,
+  Palette Mode
+Vulkan compute-based codecs: FFv1 (encode and decode), ProRes RAW (decode 
only)
+Hardware accelerated decoding: Vulkan VP9, VAAPI VVC, OpenHarmony 
H264/5
+Hardware accelerated encoding: Vulkan AV1, OpenHarmony H264/5
+Filters: colordetect, pad_cuda, scale_d3d11, Whisper, and others
+  
+  
+  
+  A new class of decoders and encoders based on pure Vulkan compute 
implementation have been added.
+  Rather than using a custom hardware accelerator present, they are based on 
compute shaders, and work
+  on any implementation of Vulkan 1.3. Decoders use the same hwaccel API and 
commands, so users do not
+  need to do anything special to enable them, as enabling Vulkan decoding is 
sufficient to use them.
+  Encoders, like our hardware accelerated encoders, require specifying a new 
encoder (ffv1_vulkan).
+  Currently, the only codecs supported are: FFv1 (encoding and decoding) and 
ProRes RAW (decode only).
+  ProRes (encode+decode) and VC-2 (encode+decode) implementations are complete 
and currently in review,
+  to be merged soon and available with the next minor release.
+  Only codecs specifically designed for parallelized decoding can be 
implemented in such a way, with
+  more mainstream codecs not being planned for support.
+  Depending on the hardware, these new codecs can provide very significant 
speedups, and open up
+  possibilities to work with them for situations like non-linear video editors 
and
+  lossless screen recording/streaming, so we are excited to learn what our 
downstream users can make with them.


Respectfully, I think this section is rather too long and technical and not
really interesting to most users. Either describe all of the changes (of which
you allude to, there are a lot) in detail, or none of them, but as it stands
this feels like shining a spotlight on your contributions in particular.


I don't think this is too technical, ffmpeg release announcement is 
targeted for people with a strong tech/video interest, not general 
audience.


Also I find it quite OK if you elaborate a bit in one highlighted area of 
the release in the news entry. A news entry is not an extensive list of 
features implemented, only highlights.


So we should apply this as soon as we can.

Thanks,
Marton
___
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] avutil/bprint: fix av_bprint_strftime with %p format string reporting truncated output (PR #20330)

2025-08-24 Thread Marton Balint via ffmpeg-devel
PR #20330 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20330
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20330.patch

And a minor factorization.


>From f8e83bce6269c95fbad90f34434ceb641bf753d5 Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Sun, 24 Aug 2025 21:42:54 +0200
Subject: [PATCH 1/2] avutil/bprint: make av_bprintf use av_vbprintf

No reason to duplicate the code.

Signed-off-by: Marton Balint 
---
 libavutil/bprint.c | 33 +
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 4e9571715c..932c03ce50 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -96,35 +96,12 @@ void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, 
unsigned size)
 *buf->str = 0;
 }
 
-void av_bprintf(AVBPrint *buf, const char *fmt, ...)
-{
-unsigned room;
-char *dst;
-va_list vl;
-int extra_len;
-
-while (1) {
-room = av_bprint_room(buf);
-dst = room ? buf->str + buf->len : NULL;
-va_start(vl, fmt);
-extra_len = vsnprintf(dst, room, fmt, vl);
-va_end(vl);
-if (extra_len <= 0)
-return;
-if (extra_len < room)
-break;
-if (av_bprint_alloc(buf, extra_len))
-break;
-}
-av_bprint_grow(buf, extra_len);
-}
-
 void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
 {
 unsigned room;
 char *dst;
-int extra_len;
 va_list vl;
+int extra_len;
 
 while (1) {
 room = av_bprint_room(buf);
@@ -142,6 +119,14 @@ void av_vbprintf(AVBPrint *buf, const char *fmt, va_list 
vl_arg)
 av_bprint_grow(buf, extra_len);
 }
 
+void av_bprintf(AVBPrint *buf, const char *fmt, ...)
+{
+va_list vl;
+va_start(vl, fmt);
+av_vbprintf(buf, fmt, vl);
+va_end(vl);
+}
+
 void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
 {
 unsigned room, real_n;
-- 
2.49.1


>From 4532caf820dcb2bc2cbac3d4e782ad27cf9fd76b Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Sun, 24 Aug 2025 21:35:41 +0200
Subject: [PATCH 2/2] avutil/bprint: fix av_bprint_strftime with %p format
 string reporting truncated output

strftime returns 0 in case of an empty output (e.g. %p format string with some
locales), there is no way to distinguish this from a buffer-too-small error
condition. So we must use some heuristics to handle this case, and not consume
INT_MAX RAM and falsely report a truncated output.

Signed-off-by: Marton Balint 
---
 libavutil/bprint.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 932c03ce50..fa244b2e04 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -167,6 +167,7 @@ void av_bprint_strftime(AVBPrint *buf, const char *fmt, 
const struct tm *tm)
 {
 unsigned room;
 size_t l;
+size_t fmt_len = 0;
 
 if (!*fmt)
 return;
@@ -174,9 +175,16 @@ void av_bprint_strftime(AVBPrint *buf, const char *fmt, 
const struct tm *tm)
 room = av_bprint_room(buf);
 if (room && (l = strftime(buf->str + buf->len, room, fmt, tm)))
 break;
+
+if (!fmt_len)
+fmt_len = strlen(fmt);
+/* A 256x space requirement for output is unlikely, so it is likely 
empty */
+if (room >> 8 > fmt_len)
+break;
+
 /* strftime does not tell us how much room it would need: let us
retry with twice as much until the buffer is large enough */
-room = !room ? strlen(fmt) + 1 :
+room = !room ? fmt_len + 1 :
room <= INT_MAX / 2 ? room * 2 : INT_MAX;
 if (av_bprint_alloc(buf, room)) {
 /* impossible to grow, try to manage something useful anyway */
-- 
2.49.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/img2dec: remove deprecated glob_sequence pattern type (PR #20267)

2025-08-17 Thread Marton Balint via ffmpeg-devel
PR #20267 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20267
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20267.patch

"glob_sequence" was deprecated since 2012. This also changes the default pattern
to "sequence", because "glob_sequence" was also the default.

Signed-off-by: Marton Balint 


>From 9e256ad6df2be7ead19bfd7887aca6bbe41f402a Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Thu, 14 Aug 2025 22:59:58 +0200
Subject: [PATCH] avformat/img2dec: remove deprecated glob_sequence pattern
 type

"glob_sequence" was deprecated since 2012. This also changes the default pattern
to "sequence", because "glob_sequence" was also the default.

Signed-off-by: Marton Balint 
---
 doc/demuxers.texi | 23 +--
 libavcodec/version.h  |  2 +-
 libavformat/img2.h|  3 +-
 libavformat/img2dec.c | 65 ++-
 4 files changed, 6 insertions(+), 87 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index c6b72c3b69..3de9992976 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -664,30 +664,9 @@ Select a glob wildcard pattern type.
 
 The pattern is interpreted like a @code{glob()} pattern. This is only
 selectable if libavformat was compiled with globbing support.
-
-@item glob_sequence @emph{(deprecated, will be removed)}
-Select a mixed glob wildcard/sequence pattern.
-
-If your version of libavformat was compiled with globbing support, and
-the provided pattern contains at least one glob meta character among
-@code{%*?[]@{@}} that is preceded by an unescaped "%", the pattern is
-interpreted like a @code{glob()} pattern, otherwise it is interpreted
-like a sequence pattern.
-
-All glob special characters @code{%*?[]@{@}} must be prefixed
-with "%". To escape a literal "%" you shall use "%%".
-
-For example the pattern @code{foo-%*.jpeg} will match all the
-filenames prefixed by "foo-" and terminating with ".jpeg", and
-@code{foo-%?%?%?.jpeg} will match all the filenames prefixed with
-"foo-", followed by a sequence of three characters, and terminating
-with ".jpeg".
-
-This pattern type is deprecated in favor of @var{glob} and
-@var{sequence}.
 @end table
 
-Default value is @var{glob_sequence}.
+Default value is @var{sequence}.
 @item pixel_format
 Set the pixel format of the images to read. If not specified the pixel
 format is guessed from the first image file in the sequence.
diff --git a/libavcodec/version.h b/libavcodec/version.h
index da2264a097..2e28c23410 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 #include "version_major.h"
 
 #define LIBAVCODEC_VERSION_MINOR  12
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/img2.h b/libavformat/img2.h
index e98902c96f..0781e681c5 100644
--- a/libavformat/img2.h
+++ b/libavformat/img2.h
@@ -31,8 +31,7 @@
 #endif
 
 enum PatternType {
-PT_GLOB_SEQUENCE,
-PT_GLOB,
+PT_GLOB = 1,
 PT_SEQUENCE,
 PT_NONE,
 PT_DEFAULT
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index f0ed84f8f6..a3f4ef14fa 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -84,27 +84,6 @@ static int infer_size(int *width_ptr, int *height_ptr, int 
size)
 return -1;
 }
 
-static int is_glob(const char *path)
-{
-#if HAVE_GLOB
-size_t span = 0;
-const char *p = path;
-
-while (p = strchr(p, '%')) {
-if (*(++p) == '%') {
-++p;
-continue;
-}
-if (span = strspn(p, "*?[]{}"))
-break;
-}
-/* Did we hit a glob char or get to the end? */
-return span != 0;
-#else
-return 0;
-#endif
-}
-
 /**
  * Get index range of image files matched by path.
  *
@@ -172,8 +151,6 @@ static int img_read_probe(const AVProbeData *p)
 if (p->filename && ff_guess_image2_codec(p->filename)) {
 if (av_filename_number_test(p->filename))
 return AVPROBE_SCORE_MAX;
-else if (is_glob(p->filename))
-return AVPROBE_SCORE_MAX;
 else if (p->filename[strcspn(p->filename, "*?{")]) // probably PT_GLOB
 return AVPROBE_SCORE_EXTENSION + 2; // score chosen to be a tad 
above the image pipes
 else if (p->buf_size == 0)
@@ -242,44 +219,9 @@ int ff_img_read_header(AVFormatContext *s1)
 if (s1->pb) {
 s->pattern_type = PT_NONE;
 } else
-s->pattern_type = PT_GLOB_SEQUENCE;
+s->pattern_type = PT_SEQUENCE;
 }
-
-if (s->pattern_type == PT_GLOB_SEQUENCE) {
-s->use_glob = is_glob(s->path);
-if (s->use_glob) {
-#if HAVE_GLOB
-char *p = s->path, *q, *dup;
-int gerr;
-#endif
-
-av_log(s1, AV_LOG_WARNING, "Pattern type 'glob_sequence' is 
deprecated: "
-  

[FFmpeg-devel] [PATCH] Remove path length limits from various places using av_get_frame_filename() (PR #20363)

2025-08-28 Thread Marton Balint via ffmpeg-devel
PR #20363 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20363
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20363.patch


>From a748e8be26e37b5e185b5e49df54d89d39e64df8 Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Wed, 27 Aug 2025 08:36:39 +0200
Subject: [PATCH 1/7] avformat/utils: add
 AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION flag

Signed-off-by: Marton Balint 
---
 doc/APIchanges | 3 +++
 libavformat/avformat.h | 3 ++-
 libavformat/utils.c| 2 +-
 libavformat/version.h  | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5d4fb8d127..92d290677b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
 
 API changes, most recent first:
 
+2025-09-xx -  - lavc 62.4.102 - avformat.h
+  Add AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION
+
 2025-08-xx -  - lavc 62.13.101 - exif.h
   Add AV_EXIF_FLAG_RECURSIVE
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index be6e532387..a7446546e5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2819,7 +2819,8 @@ void av_dump_format(AVFormatContext *ic,
 int is_output);
 
 
-#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d
+#define AV_FRAME_FILENAME_FLAGS_MULTIPLE  1  ///< Allow multiple %d
+#define AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION 2  ///< Ignore truncated 
output instead of returning an error
 
 /**
  * Return in 'buf' the path with '%d' replaced by a number.
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8a249ad85a..9b29ae26d0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -327,7 +327,7 @@ addchar:
 }
 if (!percentd_found)
 goto fail;
-if (!av_bprint_is_complete(buf))
+if (!(flags & AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION) && 
!av_bprint_is_complete(buf))
 return AVERROR(ENOMEM);
 return 0;
 fail:
diff --git a/libavformat/version.h b/libavformat/version.h
index cc56b7cf5c..858a94cc5d 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR   4
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-- 
2.49.1


>From fd409149188613e5e517376150c90aca03d32be9 Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Thu, 14 Aug 2025 23:49:34 +0200
Subject: [PATCH 2/7] avformat/utils: support arbitrary path lengths for
 av_filename_number_test

Signed-off-by: Marton Balint 
---
 libavformat/utils.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9b29ae26d0..3573aa918e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -116,9 +116,12 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int 
size)
 
 int av_filename_number_test(const char *filename)
 {
-char buf[1024];
-return filename &&
-   (av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0);
+AVBPrint bp;
+
+if (!filename)
+return 0;
+av_bprint_init(&bp, 0, AV_BPRINT_SIZE_COUNT_ONLY);
+return (ff_bprint_get_frame_filename(&bp, filename, 1, 
AV_FRAME_FILENAME_FLAGS_IGNORE_TRUNCATION) >= 0);
 }
 
 /**/
-- 
2.49.1


>From e1f67590752b501623d0b40422d29dd74dd95c59 Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Sun, 17 Aug 2025 20:39:09 +0200
Subject: [PATCH 3/7] avformat/segment: support arbitrary path lengths

Signed-off-by: Marton Balint 
---
 libavformat/segment.c | 36 +++-
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 05383de841..2c7ba0e776 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -38,6 +38,7 @@
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/time.h"
@@ -122,7 +123,7 @@ typedef struct SegmentContext {
 int   write_empty;
 
 int use_rename;
-char temp_list_filename[1024];
+char *temp_list_filename;
 
 SegmentListEntry cur_entry;
 SegmentListEntry *segment_list_entries;
@@ -191,9 +192,10 @@ static int set_segment_filename(AVFormatContext *s)
 AVFormatContext *oc = seg->avf;
 size_t size;
 int ret;
-char buf[1024];
+AVBPrint filename;
 char *new_name;
 
+av_bprint_init(&filename, 0, AV_BPRINT_SIZE_UNLIMITED);
 if (seg->segment_idx_wrap)
 seg->segment_idx %= seg->segment_idx_wrap;
 if (seg->use_strftime) {
@@ -201,18 +203,22 @@ static int set_segment_filename(AVFormatContext

[FFmpeg-devel] Re: [PATCH] avutil/bprint: fix av_bprint_strftime with %p format string reporting truncated output (PR #20330)

2025-08-26 Thread Marton Balint via ffmpeg-devel




On Tue, 26 Aug 2025, Nicolas George via ffmpeg-devel wrote:


Marton Balint via ffmpeg-devel (HE12025-08-24):

From f8e83bce6269c95fbad90f34434ceb641bf753d5 Mon Sep 17 00:00:00 2001

From: Marton Balint 
Date: Sun, 24 Aug 2025 21:42:54 +0200
Subject: [PATCH 1/2] avutil/bprint: make av_bprintf use av_vbprintf

No reason to duplicate the code.

Signed-off-by: Marton Balint 


No objection.


---
 libavutil/bprint.c | 33 +
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 4e9571715c..932c03ce50 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -96,35 +96,12 @@ void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, 
unsigned size)
 *buf->str = 0;
 }

-void av_bprintf(AVBPrint *buf, const char *fmt, ...)
-{
-unsigned room;
-char *dst;
-va_list vl;
-int extra_len;
-
-while (1) {
-room = av_bprint_room(buf);
-dst = room ? buf->str + buf->len : NULL;
-va_start(vl, fmt);
-extra_len = vsnprintf(dst, room, fmt, vl);
-va_end(vl);
-if (extra_len <= 0)
-return;
-if (extra_len < room)
-break;
-if (av_bprint_alloc(buf, extra_len))
-break;
-}
-av_bprint_grow(buf, extra_len);
-}
-
 void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
 {
 unsigned room;
 char *dst;



-int extra_len;
 va_list vl;
+int extra_len;


Uh?


This change is diff-algorithm dependant, but I have already force pushed a 
new version which gets rid of this.






 while (1) {
 room = av_bprint_room(buf);
@@ -142,6 +119,14 @@ void av_vbprintf(AVBPrint *buf, const char *fmt, va_list 
vl_arg)
 av_bprint_grow(buf, extra_len);
 }

+void av_bprintf(AVBPrint *buf, const char *fmt, ...)
+{
+va_list vl;
+va_start(vl, fmt);
+av_vbprintf(buf, fmt, vl);
+va_end(vl);
+}
+
 void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
 {
 unsigned room, real_n;


Regards,


Thanks,
Marton
___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] Re: [PATCH] avutil/bprint: fix av_bprint_strftime with %p format string reporting truncated output (PR #20330)

2025-08-26 Thread Marton Balint via ffmpeg-devel




On Tue, 26 Aug 2025, Nicolas George via ffmpeg-devel wrote:


Marton Balint via ffmpeg-devel (HE12025-08-24):

From 4532caf820dcb2bc2cbac3d4e782ad27cf9fd76b Mon Sep 17 00:00:00 2001

From: Marton Balint 
Date: Sun, 24 Aug 2025 21:35:41 +0200
Subject: [PATCH 2/2] avutil/bprint: fix av_bprint_strftime with %p format
 string reporting truncated output

strftime returns 0 in case of an empty output (e.g. %p format string with some
locales), there is no way to distinguish this from a buffer-too-small error
condition. So we must use some heuristics to handle this case, and not consume
INT_MAX RAM and falsely report a truncated output.

Signed-off-by: Marton Balint 
---
 libavutil/bprint.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index 932c03ce50..fa244b2e04 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -167,6 +167,7 @@ void av_bprint_strftime(AVBPrint *buf, const char *fmt, 
const struct tm *tm)
 {
 unsigned room;
 size_t l;



+size_t fmt_len = 0;


Why not set it here once and for all?


I just thought that for the typical case we can spare an strlen() call 
this way.






 if (!*fmt)
 return;
@@ -174,9 +175,16 @@ void av_bprint_strftime(AVBPrint *buf, const char *fmt, 
const struct tm *tm)
 room = av_bprint_room(buf);
 if (room && (l = strftime(buf->str + buf->len, room, fmt, tm)))
 break;
+
+if (!fmt_len)
+fmt_len = strlen(fmt);
+/* A 256x space requirement for output is unlikely, so it is likely 
empty */
+if (room >> 8 > fmt_len)
+break;
+


IIUC, at this point l=0 means either the buffer is too small or the
output is empty, and you distinguish between the cases by checking that
there is plenty of room, 256 chars for any char in the buffer?


Yes.



I think a lower margin should be ok, >>4 or >>5.


I'd rather keep it >>8, because strftime format strings can also 
have width specifiers, so something like "%80c" should work. Obviously 
this is always going to be a heuristics, but I wanted to be careful and 
reject only the very unlikely/insane format strings...




OTOH, I think a comment would be a good idea.


There is one, but OK, I will make the existing comment a bit more 
verbose.





 /* strftime does not tell us how much room it would need: let us
retry with twice as much until the buffer is large enough */
-room = !room ? strlen(fmt) + 1 :
+room = !room ? fmt_len + 1 :
room <= INT_MAX / 2 ? room * 2 : INT_MAX;
 if (av_bprint_alloc(buf, room)) {
 /* impossible to grow, try to manage something useful anyway */


Or we could write our own strftime, not localized.


Some API users might depend on our strftime functions returning localized 
strings...


Regards,
Marton




Regards,

--
 Nicolas George
___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] [RFC] avformat/img2dec: remove deprecated glob_sequence pattern type

2025-08-20 Thread Marton Balint via ffmpeg-devel

Hi,

I posted a patch not long ago to remove the long-deprecated glob_sequence 
pattern type.


https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20267

As far as I know there is no strict rule against removing options or 
changing defaults without a major version bump, generally we follow common 
sense (eg. if the change have limited impact, it should be OK without 
waiting for a bump).


Limited impact can be subjective of course, and every change can break 
someone's workflow (heating>)...


In any case, I intend to merge this soon, let me know if somebody strongly 
disagrees.


Thanks,
Marton
___
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] avutil/opt: also print option names on parse error (PR #20348)

2025-08-26 Thread Marton Balint via ffmpeg-devel
PR #20348 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20348
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20348.patch

It is more user-friendly to print which option caused the parse error.

Signed-off-by: Marton Balint 


>From 94431f8b33bc7ed84069ed02bc0e09bd8e9bb58f Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Wed, 27 Aug 2025 00:15:31 +0200
Subject: [PATCH] avutil/opt: also print option names on parse error

It is more user-friendly to print which option caused the parse error.

Signed-off-by: Marton Balint 
---
 libavutil/opt.c| 16 
 tests/ref/fate/opt | 28 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 7a84a18bb5..fc5834e168 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -490,7 +490,7 @@ static int set_string_number(void *obj, void *target_obj, 
const AVOption *o, con
 res = av_expr_parse_and_eval(&d, i ? buf : val, const_names,
 const_values, NULL, NULL, NULL, 
NULL, NULL, 0, obj);
 if (res < 0) {
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value 
\"%s\"\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option 
value \"%s\"\n", o->name, val);
 return res;
 }
 }
@@ -522,7 +522,7 @@ static int set_string_image_size(void *obj, const AVOption 
*o, const char *val,
 }
 ret = av_parse_video_size(dst, dst + 1, val);
 if (ret < 0)
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
image size\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" 
as image size\n", o->name, val);
 return ret;
 }
 
@@ -530,7 +530,7 @@ static int set_string_video_rate(void *obj, const AVOption 
*o, const char *val,
 {
 int ret = av_parse_video_rate(dst, val);
 if (ret < 0)
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
video rate\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" 
as video rate\n", o->name, val);
 return ret;
 }
 
@@ -543,7 +543,7 @@ static int set_string_color(void *obj, const AVOption *o, 
const char *val, uint8
 } else {
 ret = av_parse_color(dst, val, -1, obj);
 if (ret < 0)
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
color\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value 
\"%s\" as color\n", o->name, val);
 return ret;
 }
 return 0;
@@ -583,7 +583,7 @@ static int set_string_bool(void *obj, const AVOption *o, 
const char *val, int *d
 return 0;
 
 fail:
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
boolean\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as 
boolean\n", o->name, val);
 return AVERROR(EINVAL);
 }
 
@@ -601,7 +601,7 @@ static int set_string_fmt(void *obj, const AVOption *o, 
const char *val, uint8_t
 fmt = strtol(val, &tail, 0);
 if (*tail || (unsigned)fmt >= fmt_nb) {
 av_log(obj, AV_LOG_ERROR,
-   "Unable to parse option value \"%s\" as %s\n", val, 
desc);
+   "Unable to parse \"%s\" option value \"%s\" as %s\n", 
o->name, val, desc);
 return AVERROR(EINVAL);
 }
 }
@@ -724,7 +724,7 @@ static int opt_set_elem(void *obj, void *target_obj, const 
AVOption *o,
 int64_t usecs = 0;
 if (val) {
 if ((ret = av_parse_time(&usecs, val, 1)) < 0) {
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value 
\"%s\" as duration\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option 
value \"%s\" as duration\n", o->name, val);
 return ret;
 }
 }
@@ -741,7 +741,7 @@ static int opt_set_elem(void *obj, void *target_obj, const 
AVOption *o,
 case AV_OPT_TYPE_CHLAYOUT:
 ret = set_string_channel_layout(obj, o, val, dst);
 if (ret < 0) {
-av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
channel layout\n", val);
+av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value 
\"%s\" as channel layout\n", o->name, val);
 ret = AVERROR(EINVAL);
 }
 return ret;
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index b8812e3eff..1f82f7e4bd 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -231,7 +231,7 @@ Error 'foo==val'
 Setting options string 'toggle=:'
 Setting entry with key 'toggle' to value ''
 Undefined constant or missing '(' in ''
-Unable to parse option value ""
+Unable to parse "toggle" option value ""
 Error 'toggle=:'
 Setting options string 'string=:'
 Setting entry with key 'string

[FFmpeg-devel] Re: [PATCH v3 5/5] doc/protocols: Add command-line description for ipv6 options

2025-08-29 Thread Marton Balint via ffmpeg-devel




On Fri, 29 Aug 2025, Peter Enderborg via ffmpeg-devel wrote:


Two new options added for receive IPv6 multicast streams.
1 multicast_max_joins
2 multicast_interface

Change-Id: Ief0389815cff3edf26f7db5cbff033ce8bb24639
Signed-off-by: Peter Enderborg 
---
doc/protocols.texi | 17 -
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 6b582fde30..3def969dbe 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1207,7 +1207,15 @@ This is a deprecated option. Instead, 
@option{localrtpport} should be
used.

@item localaddr=@var{addr}
-Local IP address of a network interface used for sending packets or joining
+Local IP address of a network interface used for sending or receiving packets 
or joining
+multicast groups.
+
+@item multicast_interface=@var{interfacename}
+Local IP address of a network interface used for receiving packets or joining
+multicast groups.


Why is this not simply "interface"? I would expect this option to be
interchangable with localaddr at least for ipv4, so the user can decide to 
specify the interface by its ip address or its name.



+
+@item multicast_max_join=@var{n}
+Local IP address of a network interface used for receiving packets or joining
multicast groups.


This seems like unintended copy paste. What is the actual use case for 
this option? How it is decided which additional interfaces are used for 
multicast? How does this option relates to the localaddr and interface 
options?




@item timeout=@var{n}
@@ -1229,6 +1237,13 @@ port will be used for the local RTP and RTCP ports.
@item
If @option{localrtcpport} (the local RTCP port) is not set it will be
set to the local RTP port value plus 1.
+
+@item
+On IPv6 the default receive behavior is using outgoing routing table for 
selection of
+a interface for multicast streams. With @option{multicast_max_join} receiving
+can be added for multiple interfaces. With @option{multicast_interface} a
+interface is directly selected for receiving.
+


I guess this paragraph belongs to the earlier part.


@end enumerate


Please merge the documentation patch with corresponding feature patches.

Thanks,
Marton
___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] [PATCH] Various small things in regarding URL options (PR #20390)

2025-09-01 Thread Marton Balint via ffmpeg-devel
PR #20390 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20390
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20390.patch

This is a preparation series for a future patchset aiming to set protocol URL 
options via AVOptions.

This series adds AVOptions for previously URL-only options, adds some AVOption 
aliases where the URL option name and the AVOption name was different, has some 
factorization work and also fixes a small issue in the URL decoding function.


>From 4c20eeb14a26c01c4cd4dd4972c49a9562309c9b Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Sun, 24 Aug 2025 23:28:36 +0200
Subject: [PATCH 1/9] avformat/udp: add DSCP as a normal AVOption

Previously this was an URL-only option.

Signed-off-by: Marton Balint 
---
 doc/protocols.texi |  3 +++
 libavformat/udp.c  | 10 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 6b582fde30..4b871dddb7 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -2162,6 +2162,9 @@ Explicitly allow or disallow reusing UDP sockets.
 @item ttl=@var{ttl}
 Set the time to live value (for multicast only).
 
+@item dscp=@var{dscp}
+Set the 6-bit DSCP field for outgoing packets.
+
 @item connect=@var{1|0}
 Initialize the UDP socket with @code{connect()}. In this case, the
 destination address can't be changed with ff_udp_set_remote_url later.
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 84f9d3e62e..ded7a1a85e 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -118,6 +118,7 @@ typedef struct UDPContext {
 int remaining_in_dg;
 char *localaddr;
 int timeout;
+int dscp;
 struct sockaddr_storage local_addr_storage;
 char *sources;
 char *block;
@@ -142,6 +143,7 @@ static const AVOption options[] = {
 { "reuse_socket",   "explicitly allow reusing UDP sockets",
OFFSET(reuse_socket),   AV_OPT_TYPE_BOOL,   { .i64 = -1 },-1, 1,   
.flags = D|E },
 { "broadcast", "explicitly allow or disallow broadcast destination",   
OFFSET(is_broadcast),   AV_OPT_TYPE_BOOL,   { .i64 = 0  }, 0, 1,   E },
 { "ttl","Time to live (multicast only)",   
OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, 255, E },
+{ "dscp",   "DSCP class for outgoing packets", 
OFFSET(dscp),   AV_OPT_TYPE_INT,{ .i64 = -1 },-1, 63,  E },
 { "connect","set if connect() should be called on socket", 
OFFSET(is_connected),   AV_OPT_TYPE_BOOL,   { .i64 =  0 }, 0, 1,   
.flags = D|E },
 { "fifo_size",  "set the UDP receiving circular buffer size, expressed 
as a number of packets with size of 188 bytes", OFFSET(circular_buffer_size), 
AV_OPT_TYPE_INT, {.i64 = 7*4096}, 0, INT_MAX, D },
 { "overrun_nonfatal", "survive in case of UDP receiving circular buffer 
overrun", OFFSET(overrun_nonfatal), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,D },
@@ -691,7 +693,7 @@ end:
 static int udp_open(URLContext *h, const char *uri, int flags)
 {
 char hostname[1024];
-int port, udp_fd = -1, tmp, bind_ret = -1, dscp = -1;
+int port, udp_fd = -1, tmp, bind_ret = -1;
 UDPContext *s = h->priv_data;
 int is_output;
 const char *p;
@@ -760,7 +762,7 @@ static int udp_open(URLContext *h, const char *uri, int 
flags)
 s->is_connected = strtol(buf, NULL, 10);
 }
 if (av_find_info_tag(buf, sizeof(buf), "dscp", p)) {
-dscp = strtol(buf, NULL, 10);
+s->dscp = strtol(buf, NULL, 10);
 }
 if (av_find_info_tag(buf, sizeof(buf), "fifo_size", p)) {
 s->circular_buffer_size = strtol(buf, NULL, 10);
@@ -870,8 +872,8 @@ static int udp_open(URLContext *h, const char *uri, int 
flags)
 av_log(h, AV_LOG_WARNING, "socket option UDPLITE_RECV_CSCOV not 
available");
 }
 
-if (dscp >= 0) {
-dscp <<= 2;
+if (s->dscp >= 0) {
+int dscp = s->dscp << 2;
 if (setsockopt (udp_fd, IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp)) != 0) 
{
 ret = ff_neterrno();
 goto fail;
-- 
2.49.1


>From b1c70e0e7d7c2e8128f084ade72e0049de713206 Mon Sep 17 00:00:00 2001
From: Marton Balint 
Date: Mon, 25 Aug 2025 21:02:54 +0200
Subject: [PATCH 2/9] avformat/udp: factorize warning unsupported options for
 builds without PTHREAD_CANCEL

Also fix 'circular_buffer_size' parameter name in the message and the
'fifo_size' option description.

Signed-off-by: Marton Balint 
---
 libavformat/udp.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index ded7a1a85e..e1dec49010 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -145,7 +145,7 @@ static const AVOption options[] = {
 { "ttl","Time to live (multicast only)",   
OFFSET(ttl),AV_OPT_TYPE_INT,{ .i64 = 16 }, 0, 255,