diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-05-22 12:46:29 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-06-08 07:43:45 +0200 |
commit | d2d67e424fa10d883e13709095c80bd3b502ce03 (patch) | |
tree | 3ff3180c011e728fbda17dd40e200c0f4946eb07 | |
parent | d9f80ea2a7325f9c84307568843512811a99baff (diff) | |
download | ffmpeg-d2d67e424fa10d883e13709095c80bd3b502ce03.tar.gz |
Remove all uses of now deprecated metadata functions.
55 files changed, 263 insertions, 218 deletions
@@ -39,6 +39,7 @@ #include "libavutil/colorspace.h" #include "libavutil/fifo.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "libavutil/pixdesc.h" #include "libavutil/avstring.h" #include "libavutil/libm.h" @@ -189,7 +190,7 @@ static int64_t start_time = 0; static int64_t recording_timestamp = 0; static int64_t input_ts_offset = 0; static int file_overwrite = 0; -static AVMetadata *metadata; +static AVDictionary *metadata; static int do_benchmark = 0; static int do_hex_dump = 0; static int do_pkt_dump = 0; @@ -1894,7 +1895,7 @@ static int copy_chapters(int infile, int outfile) out_ch->end = FFMIN(rt, in_ch->end - ts_off); if (metadata_chapters_autocopy) - av_metadata_copy(&out_ch->metadata, in_ch->metadata, 0); + av_dict_copy(&out_ch->metadata, in_ch->metadata, 0); os->nb_chapters++; os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters); @@ -2083,8 +2084,8 @@ static int transcode(AVFormatContext **output_files, icodec = ist->st->codec; if (metadata_streams_autocopy) - av_metadata_copy(&ost->st->metadata, ist->st->metadata, - AV_METADATA_DONT_OVERWRITE); + av_dict_copy(&ost->st->metadata, ist->st->metadata, + AV_DICT_DONT_OVERWRITE); ost->st->disposition = ist->st->disposition; codec->bits_per_raw_sample= icodec->bits_per_raw_sample; @@ -2352,7 +2353,7 @@ static int transcode(AVFormatContext **output_files, /* set meta data information from input file if required */ for (i=0;i<nb_meta_data_maps;i++) { AVFormatContext *files[2]; - AVMetadata **meta[2]; + AVDictionary **meta[2]; int j; #define METADATA_CHECK_INDEX(index, nb_elems, desc)\ @@ -2395,15 +2396,15 @@ static int transcode(AVFormatContext **output_files, } } - av_metadata_copy(meta[0], *meta[1], AV_METADATA_DONT_OVERWRITE); + av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE); } /* copy global metadata by default */ if (metadata_global_autocopy) { for (i = 0; i < nb_output_files; i++) - av_metadata_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, - AV_METADATA_DONT_OVERWRITE); + av_dict_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, + AV_DICT_DONT_OVERWRITE); } /* copy chapters according to chapter maps */ @@ -2818,7 +2819,7 @@ static int opt_metadata(const char *opt, const char *arg) } *mid++= 0; - av_metadata_set2(&metadata, arg, mid, 0); + av_dict_set(&metadata, arg, mid, 0); return 0; } @@ -3523,7 +3524,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) parse_forced_key_frames(forced_key_frames, ost, video_enc); } if (video_language) { - av_metadata_set2(&st->metadata, "language", video_language, 0); + av_dict_set(&st->metadata, "language", video_language, 0); av_freep(&video_language); } @@ -3603,7 +3604,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) } audio_enc->time_base= (AVRational){1, audio_sample_rate}; if (audio_language) { - av_metadata_set2(&st->metadata, "language", audio_language, 0); + av_dict_set(&st->metadata, "language", audio_language, 0); av_freep(&audio_language); } @@ -3699,7 +3700,7 @@ static void new_subtitle_stream(AVFormatContext *oc, int file_idx) } if (subtitle_language) { - av_metadata_set2(&st->metadata, "language", subtitle_language, 0); + av_dict_set(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } @@ -3830,8 +3831,8 @@ static void opt_output_file(const char *filename) oc->timestamp = recording_timestamp; - av_metadata_copy(&oc->metadata, metadata, 0); - av_metadata_free(&metadata); + av_dict_copy(&oc->metadata, metadata, 0); + av_dict_free(&metadata); } output_files[nb_output_files++] = oc; @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "libavutil/dict.h" #include "libavdevice/avdevice.h" #include "cmdutils.h" @@ -160,7 +161,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) AVCodecContext *dec_ctx; AVCodec *dec; char val_str[128]; - AVMetadataTag *tag = NULL; + AVDictionaryEntry *tag = NULL; AVRational display_aspect_ratio; printf("[STREAM]\n"); @@ -226,7 +227,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) if (stream->nb_frames) printf("nb_frames=%"PRId64"\n", stream->nb_frames); - while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) + while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) printf("TAG:%s=%s\n", tag->key, tag->value); printf("[/STREAM]\n"); @@ -234,7 +235,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) static void show_format(AVFormatContext *fmt_ctx) { - AVMetadataTag *tag = NULL; + AVDictionaryEntry *tag = NULL; char val_str[128]; printf("[FORMAT]\n"); @@ -252,7 +253,7 @@ static void show_format(AVFormatContext *fmt_ctx) printf("bit_rate=%s\n", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate, unit_bit_per_second_str)); - while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) + while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) printf("TAG:%s=%s\n", tag->key, tag->value); printf("[/FORMAT]\n"); diff --git a/ffserver.c b/ffserver.c index 30edb05969..0f57979c9c 100644 --- a/ffserver.c +++ b/ffserver.c @@ -36,6 +36,7 @@ #include "libavformat/avio_internal.h" #include "libavutil/avstring.h" #include "libavutil/lfg.h" +#include "libavutil/dict.h" #include "libavutil/random_seed.h" #include "libavutil/parseutils.h" #include "libavutil/opt.h" @@ -854,7 +855,7 @@ static void close_connection(HTTPContext *c) ctx = c->rtp_ctx[i]; if (ctx) { av_write_trailer(ctx); - av_metadata_free(&ctx->metadata); + av_dict_free(&ctx->metadata); av_free(ctx->streams[0]); av_free(ctx); } @@ -2224,10 +2225,10 @@ static int http_prepare_data(HTTPContext *c) switch(c->state) { case HTTPSTATE_SEND_DATA_HEADER: memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); - av_metadata_set2(&c->fmt_ctx.metadata, "author" , c->stream->author , 0); - av_metadata_set2(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0); - av_metadata_set2(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); - av_metadata_set2(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); + av_dict_set(&c->fmt_ctx.metadata, "author" , c->stream->author , 0); + av_dict_set(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0); + av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); + av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams); @@ -2272,7 +2273,7 @@ static int http_prepare_data(HTTPContext *c) http_log("Error writing output header\n"); return -1; } - av_metadata_free(&c->fmt_ctx.metadata); + av_dict_free(&c->fmt_ctx.metadata); len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer); c->buffer_ptr = c->pb_buffer; @@ -2927,8 +2928,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, if (avc == NULL) { return -1; } - av_metadata_set2(&avc->metadata, "title", - stream->title[0] ? stream->title : "No Title", 0); + av_dict_set(&avc->metadata, "title", + stream->title[0] ? stream->title : "No Title", 0); avc->nb_streams = stream->nb_streams; if (stream->is_multicast) { snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d", @@ -2954,7 +2955,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, sdp_done: av_free(avc->streams); - av_metadata_free(&avc->metadata); + av_dict_free(&avc->metadata); av_free(avc); av_free(avs); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 8678f9bb9b..0e815421a7 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -20,6 +20,7 @@ */ #include "libavutil/intfloat_readwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "pcm.h" #include "aiff.h" @@ -79,7 +80,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) return; str[res] = 0; - av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, key, str, AV_DICT_DONT_STRDUP_VAL); } /* Returns the number of sound data frames or negative on error */ diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 2eb1673cc4..257ed48970 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -21,6 +21,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "apetag.h" @@ -57,7 +58,7 @@ static int ape_tag_read_field(AVFormatContext *s) return AVERROR(ENOMEM); avio_read(pb, value, size); value[size] = 0; - av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); return 0; } diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index e3b1500044..86e8b5fbce 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -28,6 +28,7 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" +#include "libavutil/dict.h" #include "avformat.h" #include "internal.h" #include <unistd.h> @@ -505,7 +506,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) } avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); if (v->bandwidth) - av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str, + av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, 0); } stream_offset += v->ctx->nb_streams; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 789df1274d..16bba93c37 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -24,6 +24,7 @@ #include "libavutil/bswap.h" #include "libavutil/common.h" #include "libavutil/avstring.h" +#include "libavutil/dict.h" #include "libavcodec/mpegaudio.h" #include "avformat.h" #include "avio_internal.h" @@ -179,7 +180,7 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) goto finish; } if (*value) - av_metadata_set2(&s->metadata, key, value, 0); + av_dict_set(&s->metadata, key, value, 0); finish: av_freep(&value); avio_seek(s->pb, off + len, SEEK_SET); @@ -689,7 +690,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL); if (iso6392) - av_metadata_set2(&st->metadata, "language", iso6392, 0); + av_dict_set(&st->metadata, "language", iso6392, 0); } } } diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index f9cc609eef..f9b9b3c045 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" -#include "metadata.h" #include "riff.h" #include "asf.h" #include "avio_internal.h" +#include "libavutil/dict.h" #undef NDEBUG #include <assert.h> @@ -296,7 +296,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; - AVMetadataTag *tags[5]; + AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; int metadata_count; @@ -307,11 +307,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); - tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0); - tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0); - tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0); - tags[3] = av_metadata_get(s->metadata, "comment" , NULL, 0); - tags[4] = av_metadata_get(s->metadata, "rating" , NULL, 0); + tags[0] = av_dict_get(s->metadata, "title" , NULL, 0); + tags[1] = av_dict_get(s->metadata, "author" , NULL, 0); + tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); + tags[3] = av_dict_get(s->metadata, "comment" , NULL, 0); + tags[4] = av_dict_get(s->metadata, "rating" , NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; @@ -381,10 +381,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data end_header(pb, hpos); } if (metadata_count) { - AVMetadataTag *tag = NULL; + AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, metadata_count); - while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9369aa98ed..2b5b50e381 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -161,7 +161,7 @@ attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AV * this function will allocate a struct for you and put it in *dst * @param src pointer to source AVDictionary struct * @param flags flags to use when setting metadata in *dst - * @note metadata is read using the AV_METADATA_IGNORE_SUFFIX flag + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag */ attribute_deprecated void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags); @@ -565,7 +565,7 @@ typedef struct AVStream { */ AVRational sample_aspect_ratio; - AVMetadata *metadata; + AVDictionary *metadata; /* Intended mostly for av_read_frame() support. Not supposed to be used by */ /* external applications; try to use something else if at all possible. */ @@ -633,7 +633,7 @@ typedef struct AVProgram { enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller unsigned int *stream_index; unsigned int nb_stream_indexes; - AVMetadata *metadata; + AVDictionary *metadata; } AVProgram; #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present @@ -643,7 +643,7 @@ typedef struct AVChapter { int id; ///< unique ID to identify the chapter AVRational time_base; ///< time base in which the start/end timestamps are specified int64_t start, end; ///< chapter start/end time in time_base units - AVMetadata *metadata; + AVDictionary *metadata; } AVChapter; /** @@ -806,7 +806,7 @@ typedef struct AVFormatContext { struct AVPacketList *packet_buffer_end; - AVMetadata *metadata; + AVDictionary *metadata; /** * Remaining size available for raw_packet_buffer, in bytes. diff --git a/libavformat/avidec.c b/libavformat/avidec.c index dd2d1d0da6..a915cc6588 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -25,6 +25,7 @@ #include <strings.h> #include "libavutil/intreadwrite.h" #include "libavutil/bswap.h" +#include "libavutil/dict.h" #include "avformat.h" #include "avi.h" #include "dv.h" @@ -261,8 +262,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t AV_WL32(key, tag); - return av_metadata_set2(st ? &st->metadata : &s->metadata, key, value, - AV_METADATA_DONT_STRDUP_VAL); + return av_dict_set(st ? &st->metadata : &s->metadata, key, value, + AV_DICT_DONT_STRDUP_VAL); } static void avi_read_info(AVFormatContext *s, uint64_t end) @@ -277,7 +278,7 @@ static void avi_read_info(AVFormatContext *s, uint64_t end) static const char months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static void avi_metadata_creation_time(AVMetadata **metadata, char *date) +static void avi_metadata_creation_time(AVDictionary **metadata, char *date) { char month[4], time[9], buffer[64]; int i, day, year; @@ -288,11 +289,11 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) if (!strcasecmp(month, months[i])) { snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", year, i+1, day, time); - av_metadata_set2(metadata, "creation_time", buffer, 0); + av_dict_set(metadata, "creation_time", buffer, 0); } } else if (date[4] == '/' && date[7] == '/') { date[4] = date[7] = '-'; - av_metadata_set2(metadata, "creation_time", date, 0); + av_dict_set(metadata, "creation_time", date, 0); } } @@ -320,7 +321,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) break; } if (name) - av_metadata_set2(&s->metadata, name, buffer, 0); + av_dict_set(&s->metadata, name, buffer, 0); avio_skip(s->pb, size); } break; @@ -770,7 +771,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); avio_skip(pb, desc_len - ret); if (*desc) - av_metadata_set2(&st->metadata, "title", desc, 0); + av_dict_set(&st->metadata, "title", desc, 0); avio_rl16(pb); /* flags? */ avio_rl32(pb); /* data size */ diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 1b6f64527e..343396cabe 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -23,6 +23,7 @@ #include "avio_internal.h" #include "riff.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" /* * TODO: @@ -157,7 +158,7 @@ static int avi_write_header(AVFormatContext *s) int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; AVCodecContext *stream, *video_enc; int64_t list1, list2, strh, strf; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; if (s->nb_streams > AVI_MAX_STREAM_COUNT) { av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n", @@ -297,7 +298,7 @@ static int avi_write_header(AVFormatContext *s) return -1; } ff_end_tag(pb, strf); - if ((t = av_metadata_get(s->streams[i]->metadata, "title", NULL, 0))) { + if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) { avi_write_info_tag(s->pb, "strn", t->value); t = NULL; } @@ -379,7 +380,7 @@ static int avi_write_header(AVFormatContext *s) ffio_wfourcc(pb, "INFO"); ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL); for (i = 0; *ff_avi_tags[i]; i++) { - if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) + if ((t = av_dict_get(s->metadata, ff_avi_tags[i], NULL, AV_DICT_MATCH_CASE))) avi_write_info_tag(s->pb, t->key, t->value); } ff_end_tag(pb, list2); diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index c720c34375..dff3b41281 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -29,6 +29,7 @@ #include "riff.h" #include "isom.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "caf.h" typedef struct { @@ -187,7 +188,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) char value[1024]; avio_get_str(pb, INT_MAX, key, sizeof(key)); avio_get_str(pb, INT_MAX, value, sizeof(value)); - av_metadata_set2(&s->metadata, key, value, 0); + av_dict_set(&s->metadata, key, value, 0); } } diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index 6915b60552..e3d800d3c4 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -22,6 +22,7 @@ #include "avformat.h" #include "ffmeta.h" #include "internal.h" +#include "libavutil/dict.h" static int probe(AVProbeData *p) { @@ -93,7 +94,7 @@ static uint8_t *unescape(uint8_t *buf, int size) return ret; } -static int read_tag(uint8_t *line, AVMetadata **m) +static int read_tag(uint8_t *line, AVDictionary **m) { uint8_t *key, *value, *p = line; @@ -117,13 +118,13 @@ static int read_tag(uint8_t *line, AVMetadata **m) return AVERROR(ENOMEM); } - av_metadata_set2(m, key, value, AV_METADATA_DONT_STRDUP_KEY | AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(m, key, value, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); return 0; } static int read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVMetadata **m = &s->metadata; + AVDictionary **m = &s->metadata; uint8_t line[1024]; while(!s->pb->eof_reached) { diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 178da5950a..0aadb8a9cc 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "ffmeta.h" +#include "libavutil/dict.h" static void write_escape_str(AVIOContext *s, const uint8_t *str) @@ -37,10 +38,10 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str) } } -static void write_tags(AVIOContext *s, AVMetadata *m) +static void write_tags(AVIOContext *s, AVDictionary *m) { - AVMetadataTag *t = NULL; - while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) { + AVDictionaryEntry *t = NULL; + while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) { write_escape_str(s, t->key); avio_w8(s, '='); write_escape_str(s, t->value); diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 38c3265d0c..fb28a6ed4c 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -22,7 +22,6 @@ #include "libavcodec/flac.h" #include "avformat.h" #include "flacenc.h" -#include "metadata.h" #include "vorbiscomment.h" #include "libavcodec/bytestream.h" @@ -39,7 +38,7 @@ static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_byte return 0; } -static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m, +static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 6fdbf9b464..c6b386e28f 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -25,6 +25,7 @@ */ #include "libavutil/avstring.h" +#include "libavutil/dict.h" #include "libavcodec/bytestream.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" @@ -271,17 +272,17 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst if(amf_type == AMF_DATA_TYPE_BOOL) { av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)); - av_metadata_set2(&s->metadata, key, str_val, 0); + av_dict_set(&s->metadata, key, str_val, 0); } else if(amf_type == AMF_DATA_TYPE_NUMBER) { snprintf(str_val, sizeof(str_val), "%.f", num_val); - av_metadata_set2(&s->metadata, key, str_val, 0); + av_dict_set(&s->metadata, key, str_val, 0); if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) vcodec->bit_rate = num_val * 1024.0; else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0)) acodec->bit_rate = num_val * 1024.0; } else if (amf_type == AMF_DATA_TYPE_STRING) - av_metadata_set2(&s->metadata, key, str_val, 0); + av_dict_set(&s->metadata, key, str_val, 0); } return 0; diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index b20a3f80c5..487993cd9a 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -23,6 +23,7 @@ #include "internal.h" #include "avc.h" #include "metadata.h" +#include "libavutil/dict.h" #undef NDEBUG #include <assert.h> @@ -177,7 +178,7 @@ static int flv_write_header(AVFormatContext *s) int i; double framerate = 0.0; int metadata_size_pos, data_size; - AVMetadataTag *tag = NULL; + AVDictionaryEntry *tag = NULL; for(i=0; i<s->nb_streams; i++){ AVCodecContext *enc = s->streams[i]->codec; @@ -274,7 +275,7 @@ static int flv_write_header(AVFormatContext *s) put_amf_double(pb, audio_enc->codec_tag); } - while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_amf_string(pb, tag->key); avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, tag->value); diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index d296ebbe57..87930ff361 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -21,6 +21,7 @@ #include "id3v1.h" #include "libavcodec/avcodec.h" +#include "libavutil/dict.h" const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = { [0] = "Blues", @@ -191,7 +192,7 @@ static void get_string(AVFormatContext *s, const char *key, *q = '\0'; if (*str) - av_metadata_set2(&s->metadata, key, str, 0); + av_dict_set(&s->metadata, key, str, 0); } /** @@ -215,11 +216,11 @@ static int parse_tag(AVFormatContext *s, const uint8_t *buf) get_string(s, "comment", buf + 97, 30); if (buf[125] == 0 && buf[126] != 0) { snprintf(str, sizeof(str), "%d", buf[126]); - av_metadata_set2(&s->metadata, "track", str, 0); + av_dict_set(&s->metadata, "track", str, 0); } genre = buf[127]; if (genre <= ID3v1_GENRE_MAX) - av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); + av_dict_set(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); return 0; } diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 06ae6f8b90..be6c03bbe5 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -23,7 +23,7 @@ #include "id3v1.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" -#include "metadata.h" +#include "libavutil/dict.h" #include "avio_internal.h" int ff_id3v2_match(const uint8_t *buf, const char * magic) @@ -133,7 +133,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha val = dst; if (val) - av_metadata_set2(&s->metadata, key, val, AV_METADATA_DONT_OVERWRITE); + av_dict_set(&s->metadata, key, val, AV_DICT_DONT_OVERWRITE); } static int is_number(const char *str) @@ -142,44 +142,44 @@ static int is_number(const char *str) return !*str; } -static AVMetadataTag* get_date_tag(AVMetadata *m, const char *tag) +static AVDictionaryEntry* get_date_tag(AVDictionary *m, const char *tag) { - AVMetadataTag *t; - if ((t = av_metadata_get(m, tag, NULL, AV_METADATA_MATCH_CASE)) && + AVDictionaryEntry *t; + if ((t = av_dict_get(m, tag, NULL, AV_DICT_MATCH_CASE)) && strlen(t->value) == 4 && is_number(t->value)) return t; return NULL; } -static void merge_date(AVMetadata **m) +static void merge_date(AVDictionary **m) { - AVMetadataTag *t; + AVDictionaryEntry *t; char date[17] = {0}; // YYYY-MM-DD hh:mm if (!(t = get_date_tag(*m, "TYER")) && !(t = get_date_tag(*m, "TYE"))) return; av_strlcpy(date, t->value, 5); - av_metadata_set2(m, "TYER", NULL, 0); - av_metadata_set2(m, "TYE", NULL, 0); + av_dict_set(m, "TYER", NULL, 0); + av_dict_set(m, "TYE", NULL, 0); if (!(t = get_date_tag(*m, "TDAT")) && !(t = get_date_tag(*m, "TDA"))) goto finish; snprintf(date + 4, sizeof(date) - 4, "-%.2s-%.2s", t->value + 2, t->value); - av_metadata_set2(m, "TDAT", NULL, 0); - av_metadata_set2(m, "TDA", NULL, 0); + av_dict_set(m, "TDAT", NULL, 0); + av_dict_set(m, "TDA", NULL, 0); if (!(t = get_date_tag(*m, "TIME")) && !(t = get_date_tag(*m, "TIM"))) goto finish; snprintf(date + 10, sizeof(date) - 10, " %.2s:%.2s", t->value, t->value + 2); - av_metadata_set2(m, "TIME", NULL, 0); - av_metadata_set2(m, "TIM", NULL, 0); + av_dict_set(m, "TIME", NULL, 0); + av_dict_set(m, "TIM", NULL, 0); finish: if (date[0]) - av_metadata_set2(m, "date", date, 0); + av_dict_set(m, "date", date, 0); } static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) diff --git a/libavformat/iff.c b/libavformat/iff.c index f9b5a773db..2b84986aff 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -30,6 +30,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #define ID_8SVX MKTAG('8','S','V','X') @@ -106,7 +107,7 @@ static int get_metadata(AVFormatContext *s, return AVERROR(EIO); } buf[data_size] = 0; - av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); return 0; } diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9c11c71e1f..64db318869 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -42,6 +42,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "libavutil/lzo.h" +#include "libavutil/dict.h" #if CONFIG_ZLIB #include <zlib.h> #endif @@ -1043,7 +1044,7 @@ static void matroska_merge_packets(AVPacket *out, AVPacket *in) } static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, - AVMetadata **metadata, char *prefix) + AVDictionary **metadata, char *prefix) { MatroskaTag *tags = list->elem; char key[1024]; @@ -1059,14 +1060,14 @@ static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, if (prefix) snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name); else av_strlcpy(key, tags[i].name, sizeof(key)); if (tags[i].def || !lang) { - av_metadata_set2(metadata, key, tags[i].string, 0); + av_dict_set(metadata, key, tags[i].string, 0); if (tags[i].sub.nb_elem) matroska_convert_tag(s, &tags[i].sub, metadata, key); } if (lang) { av_strlcat(key, "-", sizeof(key)); av_strlcat(key, lang, sizeof(key)); - av_metadata_set2(metadata, key, tags[i].string, 0); + av_dict_set(metadata, key, tags[i].string, 0); if (tags[i].sub.nb_elem) matroska_convert_tag(s, &tags[i].sub, metadata, key); } @@ -1234,7 +1235,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) if (matroska->duration) matroska->ctx->duration = matroska->duration * matroska->time_scale * 1000 / AV_TIME_BASE; - av_metadata_set2(&s->metadata, "title", matroska->title, 0); + av_dict_set(&s->metadata, "title", matroska->title, 0); tracks = matroska->tracks.elem; for (i=0; i < matroska->tracks.nb_elem; i++) { @@ -1432,8 +1433,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_id = codec_id; st->start_time = 0; if (strcmp(track->language, "und")) - av_metadata_set2(&st->metadata, "language", track->language, 0); - av_metadata_set2(&st->metadata, "title", track->name, 0); + av_dict_set(&st->metadata, "language", track->language, 0); + av_dict_set(&st->metadata, "title", track->name, 0); if (track->flag_default) st->disposition |= AV_DISPOSITION_DEFAULT; @@ -1494,7 +1495,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st = av_new_stream(s, 0); if (st == NULL) break; - av_metadata_set2(&st->metadata, "filename",attachements[j].filename, 0); + av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); st->codec->codec_id = CODEC_ID_NONE; st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; st->codec->extradata = av_malloc(attachements[j].bin.size); @@ -1522,7 +1523,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000}, chapters[i].start, chapters[i].end, chapters[i].title); - av_metadata_set2(&chapters[i].chapter->metadata, + av_dict_set(&chapters[i].chapter->metadata, "title", chapters[i].title, 0); max_start = chapters[i].start; } diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index ba2ce28e17..fde1470f9a 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -30,6 +30,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/random_seed.h" #include "libavutil/lfg.h" +#include "libavutil/dict.h" #include "libavcodec/xiph.h" #include "libavcodec/mpeg4audio.h" #include <strings.h> @@ -523,7 +524,7 @@ static int mkv_write_tracks(AVFormatContext *s) int bit_depth = av_get_bits_per_sample(codec->codec_id); int sample_rate = codec->sample_rate; int output_sample_rate = 0; - AVMetadataTag *tag; + AVDictionaryEntry *tag; if (!bit_depth) bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt); @@ -536,9 +537,9 @@ static int mkv_write_tracks(AVFormatContext *s) put_ebml_uint (pb, MATROSKA_ID_TRACKUID , i + 1); put_ebml_uint (pb, MATROSKA_ID_TRACKFLAGLACING , 0); // no lacing (yet) - if ((tag = av_metadata_get(st->metadata, "title", NULL, 0))) + if ((tag = av_dict_get(st->metadata, "title", NULL, 0))) put_ebml_string(pb, MATROSKA_ID_TRACKNAME, tag->value); - tag = av_metadata_get(st->metadata, "language", NULL, 0); + tag = av_dict_get(st->metadata, "language", NULL, 0); put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und"); if (st->disposition) @@ -586,7 +587,7 @@ static int mkv_write_tracks(AVFormatContext *s) // XXX: interlace flag? put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width); put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height); - if ((tag = av_metadata_get(s->metadata, "stereo_mode", NULL, 0))) { + if ((tag = av_dict_get(s->metadata, "stereo_mode", NULL, 0))) { uint8_t stereo_fmt = atoi(tag->value); int valid_fmt = 0; @@ -675,7 +676,7 @@ static int mkv_write_chapters(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { ebml_master chapteratom, chapterdisplay; AVChapter *c = s->chapters[i]; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); @@ -685,7 +686,7 @@ static int mkv_write_chapters(AVFormatContext *s) av_rescale_q(c->end, c->time_base, scale)); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); - if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { + if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0); put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value); put_ebml_string(pb, MATROSKA_ID_CHAPLANG , "und"); @@ -698,7 +699,7 @@ static int mkv_write_chapters(AVFormatContext *s) return 0; } -static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) +static void mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t) { uint8_t *key = av_strdup(t->key); uint8_t *p = key; @@ -728,12 +729,12 @@ static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) av_freep(&key); } -static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int elementid, +static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid, unsigned int uid, ebml_master *tags) { MatroskaMuxContext *mkv = s->priv_data; ebml_master tag, targets; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; int ret; if (!tags->pos) { @@ -749,7 +750,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element put_ebml_uint(s->pb, elementid, uid); end_ebml_master(s->pb, targets); - while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) + while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) if (strcasecmp(t->key, "title")) mkv_write_simpletag(s->pb, t); @@ -764,7 +765,7 @@ static int mkv_write_tags(AVFormatContext *s) ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); - if (av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) { + if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } @@ -772,7 +773,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; - if (!av_metadata_get(st->metadata, "", 0, AV_METADATA_IGNORE_SUFFIX)) + if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); @@ -782,7 +783,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; - if (!av_metadata_get(ch->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); @@ -799,7 +800,7 @@ static int mkv_write_header(AVFormatContext *s) MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; ebml_master ebml_header, segment_info; - AVMetadataTag *tag; + AVDictionaryEntry *tag; int ret, i; if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM; @@ -836,7 +837,7 @@ static int mkv_write_header(AVFormatContext *s) segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0); put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000); - if ((tag = av_metadata_get(s->metadata, "title", NULL, 0))) + if ((tag = av_dict_get(s->metadata, "title", NULL, 0))) put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value); if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { uint32_t segment_uid[4]; diff --git a/libavformat/metadata.h b/libavformat/metadata.h index 49be8b47e1..33e0d1ff6c 100644 --- a/libavformat/metadata.h +++ b/libavformat/metadata.h @@ -39,7 +39,7 @@ struct AVMetadataConv{ typedef struct AVMetadataConv AVMetadataConv; #endif -void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, +void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv); void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv); diff --git a/libavformat/mov.c b/libavformat/mov.c index 3aec86ceb1..ff32c92313 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" +#include "libavutil/dict.h" #include "avformat.h" #include "avio_internal.h" #include "riff.h" @@ -84,7 +85,7 @@ static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) avio_rb16(pb); // unknown snprintf(buf, sizeof(buf), "%d", avio_rb16(pb)); - av_metadata_set2(&c->fc->metadata, "track", buf, 0); + av_dict_set(&c->fc->metadata, "track", buf, 0); avio_rb16(pb); // total tracks @@ -203,10 +204,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_read(pb, str, str_size); str[str_size] = 0; } - av_metadata_set2(&c->fc->metadata, key, str, 0); + av_dict_set(&c->fc->metadata, key, str, 0); if (*language && strcmp(language, "und")) { snprintf(key2, sizeof(key2), "%s-%s", key, language); - av_metadata_set2(&c->fc->metadata, key2, str, 0); + av_dict_set(&c->fc->metadata, key2, str, 0); } } av_dlog(c->fc, "lang \"%3s\" ", language); @@ -552,10 +553,10 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (strcmp(type, "qt ")) c->isom = 1; av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); - av_metadata_set2(&c->fc->metadata, "major_brand", type, 0); + av_dict_set(&c->fc->metadata, "major_brand", type, 0); minor_ver = avio_rb32(pb); /* minor version */ snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver); - av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0); + av_dict_set(&c->fc->metadata, "minor_version", minor_ver_str, 0); comp_brand_size = atom.size - 8; if (comp_brand_size < 0) @@ -565,7 +566,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); avio_read(pb, comp_brands_str, comp_brand_size); comp_brands_str[comp_brand_size] = 0; - av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); + av_dict_set(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); av_freep(&comp_brands_str); return 0; @@ -589,7 +590,7 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } -static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) +static void mov_metadata_creation_time(AVDictionary **metadata, time_t time) { char buffer[32]; if (time) { @@ -598,7 +599,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) ptm = gmtime(&time); if (!ptm) return; strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm); - av_metadata_set2(metadata, "creation_time", buffer, 0); + av_dict_set(metadata, "creation_time", buffer, 0); } } @@ -635,7 +636,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) lang = avio_rb16(pb); /* language */ if (ff_mov_lang_to_iso639(lang, language)) - av_metadata_set2(&st->metadata, "language", language, 0); + av_dict_set(&st->metadata, "language", language, 0); avio_rb16(pb); /* quality */ return 0; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 67d39f4aef..5f4eea49fc 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -33,6 +33,7 @@ #include "internal.h" #include "libavutil/avstring.h" #include "libavutil/opt.h" +#include "libavutil/dict.h" #undef NDEBUG #include <assert.h> @@ -1525,15 +1526,15 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, int long_style) { int l, lang = 0, len, len2; - AVMetadataTag *t, *t2 = NULL; + AVDictionaryEntry *t, *t2 = NULL; char tag2[16]; - if (!(t = av_metadata_get(s->metadata, tag, NULL, 0))) + if (!(t = av_dict_get(s->metadata, tag, NULL, 0))) return 0; len = strlen(t->key); snprintf(tag2, sizeof(tag2), "%s-", tag); - while ((t2 = av_metadata_get(s->metadata, tag2, t2, AV_METADATA_IGNORE_SUFFIX))) { + while ((t2 = av_dict_get(s->metadata, tag2, t2, AV_DICT_IGNORE_SUFFIX))) { len2 = strlen(t2->key); if (len2 == len+4 && !strcmp(t->value, t2->value) && (l=ff_mov_iso639_to_lang(&t2->key[len2-3], 1)) >= 0) { @@ -1548,7 +1549,7 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); + AVDictionaryEntry *t = av_dict_get(s->metadata, "track", NULL, 0); int size = 0, track = t ? atoi(t->value) : 0; if (track) { avio_wb32(pb, 32); /* size */ @@ -1640,7 +1641,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { int64_t pos = avio_tell(pb); - AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); + AVDictionaryEntry *t = av_dict_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; avio_wb32(pb, 0); /* size */ @@ -1652,7 +1653,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, avio_wb16(pb, language_code("eng")); /* language */ avio_write(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ if (!strcmp(tag, "albm") && - (t = av_metadata_get(s->metadata, "track", NULL, 0))) + (t = av_dict_get(s->metadata, "track", NULL, 0))) avio_w8(pb, atoi(t->value)); } return updateSize(pb, pos); @@ -1671,10 +1672,10 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) for (i = 0; i < nb_chapters; i++) { AVChapter *c = s->chapters[i]; - AVMetadataTag *t; + AVDictionaryEntry *t; avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); - if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { + if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { int len = FFMIN(strlen(t->value), 255); avio_w8(pb, len); avio_write(pb, t->value, len); @@ -1752,7 +1753,7 @@ static void mov_write_psp_udta_tag(AVIOContext *pb, static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) { - AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); + AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); int64_t pos, pos2; if (title) { @@ -2102,13 +2103,13 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) for (i = 0; i < s->nb_chapters; i++) { AVChapter *c = s->chapters[i]; - AVMetadataTag *t; + AVDictionaryEntry *t; int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.duration = end - pkt.dts; - if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { + if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { len = strlen(t->value); pkt.size = len+2; pkt.data = av_malloc(pkt.size); @@ -2182,7 +2183,7 @@ static int mov_write_header(AVFormatContext *s) for(i=0; i<s->nb_streams; i++){ AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; - AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); + AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); track->enc = st->codec; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index dbecf3d2a7..a1db2323ac 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -21,6 +21,7 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "id3v2.h" #include "id3v1.h" @@ -149,7 +150,7 @@ static int mp3_read_header(AVFormatContext *s, off = avio_tell(s->pb); - if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); if (mp3_parse_vbr_tags(s, st, off) < 0) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 00ed6f8d4c..092d16ecc1 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -27,19 +27,20 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" +#include "libavutil/dict.h" static int id3v1_set_string(AVFormatContext *s, const char *key, uint8_t *buf, int buf_size) { - AVMetadataTag *tag; - if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) + AVDictionaryEntry *tag; + if ((tag = av_dict_get(s->metadata, key, NULL, 0))) av_strlcpy(buf, tag->value, buf_size); return !!tag; } static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) { - AVMetadataTag *tag; + AVDictionaryEntry *tag; int i, count = 0; memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ @@ -51,13 +52,13 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) count += id3v1_set_string(s, "TALB", buf + 63, 30); //album count += id3v1_set_string(s, "TDRL", buf + 93, 4); //date count += id3v1_set_string(s, "comment", buf + 97, 30); - if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track + if ((tag = av_dict_get(s->metadata, "TRCK", NULL, 0))) { //track buf[125] = 0; buf[126] = atoi(tag->value); count++; } buf[127] = 0xFF; /* default to unknown genre */ - if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre + if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre for(i = 0; i <= ID3v1_GENRE_MAX; i++) { if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) { buf[127] = i; @@ -173,7 +174,7 @@ static const AVClass mp3_muxer_class = { .version = LIBAVUTIL_VERSION_INT, }; -static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4], +static int id3v2_check_write_tag(AVFormatContext *s, AVDictionaryEntry *t, const char table[][4], enum ID3v2Encoding enc) { uint32_t tag; @@ -195,7 +196,7 @@ static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const cha static int mp3_write_header(struct AVFormatContext *s) { MP3Context *mp3 = s->priv_data; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; int totlen = 0, enc = mp3->id3v2_version == 3 ? ID3v2_ENCODING_UTF16BOM : ID3v2_ENCODING_UTF8; int64_t size_pos, cur_pos; @@ -212,7 +213,7 @@ static int mp3_write_header(struct AVFormatContext *s) if (mp3->id3v2_version == 4) ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL); - while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { + while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) { int ret; if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags, enc)) > 0) { diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 07c22990f6..0aec1e81d3 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "apetag.h" #include "id3v1.h" +#include "libavutil/dict.h" #define MPC_FRAMESIZE 1152 #define DELAY_FRAMES 32 @@ -96,7 +97,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) if (s->pb->seekable) { int64_t pos = avio_tell(s->pb); ff_ape_parse_tag(s); - if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); avio_seek(s->pb, pos, SEEK_SET); } diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index f675bf03fb..bf81b20b5c 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -26,6 +26,7 @@ #include "libavutil/crc.h" #include "libavutil/intreadwrite.h" #include "libavutil/log.h" +#include "libavutil/dict.h" #include "libavutil/opt.h" #include "libavcodec/bytestream.h" #include "avformat.h" @@ -938,7 +939,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type language[1] = get8(pp, desc_end); language[2] = get8(pp, desc_end); language[3] = 0; - av_metadata_set2(&st->metadata, "language", language, 0); + av_dict_set(&st->metadata, "language", language, 0); break; case 0x59: /* subtitling descriptor */ language[0] = get8(pp, desc_end); @@ -967,7 +968,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } } *pp += 4; - av_metadata_set2(&st->metadata, "language", language, 0); + av_dict_set(&st->metadata, "language", language, 0); break; case 0x0a: /* ISO 639 language descriptor */ for (i = 0; i + 4 <= desc_len; i += 4) { @@ -983,7 +984,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } if (i) { language[i - 1] = 0; - av_metadata_set2(&st->metadata, "language", language, 0); + av_dict_set(&st->metadata, "language", language, 0); } break; case 0x05: /* registration descriptor */ @@ -1227,8 +1228,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (name) { AVProgram *program = av_new_program(ts->stream, sid); if(program) { - av_metadata_set2(&program->metadata, "service_name", name, 0); - av_metadata_set2(&program->metadata, "service_provider", provider_name, 0); + av_dict_set(&program->metadata, "service_name", name, 0); + av_dict_set(&program->metadata, "service_provider", provider_name, 0); } } av_free(name); diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 393b779168..26d2cb229f 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -21,6 +21,7 @@ #include "libavutil/bswap.h" #include "libavutil/crc.h" +#include "libavutil/dict.h" #include "libavutil/opt.h" #include "libavcodec/mpegvideo.h" #include "avformat.h" @@ -244,7 +245,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) for(i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; - AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); + AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); switch(st->codec->codec_id) { case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: @@ -443,7 +444,7 @@ static int mpegts_write_header(AVFormatContext *s) MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st, *pcr_st = NULL; - AVMetadataTag *title, *provider; + AVDictionaryEntry *title, *provider; int i, j; const char *service_name; const char *provider_name; @@ -452,11 +453,11 @@ static int mpegts_write_header(AVFormatContext *s) ts->tsid = ts->transport_stream_id; ts->onid = ts->original_network_id; /* allocate a single DVB service */ - title = av_metadata_get(s->metadata, "service_name", NULL, 0); + title = av_dict_get(s->metadata, "service_name", NULL, 0); if (!title) - title = av_metadata_get(s->metadata, "title", NULL, 0); + title = av_dict_get(s->metadata, "title", NULL, 0); service_name = title ? title->value : DEFAULT_SERVICE_NAME; - provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); + provider = av_dict_get(s->metadata, "service_provider", NULL, 0); provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; service = mpegts_add_service(ts, ts->service_id, provider_name, service_name); service->pmt.write_packet = section_write_packet; diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 037a6f166a..08338c4609 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -20,6 +20,7 @@ */ #include "avformat.h" #include "riff.h" +#include "libavutil/dict.h" //#define DEBUG //#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!! @@ -328,7 +329,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) break; *p++ = '\0'; av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value); - av_metadata_set2(&s->metadata, token, value, 0); + av_dict_set(&s->metadata, token, value, 0); } av_free(strings); } diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d8278175a0..db1b999c90 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -23,6 +23,7 @@ #include <strings.h> #include "libavutil/avstring.h" #include "libavutil/bswap.h" +#include "libavutil/dict.h" #include "libavutil/tree.h" #include "avio_internal.h" #include "nut.h" @@ -401,7 +402,7 @@ static int decode_info_header(NUTContext *nut){ const char *type; AVChapter *chapter= NULL; AVStream *st= NULL; - AVMetadata **metadata = NULL; + AVDictionary **metadata = NULL; end= get_packetheader(nut, bc, 1, INFO_STARTCODE); end += avio_tell(bc); @@ -459,7 +460,7 @@ static int decode_info_header(NUTContext *nut){ } if(metadata && strcasecmp(name,"Uses") && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces")) - av_metadata_set2(metadata, name, str_value, 0); + av_dict_set(metadata, name, str_value, 0); } } diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 85340b158e..260a7607d8 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -21,6 +21,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/tree.h" +#include "libavutil/dict.h" #include "libavcodec/mpegaudiodata.h" #include "nut.h" #include "internal.h" @@ -430,7 +431,7 @@ static int add_info(AVIOContext *bc, const char *type, const char *value){ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ AVFormatContext *s= nut->avf; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; AVIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size; @@ -438,7 +439,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ if(ret < 0) return ret; - while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) + while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) count += add_info(dyn_bc, t->key, t->value); ff_put_v(bc, 0); //stream_if_plus1 @@ -489,7 +490,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) { AVIOContext *dyn_bc; uint8_t *dyn_buf = NULL; - AVMetadataTag *t = NULL; + AVDictionaryEntry *t = NULL; AVChapter *ch = nut->avf->chapters[id]; int ret, dyn_size, count = 0; @@ -502,7 +503,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start ff_put_v(bc, ch->end - ch->start); // chapter_len - while ((t = av_metadata_get(ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) + while ((t = av_dict_get(ch->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) count += add_info(dyn_bc, t->key, t->value); ff_put_v(bc, count); diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h index 7d66cd5638..e7d1022734 100644 --- a/libavformat/oggdec.h +++ b/libavformat/oggdec.h @@ -111,7 +111,7 @@ extern const struct ogg_codec ff_speex_codec; extern const struct ogg_codec ff_theora_codec; extern const struct ogg_codec ff_vorbis_codec; -int ff_vorbis_comment(AVFormatContext *ms, AVMetadata **m, const uint8_t *buf, int size); +int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size); static inline int ogg_find_stream (struct ogg * ogg, int serial) diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 92c751c07a..bc4b3c10b2 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -221,7 +221,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st, } static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, - int *header_len, AVMetadata **m, int framing_bit) + int *header_len, AVDictionary **m, int framing_bit) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; int size; @@ -247,7 +247,7 @@ static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, static int ogg_build_flac_headers(AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, - AVMetadata **m) + AVDictionary **m) { enum FLACExtradataFormat format; uint8_t *streaminfo; @@ -287,7 +287,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, static int ogg_build_speex_headers(AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, - AVMetadata **m) + AVDictionary **m) { uint8_t *p; diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 830f0bca37..86951f3e2f 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include "libavutil/avstring.h" #include "libavutil/bswap.h" +#include "libavutil/dict.h" #include "libavcodec/get_bits.h" #include "libavcodec/bytestream.h" #include "avformat.h" @@ -57,8 +58,8 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) if (!chapter) return 0; - av_metadata_set2(&chapter->metadata, "title", val, - AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&chapter->metadata, "title", val, + AV_DICT_DONT_STRDUP_VAL); } else return 0; @@ -67,7 +68,7 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) } int -ff_vorbis_comment(AVFormatContext * as, AVMetadata **m, const uint8_t *buf, int size) +ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, int size) { const uint8_t *p = buf; const uint8_t *end = buf + size; @@ -127,9 +128,9 @@ ff_vorbis_comment(AVFormatContext * as, AVMetadata **m, const uint8_t *buf, int ct[vl] = 0; if (!ogm_chapter(as, tt, ct)) - av_metadata_set2(m, tt, ct, - AV_METADATA_DONT_STRDUP_KEY | - AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(m, tt, ct, + AV_DICT_DONT_STRDUP_KEY | + AV_DICT_DONT_STRDUP_VAL); } } diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 148c6022bb..619c6a7b6c 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -22,6 +22,7 @@ //#define DEBUG #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" typedef struct { @@ -98,7 +99,7 @@ static int r3d_read_red1(AVFormatContext *s) avio_read(s->pb, filename, 257); filename[sizeof(filename)-1] = 0; - av_metadata_set2(&st->metadata, "filename", filename, 0); + av_dict_set(&st->metadata, "filename", filename, 0); av_dlog(s, "filename %s\n", filename); av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index d6a5251c05..fbc4d0cee6 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -21,6 +21,7 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "riff.h" #include "rm.h" @@ -104,7 +105,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) { int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb); get_strl(s->pb, buf, sizeof(buf), len); - av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0); + av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); } } diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index d64040c1a2..2476cb0590 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "avio_internal.h" #include "rm.h" +#include "libavutil/dict.h" typedef struct { int nb_packets; @@ -71,7 +72,7 @@ static int rv10_write_header(AVFormatContext *ctx, const char *desc, *mimetype; int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i; int bit_rate, v, duration, flags, data_pos; - AVMetadataTag *tag; + AVDictionaryEntry *tag; start_ptr = s->buf_ptr; @@ -127,13 +128,13 @@ static int rv10_write_header(AVFormatContext *ctx, ffio_wfourcc(s,"CONT"); size = 4 * 2 + 10; for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) { - tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); + tag = av_dict_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); if(tag) size += strlen(tag->value); } avio_wb32(s,size); avio_wb16(s,0); for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) { - tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); + tag = av_dict_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); put_str(s, tag ? tag->value : ""); } diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 935b81d7d8..f67d3cd7c4 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -20,6 +20,7 @@ */ #include "libavutil/avstring.h" +#include "libavutil/dict.h" #include "avformat.h" #include <stdlib.h> @@ -131,11 +132,11 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) // for the text in a few cases; samples needed.) error |= read_line(pb, line, sizeof(line)); // ARMovie error |= read_line(pb, line, sizeof(line)); // movie name - av_metadata_set2(&s->metadata, "title" , line, 0); + av_dict_set(&s->metadata, "title" , line, 0); error |= read_line(pb, line, sizeof(line)); // date/copyright - av_metadata_set2(&s->metadata, "copyright", line, 0); + av_dict_set(&s->metadata, "copyright", line, 0); error |= read_line(pb, line, sizeof(line)); // author and other - av_metadata_set2(&s->metadata, "author" , line, 0); + av_dict_set(&s->metadata, "author" , line, 0); // video headers vst = av_new_stream(s, 0); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index ecacc0eb4e..ef78426f1f 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -113,7 +113,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &ff_asf_demuxer, NULL); if (ret < 0) return ret; - av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0); + av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0); rt->asf_pb_pos = avio_tell(&pb); av_free(buf); rt->asf_ctx->pb = NULL; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index c78b762a36..b2735f6165 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -24,6 +24,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/parseutils.h" #include "libavutil/random_seed.h" +#include "libavutil/dict.h" #include "avformat.h" #include "avio_internal.h" @@ -281,11 +282,11 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } break; case 's': - av_metadata_set2(&s->metadata, "title", p, 0); + av_dict_set(&s->metadata, "title", p, 0); break; case 'i': if (s->nb_streams == 0) { - av_metadata_set2(&s->metadata, "comment", p, 0); + av_dict_set(&s->metadata, "comment", p, 0); break; } break; diff --git a/libavformat/sauce.c b/libavformat/sauce.c index f9ca17ac30..a125241335 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -25,6 +25,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "sauce.h" @@ -44,7 +45,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g #define GET_SAUCE_META(name,size) \ if (avio_read(pb, buf, size) == size && buf[0]) { \ buf[size] = 0; \ - av_metadata_set2(&avctx->metadata, name, buf, 0); \ + av_dict_set(&avctx->metadata, name, buf, 0); \ } GET_SAUCE_META("title", 35) @@ -95,7 +96,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g str[65*i + 64] = '\n'; } str[65*i] = 0; - av_metadata_set2(&avctx->metadata, "comment", str, AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&avctx->metadata, "comment", str, AV_DICT_DONT_STRDUP_VAL); } } diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 005434c6c4..f72e2c567f 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -21,6 +21,7 @@ #include <string.h> #include "libavutil/avstring.h" #include "libavutil/base64.h" +#include "libavutil/dict.h" #include "libavutil/parseutils.h" #include "libavcodec/xiph.h" #include "avformat.h" @@ -476,7 +477,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) { - AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); + AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0); struct sdp_session_level s; int i, j, port, ttl, is_multicast; char dst[32], dst_type[5]; diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 74e53727e2..fb7b063f8c 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -30,6 +30,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "pcm.h" #include "sox.h" @@ -101,8 +102,8 @@ static int sox_read_header(AVFormatContext *s, } comment[comment_size] = 0; - av_metadata_set2(&s->metadata, "comment", comment, - AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, "comment", comment, + AV_DICT_DONT_STRDUP_VAL); } avio_skip(pb, header_size - SOX_FIXED_HDR - comment_size); diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index cb71d73e9f..01d0cda2cf 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -30,6 +30,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "avio_internal.h" #include "sox.h" @@ -43,10 +44,10 @@ static int sox_write_header(AVFormatContext *s) SoXContext *sox = s->priv_data; AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; - AVMetadataTag *comment; + AVDictionaryEntry *comment; size_t comment_len = 0, comment_size; - comment = av_metadata_get(s->metadata, "comment", NULL, 0); + comment = av_dict_get(s->metadata, "comment", NULL, 0); if (comment) comment_len = strlen(comment->value); comment_size = (comment_len + 7) & ~7; diff --git a/libavformat/tta.c b/libavformat/tta.c index 003620076d..49234a81e4 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -22,6 +22,7 @@ #include "libavcodec/get_bits.h" #include "avformat.h" #include "id3v1.h" +#include "libavutil/dict.h" typedef struct { int totalframes, currentframe; @@ -43,7 +44,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) int i, channels, bps, samplerate, datalen, framelen; uint64_t framepos, start_offset; - if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); start_offset = avio_tell(s->pb); diff --git a/libavformat/tty.c b/libavformat/tty.c index ecd3f58c77..ee6b2f1334 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "libavutil/log.h" +#include "libavutil/dict.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "avformat.h" @@ -60,7 +61,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) return -1; \ if (avio_read(pb, buf, size) == size) { \ buf[len] = 0; \ - av_metadata_set2(&avctx->metadata, name, buf, 0); \ + av_dict_set(&avctx->metadata, name, buf, 0); \ } GET_EFI_META("filename", 12) diff --git a/libavformat/utils.c b/libavformat/utils.c index bdc20f6d9b..8ab59e1d3b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -26,6 +26,7 @@ #include "internal.h" #include "libavcodec/internal.h" #include "libavutil/opt.h" +#include "libavutil/dict.h" #include "metadata.h" #include "id3v2.h" #include "libavutil/avstring.h" @@ -2560,7 +2561,7 @@ void avformat_free_context(AVFormatContext *s) av_parser_close(st->parser); av_free_packet(&st->cur_pkt); } - av_metadata_free(&st->metadata); + av_dict_free(&st->metadata); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); @@ -2570,18 +2571,18 @@ void avformat_free_context(AVFormatContext *s) av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { - av_metadata_free(&s->programs[i]->metadata); + av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while(s->nb_chapters--) { - av_metadata_free(&s->chapters[s->nb_chapters]->metadata); + av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); - av_metadata_free(&s->metadata); + av_dict_free(&s->metadata); av_freep(&s->streams); av_free(s); } @@ -2685,7 +2686,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6 return NULL; dynarray_add(&s->chapters, &s->nb_chapters, chapter); } - av_metadata_set2(&chapter->metadata, "title", title, 0); + av_dict_set(&chapter->metadata, "title", title, 0); chapter->id = id; chapter->time_base= time_base; chapter->start = start; @@ -2824,7 +2825,7 @@ int av_write_header(AVFormatContext *s) /* set muxer identification string */ if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { - av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); + av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); } if(s->oformat->write_header){ @@ -3138,13 +3139,13 @@ static void print_fps(double d, const char *postfix){ else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix); } -static void dump_metadata(void *ctx, AVMetadata *m, const char *indent) +static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) { - if(m && !(m->count == 1 && av_metadata_get(m, "language", NULL, 0))){ - AVMetadataTag *tag=NULL; + if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){ + AVDictionaryEntry *tag=NULL; av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); - while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + while((tag=av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) { if(strcmp("language", tag->key)) av_log(ctx, AV_LOG_INFO, "%s %-16s: %s\n", indent, tag->key, tag->value); } @@ -3158,7 +3159,7 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; int g = av_gcd(st->time_base.num, st->time_base.den); - AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL, 0); + AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); avcodec_string(buf, sizeof(buf), st->codec, is_output); av_log(NULL, AV_LOG_INFO, " Stream #%d.%d", index, i); /* the pid is an important information, so we display it */ @@ -3282,7 +3283,7 @@ void av_dump_format(AVFormatContext *ic, if(ic->nb_programs) { int j, k, total = 0; for(j=0; j<ic->nb_programs; j++) { - AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata, + AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata, "name", NULL, 0); av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, name ? name->value : ""); diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c index 22176c6fbe..56936d7666 100644 --- a/libavformat/vorbiscomment.c +++ b/libavformat/vorbiscomment.c @@ -23,6 +23,7 @@ #include "metadata.h" #include "vorbiscomment.h" #include "libavcodec/bytestream.h" +#include "libavutil/dict.h" /** * VorbisComment metadata conversion mapping. @@ -36,15 +37,15 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { { 0 } }; -int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, +int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, unsigned *count) { int len = 8; len += strlen(vendor_string); *count = 0; if (m) { - AVMetadataTag *tag = NULL; - while ((tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + AVDictionaryEntry *tag = NULL; + while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) { len += 4 +strlen(tag->key) + 1 + strlen(tag->value); (*count)++; } @@ -52,15 +53,15 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, return len; } -int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, +int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, const char *vendor_string, const unsigned count) { bytestream_put_le32(p, strlen(vendor_string)); bytestream_put_buffer(p, vendor_string, strlen(vendor_string)); if (*m) { - AVMetadataTag *tag = NULL; + AVDictionaryEntry *tag = NULL; bytestream_put_le32(p, count); - while ((tag = av_metadata_get(*m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) { unsigned int len1 = strlen(tag->key); unsigned int len2 = strlen(tag->value); bytestream_put_le32(p, len1+1+len2); diff --git a/libavformat/vorbiscomment.h b/libavformat/vorbiscomment.h index 98cc4f8abe..7b82dc1c95 100644 --- a/libavformat/vorbiscomment.h +++ b/libavformat/vorbiscomment.h @@ -35,13 +35,13 @@ * @param count Pointer to store the number of tags in m because m->count is "not allowed" * @return The length in bytes. */ -int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, +int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, unsigned *count); /** * Writes a VorbisComment into a buffer. The buffer, p, must have enough * data to hold the whole VorbisComment. The minimum size required can be - * obtained by passing the same AVMetadata and vendor_string to + * obtained by passing the same AVDictionary and vendor_string to * ff_vorbiscomment_length() * * @param p The buffer in which to write. @@ -49,7 +49,7 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, * @param vendor_string The vendor string to write. * @param count The number of tags in m because m->count is "not allowed" */ -int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, +int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, const char *vendor_string, const unsigned count); extern const AVMetadataConv ff_vorbiscomment_metadata_conv[]; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 14fb8d76e3..5be7dfea21 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" typedef struct VqfContext { int frame_bit_len; @@ -56,7 +57,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, return; avio_read(s->pb, buf, len); buf[len] = 0; - av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); } static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 292ef66b54..e57a9bf844 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -28,6 +28,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #define FORM_TAG MKTAG('F', 'O', 'R', 'M') @@ -130,8 +131,8 @@ static int wc3_read_header(AVFormatContext *s, if ((ret = avio_read(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0; - av_metadata_set2(&s->metadata, "title", buffer, - AV_METADATA_DONT_STRDUP_VAL); + av_dict_set(&s->metadata, "title", buffer, + AV_DICT_DONT_STRDUP_VAL); break; case SIZE_TAG: diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 0a18c8e517..0f9fdeff06 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/intfloat_readwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "internal.h" #include "riff.h" @@ -483,7 +484,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) st = av_new_stream(s, 0); if (!st) goto done; - av_metadata_set2(&st->metadata, "title", description, 0); + av_dict_set(&st->metadata, "title", description, 0); st->codec->codec_id = CODEC_ID_MJPEG; st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; st->codec->extradata = av_mallocz(filesize); @@ -543,7 +544,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty return; } - av_metadata_set2(&s->metadata, key, buf, 0); + av_dict_set(&s->metadata, key, buf, 0); av_freep(&buf); } @@ -867,7 +868,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p avio_read(pb, language, 3); if (language[0]) { language[3] = 0; - av_metadata_set2(&st->metadata, "language", language, 0); + av_dict_set(&st->metadata, "language", language, 0); if (!strcmp(language, "nar") || !strcmp(language, "NAR")) st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; } diff --git a/libavformat/wv.c b/libavformat/wv.c index 7106735041..8f9d0fdb1b 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -21,6 +21,7 @@ #include "libavutil/audioconvert.h" #include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" #include "avformat.h" #include "apetag.h" #include "id3v1.h" @@ -226,7 +227,7 @@ static int wv_read_header(AVFormatContext *s, if(s->pb->seekable) { int64_t cur = avio_tell(s->pb); ff_ape_parse_tag(s); - if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + if(!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); avio_seek(s->pb, cur, SEEK_SET); } |