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] avformat/img2dec: remove deprecated glob_sequence pattern type (PR #20267)
@ 2025-08-17  9:28 Marton Balint via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: Marton Balint via ffmpeg-devel @ 2025-08-17  9:28 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

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 <cus@passwd.hu>


From 9e256ad6df2be7ead19bfd7887aca6bbe41f402a Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
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 <cus@passwd.hu>
---
 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: "
-                   "use pattern_type 'glob' instead\n");
-#if HAVE_GLOB
-            dup = q = av_strdup(p);
-            while (*q) {
-                /* Do we have room for the next char and a \ insertion? */
-                if ((p - s->path) >= (sizeof(s->path) - 2))
-                  break;
-                if (*q == '%' && strspn(q + 1, "%*?[]{}"))
-                    ++q;
-                else if (strspn(q, "\\*?[]{}"))
-                    *p++ = '\\';
-                *p++ = *q++;
-            }
-            *p = 0;
-            av_free(dup);
-
-            gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);
-            if (gerr != 0) {
-                return AVERROR(ENOENT);
-            }
-            first_index = 0;
-            last_index = s->globstate.gl_pathc - 1;
-#endif
-        }
-        }
-        if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) {
+        if (s->pattern_type == PT_SEQUENCE) {
             if (find_image_range(s1->pb, &first_index, &last_index, s->path,
                                  s->start_number, s->start_number_range) < 0) {
                 av_log(s1, AV_LOG_ERROR,
@@ -303,7 +245,7 @@ int ff_img_read_header(AVFormatContext *s1)
                    "is not supported by this libavformat build\n");
             return AVERROR(ENOSYS);
 #endif
-        } else if (s->pattern_type != PT_GLOB_SEQUENCE && s->pattern_type != PT_NONE) {
+        } else if (s->pattern_type != PT_NONE) {
             av_log(s1, AV_LOG_ERROR,
                    "Unknown value '%d' for pattern_type option\n", s->pattern_type);
             return AVERROR(EINVAL);
@@ -623,7 +565,6 @@ static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
 #if CONFIG_IMAGE2_DEMUXER
 const AVOption ff_img_options[] = {
     { "pattern_type", "set pattern type",                    OFFSET(pattern_type), AV_OPT_TYPE_INT,    {.i64=PT_DEFAULT}, 0,       INT_MAX, DEC, .unit = "pattern_type"},
-    { "glob_sequence","select glob/sequence pattern type",   0, AV_OPT_TYPE_CONST,  {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
     { "glob",         "select glob pattern type",            0, AV_OPT_TYPE_CONST,  {.i64=PT_GLOB         }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
     { "sequence",     "select sequence pattern type",        0, AV_OPT_TYPE_CONST,  {.i64=PT_SEQUENCE     }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
     { "none",         "disable pattern matching",            0, AV_OPT_TYPE_CONST,  {.i64=PT_NONE         }, INT_MIN, INT_MAX, DEC, .unit = "pattern_type" },
-- 
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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-17  9:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-17  9:28 [FFmpeg-devel] [PATCH] avformat/img2dec: remove deprecated glob_sequence pattern type (PR #20267) Marton Balint via ffmpeg-devel

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