[FFmpeg-cvslog] lavf/img2dec: add start_number_range option
Stefano Sabatini
git at videolan.org
Sun Aug 5 15:49:19 CEST 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sun Aug 5 10:04:02 2012 +0200| [9bece760097bf1de120e47aa504c9a9ca54d4490] | committer: Stefano Sabatini
lavf/img2dec: add start_number_range option
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bece760097bf1de120e47aa504c9a9ca54d4490
---
doc/demuxers.texi | 8 ++++++--
libavformat/img2dec.c | 14 +++++++-------
libavformat/version.h | 2 +-
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 07d82c0..d96fe71 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -35,8 +35,8 @@ specified in the pattern with the string "%%".
If the pattern contains "%d" or "%0 at var{N}d", the first filename of
the file list specified by the pattern must contain a number
inclusively contained between @var{start_number} and
- at var{start_number}+4, and all the following numbers must be
-sequential.
+ at var{start_number}+ at var{start_number_range}-1, and all the following
+numbers must be sequential.
The pattern may contain a suffix which is used to automatically
determine the format of the images contained in the files.
@@ -62,6 +62,10 @@ format is guessed from the first image file in the sequence.
@item start_number
Set the index of the file matched by the image file pattern to start
to read from. Default value is 0.
+ at item start_number_range
+Set the index interval range to check when looking for the first image
+file in the sequence, starting from @var{start_number}. Default value
+is 5.
@item video_size
Set the video size of the images to read. If not specified the video
size is guessed from the first image file in the sequence.
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 4cd8c82..0443b1a 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -59,6 +59,7 @@ typedef struct {
glob_t globstate;
#endif
int start_number;
+ int start_number_range;
} VideoDemuxData;
static const int sizes[][2] = {
@@ -108,8 +109,6 @@ static int is_glob(const char *path)
#endif
}
-#define FIRST_INDEX_SEARCH_RANGE 5
-
/**
* Get index range of image files matched by path.
*
@@ -120,13 +119,13 @@ static int is_glob(const char *path)
* @return -1 if no image file could be found
*/
static int find_image_range(int *pfirst_index, int *plast_index,
- const char *path, int start_index)
+ const char *path, int start_index, int start_index_range)
{
char buf[1024];
int range, last_index, range1, first_index;
/* find the first image */
- for (first_index = start_index; first_index < start_index + FIRST_INDEX_SEARCH_RANGE; first_index++) {
+ for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
*pfirst_index =
*plast_index = 1;
@@ -137,7 +136,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
if (avio_check(buf, AVIO_FLAG_READ) > 0)
break;
}
- if (first_index == start_index + FIRST_INDEX_SEARCH_RANGE)
+ if (first_index == start_index + start_index_range)
goto fail;
/* find the last image */
@@ -263,10 +262,10 @@ static int read_header(AVFormatContext *s1)
#endif
} else {
if (find_image_range(&first_index, &last_index, s->path,
- s->start_number) < 0) {
+ s->start_number, s->start_number_range) < 0) {
av_log(s1, AV_LOG_ERROR,
"Could find no file with with path '%s' and index in the range %d-%d\n",
- s->path, s->start_number, s->start_number+FIRST_INDEX_SEARCH_RANGE-1);
+ s->path, s->start_number, s->start_number + s->start_number_range - 1);
return AVERROR(ENOENT);
}
}
@@ -391,6 +390,7 @@ static const AVOption options[] = {
{ "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 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, {.dbl = 0}, 0, INT_MAX, DEC },
+ { "start_number_range", "set range for looking at the first sequence number", OFFSET(start_number_range), AV_OPT_TYPE_INT, {.dbl = 5}, 1, INT_MAX, DEC },
{ "video_size", "set video size", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ NULL },
};
diff --git a/libavformat/version.h b/libavformat/version.h
index faf068f..4cda247 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 22
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list