36 #define GLOB_NOMAGIC 0
58 enum { PT_GLOB_SEQUENCE, PT_GLOB, PT_SEQUENCE } pattern_type;
86 *width_ptr =
sizes[i][0];
87 *height_ptr =
sizes[i][1];
101 while (p = strchr(p,
'%')) {
106 if (span = strspn(p,
"*?[]{}"))
126 const char *path,
int start_index,
int start_index_range)
129 int range, last_index, range1, first_index;
132 for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
143 if (first_index == start_index + start_index_range)
147 last_index = first_index;
156 last_index + range1) < 0)
162 if (range >= (1 << 30))
170 *pfirst_index = first_index;
171 *plast_index = last_index;
196 int first_index, last_index, ret = 0;
218 "Could not parse video size: %s.\n", s->
video_size);
223 "Could not parse framerate: %s.\n", s->
framerate);
250 char *p = s->
path, *q, *dup;
254 "use pattern_type 'glob' instead\n");
259 if ((p - s->
path) >= (
sizeof(s->
path) - 2))
261 if (*q ==
'%' && strspn(q + 1,
"%*?[]{}"))
263 else if (strspn(q,
"\\*?[]{}"))
270 gerr = glob(s->
path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC,
NULL, &s->globstate);
275 last_index = s->globstate.gl_pathc - 1;
283 "Could find no file with with path '%s' and index in the range %d-%d\n",
290 gerr = glob(s->
path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC,
NULL, &s->globstate);
295 last_index = s->globstate.gl_pathc - 1;
299 "Pattern type 'glob' was selected but globbing "
300 "is not supported by this libavformat build\n");
305 "Unknown value '%d' for pattern_type option\n", s->
pattern_type);
313 st->
duration = last_index - first_index + 1;
323 const char *str = strrchr(s->
path,
'.');
340 char filename_bytes[1024];
341 char *filename = filename_bytes;
343 int size[3] = { 0 }, ret[3] = { 0 };
356 filename = s->globstate.gl_pathv[s->
img_number];
364 for (i = 0; i < 3; i++) {
377 filename[strlen(filename) - 1] =
'U' + i;
401 for (i = 0; i < 3; i++) {
411 if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
427 globfree(&s->globstate);
444 #define OFFSET(x) offsetof(VideoDemuxData, x)
445 #define DEC AV_OPT_FLAG_DECODING_PARAM
450 {
"pattern_type",
"set pattern type",
OFFSET(pattern_type),
AV_OPT_TYPE_INT, {.i64=PT_GLOB_SEQUENCE}, 0, INT_MAX,
DEC,
"pattern_type"},
451 {
"glob_sequence",
"select glob/sequence pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
452 {
"glob",
"select glob pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
453 {
"sequence",
"select sequence pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
456 {
"start_number",
"set first number in the sequence",
OFFSET(start_number),
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX,
DEC },
457 {
"start_number_range",
"set range for looking at the first sequence number",
OFFSET(start_number_range),
AV_OPT_TYPE_INT, {.i64 = 5}, 1, INT_MAX,
DEC },
463 #if CONFIG_IMAGE2_DEMUXER
464 static const AVClass img2_class = {
480 .priv_class = &img2_class,
483 #if CONFIG_IMAGE2PIPE_DEMUXER
484 static const AVClass img2pipe_class = {
491 .
name =
"image2pipe",
496 .priv_class = &img2pipe_class,