History

lavu: introduce av_parse_ratio() and use it in ffmpeg and lavfi/aspect

Factorize code and provide ratio parsing consistency.

Stefano Sabatini committed 14 years ago

Commit 70ffda31 parent 1ca08127 files · +75 −50Browse files

Showing the changes to libavutil/parseutils.h (1 of 7 files). Show all

Unified · Split

libavutil/parseutils.h+24−0
@@ -28,6 +28,30 @@ · 27 unmodified lines
28 * misc parsing utilities28 * misc parsing utilities
29 */29 */
30 30
31/**
32 * Parse str and store the parsed ratio in q.
33 *
34 * Note that a ratio with infinite (1/0) or negative value is
35 * considered valid, so you should check on the returned value if you
36 * want to exclude those values.
37 *
38 * The undefined value can be expressed using the "0:0" string.
39 *
40 * @param[in,out] q pointer to the AVRational which will contain the ratio
41 * @param[in] str the string to parse: it has to be a string in the format
42 * num:den, a float number or an expression
43 * @param[in] max the maximum allowed numerator and denominator
44 * @param[in] log_offset log level offset which is applied to the log
45 * level of log_ctx
46 * @param[in] log_ctx parent logging context
47 * @return >= 0 on success, a negative error code otherwise
48 */
49int av_parse_ratio(AVRational *q, const char *str, int max,
50 int log_offset, void *log_ctx);
51
52#define av_parse_ratio_quiet(rate, str, max) \
53 av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL)
54
31/**55/**
32 * Parse str and put in width_ptr and height_ptr the detected values.56 * Parse str and put in width_ptr and height_ptr the detected values.
33 *57 *

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