From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 3FB304950B for ; Sun, 17 Aug 2025 09:28:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D73FF68CC39; Sun, 17 Aug 2025 12:28:31 +0300 (EEST) Received: from c1ad6a1ecdc3 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 796C668AD9B for ; Sun, 17 Aug 2025 12:28:30 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avformat/img2dec=3A_remove_?= =?utf-8?q?deprecated_glob=5Fsequence_pattern_type_=28PR_=2320267=29?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Marton Balint via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250817092831.D73FF68CC39@ffbox0-bg.ffmpeg.org> Date: Sun, 17 Aug 2025 12:28:31 +0300 (EEST) Archived-At: List-Archive: List-Post: 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: " - "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".