Commit b37858ea authored by Liviu Oniciuc's avatar Liviu Oniciuc Committed by Michael Niedermayer

avformat/img2dec: remove the non-negative number requirement for start_number option

industrial cameras usually mark the trigger frame as frame number 0
all frames saved before trigger frame receive a negative sequence number
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 6a0cd529
...@@ -537,7 +537,7 @@ const AVOption ff_img_options[] = { ...@@ -537,7 +537,7 @@ const AVOption ff_img_options[] = {
{ "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" },
{ "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 }, 0, 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 },
{ "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 }, { "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 },
{ "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, { "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
{ "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC }, { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
......
...@@ -3827,6 +3827,8 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) ...@@ -3827,6 +3827,8 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
if (percentd_found) if (percentd_found)
goto fail; goto fail;
percentd_found = 1; percentd_found = 1;
if(number < 0)
nd += 1;
snprintf(buf1, sizeof(buf1), "%0*d", nd, number); snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
len = strlen(buf1); len = strlen(buf1);
if ((q - buf + len) > buf_size - 1) if ((q - buf + len) > buf_size - 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment