annotate lib/libavutil/avstring.h @ 2535:3a36de426f5f

For draw uPlayerCreationUI_ArrowAnim
author Ritor1
date Sun, 15 Feb 2015 23:39:07 +0600
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * Copyright (c) 2007 Mans Rullgard
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 #ifndef AVUTIL_AVSTRING_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 #define AVUTIL_AVSTRING_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 #include <stddef.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 #include "attributes.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 * @addtogroup lavu_string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 * the address of the first character in str after the prefix.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36 * @param str input string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 * @param pfx prefix to test
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 * @param ptr updated if the prefix is matched inside str
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 * @return non-zero if the prefix matches, zero otherwise
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 int av_strstart(const char *str, const char *pfx, const char **ptr);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 * Return non-zero if pfx is a prefix of str independent of case. If
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 * it is, *ptr is set to the address of the first character in str
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46 * after the prefix.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 * @param str input string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 * @param pfx prefix to test
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 * @param ptr updated if the prefix is matched inside str
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 * @return non-zero if the prefix matches, zero otherwise
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 int av_stristart(const char *str, const char *pfx, const char **ptr);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56 * Locate the first case-independent occurrence in the string haystack
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 * of the string needle. A zero-length string needle is considered to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 * match at the start of haystack.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 * This function is a case-insensitive version of the standard strstr().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 * @param haystack string to search in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 * @param needle string to search for
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 * @return pointer to the located match within haystack
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 * or a null pointer if no match
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 char *av_stristr(const char *haystack, const char *needle);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 * Locate the first occurrence of the string needle in the string haystack
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 * where not more than hay_length characters are searched. A zero-length
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 * string needle is considered to match at the start of haystack.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 * This function is a length-limited version of the standard strstr().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 * @param haystack string to search in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 * @param needle string to search for
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 * @param hay_length length of string to search in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 * @return pointer to the located match within haystack
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 * or a null pointer if no match
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 char *av_strnstr(const char *haystack, const char *needle, size_t hay_length);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 * Copy the string src to dst, but no more than size - 1 bytes, and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 * null-terminate dst.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 * This function is the same as BSD strlcpy().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 * @param dst destination buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 * @param src source string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 * @param size size of destination buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 * @return the length of src
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 * @warning since the return value is the length of src, src absolutely
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 * _must_ be a properly 0-terminated string, otherwise this will read beyond
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 * the end of the buffer and possibly crash.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 size_t av_strlcpy(char *dst, const char *src, size_t size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102 * Append the string src to the string dst, but to a total length of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 * no more than size - 1 bytes, and null-terminate dst.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 * This function is similar to BSD strlcat(), but differs when
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 * size <= strlen(dst).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 * @param dst destination buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 * @param src source string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110 * @param size size of destination buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 * @return the total length of src and dst
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 * @warning since the return value use the length of src and dst, these
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 * absolutely _must_ be a properly 0-terminated strings, otherwise this
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 * will read beyond the end of the buffer and possibly crash.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 size_t av_strlcat(char *dst, const char *src, size_t size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
118
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
119 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
120 * Append output to a string, according to a format. Never write out of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
121 * the destination buffer, and always put a terminating 0 within
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
122 * the buffer.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
123 * @param dst destination buffer (string to which the output is
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
124 * appended)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
125 * @param size total size of the destination buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
126 * @param fmt printf-compatible format string, specifying how the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
127 * following parameters are used
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
128 * @return the length of the string that would have been generated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
129 * if enough space had been available
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
130 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
131 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
132
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
133 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
134 * Print arguments following specified format into a large enough auto
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
135 * allocated buffer. It is similar to GNU asprintf().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
136 * @param fmt printf-compatible format string, specifying how the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
137 * following parameters are used.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
138 * @return the allocated string
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
139 * @note You have to free the string yourself with av_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
140 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
141 char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
142
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
143 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
144 * Convert a number to a av_malloced string.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
145 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
146 char *av_d2str(double d);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
147
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
148 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
149 * Unescape the given string until a non escaped terminating char,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
150 * and return the token corresponding to the unescaped string.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
151 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
152 * The normal \ and ' escaping is supported. Leading and trailing
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
153 * whitespaces are removed, unless they are escaped with '\' or are
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
154 * enclosed between ''.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
155 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
156 * @param buf the buffer to parse, buf will be updated to point to the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
157 * terminating char
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
158 * @param term a 0-terminated list of terminating chars
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
159 * @return the malloced unescaped string, which must be av_freed by
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
160 * the user, NULL in case of allocation failure
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
161 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
162 char *av_get_token(const char **buf, const char *term);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
163
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
164 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
165 * Split the string into several tokens which can be accessed by
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
166 * successive calls to av_strtok().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
167 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
168 * A token is defined as a sequence of characters not belonging to the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
169 * set specified in delim.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
170 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
171 * On the first call to av_strtok(), s should point to the string to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
172 * parse, and the value of saveptr is ignored. In subsequent calls, s
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
173 * should be NULL, and saveptr should be unchanged since the previous
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
174 * call.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
175 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
176 * This function is similar to strtok_r() defined in POSIX.1.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
177 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
178 * @param s the string to parse, may be NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
179 * @param delim 0-terminated list of token delimiters, must be non-NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
180 * @param saveptr user-provided pointer which points to stored
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
181 * information necessary for av_strtok() to continue scanning the same
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
182 * string. saveptr is updated to point to the next character after the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
183 * first delimiter found, or to NULL if the string was terminated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
184 * @return the found token, or NULL when no token is found
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
185 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
186 char *av_strtok(char *s, const char *delim, char **saveptr);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
187
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
188 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
189 * Locale-independent conversion of ASCII isdigit.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
190 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
191 int av_isdigit(int c);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
192
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
193 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
194 * Locale-independent conversion of ASCII isgraph.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
195 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
196 int av_isgraph(int c);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
197
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
198 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
199 * Locale-independent conversion of ASCII isspace.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
200 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
201 int av_isspace(int c);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
202
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
203 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
204 * Locale-independent conversion of ASCII characters to uppercase.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
205 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
206 static inline int av_toupper(int c)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
207 {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
208 if (c >= 'a' && c <= 'z')
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
209 c ^= 0x20;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
210 return c;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
211 }
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
212
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
213 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
214 * Locale-independent conversion of ASCII characters to lowercase.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
215 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
216 static inline int av_tolower(int c)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
217 {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
218 if (c >= 'A' && c <= 'Z')
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
219 c ^= 0x20;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
220 return c;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
221 }
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
222
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
223 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
224 * Locale-independent conversion of ASCII isxdigit.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
225 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
226 int av_isxdigit(int c);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
227
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
228 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
229 * Locale-independent case-insensitive compare.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
230 * @note This means only ASCII-range characters are case-insensitive
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
231 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
232 int av_strcasecmp(const char *a, const char *b);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
233
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
234 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
235 * Locale-independent case-insensitive compare.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
236 * @note This means only ASCII-range characters are case-insensitive
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
237 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
238 int av_strncasecmp(const char *a, const char *b, size_t n);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
239
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
240
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
241 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
242 * Thread safe basename.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
243 * @param path the path, on DOS both \ and / are considered separators.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
244 * @return pointer to the basename substring.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
245 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
246 const char *av_basename(const char *path);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
247
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
248 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
249 * Thread safe dirname.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
250 * @param path the path, on DOS both \ and / are considered separators.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
251 * @return the path with the separator replaced by the string terminator or ".".
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
252 * @note the function may change the input string.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
253 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
254 const char *av_dirname(char *path);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
255
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
256 enum AVEscapeMode {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
257 AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
258 AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
259 AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
260 };
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
261
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
262 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
263 * Consider spaces special and escape them even in the middle of the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
264 * string.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
265 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
266 * This is equivalent to adding the whitespace characters to the special
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
267 * characters lists, except it is guaranteed to use the exact same list
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
268 * of whitespace characters as the rest of libavutil.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
269 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
270 #define AV_ESCAPE_FLAG_WHITESPACE 0x01
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
271
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
272 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
273 * Escape only specified special characters.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
274 * Without this flag, escape also any characters that may be considered
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
275 * special by av_get_token(), such as the single quote.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
276 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
277 #define AV_ESCAPE_FLAG_STRICT 0x02
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
278
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
279 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
280 * Escape string in src, and put the escaped string in an allocated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
281 * string in *dst, which must be freed with av_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
282 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
283 * @param dst pointer where an allocated string is put
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
284 * @param src string to escape, must be non-NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
285 * @param special_chars string containing the special characters which
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
286 * need to be escaped, can be NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
287 * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
288 * Any unknown value for mode will be considered equivalent to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
289 * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
290 * notice.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
291 * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_ macros
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
292 * @return the length of the allocated string, or a negative error code in case of error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
293 * @see av_bprint_escape()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
294 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
295 int av_escape(char **dst, const char *src, const char *special_chars,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
296 enum AVEscapeMode mode, int flags);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
297
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
298 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
299 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
300 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
301
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
302 #endif /* AVUTIL_AVSTRING_H */