History

libavfilter: add ff_parse_time_base()

Michael Niedermayer committed 14 years ago

Commit 34484041 parent 6579bc42 files · +22 −0Browse files

Unified · Split

2 files
  1. libavfilter/formats.c +12 −0
  2. libavfilter/internal.h +10 −0
libavfilter/formats.c+12−0
@@ -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
497int 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
496int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)508int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
497{509{
498 char *tail;510 char *tail;
libavfilter/internal.h+10−0
@@ -111,6 +111,16 @@ int ff_parse_pixel_format(enum PixelFormat *ret, const char *arg, void *log_ctx) · 110 unmodified lines
111 */111 */
112int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx);112int 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 */
122int 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 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t