mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-25 04:19:05 +00:00
lavf/img2dec: add option to disable pattern matching
Signed-off-by: Marton Balint <cus@passwd.hu> Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
37efad4e5b
commit
93cc5ca7ed
@ -258,6 +258,10 @@ Select the pattern type used to interpret the provided filename.
|
|||||||
|
|
||||||
@var{pattern_type} accepts one of the following values.
|
@var{pattern_type} accepts one of the following values.
|
||||||
@table @option
|
@table @option
|
||||||
|
@item none
|
||||||
|
Disable pattern matching, therefore the video will only contain the specified
|
||||||
|
image. You should use this option if you do not want to create sequences from
|
||||||
|
multiple images and your filenames may contain special pattern characters.
|
||||||
@item sequence
|
@item sequence
|
||||||
Select a sequence pattern type, used to specify a sequence of files
|
Select a sequence pattern type, used to specify a sequence of files
|
||||||
indexed by sequential numbers.
|
indexed by sequential numbers.
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
enum PatternType {
|
enum PatternType {
|
||||||
PT_GLOB_SEQUENCE,
|
PT_GLOB_SEQUENCE,
|
||||||
PT_GLOB,
|
PT_GLOB,
|
||||||
PT_SEQUENCE
|
PT_SEQUENCE,
|
||||||
|
PT_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct VideoDemuxData {
|
typedef struct VideoDemuxData {
|
||||||
|
@ -177,7 +177,7 @@ static int img_read_probe(AVProbeData *p)
|
|||||||
int ff_img_read_header(AVFormatContext *s1)
|
int ff_img_read_header(AVFormatContext *s1)
|
||||||
{
|
{
|
||||||
VideoDemuxData *s = s1->priv_data;
|
VideoDemuxData *s = s1->priv_data;
|
||||||
int first_index, last_index;
|
int first_index = 1, last_index = 1;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ int ff_img_read_header(AVFormatContext *s1)
|
|||||||
"is not supported by this libavformat build\n");
|
"is not supported by this libavformat build\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
#endif
|
#endif
|
||||||
} else if (s->pattern_type != PT_GLOB_SEQUENCE) {
|
} else if (s->pattern_type != PT_GLOB_SEQUENCE && s->pattern_type != PT_NONE) {
|
||||||
av_log(s1, AV_LOG_ERROR,
|
av_log(s1, AV_LOG_ERROR,
|
||||||
"Unknown value '%d' for pattern_type option\n", s->pattern_type);
|
"Unknown value '%d' for pattern_type option\n", s->pattern_type);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
@ -377,7 +377,9 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
if (s->img_number > s->img_last)
|
if (s->img_number > s->img_last)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
if (s->use_glob) {
|
if (s->pattern_type == PT_NONE) {
|
||||||
|
av_strlcpy(filename_bytes, s->path, sizeof(filename_bytes));
|
||||||
|
} else if (s->use_glob) {
|
||||||
#if HAVE_GLOB
|
#if HAVE_GLOB
|
||||||
filename = s->globstate.gl_pathv[s->img_number];
|
filename = s->globstate.gl_pathv[s->img_number];
|
||||||
#endif
|
#endif
|
||||||
@ -538,6 +540,7 @@ const AVOption ff_img_options[] = {
|
|||||||
{ "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
{ "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||||
{ "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
{ "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||||
{ "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
{ "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||||
|
{ "none", "disable pattern matching", 0, AV_OPT_TYPE_CONST, {.i64=PT_NONE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||||
|
|
||||||
{ "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
|
{ "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
|
||||||
{ "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
|
{ "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 56
|
#define LIBAVFORMAT_VERSION_MAJOR 56
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 33
|
#define LIBAVFORMAT_VERSION_MINOR 33
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
#define LIBAVFORMAT_VERSION_MICRO 101
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
LIBAVFORMAT_VERSION_MINOR, \
|
LIBAVFORMAT_VERSION_MINOR, \
|
||||||
|
Loading…
Reference in New Issue
Block a user