diff options
author | Mashiat Sarker Shakkhar <mashiat.sarker@gmail.com> | 2012-06-24 13:40:50 +0600 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-24 12:40:54 +0200 |
commit | 98b3f17bd7182f4fbf318e09068bc19457a82d69 (patch) | |
tree | 64bb6d5fba5401367e74390f2c0927578af3b082 /libavformat/img2dec.c | |
parent | eeddd3962e8653677446886b7a896ff3b5a05c51 (diff) | |
download | ffmpeg-98b3f17bd7182f4fbf318e09068bc19457a82d69.tar.gz |
image2: Add "start_number" private option to the demuxer
Currently if a pattern is given we search for up to the fifth file name in
that sequence. This option sets that limit to an arbitrary number.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 3579d3b22c..f962ccfb7e 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -58,6 +58,7 @@ typedef struct { #if HAVE_GLOB glob_t globstate; #endif + int start_number; } VideoDemuxData; static const int sizes[][2] = { @@ -109,13 +110,13 @@ static int is_glob(const char *path) /* return -1 if no image found */ static int find_image_range(int *pfirst_index, int *plast_index, - const char *path) + const char *path, int max_start) { char buf[1024]; int range, last_index, range1, first_index; /* find the first image */ - for(first_index = 0; first_index < 5; first_index++) { + for(first_index = max_start; first_index < max_start + 5; first_index++) { if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){ *pfirst_index = *plast_index = 1; @@ -251,8 +252,8 @@ static int read_header(AVFormatContext *s1) last_index = s->globstate.gl_pathc - 1; #endif } else { - if (find_image_range(&first_index, &last_index, s->path) < 0) - return AVERROR(ENOENT); + if (find_image_range(&first_index, &last_index, s->path, s->start_number - 1) < 0) + return AVERROR(ENOENT); } s->img_first = first_index; s->img_last = last_index; @@ -375,6 +376,7 @@ static const AVOption options[] = { { "video_size", "", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, { "loop", "", OFFSET(loop), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, DEC }, + { "start_number", "first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, DEC }, { NULL }, }; |