Fix style: "if(" -> "if (".
[libav.git] / libavfilter / parseutils.h
CommitLineData
d11dbf09
MN
1/*
2 * copyright (c) 2009 Stefano Sabatini
3 * This file is part of FFmpeg.
4 *
5 * FFmpeg is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * FFmpeg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with FFmpeg; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20/**
ba87f080 21 * @file
d11dbf09
MN
22 * parsing utils
23 */
24
25#ifndef AVFILTER_PARSEUTILS_H
26#define AVFILTER_PARSEUTILS_H
27
c1ec75b5
SS
28#include "libavcodec/opt.h"
29
d11dbf09 30/**
49bd8e4b
MR
31 * Unescape the given string until a non escaped terminating char,
32 * and return the token corresponding to the unescaped string.
d11dbf09
MN
33 *
34 * The normal \ and ' escaping is supported. Leading and trailing
35 * whitespaces are removed.
36 *
d11dbf09
MN
37 * @param buf the buffer to parse, buf will be updated to point to the
38 * terminating char
053a79b2 39 * @param term a 0-terminated list of terminating chars
d11dbf09 40 * @return the malloced unescaped string, which must be av_freed by
30d93310 41 * the user, NULL in case of allocation failure
d11dbf09
MN
42 */
43char *av_get_token(const char **buf, const char *term);
44
a3015225 45/**
49bd8e4b 46 * Put the RGBA values that correspond to color_string in rgba_color.
a3015225
SS
47 *
48 * @param color_string a string specifying a color. It can be the name of
a52e2c3a
SS
49 * a color (case insensitive match) or a 0xRRGGBB[AA] sequence,
50 * possibly followed by "@" and a string representing the alpha
51 * component.
52 * The alpha component may be a string composed by "0x" followed by an
53 * hexadecimal number or a base-10 number between 0 and 255, or a
54 * decimal number between 0.0 and 1.0, which represents the opacity
55 * value (0/0x00/0.0 means completely transparent, 255/0xff/1.0
56 * completely opaque).
57 * If the alpha component is not specified then 255 is assumed.
3d3bd64d 58 * The string "random" will result in a random color.
a3015225
SS
59 * @return >= 0 in case of success, a negative value in case of
60 * failure (for example if color_string cannot be parsed).
61 */
62int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx);
63
c1ec75b5 64/**
49bd8e4b 65 * Parse the key/value pairs list in opts. For each key/value pair
c1ec75b5
SS
66 * found, stores the value in the field in ctx that is named like the
67 * key. ctx must be an AVClass context, storing is done using
68 * AVOptions.
69 *
70 * @param key_val_sep a 0-terminated list of characters used to
71 * separate key from value
72 * @param pairs_sep a 0-terminated list of characters used to separate
73 * two pairs from each other
74 * @return the number of successfully set key/value pairs, or a negative
75 * value corresponding to an AVERROR code in case of error:
76 * AVERROR(EINVAL) if opts cannot be parsed,
77 * the error code issued by av_set_string3() if a key/value pair
78 * cannot be set
79 */
80int av_set_options_string(void *ctx, const char *opts,
81 const char *key_val_sep, const char *pairs_sep);
82
d11dbf09 83#endif /* AVFILTER_PARSEUTILS_H */