aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-04-12 23:58:02 +0200
committerStefano Sabatini <stefasab@gmail.com>2013-04-13 14:09:16 +0200
commit87dd62e141985599974ede08d17f66691e9dd6c2 (patch)
treecace0b66da26b8a419a81f0f0f6983142e3bac2f
parentdcea58502c9b7992e284233f2c5ba75c51456ad3 (diff)
downloadffmpeg-87dd62e141985599974ede08d17f66691e9dd6c2.tar.gz
lavfi/testsrc: make use of AV_OPT_TYPE_DURATION
Simplify.
-rw-r--r--libavfilter/vsrc_testsrc.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 4292b88e24..7b594678a5 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -53,7 +53,6 @@ typedef struct {
unsigned int nb_frame;
AVRational time_base, frame_rate;
int64_t pts;
- char *duration_str; ///< total duration of the generated video
int64_t duration; ///< duration expressed in microseconds
AVRational sar; ///< sample aspect ratio
int nb_decimals;
@@ -80,8 +79,8 @@ typedef struct {
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
{ "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
{ "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
- { "duration", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },\
- { "d", "set video duration", OFFSET(duration_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },\
+ { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
+ { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
{ "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
@@ -108,13 +107,6 @@ static av_cold int init(AVFilterContext *ctx)
TestSourceContext *test = ctx->priv;
int ret = 0;
- test->duration = -1;
- if (test->duration_str &&
- (ret = av_parse_time(&test->duration, test->duration_str, 1)) < 0) {
- av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration_str);
- return ret;
- }
-
if (test->nb_decimals && strcmp(ctx->filter->name, "testsrc")) {
av_log(ctx, AV_LOG_WARNING,
"Option 'decimals' is ignored with source '%s'\n",