Browse code

Merge commit '38c1466ca41c73c7ce347da702362cb69c151716'

* commit '38c1466ca41c73c7ce347da702362cb69c151716':
dict: add av_dict_parse_string()
doc: support multitable in texi2pod

Conflicts:
doc/APIchanges
libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/01/26 21:34:30
Showing 5 changed files
... ...
@@ -138,6 +138,10 @@ API changes, most recent first:
138 138
 2012-03-26 - a67d9cf - lavfi 2.66.100
139 139
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
140 140
 
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
+
141 145
 2013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h
142 146
   Add av_strnstr()
143 147
 
... ...
@@ -169,7 +169,7 @@ INF: while(<$inf>) {
169 169
         } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
170 170
             $shift = "";
171 171
             $_ = "";        # need a paragraph break
172
-        } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
172
+        } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) {
173 173
             $_ = "\n=back\n";
174 174
             $ic = pop @icstack;
175 175
         } else {
... ...
@@ -269,7 +269,7 @@ INF: while(<$inf>) {
269 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 273
         push @endwstack, $endw;
274 274
         push @icstack, $ic;
275 275
         $endw = $1;
... ...
@@ -278,6 +278,7 @@ INF: while(<$inf>) {
278 278
         $ic =~ s/\@(?:code|kbd)/C/;
279 279
         $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
280 280
         $ic =~ s/\@(?:file)/F/;
281
+        $ic =~ s/\@(?:columnfractions)//;
281 282
         $_ = "\n=over 4\n";
282 283
     };
283 284
 
... ...
@@ -288,6 +289,21 @@ INF: while(<$inf>) {
288 288
         $_ = "";        # need a paragraph break
289 289
     };
290 290
 
291
+    /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
292
+        my $columns = $1;
293
+        $columns =~ s/\@tab/ : /;
294
+
295
+        $_ = "\n=item B&LT;". $columns ."&GT;\n";
296
+    };
297
+
298
+    /^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
299
+        my $columns = $1;
300
+        $columns =~ s/\@tab/ : /;
301
+
302
+        $_ = " : ". $columns;
303
+        $section =~ s/\n+\s+$//;
304
+    };
305
+
291 306
     /^\@itemx?\s*(.+)?$/ and do {
292 307
         if (defined $1) {
293 308
             # Entity escapes prevent munging by the <> processing below.
... ...
@@ -110,6 +110,53 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
110 110
     return 0;
111 111
 }
112 112
 
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
+
113 160
 void av_dict_free(AVDictionary **pm)
114 161
 {
115 162
     AVDictionary *m = *pm;
... ...
@@ -113,6 +113,23 @@ int av_dict_count(const AVDictionary *m);
113 113
 int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
114 114
 
115 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
+
132
+/**
116 133
  * Copy entries from one AVDictionary struct into another.
117 134
  * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
118 135
  *            this function will allocate a struct for you and put it in *dst
... ...
@@ -75,7 +75,7 @@
75 75
  */
76 76
 
77 77
 #define LIBAVUTIL_VERSION_MAJOR  52
78
-#define LIBAVUTIL_VERSION_MINOR  16
78
+#define LIBAVUTIL_VERSION_MINOR  17
79 79
 #define LIBAVUTIL_VERSION_MICRO 100
80 80
 
81 81
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \