History

Merge commit '38c1466ca41c73c7ce347da702362cb69c151716'

* commit '38c1466ca41c73c7ce347da702362cb69c151716': dict: add av_dict_parse_string() doc: support multitable in texi2pod Conflicts: doc/APIchanges libavutil/version.h

Michael Niedermayer committed 13 years ago

Commit e7e14bc2 parents 25c7552 38c14665 files · +87 −3Browse files

Unified · Split

5 files
  1. doc/APIchanges +4 −0
  2. doc/texi2pod.pl +18 −2
  3. libavutil/dict.c +47 −0
  4. libavutil/dict.h +17 −0
  5. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -138,6 +138,10 @@ API changes, most recent first: · 137 unmodified lines
1382012-03-26 - a67d9cf - lavfi 2.66.1001382012-03-26 - a67d9cf - lavfi 2.66.100
139 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.139 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
140 140
1412013-xx-xx - xxxxxxx - lavu 52.7.0 - dict.h
142 Add av_dict_parse_string() to set multiple key/value pairs at once from a
143 string.
144
1412013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h1452013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h
142 Add av_strnstr()146 Add av_strnstr()
143 147
doc/texi2pod.pl+18−2
@@ -169,7 +169,7 @@ INF: while(<$inf>) { · 168 unmodified lines
169 } elsif ($ended =~ /^(?:example|smallexample|display)$/) {169 } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
170 $shift = "";170 $shift = "";
171 $_ = ""; # need a paragraph break171 $_ = ""; # need a paragraph break
172 } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {172 } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) {
173 $_ = "\n=back\n";173 $_ = "\n=back\n";
174 $ic = pop @icstack;174 $ic = pop @icstack;
175 } else {175 } else {
@@ -269,7 +269,7 @@ INF: while(<$inf>) { · 93 unmodified lines
269 $endw = "enumerate";269 $endw = "enumerate";
270 };270 };
271 271
272 /^\@([fv]?table)\s+(\@[a-z]+)/ and do {272 /^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do {
273 push @endwstack, $endw;273 push @endwstack, $endw;
274 push @icstack, $ic;274 push @icstack, $ic;
275 $endw = $1;275 $endw = $1;
@@ -278,6 +278,7 @@ INF: while(<$inf>) { · 2 unmodified lines
278 $ic =~ s/\@(?:code|kbd)/C/;278 $ic =~ s/\@(?:code|kbd)/C/;
279 $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;279 $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
280 $ic =~ s/\@(?:file)/F/;280 $ic =~ s/\@(?:file)/F/;
281 $ic =~ s/\@(?:columnfractions)//;
281 $_ = "\n=over 4\n";282 $_ = "\n=over 4\n";
282 };283 };
283 284
@@ -288,6 +289,21 @@ INF: while(<$inf>) { · 4 unmodified lines
288 $_ = ""; # need a paragraph break289 $_ = ""; # need a paragraph break
289 };290 };
290 291
292 /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
293 my $columns = $1;
294 $columns =~ s/\@tab/ : /;
295
296 $_ = "\n=item B&LT;". $columns ."&GT;\n";
297 };
298
299 /^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
300 my $columns = $1;
301 $columns =~ s/\@tab/ : /;
302
303 $_ = " : ". $columns;
304 $section =~ s/\n+\s+$//;
305 };
306
291 /^\@itemx?\s*(.+)?$/ and do {307 /^\@itemx?\s*(.+)?$/ and do {
292 if (defined $1) {308 if (defined $1) {
293 # Entity escapes prevent munging by the <> processing below.309 # Entity escapes prevent munging by the <> processing below.
libavutil/dict.c+47−0
@@ -110,6 +110,53 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags · 109 unmodified lines
110 return 0;110 return 0;
111}111}
112 112
113static int parse_key_value_pair(AVDictionary **pm, const char **buf,
114 const char *key_val_sep, const char *pairs_sep,
115 int flags)
116{
117 char *key = av_get_token(buf, key_val_sep);
118 char *val = NULL;
119 int ret;
120
121 if (key && *key && strspn(*buf, key_val_sep)) {
122 (*buf)++;
123 val = av_get_token(buf, pairs_sep);
124 }
125
126 if (key && *key && val && *val)
127 ret = av_dict_set(pm, key, val, flags);
128 else
129 ret = AVERROR(EINVAL);
130
131 av_freep(&key);
132 av_freep(&val);
133
134 return ret;
135}
136
137int av_dict_parse_string(AVDictionary **pm, const char *str,
138 const char *key_val_sep, const char *pairs_sep,
139 int flags)
140{
141 int ret;
142
143 if (!str)
144 return 0;
145
146 /* ignore STRDUP flags */
147 flags &= ~(AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
148
149 while (*str) {
150 if ((ret = parse_key_value_pair(pm, &str, key_val_sep, pairs_sep, flags)) < 0)
151 return ret;
152
153 if (*str)
154 str++;
155 }
156
157 return 0;
158}
159
113void av_dict_free(AVDictionary **pm)160void av_dict_free(AVDictionary **pm)
114{161{
115 AVDictionary *m = *pm;162 AVDictionary *m = *pm;
libavutil/dict.h+17−0
@@ -112,6 +112,23 @@ int av_dict_count(const AVDictionary *m); · 111 unmodified lines
112 */112 */
113int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);113int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
114 114
115/**
116 * Parse the key/value pairs list and add to a dictionary.
117 *
118 * @param key_val_sep a 0-terminated list of characters used to separate
119 * key from value
120 * @param pairs_sep a 0-terminated list of characters used to separate
121 * two pairs from each other
122 * @param flags flags to use when adding to dictionary.
123 * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
124 * are ignored since the key/value tokens will always
125 * be duplicated.
126 * @return 0 on success, negative AVERROR code on failure
127 */
128int av_dict_parse_string(AVDictionary **pm, const char *str,
129 const char *key_val_sep, const char *pairs_sep,
130 int flags);
131
115/**132/**
116 * Copy entries from one AVDictionary struct into another.133 * Copy entries from one AVDictionary struct into another.
117 * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,134 * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
libavutil/version.h+1−1
@@ -75,7 +75,7 @@ · 74 unmodified lines
75 */75 */
76 76
77#define LIBAVUTIL_VERSION_MAJOR 5277#define LIBAVUTIL_VERSION_MAJOR 52
78#define LIBAVUTIL_VERSION_MINOR 1678#define LIBAVUTIL_VERSION_MINOR 17
79#define LIBAVUTIL_VERSION_MICRO 10079#define LIBAVUTIL_VERSION_MICRO 100
80 80
81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \81#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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