Statistics
| Branch: | Revision:

ffmpeg / libavfilter / parseutils.h @ 63613fe6

History | View | Annotate | Download (2.73 KB)

1 d11dbf09 Michael Niedermayer
/*
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
/**
21
 * @file libavfilter/parseutils.h
22
 * parsing utils
23
 */
24
25
#ifndef AVFILTER_PARSEUTILS_H
26
#define AVFILTER_PARSEUTILS_H
27
28 c1ec75b5 Stefano Sabatini
#include "libavcodec/opt.h"
29
30 d11dbf09 Michael Niedermayer
/**
31
 * Unescapes the given string until a non escaped terminating char,
32
 * and returns the token corresponding to the unescaped string.
33
 *
34
 * The normal \ and ' escaping is supported. Leading and trailing
35
 * whitespaces are removed.
36
 *
37
 * @param term a 0-terminated list of terminating chars
38
 * @param buf the buffer to parse, buf will be updated to point to the
39
 * terminating char
40
 * @return the malloced unescaped string, which must be av_freed by
41
 * the user
42
 */
43
char *av_get_token(const char **buf, const char *term);
44
45 a3015225 Stefano Sabatini
/**
46
 * Puts the RGBA values that correspond to color_string in rgba_color.
47
 *
48
 * @param color_string a string specifying a color. It can be the name of
49 b69b622c Stefano Sabatini
 * a color (case insensitive match) or a 0xRRGGBB[AA] sequence.
50 3d3bd64d Stefano Sabatini
 * The string "random" will result in a random color.
51 a3015225 Stefano Sabatini
 * @return >= 0 in case of success, a negative value in case of
52
 * failure (for example if color_string cannot be parsed).
53
 */
54
int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx);
55
56 c1ec75b5 Stefano Sabatini
/**
57
 * Parses the key/value pairs list in opts. For each key/value pair
58
 * found, stores the value in the field in ctx that is named like the
59
 * key. ctx must be an AVClass context, storing is done using
60
 * AVOptions.
61
 *
62
 * @param key_val_sep a 0-terminated list of characters used to
63
 * separate key from value
64
 * @param pairs_sep a 0-terminated list of characters used to separate
65
 * two pairs from each other
66
 * @return the number of successfully set key/value pairs, or a negative
67
 * value corresponding to an AVERROR code in case of error:
68
 * AVERROR(EINVAL) if opts cannot be parsed,
69
 * the error code issued by av_set_string3() if a key/value pair
70
 * cannot be set
71
 */
72
int av_set_options_string(void *ctx, const char *opts,
73
                          const char *key_val_sep, const char *pairs_sep);
74
75 d11dbf09 Michael Niedermayer
#endif  /* AVFILTER_PARSEUTILS_H */