[FFmpeg-devel] [PATCH 2/6] lavfi/testsrc: make use of AV_OPT_TYPE_VIDEO_RATE
Clément Bœsch
ubitux at gmail.com
Tue Mar 26 13:36:58 CET 2013
On Tue, Mar 26, 2013 at 12:26:31PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavfilter/vsrc_testsrc.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
> index b650a61..bc0d3d1 100644
> --- a/libavfilter/vsrc_testsrc.c
> +++ b/libavfilter/vsrc_testsrc.c
> @@ -52,7 +52,6 @@ typedef struct {
> unsigned int nb_frame;
> AVRational time_base, frame_rate;
> int64_t pts;
> - char *frame_rate_str; ///< video frame rate
> char *duration_str; ///< total duration of the generated video
> int64_t duration; ///< duration expressed in microseconds
> AVRational sar; ///< sample aspect ratio
> @@ -78,8 +77,8 @@ typedef struct {
> static const AVOption options[] = {
> { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },
> { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },
> - { "rate", "set video rate", OFFSET(frame_rate_str), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, FLAGS },
> - { "r", "set video rate", OFFSET(frame_rate_str), AV_OPT_TYPE_STRING, {.str = "25"}, 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 },
> { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
> @@ -104,11 +103,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
> if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0)
> return ret;
>
> - if ((ret = av_parse_video_rate(&test->frame_rate, test->frame_rate_str)) < 0) {
> - av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->frame_rate_str);
> - return ret;
> - }
> -
> test->duration = -1;
> if (test->duration_str &&
> (ret = av_parse_time(&test->duration, test->duration_str, 1)) < 0) {
LGTM
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130326/389e8c88/attachment.asc>
More information about the ffmpeg-devel
mailing list