Unified · Split
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #include "libavutil/eval.h" | 22 | #include "libavutil/eval.h" |
| 23 | #include "libavutil/pixdesc.h" | 23 | #include "libavutil/pixdesc.h" |
| 24 | #include "libavutil/parseutils.h" | ||
| 24 | #include "libavutil/audioconvert.h" | 25 | #include "libavutil/audioconvert.h" |
| 25 | #include "avfilter.h" | 26 | #include "avfilter.h" |
| 26 | #include "internal.h" | 27 | #include "internal.h" |
| @@ -493,6 +494,17 @@ int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx) · 466 unmodified lines | |||
| 493 | return 0; | 494 | return 0; |
| 494 | } | 495 | } |
| 495 | 496 | ||
| 497 | int ff_parse_time_base(AVRational *ret, const char *arg, void *log_ctx) | ||
| 498 | { | ||
| 499 | AVRational r; | ||
| 500 | if(av_parse_ratio(&r, arg, INT_MAX, 0, log_ctx) < 0 ||r.num<=0 ||r.den<=0) { | ||
| 501 | av_log(log_ctx, AV_LOG_ERROR, "Invalid time base '%s'\n", arg); | ||
| 502 | return AVERROR(EINVAL); | ||
| 503 | } | ||
| 504 | *ret = r; | ||
| 505 | return 0; | ||
| 506 | } | ||
| 507 | |||
| 496 | int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx) | 508 | int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx) |
| 497 | { | 509 | { |
| 498 | char *tail; | 510 | char *tail; |
| @@ -111,6 +111,16 @@ int ff_parse_pixel_format(enum PixelFormat *ret, const char *arg, void *log_ctx) · 110 unmodified lines | |||
| 111 | */ | 111 | */ |
| 112 | int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx); | 112 | int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx); |
| 113 | 113 | ||
| 114 | /** | ||
| 115 | * Parse a time base. | ||
| 116 | * | ||
| 117 | * @param ret unsigned AVRational pointer to where the value should be written | ||
| 118 | * @param arg string to parse | ||
| 119 | * @param log_ctx log context | ||
| 120 | * @return 0 in case of success, a negative AVERROR code on error | ||
| 121 | */ | ||
| 122 | int ff_parse_time_base(AVRational *ret, const char *arg, void *log_ctx); | ||
| 123 | |||
| 114 | /** | 124 | /** |
| 115 | * Parse a sample format name or a corresponding integer representation. | 125 | * Parse a sample format name or a corresponding integer representation. |
| 116 | * | 126 | * |