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
138138 2012-03-26 - a67d9cf - lavfi 2.66.100
139139 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
140140
141+2013-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+
141145 2013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h
142146 Add av_strnstr()
143147
doc/texi2pod.pl+18−2
@@ -169,7 +169,7 @@ INF: while(<$inf>) { · 168 unmodified lines
169169 } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
170170 $shift = "";
171171 $_ = ""; # need a paragraph break
172− } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
172+ } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) {
173173 $_ = "\n=back\n";
174174 $ic = pop @icstack;
175175 } else {
@@ -269,7 +269,7 @@ INF: while(<$inf>) { · 93 unmodified lines
269269 $endw = "enumerate";
270270 };
271271
272− /^\@([fv]?table)\s+(\@[a-z]+)/ and do {
272+ /^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do {
273273 push @endwstack, $endw;
274274 push @icstack, $ic;
275275 $endw = $1;
@@ -278,6 +278,7 @@ INF: while(<$inf>) { · 2 unmodified lines
278278 $ic =~ s/\@(?:code|kbd)/C/;
279279 $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
280280 $ic =~ s/\@(?:file)/F/;
281+ $ic =~ s/\@(?:columnfractions)//;
281282 $_ = "\n=over 4\n";
282283 };
283284
@@ -288,6 +289,21 @@ INF: while(<$inf>) { · 4 unmodified lines
288289 $_ = ""; # need a paragraph break
289290 };
290291
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+
291307 /^\@itemx?\s*(.+)?$/ and do {
292308 if (defined $1) {
293309 # 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
110110 return 0;
111111 }
112112
113+static 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+
137+int 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+
113160 void av_dict_free(AVDictionary **pm)
114161 {
115162 AVDictionary *m = *pm;
libavutil/dict.h+17−0
@@ -112,6 +112,23 @@ int av_dict_count(const AVDictionary *m); · 111 unmodified lines
112112 */
113113 int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
114114
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+ */
128+int av_dict_parse_string(AVDictionary **pm, const char *str,
129+ const char *key_val_sep, const char *pairs_sep,
130+ int flags);
131+
115132 /**
116133 * Copy entries from one AVDictionary struct into another.
117134 * @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
7575 */
7676
7777 #define LIBAVUTIL_VERSION_MAJOR 52
78−#define LIBAVUTIL_VERSION_MINOR 16
78+#define LIBAVUTIL_VERSION_MINOR 17
7979 #define LIBAVUTIL_VERSION_MICRO 100
8080
8181 #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