36 #define GLOB_NOMAGIC 0
57 enum { PT_GLOB_SEQUENCE, PT_GLOB, PT_SEQUENCE } pattern_type;
85 *width_ptr =
sizes[i][0];
86 *height_ptr =
sizes[i][1];
100 while (p = strchr(p,
'%')) {
105 if (span = strspn(p,
"*?[]{}"))
125 const char *path,
int start_index,
int start_index_range)
128 int range, last_index, range1, first_index;
131 for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
142 if (first_index == start_index + start_index_range)
146 last_index = first_index;
155 last_index + range1) < 0)
161 if (range >= (1 << 30))
169 *pfirst_index = first_index;
170 *plast_index = last_index;
195 int first_index, last_index, ret = 0;
217 "Could not parse video size: %s.\n", s->
video_size);
222 "Could not parse framerate: %s.\n", s->
framerate);
249 char *p = s->
path, *q, *dup;
253 "use pattern_type 'glob' instead\n");
258 if ((p - s->
path) >= (
sizeof(s->
path) - 2))
260 if (*q ==
'%' && strspn(q + 1,
"%*?[]{}"))
262 else if (strspn(q,
"\\*?[]{}"))
269 gerr = glob(s->
path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC,
NULL, &s->globstate);
274 last_index = s->globstate.gl_pathc - 1;
282 "Could find no file with with path '%s' and index in the range %d-%d\n",
289 gerr = glob(s->
path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC,
NULL, &s->globstate);
294 last_index = s->globstate.gl_pathc - 1;
298 "Pattern type 'glob' was selected but globbing "
299 "is not supported by this libavformat build\n");
304 "Unknown value '%d' for pattern_type option\n", s->
pattern_type);
312 st->
duration = last_index - first_index + 1;
322 const char *str = strrchr(s->
path,
'.');
339 char filename_bytes[1024];
340 char *filename = filename_bytes;
342 int size[3] = { 0 }, ret[3] = { 0 };
355 filename = s->globstate.gl_pathv[s->
img_number];
363 for (i = 0; i < 3; i++) {
376 filename[strlen(filename) - 1] =
'U' + i;
398 for (i = 0; i < 3; i++) {
408 if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
423 globfree(&s->globstate);
429 #define OFFSET(x) offsetof(VideoDemuxData, x)
430 #define DEC AV_OPT_FLAG_DECODING_PARAM
435 {
"pattern_type",
"set pattern type",
OFFSET(pattern_type),
AV_OPT_TYPE_INT, {.i64=PT_GLOB_SEQUENCE}, 0, INT_MAX,
DEC,
"pattern_type"},
436 {
"glob_sequence",
"glob/sequence pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
437 {
"glob",
"glob pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
438 {
"sequence",
"glob pattern type", 0,
AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX,
DEC,
"pattern_type" },
441 {
"start_number",
"set first number in the sequence",
OFFSET(start_number),
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX,
DEC },
442 {
"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 },
448 #if CONFIG_IMAGE2_DEMUXER
449 static const AVClass img2_class = {
464 .priv_class = &img2_class,
467 #if CONFIG_IMAGE2PIPE_DEMUXER
468 static const AVClass img2pipe_class = {
475 .
name =
"image2pipe",
480 .priv_class = &img2pipe_class,