* 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>tags/n1.2
| @@ -138,6 +138,10 @@ API changes, most recent first: | |||||
| 2012-03-26 - a67d9cf - lavfi 2.66.100 | 2012-03-26 - a67d9cf - lavfi 2.66.100 | ||||
| Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. | ||||
| 2013-xx-xx - xxxxxxx - lavu 52.7.0 - dict.h | |||||
| Add av_dict_parse_string() to set multiple key/value pairs at once from a | |||||
| string. | |||||
| 2013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h | 2013-01-xx - xxxxxxx - lavu 52.6.0 - avstring.h | ||||
| Add av_strnstr() | Add av_strnstr() | ||||
| @@ -169,7 +169,7 @@ INF: while(<$inf>) { | |||||
| } elsif ($ended =~ /^(?:example|smallexample|display)$/) { | } elsif ($ended =~ /^(?:example|smallexample|display)$/) { | ||||
| $shift = ""; | $shift = ""; | ||||
| $_ = ""; # need a paragraph break | $_ = ""; # need a paragraph break | ||||
| } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { | |||||
| } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) { | |||||
| $_ = "\n=back\n"; | $_ = "\n=back\n"; | ||||
| $ic = pop @icstack; | $ic = pop @icstack; | ||||
| } else { | } else { | ||||
| @@ -269,7 +269,7 @@ INF: while(<$inf>) { | |||||
| $endw = "enumerate"; | $endw = "enumerate"; | ||||
| }; | }; | ||||
| /^\@([fv]?table)\s+(\@[a-z]+)/ and do { | |||||
| /^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do { | |||||
| push @endwstack, $endw; | push @endwstack, $endw; | ||||
| push @icstack, $ic; | push @icstack, $ic; | ||||
| $endw = $1; | $endw = $1; | ||||
| @@ -278,6 +278,7 @@ INF: while(<$inf>) { | |||||
| $ic =~ s/\@(?:code|kbd)/C/; | $ic =~ s/\@(?:code|kbd)/C/; | ||||
| $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; | $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; | ||||
| $ic =~ s/\@(?:file)/F/; | $ic =~ s/\@(?:file)/F/; | ||||
| $ic =~ s/\@(?:columnfractions)//; | |||||
| $_ = "\n=over 4\n"; | $_ = "\n=over 4\n"; | ||||
| }; | }; | ||||
| @@ -288,6 +289,21 @@ INF: while(<$inf>) { | |||||
| $_ = ""; # need a paragraph break | $_ = ""; # need a paragraph break | ||||
| }; | }; | ||||
| /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do { | |||||
| my $columns = $1; | |||||
| $columns =~ s/\@tab/ : /; | |||||
| $_ = "\n=item B<". $columns .">\n"; | |||||
| }; | |||||
| /^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do { | |||||
| my $columns = $1; | |||||
| $columns =~ s/\@tab/ : /; | |||||
| $_ = " : ". $columns; | |||||
| $section =~ s/\n+\s+$//; | |||||
| }; | |||||
| /^\@itemx?\s*(.+)?$/ and do { | /^\@itemx?\s*(.+)?$/ and do { | ||||
| if (defined $1) { | if (defined $1) { | ||||
| # Entity escapes prevent munging by the <> processing below. | # 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 | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static int parse_key_value_pair(AVDictionary **pm, const char **buf, | |||||
| const char *key_val_sep, const char *pairs_sep, | |||||
| int flags) | |||||
| { | |||||
| char *key = av_get_token(buf, key_val_sep); | |||||
| char *val = NULL; | |||||
| int ret; | |||||
| if (key && *key && strspn(*buf, key_val_sep)) { | |||||
| (*buf)++; | |||||
| val = av_get_token(buf, pairs_sep); | |||||
| } | |||||
| if (key && *key && val && *val) | |||||
| ret = av_dict_set(pm, key, val, flags); | |||||
| else | |||||
| ret = AVERROR(EINVAL); | |||||
| av_freep(&key); | |||||
| av_freep(&val); | |||||
| return ret; | |||||
| } | |||||
| int av_dict_parse_string(AVDictionary **pm, const char *str, | |||||
| const char *key_val_sep, const char *pairs_sep, | |||||
| int flags) | |||||
| { | |||||
| int ret; | |||||
| if (!str) | |||||
| return 0; | |||||
| /* ignore STRDUP flags */ | |||||
| flags &= ~(AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); | |||||
| while (*str) { | |||||
| if ((ret = parse_key_value_pair(pm, &str, key_val_sep, pairs_sep, flags)) < 0) | |||||
| return ret; | |||||
| if (*str) | |||||
| str++; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| void av_dict_free(AVDictionary **pm) | void av_dict_free(AVDictionary **pm) | ||||
| { | { | ||||
| AVDictionary *m = *pm; | AVDictionary *m = *pm; | ||||
| @@ -112,6 +112,23 @@ int av_dict_count(const AVDictionary *m); | |||||
| */ | */ | ||||
| int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); | int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); | ||||
| /** | |||||
| * Parse the key/value pairs list and add to a dictionary. | |||||
| * | |||||
| * @param key_val_sep a 0-terminated list of characters used to separate | |||||
| * key from value | |||||
| * @param pairs_sep a 0-terminated list of characters used to separate | |||||
| * two pairs from each other | |||||
| * @param flags flags to use when adding to dictionary. | |||||
| * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL | |||||
| * are ignored since the key/value tokens will always | |||||
| * be duplicated. | |||||
| * @return 0 on success, negative AVERROR code on failure | |||||
| */ | |||||
| int av_dict_parse_string(AVDictionary **pm, const char *str, | |||||
| const char *key_val_sep, const char *pairs_sep, | |||||
| int flags); | |||||
| /** | /** | ||||
| * Copy entries from one AVDictionary struct into another. | * Copy entries from one AVDictionary struct into another. | ||||
| * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, | * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, | ||||
| @@ -75,7 +75,7 @@ | |||||
| */ | */ | ||||
| #define LIBAVUTIL_VERSION_MAJOR 52 | #define LIBAVUTIL_VERSION_MAJOR 52 | ||||
| #define LIBAVUTIL_VERSION_MINOR 16 | |||||
| #define LIBAVUTIL_VERSION_MINOR 17 | |||||
| #define LIBAVUTIL_VERSION_MICRO 100 | #define LIBAVUTIL_VERSION_MICRO 100 | ||||
| #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | ||||