| ... | ... |
@@ -39,6 +39,7 @@ |
| 39 | 39 |
#include "libavutil/colorspace.h" |
| 40 | 40 |
#include "libavutil/fifo.h" |
| 41 | 41 |
#include "libavutil/intreadwrite.h" |
| 42 |
+#include "libavutil/dict.h" |
|
| 42 | 43 |
#include "libavutil/pixdesc.h" |
| 43 | 44 |
#include "libavutil/avstring.h" |
| 44 | 45 |
#include "libavutil/libm.h" |
| ... | ... |
@@ -189,7 +190,7 @@ static int64_t start_time = 0; |
| 189 | 189 |
static int64_t recording_timestamp = 0; |
| 190 | 190 |
static int64_t input_ts_offset = 0; |
| 191 | 191 |
static int file_overwrite = 0; |
| 192 |
-static AVMetadata *metadata; |
|
| 192 |
+static AVDictionary *metadata; |
|
| 193 | 193 |
static int do_benchmark = 0; |
| 194 | 194 |
static int do_hex_dump = 0; |
| 195 | 195 |
static int do_pkt_dump = 0; |
| ... | ... |
@@ -1894,7 +1895,7 @@ static int copy_chapters(int infile, int outfile) |
| 1894 | 1894 |
out_ch->end = FFMIN(rt, in_ch->end - ts_off); |
| 1895 | 1895 |
|
| 1896 | 1896 |
if (metadata_chapters_autocopy) |
| 1897 |
- av_metadata_copy(&out_ch->metadata, in_ch->metadata, 0); |
|
| 1897 |
+ av_dict_copy(&out_ch->metadata, in_ch->metadata, 0); |
|
| 1898 | 1898 |
|
| 1899 | 1899 |
os->nb_chapters++; |
| 1900 | 1900 |
os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters); |
| ... | ... |
@@ -2083,8 +2084,8 @@ static int transcode(AVFormatContext **output_files, |
| 2083 | 2083 |
icodec = ist->st->codec; |
| 2084 | 2084 |
|
| 2085 | 2085 |
if (metadata_streams_autocopy) |
| 2086 |
- av_metadata_copy(&ost->st->metadata, ist->st->metadata, |
|
| 2087 |
- AV_METADATA_DONT_OVERWRITE); |
|
| 2086 |
+ av_dict_copy(&ost->st->metadata, ist->st->metadata, |
|
| 2087 |
+ AV_DICT_DONT_OVERWRITE); |
|
| 2088 | 2088 |
|
| 2089 | 2089 |
ost->st->disposition = ist->st->disposition; |
| 2090 | 2090 |
codec->bits_per_raw_sample= icodec->bits_per_raw_sample; |
| ... | ... |
@@ -2352,7 +2353,7 @@ static int transcode(AVFormatContext **output_files, |
| 2352 | 2352 |
/* set meta data information from input file if required */ |
| 2353 | 2353 |
for (i=0;i<nb_meta_data_maps;i++) {
|
| 2354 | 2354 |
AVFormatContext *files[2]; |
| 2355 |
- AVMetadata **meta[2]; |
|
| 2355 |
+ AVDictionary **meta[2]; |
|
| 2356 | 2356 |
int j; |
| 2357 | 2357 |
|
| 2358 | 2358 |
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\ |
| ... | ... |
@@ -2395,15 +2396,15 @@ static int transcode(AVFormatContext **output_files, |
| 2395 | 2395 |
} |
| 2396 | 2396 |
} |
| 2397 | 2397 |
|
| 2398 |
- av_metadata_copy(meta[0], *meta[1], AV_METADATA_DONT_OVERWRITE); |
|
| 2398 |
+ av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE); |
|
| 2399 | 2399 |
} |
| 2400 | 2400 |
|
| 2401 | 2401 |
/* copy global metadata by default */ |
| 2402 | 2402 |
if (metadata_global_autocopy) {
|
| 2403 | 2403 |
|
| 2404 | 2404 |
for (i = 0; i < nb_output_files; i++) |
| 2405 |
- av_metadata_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, |
|
| 2406 |
- AV_METADATA_DONT_OVERWRITE); |
|
| 2405 |
+ av_dict_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, |
|
| 2406 |
+ AV_DICT_DONT_OVERWRITE); |
|
| 2407 | 2407 |
} |
| 2408 | 2408 |
|
| 2409 | 2409 |
/* copy chapters according to chapter maps */ |
| ... | ... |
@@ -2818,7 +2819,7 @@ static int opt_metadata(const char *opt, const char *arg) |
| 2818 | 2818 |
} |
| 2819 | 2819 |
*mid++= 0; |
| 2820 | 2820 |
|
| 2821 |
- av_metadata_set2(&metadata, arg, mid, 0); |
|
| 2821 |
+ av_dict_set(&metadata, arg, mid, 0); |
|
| 2822 | 2822 |
|
| 2823 | 2823 |
return 0; |
| 2824 | 2824 |
} |
| ... | ... |
@@ -3523,7 +3524,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) |
| 3523 | 3523 |
parse_forced_key_frames(forced_key_frames, ost, video_enc); |
| 3524 | 3524 |
} |
| 3525 | 3525 |
if (video_language) {
|
| 3526 |
- av_metadata_set2(&st->metadata, "language", video_language, 0); |
|
| 3526 |
+ av_dict_set(&st->metadata, "language", video_language, 0); |
|
| 3527 | 3527 |
av_freep(&video_language); |
| 3528 | 3528 |
} |
| 3529 | 3529 |
|
| ... | ... |
@@ -3603,7 +3604,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) |
| 3603 | 3603 |
} |
| 3604 | 3604 |
audio_enc->time_base= (AVRational){1, audio_sample_rate};
|
| 3605 | 3605 |
if (audio_language) {
|
| 3606 |
- av_metadata_set2(&st->metadata, "language", audio_language, 0); |
|
| 3606 |
+ av_dict_set(&st->metadata, "language", audio_language, 0); |
|
| 3607 | 3607 |
av_freep(&audio_language); |
| 3608 | 3608 |
} |
| 3609 | 3609 |
|
| ... | ... |
@@ -3699,7 +3700,7 @@ static void new_subtitle_stream(AVFormatContext *oc, int file_idx) |
| 3699 | 3699 |
} |
| 3700 | 3700 |
|
| 3701 | 3701 |
if (subtitle_language) {
|
| 3702 |
- av_metadata_set2(&st->metadata, "language", subtitle_language, 0); |
|
| 3702 |
+ av_dict_set(&st->metadata, "language", subtitle_language, 0); |
|
| 3703 | 3703 |
av_freep(&subtitle_language); |
| 3704 | 3704 |
} |
| 3705 | 3705 |
|
| ... | ... |
@@ -3830,8 +3831,8 @@ static void opt_output_file(const char *filename) |
| 3830 | 3830 |
|
| 3831 | 3831 |
oc->timestamp = recording_timestamp; |
| 3832 | 3832 |
|
| 3833 |
- av_metadata_copy(&oc->metadata, metadata, 0); |
|
| 3834 |
- av_metadata_free(&metadata); |
|
| 3833 |
+ av_dict_copy(&oc->metadata, metadata, 0); |
|
| 3834 |
+ av_dict_free(&metadata); |
|
| 3835 | 3835 |
} |
| 3836 | 3836 |
|
| 3837 | 3837 |
output_files[nb_output_files++] = oc; |
| ... | ... |
@@ -25,6 +25,7 @@ |
| 25 | 25 |
#include "libavcodec/avcodec.h" |
| 26 | 26 |
#include "libavutil/opt.h" |
| 27 | 27 |
#include "libavutil/pixdesc.h" |
| 28 |
+#include "libavutil/dict.h" |
|
| 28 | 29 |
#include "libavdevice/avdevice.h" |
| 29 | 30 |
#include "cmdutils.h" |
| 30 | 31 |
|
| ... | ... |
@@ -160,7 +161,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) |
| 160 | 160 |
AVCodecContext *dec_ctx; |
| 161 | 161 |
AVCodec *dec; |
| 162 | 162 |
char val_str[128]; |
| 163 |
- AVMetadataTag *tag = NULL; |
|
| 163 |
+ AVDictionaryEntry *tag = NULL; |
|
| 164 | 164 |
AVRational display_aspect_ratio; |
| 165 | 165 |
|
| 166 | 166 |
printf("[STREAM]\n");
|
| ... | ... |
@@ -226,7 +227,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) |
| 226 | 226 |
if (stream->nb_frames) |
| 227 | 227 |
printf("nb_frames=%"PRId64"\n", stream->nb_frames);
|
| 228 | 228 |
|
| 229 |
- while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) |
|
| 229 |
+ while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) |
|
| 230 | 230 |
printf("TAG:%s=%s\n", tag->key, tag->value);
|
| 231 | 231 |
|
| 232 | 232 |
printf("[/STREAM]\n");
|
| ... | ... |
@@ -234,7 +235,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) |
| 234 | 234 |
|
| 235 | 235 |
static void show_format(AVFormatContext *fmt_ctx) |
| 236 | 236 |
{
|
| 237 |
- AVMetadataTag *tag = NULL; |
|
| 237 |
+ AVDictionaryEntry *tag = NULL; |
|
| 238 | 238 |
char val_str[128]; |
| 239 | 239 |
|
| 240 | 240 |
printf("[FORMAT]\n");
|
| ... | ... |
@@ -252,7 +253,7 @@ static void show_format(AVFormatContext *fmt_ctx) |
| 252 | 252 |
printf("bit_rate=%s\n", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate,
|
| 253 | 253 |
unit_bit_per_second_str)); |
| 254 | 254 |
|
| 255 |
- while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) |
|
| 255 |
+ while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) |
|
| 256 | 256 |
printf("TAG:%s=%s\n", tag->key, tag->value);
|
| 257 | 257 |
|
| 258 | 258 |
printf("[/FORMAT]\n");
|
| ... | ... |
@@ -36,6 +36,7 @@ |
| 36 | 36 |
#include "libavformat/avio_internal.h" |
| 37 | 37 |
#include "libavutil/avstring.h" |
| 38 | 38 |
#include "libavutil/lfg.h" |
| 39 |
+#include "libavutil/dict.h" |
|
| 39 | 40 |
#include "libavutil/random_seed.h" |
| 40 | 41 |
#include "libavutil/parseutils.h" |
| 41 | 42 |
#include "libavutil/opt.h" |
| ... | ... |
@@ -854,7 +855,7 @@ static void close_connection(HTTPContext *c) |
| 854 | 854 |
ctx = c->rtp_ctx[i]; |
| 855 | 855 |
if (ctx) {
|
| 856 | 856 |
av_write_trailer(ctx); |
| 857 |
- av_metadata_free(&ctx->metadata); |
|
| 857 |
+ av_dict_free(&ctx->metadata); |
|
| 858 | 858 |
av_free(ctx->streams[0]); |
| 859 | 859 |
av_free(ctx); |
| 860 | 860 |
} |
| ... | ... |
@@ -2224,10 +2225,10 @@ static int http_prepare_data(HTTPContext *c) |
| 2224 | 2224 |
switch(c->state) {
|
| 2225 | 2225 |
case HTTPSTATE_SEND_DATA_HEADER: |
| 2226 | 2226 |
memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); |
| 2227 |
- av_metadata_set2(&c->fmt_ctx.metadata, "author" , c->stream->author , 0); |
|
| 2228 |
- av_metadata_set2(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0); |
|
| 2229 |
- av_metadata_set2(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); |
|
| 2230 |
- av_metadata_set2(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); |
|
| 2227 |
+ av_dict_set(&c->fmt_ctx.metadata, "author" , c->stream->author , 0); |
|
| 2228 |
+ av_dict_set(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0); |
|
| 2229 |
+ av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); |
|
| 2230 |
+ av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); |
|
| 2231 | 2231 |
|
| 2232 | 2232 |
c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams); |
| 2233 | 2233 |
|
| ... | ... |
@@ -2272,7 +2273,7 @@ static int http_prepare_data(HTTPContext *c) |
| 2272 | 2272 |
http_log("Error writing output header\n");
|
| 2273 | 2273 |
return -1; |
| 2274 | 2274 |
} |
| 2275 |
- av_metadata_free(&c->fmt_ctx.metadata); |
|
| 2275 |
+ av_dict_free(&c->fmt_ctx.metadata); |
|
| 2276 | 2276 |
|
| 2277 | 2277 |
len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer); |
| 2278 | 2278 |
c->buffer_ptr = c->pb_buffer; |
| ... | ... |
@@ -2927,8 +2928,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, |
| 2927 | 2927 |
if (avc == NULL) {
|
| 2928 | 2928 |
return -1; |
| 2929 | 2929 |
} |
| 2930 |
- av_metadata_set2(&avc->metadata, "title", |
|
| 2931 |
- stream->title[0] ? stream->title : "No Title", 0); |
|
| 2930 |
+ av_dict_set(&avc->metadata, "title", |
|
| 2931 |
+ stream->title[0] ? stream->title : "No Title", 0); |
|
| 2932 | 2932 |
avc->nb_streams = stream->nb_streams; |
| 2933 | 2933 |
if (stream->is_multicast) {
|
| 2934 | 2934 |
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, |
| 2954 | 2954 |
|
| 2955 | 2955 |
sdp_done: |
| 2956 | 2956 |
av_free(avc->streams); |
| 2957 |
- av_metadata_free(&avc->metadata); |
|
| 2957 |
+ av_dict_free(&avc->metadata); |
|
| 2958 | 2958 |
av_free(avc); |
| 2959 | 2959 |
av_free(avs); |
| 2960 | 2960 |
|
| ... | ... |
@@ -20,6 +20,7 @@ |
| 20 | 20 |
*/ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/intfloat_readwrite.h" |
| 23 |
+#include "libavutil/dict.h" |
|
| 23 | 24 |
#include "avformat.h" |
| 24 | 25 |
#include "pcm.h" |
| 25 | 26 |
#include "aiff.h" |
| ... | ... |
@@ -79,7 +80,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) |
| 79 | 79 |
return; |
| 80 | 80 |
|
| 81 | 81 |
str[res] = 0; |
| 82 |
- av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL); |
|
| 82 |
+ av_dict_set(&s->metadata, key, str, AV_DICT_DONT_STRDUP_VAL); |
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
/* Returns the number of sound data frames or negative on error */ |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
*/ |
| 22 | 22 |
|
| 23 | 23 |
#include "libavutil/intreadwrite.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "avformat.h" |
| 25 | 26 |
#include "apetag.h" |
| 26 | 27 |
|
| ... | ... |
@@ -57,7 +58,7 @@ static int ape_tag_read_field(AVFormatContext *s) |
| 57 | 57 |
return AVERROR(ENOMEM); |
| 58 | 58 |
avio_read(pb, value, size); |
| 59 | 59 |
value[size] = 0; |
| 60 |
- av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); |
|
| 60 |
+ av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); |
|
| 61 | 61 |
return 0; |
| 62 | 62 |
} |
| 63 | 63 |
|
| ... | ... |
@@ -28,6 +28,7 @@ |
| 28 | 28 |
#include "libavutil/avstring.h" |
| 29 | 29 |
#include "libavutil/intreadwrite.h" |
| 30 | 30 |
#include "libavutil/opt.h" |
| 31 |
+#include "libavutil/dict.h" |
|
| 31 | 32 |
#include "avformat.h" |
| 32 | 33 |
#include "internal.h" |
| 33 | 34 |
#include <unistd.h> |
| ... | ... |
@@ -505,7 +506,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 505 | 505 |
} |
| 506 | 506 |
avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); |
| 507 | 507 |
if (v->bandwidth) |
| 508 |
- av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str, |
|
| 508 |
+ av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, |
|
| 509 | 509 |
0); |
| 510 | 510 |
} |
| 511 | 511 |
stream_offset += v->ctx->nb_streams; |
| ... | ... |
@@ -24,6 +24,7 @@ |
| 24 | 24 |
#include "libavutil/bswap.h" |
| 25 | 25 |
#include "libavutil/common.h" |
| 26 | 26 |
#include "libavutil/avstring.h" |
| 27 |
+#include "libavutil/dict.h" |
|
| 27 | 28 |
#include "libavcodec/mpegaudio.h" |
| 28 | 29 |
#include "avformat.h" |
| 29 | 30 |
#include "avio_internal.h" |
| ... | ... |
@@ -179,7 +180,7 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) |
| 179 | 179 |
goto finish; |
| 180 | 180 |
} |
| 181 | 181 |
if (*value) |
| 182 |
- av_metadata_set2(&s->metadata, key, value, 0); |
|
| 182 |
+ av_dict_set(&s->metadata, key, value, 0); |
|
| 183 | 183 |
finish: |
| 184 | 184 |
av_freep(&value); |
| 185 | 185 |
avio_seek(s->pb, off + len, SEEK_SET); |
| ... | ... |
@@ -689,7 +690,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 689 | 689 |
const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any
|
| 690 | 690 |
const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL); |
| 691 | 691 |
if (iso6392) |
| 692 |
- av_metadata_set2(&st->metadata, "language", iso6392, 0); |
|
| 692 |
+ av_dict_set(&st->metadata, "language", iso6392, 0); |
|
| 693 | 693 |
} |
| 694 | 694 |
} |
| 695 | 695 |
} |
| ... | ... |
@@ -19,10 +19,10 @@ |
| 19 | 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 |
*/ |
| 21 | 21 |
#include "avformat.h" |
| 22 |
-#include "metadata.h" |
|
| 23 | 22 |
#include "riff.h" |
| 24 | 23 |
#include "asf.h" |
| 25 | 24 |
#include "avio_internal.h" |
| 25 |
+#include "libavutil/dict.h" |
|
| 26 | 26 |
|
| 27 | 27 |
#undef NDEBUG |
| 28 | 28 |
#include <assert.h> |
| ... | ... |
@@ -296,7 +296,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 296 | 296 |
{
|
| 297 | 297 |
ASFContext *asf = s->priv_data; |
| 298 | 298 |
AVIOContext *pb = s->pb; |
| 299 |
- AVMetadataTag *tags[5]; |
|
| 299 |
+ AVDictionaryEntry *tags[5]; |
|
| 300 | 300 |
int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; |
| 301 | 301 |
int has_title; |
| 302 | 302 |
int metadata_count; |
| ... | ... |
@@ -307,11 +307,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data |
| 307 | 307 |
|
| 308 | 308 |
ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); |
| 309 | 309 |
|
| 310 |
- tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0); |
|
| 311 |
- tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0); |
|
| 312 |
- tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0); |
|
| 313 |
- tags[3] = av_metadata_get(s->metadata, "comment" , NULL, 0); |
|
| 314 |
- tags[4] = av_metadata_get(s->metadata, "rating" , NULL, 0); |
|
| 310 |
+ tags[0] = av_dict_get(s->metadata, "title" , NULL, 0); |
|
| 311 |
+ tags[1] = av_dict_get(s->metadata, "author" , NULL, 0); |
|
| 312 |
+ tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); |
|
| 313 |
+ tags[3] = av_dict_get(s->metadata, "comment" , NULL, 0); |
|
| 314 |
+ tags[4] = av_dict_get(s->metadata, "rating" , NULL, 0); |
|
| 315 | 315 |
|
| 316 | 316 |
duration = asf->duration + PREROLL_TIME * 10000; |
| 317 | 317 |
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 |
| 381 | 381 |
end_header(pb, hpos); |
| 382 | 382 |
} |
| 383 | 383 |
if (metadata_count) {
|
| 384 |
- AVMetadataTag *tag = NULL; |
|
| 384 |
+ AVDictionaryEntry *tag = NULL; |
|
| 385 | 385 |
hpos = put_header(pb, &ff_asf_extended_content_header); |
| 386 | 386 |
avio_wl16(pb, metadata_count); |
| 387 |
- while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 387 |
+ while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 388 | 388 |
put_str16(pb, tag->key); |
| 389 | 389 |
avio_wl16(pb, 0); |
| 390 | 390 |
put_str16(pb, tag->value); |
| ... | ... |
@@ -161,7 +161,7 @@ attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AV |
| 161 | 161 |
* this function will allocate a struct for you and put it in *dst |
| 162 | 162 |
* @param src pointer to source AVDictionary struct |
| 163 | 163 |
* @param flags flags to use when setting metadata in *dst |
| 164 |
- * @note metadata is read using the AV_METADATA_IGNORE_SUFFIX flag |
|
| 164 |
+ * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag |
|
| 165 | 165 |
*/ |
| 166 | 166 |
attribute_deprecated void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags); |
| 167 | 167 |
|
| ... | ... |
@@ -565,7 +565,7 @@ typedef struct AVStream {
|
| 565 | 565 |
*/ |
| 566 | 566 |
AVRational sample_aspect_ratio; |
| 567 | 567 |
|
| 568 |
- AVMetadata *metadata; |
|
| 568 |
+ AVDictionary *metadata; |
|
| 569 | 569 |
|
| 570 | 570 |
/* Intended mostly for av_read_frame() support. Not supposed to be used by */ |
| 571 | 571 |
/* external applications; try to use something else if at all possible. */ |
| ... | ... |
@@ -633,7 +633,7 @@ typedef struct AVProgram {
|
| 633 | 633 |
enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller |
| 634 | 634 |
unsigned int *stream_index; |
| 635 | 635 |
unsigned int nb_stream_indexes; |
| 636 |
- AVMetadata *metadata; |
|
| 636 |
+ AVDictionary *metadata; |
|
| 637 | 637 |
} AVProgram; |
| 638 | 638 |
|
| 639 | 639 |
#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present |
| ... | ... |
@@ -643,7 +643,7 @@ typedef struct AVChapter {
|
| 643 | 643 |
int id; ///< unique ID to identify the chapter |
| 644 | 644 |
AVRational time_base; ///< time base in which the start/end timestamps are specified |
| 645 | 645 |
int64_t start, end; ///< chapter start/end time in time_base units |
| 646 |
- AVMetadata *metadata; |
|
| 646 |
+ AVDictionary *metadata; |
|
| 647 | 647 |
} AVChapter; |
| 648 | 648 |
|
| 649 | 649 |
/** |
| ... | ... |
@@ -806,7 +806,7 @@ typedef struct AVFormatContext {
|
| 806 | 806 |
|
| 807 | 807 |
struct AVPacketList *packet_buffer_end; |
| 808 | 808 |
|
| 809 |
- AVMetadata *metadata; |
|
| 809 |
+ AVDictionary *metadata; |
|
| 810 | 810 |
|
| 811 | 811 |
/** |
| 812 | 812 |
* Remaining size available for raw_packet_buffer, in bytes. |
| ... | ... |
@@ -25,6 +25,7 @@ |
| 25 | 25 |
#include <strings.h> |
| 26 | 26 |
#include "libavutil/intreadwrite.h" |
| 27 | 27 |
#include "libavutil/bswap.h" |
| 28 |
+#include "libavutil/dict.h" |
|
| 28 | 29 |
#include "avformat.h" |
| 29 | 30 |
#include "avi.h" |
| 30 | 31 |
#include "dv.h" |
| ... | ... |
@@ -261,8 +262,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t |
| 261 | 261 |
|
| 262 | 262 |
AV_WL32(key, tag); |
| 263 | 263 |
|
| 264 |
- return av_metadata_set2(st ? &st->metadata : &s->metadata, key, value, |
|
| 265 |
- AV_METADATA_DONT_STRDUP_VAL); |
|
| 264 |
+ return av_dict_set(st ? &st->metadata : &s->metadata, key, value, |
|
| 265 |
+ AV_DICT_DONT_STRDUP_VAL); |
|
| 266 | 266 |
} |
| 267 | 267 |
|
| 268 | 268 |
static void avi_read_info(AVFormatContext *s, uint64_t end) |
| ... | ... |
@@ -277,7 +278,7 @@ static void avi_read_info(AVFormatContext *s, uint64_t end) |
| 277 | 277 |
static const char months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
| 278 | 278 |
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; |
| 279 | 279 |
|
| 280 |
-static void avi_metadata_creation_time(AVMetadata **metadata, char *date) |
|
| 280 |
+static void avi_metadata_creation_time(AVDictionary **metadata, char *date) |
|
| 281 | 281 |
{
|
| 282 | 282 |
char month[4], time[9], buffer[64]; |
| 283 | 283 |
int i, day, year; |
| ... | ... |
@@ -288,11 +289,11 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) |
| 288 | 288 |
if (!strcasecmp(month, months[i])) {
|
| 289 | 289 |
snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", |
| 290 | 290 |
year, i+1, day, time); |
| 291 |
- av_metadata_set2(metadata, "creation_time", buffer, 0); |
|
| 291 |
+ av_dict_set(metadata, "creation_time", buffer, 0); |
|
| 292 | 292 |
} |
| 293 | 293 |
} else if (date[4] == '/' && date[7] == '/') {
|
| 294 | 294 |
date[4] = date[7] = '-'; |
| 295 |
- av_metadata_set2(metadata, "creation_time", date, 0); |
|
| 295 |
+ av_dict_set(metadata, "creation_time", date, 0); |
|
| 296 | 296 |
} |
| 297 | 297 |
} |
| 298 | 298 |
|
| ... | ... |
@@ -320,7 +321,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) |
| 320 | 320 |
break; |
| 321 | 321 |
} |
| 322 | 322 |
if (name) |
| 323 |
- av_metadata_set2(&s->metadata, name, buffer, 0); |
|
| 323 |
+ av_dict_set(&s->metadata, name, buffer, 0); |
|
| 324 | 324 |
avio_skip(s->pb, size); |
| 325 | 325 |
} |
| 326 | 326 |
break; |
| ... | ... |
@@ -770,7 +771,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
|
| 770 | 770 |
ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); |
| 771 | 771 |
avio_skip(pb, desc_len - ret); |
| 772 | 772 |
if (*desc) |
| 773 |
- av_metadata_set2(&st->metadata, "title", desc, 0); |
|
| 773 |
+ av_dict_set(&st->metadata, "title", desc, 0); |
|
| 774 | 774 |
|
| 775 | 775 |
avio_rl16(pb); /* flags? */ |
| 776 | 776 |
avio_rl32(pb); /* data size */ |
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#include "avio_internal.h" |
| 24 | 24 |
#include "riff.h" |
| 25 | 25 |
#include "libavutil/intreadwrite.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
|
| 27 | 28 |
/* |
| 28 | 29 |
* TODO: |
| ... | ... |
@@ -157,7 +158,7 @@ static int avi_write_header(AVFormatContext *s) |
| 157 | 157 |
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; |
| 158 | 158 |
AVCodecContext *stream, *video_enc; |
| 159 | 159 |
int64_t list1, list2, strh, strf; |
| 160 |
- AVMetadataTag *t = NULL; |
|
| 160 |
+ AVDictionaryEntry *t = NULL; |
|
| 161 | 161 |
|
| 162 | 162 |
if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
|
| 163 | 163 |
av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n", |
| ... | ... |
@@ -297,7 +298,7 @@ static int avi_write_header(AVFormatContext *s) |
| 297 | 297 |
return -1; |
| 298 | 298 |
} |
| 299 | 299 |
ff_end_tag(pb, strf); |
| 300 |
- if ((t = av_metadata_get(s->streams[i]->metadata, "title", NULL, 0))) {
|
|
| 300 |
+ if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
|
|
| 301 | 301 |
avi_write_info_tag(s->pb, "strn", t->value); |
| 302 | 302 |
t = NULL; |
| 303 | 303 |
} |
| ... | ... |
@@ -379,7 +380,7 @@ static int avi_write_header(AVFormatContext *s) |
| 379 | 379 |
ffio_wfourcc(pb, "INFO"); |
| 380 | 380 |
ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL); |
| 381 | 381 |
for (i = 0; *ff_avi_tags[i]; i++) {
|
| 382 |
- if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) |
|
| 382 |
+ if ((t = av_dict_get(s->metadata, ff_avi_tags[i], NULL, AV_DICT_MATCH_CASE))) |
|
| 383 | 383 |
avi_write_info_tag(s->pb, t->key, t->value); |
| 384 | 384 |
} |
| 385 | 385 |
ff_end_tag(pb, list2); |
| ... | ... |
@@ -29,6 +29,7 @@ |
| 29 | 29 |
#include "riff.h" |
| 30 | 30 |
#include "isom.h" |
| 31 | 31 |
#include "libavutil/intreadwrite.h" |
| 32 |
+#include "libavutil/dict.h" |
|
| 32 | 33 |
#include "caf.h" |
| 33 | 34 |
|
| 34 | 35 |
typedef struct {
|
| ... | ... |
@@ -187,7 +188,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) |
| 187 | 187 |
char value[1024]; |
| 188 | 188 |
avio_get_str(pb, INT_MAX, key, sizeof(key)); |
| 189 | 189 |
avio_get_str(pb, INT_MAX, value, sizeof(value)); |
| 190 |
- av_metadata_set2(&s->metadata, key, value, 0); |
|
| 190 |
+ av_dict_set(&s->metadata, key, value, 0); |
|
| 191 | 191 |
} |
| 192 | 192 |
} |
| 193 | 193 |
|
| ... | ... |
@@ -22,6 +22,7 @@ |
| 22 | 22 |
#include "avformat.h" |
| 23 | 23 |
#include "ffmeta.h" |
| 24 | 24 |
#include "internal.h" |
| 25 |
+#include "libavutil/dict.h" |
|
| 25 | 26 |
|
| 26 | 27 |
static int probe(AVProbeData *p) |
| 27 | 28 |
{
|
| ... | ... |
@@ -93,7 +94,7 @@ static uint8_t *unescape(uint8_t *buf, int size) |
| 93 | 93 |
return ret; |
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 |
-static int read_tag(uint8_t *line, AVMetadata **m) |
|
| 96 |
+static int read_tag(uint8_t *line, AVDictionary **m) |
|
| 97 | 97 |
{
|
| 98 | 98 |
uint8_t *key, *value, *p = line; |
| 99 | 99 |
|
| ... | ... |
@@ -117,13 +118,13 @@ static int read_tag(uint8_t *line, AVMetadata **m) |
| 117 | 117 |
return AVERROR(ENOMEM); |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 |
- av_metadata_set2(m, key, value, AV_METADATA_DONT_STRDUP_KEY | AV_METADATA_DONT_STRDUP_VAL); |
|
| 120 |
+ av_dict_set(m, key, value, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); |
|
| 121 | 121 |
return 0; |
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
static int read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 125 | 125 |
{
|
| 126 |
- AVMetadata **m = &s->metadata; |
|
| 126 |
+ AVDictionary **m = &s->metadata; |
|
| 127 | 127 |
uint8_t line[1024]; |
| 128 | 128 |
|
| 129 | 129 |
while(!s->pb->eof_reached) {
|
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
|
| 24 | 24 |
#include "avformat.h" |
| 25 | 25 |
#include "ffmeta.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
|
| 27 | 28 |
|
| 28 | 29 |
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) |
| 37 | 37 |
} |
| 38 | 38 |
} |
| 39 | 39 |
|
| 40 |
-static void write_tags(AVIOContext *s, AVMetadata *m) |
|
| 40 |
+static void write_tags(AVIOContext *s, AVDictionary *m) |
|
| 41 | 41 |
{
|
| 42 |
- AVMetadataTag *t = NULL; |
|
| 43 |
- while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 42 |
+ AVDictionaryEntry *t = NULL; |
|
| 43 |
+ while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 44 | 44 |
write_escape_str(s, t->key); |
| 45 | 45 |
avio_w8(s, '='); |
| 46 | 46 |
write_escape_str(s, t->value); |
| ... | ... |
@@ -22,7 +22,6 @@ |
| 22 | 22 |
#include "libavcodec/flac.h" |
| 23 | 23 |
#include "avformat.h" |
| 24 | 24 |
#include "flacenc.h" |
| 25 |
-#include "metadata.h" |
|
| 26 | 25 |
#include "vorbiscomment.h" |
| 27 | 26 |
#include "libavcodec/bytestream.h" |
| 28 | 27 |
|
| ... | ... |
@@ -39,7 +38,7 @@ static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_byte |
| 39 | 39 |
return 0; |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 |
-static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m, |
|
| 42 |
+static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, |
|
| 43 | 43 |
int last_block, int bitexact) |
| 44 | 44 |
{
|
| 45 | 45 |
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; |
| ... | ... |
@@ -25,6 +25,7 @@ |
| 25 | 25 |
*/ |
| 26 | 26 |
|
| 27 | 27 |
#include "libavutil/avstring.h" |
| 28 |
+#include "libavutil/dict.h" |
|
| 28 | 29 |
#include "libavcodec/bytestream.h" |
| 29 | 30 |
#include "libavcodec/mpeg4audio.h" |
| 30 | 31 |
#include "avformat.h" |
| ... | ... |
@@ -271,17 +272,17 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst |
| 271 | 271 |
|
| 272 | 272 |
if(amf_type == AMF_DATA_TYPE_BOOL) {
|
| 273 | 273 |
av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)); |
| 274 |
- av_metadata_set2(&s->metadata, key, str_val, 0); |
|
| 274 |
+ av_dict_set(&s->metadata, key, str_val, 0); |
|
| 275 | 275 |
} else if(amf_type == AMF_DATA_TYPE_NUMBER) {
|
| 276 | 276 |
snprintf(str_val, sizeof(str_val), "%.f", num_val); |
| 277 |
- av_metadata_set2(&s->metadata, key, str_val, 0); |
|
| 277 |
+ av_dict_set(&s->metadata, key, str_val, 0); |
|
| 278 | 278 |
if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; |
| 279 | 279 |
else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) |
| 280 | 280 |
vcodec->bit_rate = num_val * 1024.0; |
| 281 | 281 |
else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0)) |
| 282 | 282 |
acodec->bit_rate = num_val * 1024.0; |
| 283 | 283 |
} else if (amf_type == AMF_DATA_TYPE_STRING) |
| 284 |
- av_metadata_set2(&s->metadata, key, str_val, 0); |
|
| 284 |
+ av_dict_set(&s->metadata, key, str_val, 0); |
|
| 285 | 285 |
} |
| 286 | 286 |
|
| 287 | 287 |
return 0; |
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#include "internal.h" |
| 24 | 24 |
#include "avc.h" |
| 25 | 25 |
#include "metadata.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
|
| 27 | 28 |
#undef NDEBUG |
| 28 | 29 |
#include <assert.h> |
| ... | ... |
@@ -177,7 +178,7 @@ static int flv_write_header(AVFormatContext *s) |
| 177 | 177 |
int i; |
| 178 | 178 |
double framerate = 0.0; |
| 179 | 179 |
int metadata_size_pos, data_size; |
| 180 |
- AVMetadataTag *tag = NULL; |
|
| 180 |
+ AVDictionaryEntry *tag = NULL; |
|
| 181 | 181 |
|
| 182 | 182 |
for(i=0; i<s->nb_streams; i++){
|
| 183 | 183 |
AVCodecContext *enc = s->streams[i]->codec; |
| ... | ... |
@@ -274,7 +275,7 @@ static int flv_write_header(AVFormatContext *s) |
| 274 | 274 |
put_amf_double(pb, audio_enc->codec_tag); |
| 275 | 275 |
} |
| 276 | 276 |
|
| 277 |
- while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 277 |
+ while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 278 | 278 |
put_amf_string(pb, tag->key); |
| 279 | 279 |
avio_w8(pb, AMF_DATA_TYPE_STRING); |
| 280 | 280 |
put_amf_string(pb, tag->value); |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "id3v1.h" |
| 23 | 23 |
#include "libavcodec/avcodec.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
|
| 25 | 26 |
const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
|
| 26 | 27 |
[0] = "Blues", |
| ... | ... |
@@ -191,7 +192,7 @@ static void get_string(AVFormatContext *s, const char *key, |
| 191 | 191 |
*q = '\0'; |
| 192 | 192 |
|
| 193 | 193 |
if (*str) |
| 194 |
- av_metadata_set2(&s->metadata, key, str, 0); |
|
| 194 |
+ av_dict_set(&s->metadata, key, str, 0); |
|
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 | 197 |
/** |
| ... | ... |
@@ -215,11 +216,11 @@ static int parse_tag(AVFormatContext *s, const uint8_t *buf) |
| 215 | 215 |
get_string(s, "comment", buf + 97, 30); |
| 216 | 216 |
if (buf[125] == 0 && buf[126] != 0) {
|
| 217 | 217 |
snprintf(str, sizeof(str), "%d", buf[126]); |
| 218 |
- av_metadata_set2(&s->metadata, "track", str, 0); |
|
| 218 |
+ av_dict_set(&s->metadata, "track", str, 0); |
|
| 219 | 219 |
} |
| 220 | 220 |
genre = buf[127]; |
| 221 | 221 |
if (genre <= ID3v1_GENRE_MAX) |
| 222 |
- av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); |
|
| 222 |
+ av_dict_set(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); |
|
| 223 | 223 |
return 0; |
| 224 | 224 |
} |
| 225 | 225 |
|
| ... | ... |
@@ -23,7 +23,7 @@ |
| 23 | 23 |
#include "id3v1.h" |
| 24 | 24 |
#include "libavutil/avstring.h" |
| 25 | 25 |
#include "libavutil/intreadwrite.h" |
| 26 |
-#include "metadata.h" |
|
| 26 |
+#include "libavutil/dict.h" |
|
| 27 | 27 |
#include "avio_internal.h" |
| 28 | 28 |
|
| 29 | 29 |
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 |
| 133 | 133 |
val = dst; |
| 134 | 134 |
|
| 135 | 135 |
if (val) |
| 136 |
- av_metadata_set2(&s->metadata, key, val, AV_METADATA_DONT_OVERWRITE); |
|
| 136 |
+ av_dict_set(&s->metadata, key, val, AV_DICT_DONT_OVERWRITE); |
|
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 | 139 |
static int is_number(const char *str) |
| ... | ... |
@@ -142,44 +142,44 @@ static int is_number(const char *str) |
| 142 | 142 |
return !*str; |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 |
-static AVMetadataTag* get_date_tag(AVMetadata *m, const char *tag) |
|
| 145 |
+static AVDictionaryEntry* get_date_tag(AVDictionary *m, const char *tag) |
|
| 146 | 146 |
{
|
| 147 |
- AVMetadataTag *t; |
|
| 148 |
- if ((t = av_metadata_get(m, tag, NULL, AV_METADATA_MATCH_CASE)) && |
|
| 147 |
+ AVDictionaryEntry *t; |
|
| 148 |
+ if ((t = av_dict_get(m, tag, NULL, AV_DICT_MATCH_CASE)) && |
|
| 149 | 149 |
strlen(t->value) == 4 && is_number(t->value)) |
| 150 | 150 |
return t; |
| 151 | 151 |
return NULL; |
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 |
-static void merge_date(AVMetadata **m) |
|
| 154 |
+static void merge_date(AVDictionary **m) |
|
| 155 | 155 |
{
|
| 156 |
- AVMetadataTag *t; |
|
| 156 |
+ AVDictionaryEntry *t; |
|
| 157 | 157 |
char date[17] = {0}; // YYYY-MM-DD hh:mm
|
| 158 | 158 |
|
| 159 | 159 |
if (!(t = get_date_tag(*m, "TYER")) && |
| 160 | 160 |
!(t = get_date_tag(*m, "TYE"))) |
| 161 | 161 |
return; |
| 162 | 162 |
av_strlcpy(date, t->value, 5); |
| 163 |
- av_metadata_set2(m, "TYER", NULL, 0); |
|
| 164 |
- av_metadata_set2(m, "TYE", NULL, 0); |
|
| 163 |
+ av_dict_set(m, "TYER", NULL, 0); |
|
| 164 |
+ av_dict_set(m, "TYE", NULL, 0); |
|
| 165 | 165 |
|
| 166 | 166 |
if (!(t = get_date_tag(*m, "TDAT")) && |
| 167 | 167 |
!(t = get_date_tag(*m, "TDA"))) |
| 168 | 168 |
goto finish; |
| 169 | 169 |
snprintf(date + 4, sizeof(date) - 4, "-%.2s-%.2s", t->value + 2, t->value); |
| 170 |
- av_metadata_set2(m, "TDAT", NULL, 0); |
|
| 171 |
- av_metadata_set2(m, "TDA", NULL, 0); |
|
| 170 |
+ av_dict_set(m, "TDAT", NULL, 0); |
|
| 171 |
+ av_dict_set(m, "TDA", NULL, 0); |
|
| 172 | 172 |
|
| 173 | 173 |
if (!(t = get_date_tag(*m, "TIME")) && |
| 174 | 174 |
!(t = get_date_tag(*m, "TIM"))) |
| 175 | 175 |
goto finish; |
| 176 | 176 |
snprintf(date + 10, sizeof(date) - 10, " %.2s:%.2s", t->value, t->value + 2); |
| 177 |
- av_metadata_set2(m, "TIME", NULL, 0); |
|
| 178 |
- av_metadata_set2(m, "TIM", NULL, 0); |
|
| 177 |
+ av_dict_set(m, "TIME", NULL, 0); |
|
| 178 |
+ av_dict_set(m, "TIM", NULL, 0); |
|
| 179 | 179 |
|
| 180 | 180 |
finish: |
| 181 | 181 |
if (date[0]) |
| 182 |
- av_metadata_set2(m, "date", date, 0); |
|
| 182 |
+ av_dict_set(m, "date", date, 0); |
|
| 183 | 183 |
} |
| 184 | 184 |
|
| 185 | 185 |
static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
*/ |
| 31 | 31 |
|
| 32 | 32 |
#include "libavutil/intreadwrite.h" |
| 33 |
+#include "libavutil/dict.h" |
|
| 33 | 34 |
#include "avformat.h" |
| 34 | 35 |
|
| 35 | 36 |
#define ID_8SVX MKTAG('8','S','V','X')
|
| ... | ... |
@@ -106,7 +107,7 @@ static int get_metadata(AVFormatContext *s, |
| 106 | 106 |
return AVERROR(EIO); |
| 107 | 107 |
} |
| 108 | 108 |
buf[data_size] = 0; |
| 109 |
- av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); |
|
| 109 |
+ av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); |
|
| 110 | 110 |
return 0; |
| 111 | 111 |
} |
| 112 | 112 |
|
| ... | ... |
@@ -42,6 +42,7 @@ |
| 42 | 42 |
#include "libavutil/intreadwrite.h" |
| 43 | 43 |
#include "libavutil/avstring.h" |
| 44 | 44 |
#include "libavutil/lzo.h" |
| 45 |
+#include "libavutil/dict.h" |
|
| 45 | 46 |
#if CONFIG_ZLIB |
| 46 | 47 |
#include <zlib.h> |
| 47 | 48 |
#endif |
| ... | ... |
@@ -1043,7 +1044,7 @@ static void matroska_merge_packets(AVPacket *out, AVPacket *in) |
| 1043 | 1043 |
} |
| 1044 | 1044 |
|
| 1045 | 1045 |
static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, |
| 1046 |
- AVMetadata **metadata, char *prefix) |
|
| 1046 |
+ AVDictionary **metadata, char *prefix) |
|
| 1047 | 1047 |
{
|
| 1048 | 1048 |
MatroskaTag *tags = list->elem; |
| 1049 | 1049 |
char key[1024]; |
| ... | ... |
@@ -1059,14 +1060,14 @@ static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, |
| 1059 | 1059 |
if (prefix) snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name); |
| 1060 | 1060 |
else av_strlcpy(key, tags[i].name, sizeof(key)); |
| 1061 | 1061 |
if (tags[i].def || !lang) {
|
| 1062 |
- av_metadata_set2(metadata, key, tags[i].string, 0); |
|
| 1062 |
+ av_dict_set(metadata, key, tags[i].string, 0); |
|
| 1063 | 1063 |
if (tags[i].sub.nb_elem) |
| 1064 | 1064 |
matroska_convert_tag(s, &tags[i].sub, metadata, key); |
| 1065 | 1065 |
} |
| 1066 | 1066 |
if (lang) {
|
| 1067 | 1067 |
av_strlcat(key, "-", sizeof(key)); |
| 1068 | 1068 |
av_strlcat(key, lang, sizeof(key)); |
| 1069 |
- av_metadata_set2(metadata, key, tags[i].string, 0); |
|
| 1069 |
+ av_dict_set(metadata, key, tags[i].string, 0); |
|
| 1070 | 1070 |
if (tags[i].sub.nb_elem) |
| 1071 | 1071 |
matroska_convert_tag(s, &tags[i].sub, metadata, key); |
| 1072 | 1072 |
} |
| ... | ... |
@@ -1234,7 +1235,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1234 | 1234 |
if (matroska->duration) |
| 1235 | 1235 |
matroska->ctx->duration = matroska->duration * matroska->time_scale |
| 1236 | 1236 |
* 1000 / AV_TIME_BASE; |
| 1237 |
- av_metadata_set2(&s->metadata, "title", matroska->title, 0); |
|
| 1237 |
+ av_dict_set(&s->metadata, "title", matroska->title, 0); |
|
| 1238 | 1238 |
|
| 1239 | 1239 |
tracks = matroska->tracks.elem; |
| 1240 | 1240 |
for (i=0; i < matroska->tracks.nb_elem; i++) {
|
| ... | ... |
@@ -1432,8 +1433,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1432 | 1432 |
st->codec->codec_id = codec_id; |
| 1433 | 1433 |
st->start_time = 0; |
| 1434 | 1434 |
if (strcmp(track->language, "und")) |
| 1435 |
- av_metadata_set2(&st->metadata, "language", track->language, 0); |
|
| 1436 |
- av_metadata_set2(&st->metadata, "title", track->name, 0); |
|
| 1435 |
+ av_dict_set(&st->metadata, "language", track->language, 0); |
|
| 1436 |
+ av_dict_set(&st->metadata, "title", track->name, 0); |
|
| 1437 | 1437 |
|
| 1438 | 1438 |
if (track->flag_default) |
| 1439 | 1439 |
st->disposition |= AV_DISPOSITION_DEFAULT; |
| ... | ... |
@@ -1494,7 +1495,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1494 | 1494 |
AVStream *st = av_new_stream(s, 0); |
| 1495 | 1495 |
if (st == NULL) |
| 1496 | 1496 |
break; |
| 1497 |
- av_metadata_set2(&st->metadata, "filename",attachements[j].filename, 0); |
|
| 1497 |
+ av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); |
|
| 1498 | 1498 |
st->codec->codec_id = CODEC_ID_NONE; |
| 1499 | 1499 |
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; |
| 1500 | 1500 |
st->codec->extradata = av_malloc(attachements[j].bin.size); |
| ... | ... |
@@ -1522,7 +1523,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1522 | 1522 |
ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
|
| 1523 | 1523 |
chapters[i].start, chapters[i].end, |
| 1524 | 1524 |
chapters[i].title); |
| 1525 |
- av_metadata_set2(&chapters[i].chapter->metadata, |
|
| 1525 |
+ av_dict_set(&chapters[i].chapter->metadata, |
|
| 1526 | 1526 |
"title", chapters[i].title, 0); |
| 1527 | 1527 |
max_start = chapters[i].start; |
| 1528 | 1528 |
} |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
#include "libavutil/intreadwrite.h" |
| 31 | 31 |
#include "libavutil/random_seed.h" |
| 32 | 32 |
#include "libavutil/lfg.h" |
| 33 |
+#include "libavutil/dict.h" |
|
| 33 | 34 |
#include "libavcodec/xiph.h" |
| 34 | 35 |
#include "libavcodec/mpeg4audio.h" |
| 35 | 36 |
#include <strings.h> |
| ... | ... |
@@ -523,7 +524,7 @@ static int mkv_write_tracks(AVFormatContext *s) |
| 523 | 523 |
int bit_depth = av_get_bits_per_sample(codec->codec_id); |
| 524 | 524 |
int sample_rate = codec->sample_rate; |
| 525 | 525 |
int output_sample_rate = 0; |
| 526 |
- AVMetadataTag *tag; |
|
| 526 |
+ AVDictionaryEntry *tag; |
|
| 527 | 527 |
|
| 528 | 528 |
if (!bit_depth) |
| 529 | 529 |
bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt); |
| ... | ... |
@@ -536,9 +537,9 @@ static int mkv_write_tracks(AVFormatContext *s) |
| 536 | 536 |
put_ebml_uint (pb, MATROSKA_ID_TRACKUID , i + 1); |
| 537 | 537 |
put_ebml_uint (pb, MATROSKA_ID_TRACKFLAGLACING , 0); // no lacing (yet) |
| 538 | 538 |
|
| 539 |
- if ((tag = av_metadata_get(st->metadata, "title", NULL, 0))) |
|
| 539 |
+ if ((tag = av_dict_get(st->metadata, "title", NULL, 0))) |
|
| 540 | 540 |
put_ebml_string(pb, MATROSKA_ID_TRACKNAME, tag->value); |
| 541 |
- tag = av_metadata_get(st->metadata, "language", NULL, 0); |
|
| 541 |
+ tag = av_dict_get(st->metadata, "language", NULL, 0); |
|
| 542 | 542 |
put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und"); |
| 543 | 543 |
|
| 544 | 544 |
if (st->disposition) |
| ... | ... |
@@ -586,7 +587,7 @@ static int mkv_write_tracks(AVFormatContext *s) |
| 586 | 586 |
// XXX: interlace flag? |
| 587 | 587 |
put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width); |
| 588 | 588 |
put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height); |
| 589 |
- if ((tag = av_metadata_get(s->metadata, "stereo_mode", NULL, 0))) {
|
|
| 589 |
+ if ((tag = av_dict_get(s->metadata, "stereo_mode", NULL, 0))) {
|
|
| 590 | 590 |
uint8_t stereo_fmt = atoi(tag->value); |
| 591 | 591 |
int valid_fmt = 0; |
| 592 | 592 |
|
| ... | ... |
@@ -675,7 +676,7 @@ static int mkv_write_chapters(AVFormatContext *s) |
| 675 | 675 |
for (i = 0; i < s->nb_chapters; i++) {
|
| 676 | 676 |
ebml_master chapteratom, chapterdisplay; |
| 677 | 677 |
AVChapter *c = s->chapters[i]; |
| 678 |
- AVMetadataTag *t = NULL; |
|
| 678 |
+ AVDictionaryEntry *t = NULL; |
|
| 679 | 679 |
|
| 680 | 680 |
chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0); |
| 681 | 681 |
put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id); |
| ... | ... |
@@ -685,7 +686,7 @@ static int mkv_write_chapters(AVFormatContext *s) |
| 685 | 685 |
av_rescale_q(c->end, c->time_base, scale)); |
| 686 | 686 |
put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0); |
| 687 | 687 |
put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1); |
| 688 |
- if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
|
|
| 688 |
+ if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
|
|
| 689 | 689 |
chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0); |
| 690 | 690 |
put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value); |
| 691 | 691 |
put_ebml_string(pb, MATROSKA_ID_CHAPLANG , "und"); |
| ... | ... |
@@ -698,7 +699,7 @@ static int mkv_write_chapters(AVFormatContext *s) |
| 698 | 698 |
return 0; |
| 699 | 699 |
} |
| 700 | 700 |
|
| 701 |
-static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) |
|
| 701 |
+static void mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t) |
|
| 702 | 702 |
{
|
| 703 | 703 |
uint8_t *key = av_strdup(t->key); |
| 704 | 704 |
uint8_t *p = key; |
| ... | ... |
@@ -728,12 +729,12 @@ static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) |
| 728 | 728 |
av_freep(&key); |
| 729 | 729 |
} |
| 730 | 730 |
|
| 731 |
-static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int elementid, |
|
| 731 |
+static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid, |
|
| 732 | 732 |
unsigned int uid, ebml_master *tags) |
| 733 | 733 |
{
|
| 734 | 734 |
MatroskaMuxContext *mkv = s->priv_data; |
| 735 | 735 |
ebml_master tag, targets; |
| 736 |
- AVMetadataTag *t = NULL; |
|
| 736 |
+ AVDictionaryEntry *t = NULL; |
|
| 737 | 737 |
int ret; |
| 738 | 738 |
|
| 739 | 739 |
if (!tags->pos) {
|
| ... | ... |
@@ -749,7 +750,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element |
| 749 | 749 |
put_ebml_uint(s->pb, elementid, uid); |
| 750 | 750 |
end_ebml_master(s->pb, targets); |
| 751 | 751 |
|
| 752 |
- while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) |
|
| 752 |
+ while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) |
|
| 753 | 753 |
if (strcasecmp(t->key, "title")) |
| 754 | 754 |
mkv_write_simpletag(s->pb, t); |
| 755 | 755 |
|
| ... | ... |
@@ -764,7 +765,7 @@ static int mkv_write_tags(AVFormatContext *s) |
| 764 | 764 |
|
| 765 | 765 |
ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); |
| 766 | 766 |
|
| 767 |
- if (av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) {
|
|
| 767 |
+ if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
|
|
| 768 | 768 |
ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); |
| 769 | 769 |
if (ret < 0) return ret; |
| 770 | 770 |
} |
| ... | ... |
@@ -772,7 +773,7 @@ static int mkv_write_tags(AVFormatContext *s) |
| 772 | 772 |
for (i = 0; i < s->nb_streams; i++) {
|
| 773 | 773 |
AVStream *st = s->streams[i]; |
| 774 | 774 |
|
| 775 |
- if (!av_metadata_get(st->metadata, "", 0, AV_METADATA_IGNORE_SUFFIX)) |
|
| 775 |
+ if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) |
|
| 776 | 776 |
continue; |
| 777 | 777 |
|
| 778 | 778 |
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) |
| 782 | 782 |
for (i = 0; i < s->nb_chapters; i++) {
|
| 783 | 783 |
AVChapter *ch = s->chapters[i]; |
| 784 | 784 |
|
| 785 |
- if (!av_metadata_get(ch->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
|
| 785 |
+ if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) |
|
| 786 | 786 |
continue; |
| 787 | 787 |
|
| 788 | 788 |
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) |
| 799 | 799 |
MatroskaMuxContext *mkv = s->priv_data; |
| 800 | 800 |
AVIOContext *pb = s->pb; |
| 801 | 801 |
ebml_master ebml_header, segment_info; |
| 802 |
- AVMetadataTag *tag; |
|
| 802 |
+ AVDictionaryEntry *tag; |
|
| 803 | 803 |
int ret, i; |
| 804 | 804 |
|
| 805 | 805 |
if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM; |
| ... | ... |
@@ -836,7 +837,7 @@ static int mkv_write_header(AVFormatContext *s) |
| 836 | 836 |
|
| 837 | 837 |
segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0); |
| 838 | 838 |
put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000); |
| 839 |
- if ((tag = av_metadata_get(s->metadata, "title", NULL, 0))) |
|
| 839 |
+ if ((tag = av_dict_get(s->metadata, "title", NULL, 0))) |
|
| 840 | 840 |
put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value); |
| 841 | 841 |
if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
| 842 | 842 |
uint32_t segment_uid[4]; |
| ... | ... |
@@ -39,7 +39,7 @@ struct AVMetadataConv{
|
| 39 | 39 |
typedef struct AVMetadataConv AVMetadataConv; |
| 40 | 40 |
#endif |
| 41 | 41 |
|
| 42 |
-void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, |
|
| 42 |
+void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, |
|
| 43 | 43 |
const AVMetadataConv *s_conv); |
| 44 | 44 |
void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, |
| 45 | 45 |
const AVMetadataConv *s_conv); |
| ... | ... |
@@ -27,6 +27,7 @@ |
| 27 | 27 |
|
| 28 | 28 |
#include "libavutil/intreadwrite.h" |
| 29 | 29 |
#include "libavutil/avstring.h" |
| 30 |
+#include "libavutil/dict.h" |
|
| 30 | 31 |
#include "avformat.h" |
| 31 | 32 |
#include "avio_internal.h" |
| 32 | 33 |
#include "riff.h" |
| ... | ... |
@@ -84,7 +85,7 @@ static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) |
| 84 | 84 |
|
| 85 | 85 |
avio_rb16(pb); // unknown |
| 86 | 86 |
snprintf(buf, sizeof(buf), "%d", avio_rb16(pb)); |
| 87 |
- av_metadata_set2(&c->fc->metadata, "track", buf, 0); |
|
| 87 |
+ av_dict_set(&c->fc->metadata, "track", buf, 0); |
|
| 88 | 88 |
|
| 89 | 89 |
avio_rb16(pb); // total tracks |
| 90 | 90 |
|
| ... | ... |
@@ -203,10 +204,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 203 | 203 |
avio_read(pb, str, str_size); |
| 204 | 204 |
str[str_size] = 0; |
| 205 | 205 |
} |
| 206 |
- av_metadata_set2(&c->fc->metadata, key, str, 0); |
|
| 206 |
+ av_dict_set(&c->fc->metadata, key, str, 0); |
|
| 207 | 207 |
if (*language && strcmp(language, "und")) {
|
| 208 | 208 |
snprintf(key2, sizeof(key2), "%s-%s", key, language); |
| 209 |
- av_metadata_set2(&c->fc->metadata, key2, str, 0); |
|
| 209 |
+ av_dict_set(&c->fc->metadata, key2, str, 0); |
|
| 210 | 210 |
} |
| 211 | 211 |
} |
| 212 | 212 |
av_dlog(c->fc, "lang \"%3s\" ", language); |
| ... | ... |
@@ -552,10 +553,10 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 552 | 552 |
if (strcmp(type, "qt ")) |
| 553 | 553 |
c->isom = 1; |
| 554 | 554 |
av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); |
| 555 |
- av_metadata_set2(&c->fc->metadata, "major_brand", type, 0); |
|
| 555 |
+ av_dict_set(&c->fc->metadata, "major_brand", type, 0); |
|
| 556 | 556 |
minor_ver = avio_rb32(pb); /* minor version */ |
| 557 | 557 |
snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver); |
| 558 |
- av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0); |
|
| 558 |
+ av_dict_set(&c->fc->metadata, "minor_version", minor_ver_str, 0); |
|
| 559 | 559 |
|
| 560 | 560 |
comp_brand_size = atom.size - 8; |
| 561 | 561 |
if (comp_brand_size < 0) |
| ... | ... |
@@ -565,7 +566,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 565 | 565 |
return AVERROR(ENOMEM); |
| 566 | 566 |
avio_read(pb, comp_brands_str, comp_brand_size); |
| 567 | 567 |
comp_brands_str[comp_brand_size] = 0; |
| 568 |
- av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); |
|
| 568 |
+ av_dict_set(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); |
|
| 569 | 569 |
av_freep(&comp_brands_str); |
| 570 | 570 |
|
| 571 | 571 |
return 0; |
| ... | ... |
@@ -589,7 +590,7 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 589 | 589 |
return mov_read_default(c, pb, atom); |
| 590 | 590 |
} |
| 591 | 591 |
|
| 592 |
-static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) |
|
| 592 |
+static void mov_metadata_creation_time(AVDictionary **metadata, time_t time) |
|
| 593 | 593 |
{
|
| 594 | 594 |
char buffer[32]; |
| 595 | 595 |
if (time) {
|
| ... | ... |
@@ -598,7 +599,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) |
| 598 | 598 |
ptm = gmtime(&time); |
| 599 | 599 |
if (!ptm) return; |
| 600 | 600 |
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm); |
| 601 |
- av_metadata_set2(metadata, "creation_time", buffer, 0); |
|
| 601 |
+ av_dict_set(metadata, "creation_time", buffer, 0); |
|
| 602 | 602 |
} |
| 603 | 603 |
} |
| 604 | 604 |
|
| ... | ... |
@@ -635,7 +636,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 635 | 635 |
|
| 636 | 636 |
lang = avio_rb16(pb); /* language */ |
| 637 | 637 |
if (ff_mov_lang_to_iso639(lang, language)) |
| 638 |
- av_metadata_set2(&st->metadata, "language", language, 0); |
|
| 638 |
+ av_dict_set(&st->metadata, "language", language, 0); |
|
| 639 | 639 |
avio_rb16(pb); /* quality */ |
| 640 | 640 |
|
| 641 | 641 |
return 0; |
| ... | ... |
@@ -33,6 +33,7 @@ |
| 33 | 33 |
#include "internal.h" |
| 34 | 34 |
#include "libavutil/avstring.h" |
| 35 | 35 |
#include "libavutil/opt.h" |
| 36 |
+#include "libavutil/dict.h" |
|
| 36 | 37 |
|
| 37 | 38 |
#undef NDEBUG |
| 38 | 39 |
#include <assert.h> |
| ... | ... |
@@ -1525,15 +1526,15 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, |
| 1525 | 1525 |
int long_style) |
| 1526 | 1526 |
{
|
| 1527 | 1527 |
int l, lang = 0, len, len2; |
| 1528 |
- AVMetadataTag *t, *t2 = NULL; |
|
| 1528 |
+ AVDictionaryEntry *t, *t2 = NULL; |
|
| 1529 | 1529 |
char tag2[16]; |
| 1530 | 1530 |
|
| 1531 |
- if (!(t = av_metadata_get(s->metadata, tag, NULL, 0))) |
|
| 1531 |
+ if (!(t = av_dict_get(s->metadata, tag, NULL, 0))) |
|
| 1532 | 1532 |
return 0; |
| 1533 | 1533 |
|
| 1534 | 1534 |
len = strlen(t->key); |
| 1535 | 1535 |
snprintf(tag2, sizeof(tag2), "%s-", tag); |
| 1536 |
- while ((t2 = av_metadata_get(s->metadata, tag2, t2, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 1536 |
+ while ((t2 = av_dict_get(s->metadata, tag2, t2, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 1537 | 1537 |
len2 = strlen(t2->key); |
| 1538 | 1538 |
if (len2 == len+4 && !strcmp(t->value, t2->value) |
| 1539 | 1539 |
&& (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, |
| 1548 | 1548 |
static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, |
| 1549 | 1549 |
AVFormatContext *s) |
| 1550 | 1550 |
{
|
| 1551 |
- AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); |
|
| 1551 |
+ AVDictionaryEntry *t = av_dict_get(s->metadata, "track", NULL, 0); |
|
| 1552 | 1552 |
int size = 0, track = t ? atoi(t->value) : 0; |
| 1553 | 1553 |
if (track) {
|
| 1554 | 1554 |
avio_wb32(pb, 32); /* size */ |
| ... | ... |
@@ -1640,7 +1641,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, |
| 1640 | 1640 |
const char *tag, const char *str) |
| 1641 | 1641 |
{
|
| 1642 | 1642 |
int64_t pos = avio_tell(pb); |
| 1643 |
- AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); |
|
| 1643 |
+ AVDictionaryEntry *t = av_dict_get(s->metadata, str, NULL, 0); |
|
| 1644 | 1644 |
if (!t || !utf8len(t->value)) |
| 1645 | 1645 |
return 0; |
| 1646 | 1646 |
avio_wb32(pb, 0); /* size */ |
| ... | ... |
@@ -1652,7 +1653,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, |
| 1652 | 1652 |
avio_wb16(pb, language_code("eng")); /* language */
|
| 1653 | 1653 |
avio_write(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ |
| 1654 | 1654 |
if (!strcmp(tag, "albm") && |
| 1655 |
- (t = av_metadata_get(s->metadata, "track", NULL, 0))) |
|
| 1655 |
+ (t = av_dict_get(s->metadata, "track", NULL, 0))) |
|
| 1656 | 1656 |
avio_w8(pb, atoi(t->value)); |
| 1657 | 1657 |
} |
| 1658 | 1658 |
return updateSize(pb, pos); |
| ... | ... |
@@ -1671,10 +1672,10 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) |
| 1671 | 1671 |
|
| 1672 | 1672 |
for (i = 0; i < nb_chapters; i++) {
|
| 1673 | 1673 |
AVChapter *c = s->chapters[i]; |
| 1674 |
- AVMetadataTag *t; |
|
| 1674 |
+ AVDictionaryEntry *t; |
|
| 1675 | 1675 |
avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000}));
|
| 1676 | 1676 |
|
| 1677 |
- if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
|
|
| 1677 |
+ if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
|
|
| 1678 | 1678 |
int len = FFMIN(strlen(t->value), 255); |
| 1679 | 1679 |
avio_w8(pb, len); |
| 1680 | 1680 |
avio_write(pb, t->value, len); |
| ... | ... |
@@ -1752,7 +1753,7 @@ static void mov_write_psp_udta_tag(AVIOContext *pb, |
| 1752 | 1752 |
|
| 1753 | 1753 |
static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) |
| 1754 | 1754 |
{
|
| 1755 |
- AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); |
|
| 1755 |
+ AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); |
|
| 1756 | 1756 |
int64_t pos, pos2; |
| 1757 | 1757 |
|
| 1758 | 1758 |
if (title) {
|
| ... | ... |
@@ -2102,13 +2103,13 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) |
| 2102 | 2102 |
|
| 2103 | 2103 |
for (i = 0; i < s->nb_chapters; i++) {
|
| 2104 | 2104 |
AVChapter *c = s->chapters[i]; |
| 2105 |
- AVMetadataTag *t; |
|
| 2105 |
+ AVDictionaryEntry *t; |
|
| 2106 | 2106 |
|
| 2107 | 2107 |
int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
|
| 2108 | 2108 |
pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
|
| 2109 | 2109 |
pkt.duration = end - pkt.dts; |
| 2110 | 2110 |
|
| 2111 |
- if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
|
|
| 2111 |
+ if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
|
|
| 2112 | 2112 |
len = strlen(t->value); |
| 2113 | 2113 |
pkt.size = len+2; |
| 2114 | 2114 |
pkt.data = av_malloc(pkt.size); |
| ... | ... |
@@ -2182,7 +2183,7 @@ static int mov_write_header(AVFormatContext *s) |
| 2182 | 2182 |
for(i=0; i<s->nb_streams; i++){
|
| 2183 | 2183 |
AVStream *st= s->streams[i]; |
| 2184 | 2184 |
MOVTrack *track= &mov->tracks[i]; |
| 2185 |
- AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); |
|
| 2185 |
+ AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); |
|
| 2186 | 2186 |
|
| 2187 | 2187 |
track->enc = st->codec; |
| 2188 | 2188 |
track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/avstring.h" |
| 23 | 23 |
#include "libavutil/intreadwrite.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "avformat.h" |
| 25 | 26 |
#include "id3v2.h" |
| 26 | 27 |
#include "id3v1.h" |
| ... | ... |
@@ -149,7 +150,7 @@ static int mp3_read_header(AVFormatContext *s, |
| 149 | 149 |
|
| 150 | 150 |
off = avio_tell(s->pb); |
| 151 | 151 |
|
| 152 |
- if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
|
| 152 |
+ if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) |
|
| 153 | 153 |
ff_id3v1_read(s); |
| 154 | 154 |
|
| 155 | 155 |
if (mp3_parse_vbr_tags(s, st, off) < 0) |
| ... | ... |
@@ -27,19 +27,20 @@ |
| 27 | 27 |
#include "libavutil/avstring.h" |
| 28 | 28 |
#include "libavutil/intreadwrite.h" |
| 29 | 29 |
#include "libavutil/opt.h" |
| 30 |
+#include "libavutil/dict.h" |
|
| 30 | 31 |
|
| 31 | 32 |
static int id3v1_set_string(AVFormatContext *s, const char *key, |
| 32 | 33 |
uint8_t *buf, int buf_size) |
| 33 | 34 |
{
|
| 34 |
- AVMetadataTag *tag; |
|
| 35 |
- if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) |
|
| 35 |
+ AVDictionaryEntry *tag; |
|
| 36 |
+ if ((tag = av_dict_get(s->metadata, key, NULL, 0))) |
|
| 36 | 37 |
av_strlcpy(buf, tag->value, buf_size); |
| 37 | 38 |
return !!tag; |
| 38 | 39 |
} |
| 39 | 40 |
|
| 40 | 41 |
static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) |
| 41 | 42 |
{
|
| 42 |
- AVMetadataTag *tag; |
|
| 43 |
+ AVDictionaryEntry *tag; |
|
| 43 | 44 |
int i, count = 0; |
| 44 | 45 |
|
| 45 | 46 |
memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ |
| ... | ... |
@@ -51,13 +52,13 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) |
| 51 | 51 |
count += id3v1_set_string(s, "TALB", buf + 63, 30); //album |
| 52 | 52 |
count += id3v1_set_string(s, "TDRL", buf + 93, 4); //date |
| 53 | 53 |
count += id3v1_set_string(s, "comment", buf + 97, 30); |
| 54 |
- if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track
|
|
| 54 |
+ if ((tag = av_dict_get(s->metadata, "TRCK", NULL, 0))) { //track
|
|
| 55 | 55 |
buf[125] = 0; |
| 56 | 56 |
buf[126] = atoi(tag->value); |
| 57 | 57 |
count++; |
| 58 | 58 |
} |
| 59 | 59 |
buf[127] = 0xFF; /* default to unknown genre */ |
| 60 |
- if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre
|
|
| 60 |
+ if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre
|
|
| 61 | 61 |
for(i = 0; i <= ID3v1_GENRE_MAX; i++) {
|
| 62 | 62 |
if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) {
|
| 63 | 63 |
buf[127] = i; |
| ... | ... |
@@ -173,7 +174,7 @@ static const AVClass mp3_muxer_class = {
|
| 173 | 173 |
.version = LIBAVUTIL_VERSION_INT, |
| 174 | 174 |
}; |
| 175 | 175 |
|
| 176 |
-static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4], |
|
| 176 |
+static int id3v2_check_write_tag(AVFormatContext *s, AVDictionaryEntry *t, const char table[][4], |
|
| 177 | 177 |
enum ID3v2Encoding enc) |
| 178 | 178 |
{
|
| 179 | 179 |
uint32_t tag; |
| ... | ... |
@@ -195,7 +196,7 @@ static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const cha |
| 195 | 195 |
static int mp3_write_header(struct AVFormatContext *s) |
| 196 | 196 |
{
|
| 197 | 197 |
MP3Context *mp3 = s->priv_data; |
| 198 |
- AVMetadataTag *t = NULL; |
|
| 198 |
+ AVDictionaryEntry *t = NULL; |
|
| 199 | 199 |
int totlen = 0, enc = mp3->id3v2_version == 3 ? ID3v2_ENCODING_UTF16BOM : |
| 200 | 200 |
ID3v2_ENCODING_UTF8; |
| 201 | 201 |
int64_t size_pos, cur_pos; |
| ... | ... |
@@ -212,7 +213,7 @@ static int mp3_write_header(struct AVFormatContext *s) |
| 212 | 212 |
if (mp3->id3v2_version == 4) |
| 213 | 213 |
ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL); |
| 214 | 214 |
|
| 215 |
- while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 215 |
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 216 | 216 |
int ret; |
| 217 | 217 |
|
| 218 | 218 |
if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags, enc)) > 0) {
|
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#include "avformat.h" |
| 24 | 24 |
#include "apetag.h" |
| 25 | 25 |
#include "id3v1.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
|
| 27 | 28 |
#define MPC_FRAMESIZE 1152 |
| 28 | 29 |
#define DELAY_FRAMES 32 |
| ... | ... |
@@ -96,7 +97,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 96 | 96 |
if (s->pb->seekable) {
|
| 97 | 97 |
int64_t pos = avio_tell(s->pb); |
| 98 | 98 |
ff_ape_parse_tag(s); |
| 99 |
- if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
|
| 99 |
+ if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) |
|
| 100 | 100 |
ff_id3v1_read(s); |
| 101 | 101 |
avio_seek(s->pb, pos, SEEK_SET); |
| 102 | 102 |
} |
| ... | ... |
@@ -26,6 +26,7 @@ |
| 26 | 26 |
#include "libavutil/crc.h" |
| 27 | 27 |
#include "libavutil/intreadwrite.h" |
| 28 | 28 |
#include "libavutil/log.h" |
| 29 |
+#include "libavutil/dict.h" |
|
| 29 | 30 |
#include "libavutil/opt.h" |
| 30 | 31 |
#include "libavcodec/bytestream.h" |
| 31 | 32 |
#include "avformat.h" |
| ... | ... |
@@ -938,7 +939,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type |
| 938 | 938 |
language[1] = get8(pp, desc_end); |
| 939 | 939 |
language[2] = get8(pp, desc_end); |
| 940 | 940 |
language[3] = 0; |
| 941 |
- av_metadata_set2(&st->metadata, "language", language, 0); |
|
| 941 |
+ av_dict_set(&st->metadata, "language", language, 0); |
|
| 942 | 942 |
break; |
| 943 | 943 |
case 0x59: /* subtitling descriptor */ |
| 944 | 944 |
language[0] = get8(pp, desc_end); |
| ... | ... |
@@ -967,7 +968,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type |
| 967 | 967 |
} |
| 968 | 968 |
} |
| 969 | 969 |
*pp += 4; |
| 970 |
- av_metadata_set2(&st->metadata, "language", language, 0); |
|
| 970 |
+ av_dict_set(&st->metadata, "language", language, 0); |
|
| 971 | 971 |
break; |
| 972 | 972 |
case 0x0a: /* ISO 639 language descriptor */ |
| 973 | 973 |
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 |
| 983 | 983 |
} |
| 984 | 984 |
if (i) {
|
| 985 | 985 |
language[i - 1] = 0; |
| 986 |
- av_metadata_set2(&st->metadata, "language", language, 0); |
|
| 986 |
+ av_dict_set(&st->metadata, "language", language, 0); |
|
| 987 | 987 |
} |
| 988 | 988 |
break; |
| 989 | 989 |
case 0x05: /* registration descriptor */ |
| ... | ... |
@@ -1227,8 +1228,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
| 1227 | 1227 |
if (name) {
|
| 1228 | 1228 |
AVProgram *program = av_new_program(ts->stream, sid); |
| 1229 | 1229 |
if(program) {
|
| 1230 |
- av_metadata_set2(&program->metadata, "service_name", name, 0); |
|
| 1231 |
- av_metadata_set2(&program->metadata, "service_provider", provider_name, 0); |
|
| 1230 |
+ av_dict_set(&program->metadata, "service_name", name, 0); |
|
| 1231 |
+ av_dict_set(&program->metadata, "service_provider", provider_name, 0); |
|
| 1232 | 1232 |
} |
| 1233 | 1233 |
} |
| 1234 | 1234 |
av_free(name); |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/bswap.h" |
| 23 | 23 |
#include "libavutil/crc.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "libavutil/opt.h" |
| 25 | 26 |
#include "libavcodec/mpegvideo.h" |
| 26 | 27 |
#include "avformat.h" |
| ... | ... |
@@ -244,7 +245,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) |
| 244 | 244 |
for(i = 0; i < s->nb_streams; i++) {
|
| 245 | 245 |
AVStream *st = s->streams[i]; |
| 246 | 246 |
MpegTSWriteStream *ts_st = st->priv_data; |
| 247 |
- AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); |
|
| 247 |
+ AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); |
|
| 248 | 248 |
switch(st->codec->codec_id) {
|
| 249 | 249 |
case CODEC_ID_MPEG1VIDEO: |
| 250 | 250 |
case CODEC_ID_MPEG2VIDEO: |
| ... | ... |
@@ -443,7 +444,7 @@ static int mpegts_write_header(AVFormatContext *s) |
| 443 | 443 |
MpegTSWriteStream *ts_st; |
| 444 | 444 |
MpegTSService *service; |
| 445 | 445 |
AVStream *st, *pcr_st = NULL; |
| 446 |
- AVMetadataTag *title, *provider; |
|
| 446 |
+ AVDictionaryEntry *title, *provider; |
|
| 447 | 447 |
int i, j; |
| 448 | 448 |
const char *service_name; |
| 449 | 449 |
const char *provider_name; |
| ... | ... |
@@ -452,11 +453,11 @@ static int mpegts_write_header(AVFormatContext *s) |
| 452 | 452 |
ts->tsid = ts->transport_stream_id; |
| 453 | 453 |
ts->onid = ts->original_network_id; |
| 454 | 454 |
/* allocate a single DVB service */ |
| 455 |
- title = av_metadata_get(s->metadata, "service_name", NULL, 0); |
|
| 455 |
+ title = av_dict_get(s->metadata, "service_name", NULL, 0); |
|
| 456 | 456 |
if (!title) |
| 457 |
- title = av_metadata_get(s->metadata, "title", NULL, 0); |
|
| 457 |
+ title = av_dict_get(s->metadata, "title", NULL, 0); |
|
| 458 | 458 |
service_name = title ? title->value : DEFAULT_SERVICE_NAME; |
| 459 |
- provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); |
|
| 459 |
+ provider = av_dict_get(s->metadata, "service_provider", NULL, 0); |
|
| 460 | 460 |
provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; |
| 461 | 461 |
service = mpegts_add_service(ts, ts->service_id, provider_name, service_name); |
| 462 | 462 |
service->pmt.write_packet = section_write_packet; |
| ... | ... |
@@ -20,6 +20,7 @@ |
| 20 | 20 |
*/ |
| 21 | 21 |
#include "avformat.h" |
| 22 | 22 |
#include "riff.h" |
| 23 |
+#include "libavutil/dict.h" |
|
| 23 | 24 |
|
| 24 | 25 |
//#define DEBUG |
| 25 | 26 |
//#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) |
| 328 | 328 |
break; |
| 329 | 329 |
*p++ = '\0'; |
| 330 | 330 |
av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value); |
| 331 |
- av_metadata_set2(&s->metadata, token, value, 0); |
|
| 331 |
+ av_dict_set(&s->metadata, token, value, 0); |
|
| 332 | 332 |
} |
| 333 | 333 |
av_free(strings); |
| 334 | 334 |
} |
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#include <strings.h> |
| 24 | 24 |
#include "libavutil/avstring.h" |
| 25 | 25 |
#include "libavutil/bswap.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
#include "libavutil/tree.h" |
| 27 | 28 |
#include "avio_internal.h" |
| 28 | 29 |
#include "nut.h" |
| ... | ... |
@@ -401,7 +402,7 @@ static int decode_info_header(NUTContext *nut){
|
| 401 | 401 |
const char *type; |
| 402 | 402 |
AVChapter *chapter= NULL; |
| 403 | 403 |
AVStream *st= NULL; |
| 404 |
- AVMetadata **metadata = NULL; |
|
| 404 |
+ AVDictionary **metadata = NULL; |
|
| 405 | 405 |
|
| 406 | 406 |
end= get_packetheader(nut, bc, 1, INFO_STARTCODE); |
| 407 | 407 |
end += avio_tell(bc); |
| ... | ... |
@@ -459,7 +460,7 @@ static int decode_info_header(NUTContext *nut){
|
| 459 | 459 |
} |
| 460 | 460 |
if(metadata && strcasecmp(name,"Uses") |
| 461 | 461 |
&& strcasecmp(name,"Depends") && strcasecmp(name,"Replaces")) |
| 462 |
- av_metadata_set2(metadata, name, str_value, 0); |
|
| 462 |
+ av_dict_set(metadata, name, str_value, 0); |
|
| 463 | 463 |
} |
| 464 | 464 |
} |
| 465 | 465 |
|
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/intreadwrite.h" |
| 23 | 23 |
#include "libavutil/tree.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "libavcodec/mpegaudiodata.h" |
| 25 | 26 |
#include "nut.h" |
| 26 | 27 |
#include "internal.h" |
| ... | ... |
@@ -430,7 +431,7 @@ static int add_info(AVIOContext *bc, const char *type, const char *value){
|
| 430 | 430 |
|
| 431 | 431 |
static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
|
| 432 | 432 |
AVFormatContext *s= nut->avf; |
| 433 |
- AVMetadataTag *t = NULL; |
|
| 433 |
+ AVDictionaryEntry *t = NULL; |
|
| 434 | 434 |
AVIOContext *dyn_bc; |
| 435 | 435 |
uint8_t *dyn_buf=NULL; |
| 436 | 436 |
int count=0, dyn_size; |
| ... | ... |
@@ -438,7 +439,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
|
| 438 | 438 |
if(ret < 0) |
| 439 | 439 |
return ret; |
| 440 | 440 |
|
| 441 |
- while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) |
|
| 441 |
+ while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) |
|
| 442 | 442 |
count += add_info(dyn_bc, t->key, t->value); |
| 443 | 443 |
|
| 444 | 444 |
ff_put_v(bc, 0); //stream_if_plus1 |
| ... | ... |
@@ -489,7 +490,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) |
| 489 | 489 |
{
|
| 490 | 490 |
AVIOContext *dyn_bc; |
| 491 | 491 |
uint8_t *dyn_buf = NULL; |
| 492 |
- AVMetadataTag *t = NULL; |
|
| 492 |
+ AVDictionaryEntry *t = NULL; |
|
| 493 | 493 |
AVChapter *ch = nut->avf->chapters[id]; |
| 494 | 494 |
int ret, dyn_size, count = 0; |
| 495 | 495 |
|
| ... | ... |
@@ -502,7 +503,7 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id) |
| 502 | 502 |
put_tt(nut, nut->chapter[id].time_base, bc, ch->start); // chapter_start |
| 503 | 503 |
ff_put_v(bc, ch->end - ch->start); // chapter_len |
| 504 | 504 |
|
| 505 |
- while ((t = av_metadata_get(ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) |
|
| 505 |
+ while ((t = av_dict_get(ch->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) |
|
| 506 | 506 |
count += add_info(dyn_bc, t->key, t->value); |
| 507 | 507 |
|
| 508 | 508 |
ff_put_v(bc, count); |
| ... | ... |
@@ -111,7 +111,7 @@ extern const struct ogg_codec ff_speex_codec; |
| 111 | 111 |
extern const struct ogg_codec ff_theora_codec; |
| 112 | 112 |
extern const struct ogg_codec ff_vorbis_codec; |
| 113 | 113 |
|
| 114 |
-int ff_vorbis_comment(AVFormatContext *ms, AVMetadata **m, const uint8_t *buf, int size); |
|
| 114 |
+int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size); |
|
| 115 | 115 |
|
| 116 | 116 |
static inline int |
| 117 | 117 |
ogg_find_stream (struct ogg * ogg, int serial) |
| ... | ... |
@@ -221,7 +221,7 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st, |
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 | 223 |
static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, |
| 224 |
- int *header_len, AVMetadata **m, int framing_bit) |
|
| 224 |
+ int *header_len, AVDictionary **m, int framing_bit) |
|
| 225 | 225 |
{
|
| 226 | 226 |
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; |
| 227 | 227 |
int size; |
| ... | ... |
@@ -247,7 +247,7 @@ static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, |
| 247 | 247 |
|
| 248 | 248 |
static int ogg_build_flac_headers(AVCodecContext *avctx, |
| 249 | 249 |
OGGStreamContext *oggstream, int bitexact, |
| 250 |
- AVMetadata **m) |
|
| 250 |
+ AVDictionary **m) |
|
| 251 | 251 |
{
|
| 252 | 252 |
enum FLACExtradataFormat format; |
| 253 | 253 |
uint8_t *streaminfo; |
| ... | ... |
@@ -287,7 +287,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, |
| 287 | 287 |
|
| 288 | 288 |
static int ogg_build_speex_headers(AVCodecContext *avctx, |
| 289 | 289 |
OGGStreamContext *oggstream, int bitexact, |
| 290 |
- AVMetadata **m) |
|
| 290 |
+ AVDictionary **m) |
|
| 291 | 291 |
{
|
| 292 | 292 |
uint8_t *p; |
| 293 | 293 |
|
| ... | ... |
@@ -25,6 +25,7 @@ |
| 25 | 25 |
#include <stdlib.h> |
| 26 | 26 |
#include "libavutil/avstring.h" |
| 27 | 27 |
#include "libavutil/bswap.h" |
| 28 |
+#include "libavutil/dict.h" |
|
| 28 | 29 |
#include "libavcodec/get_bits.h" |
| 29 | 30 |
#include "libavcodec/bytestream.h" |
| 30 | 31 |
#include "avformat.h" |
| ... | ... |
@@ -57,8 +58,8 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) |
| 57 | 57 |
if (!chapter) |
| 58 | 58 |
return 0; |
| 59 | 59 |
|
| 60 |
- av_metadata_set2(&chapter->metadata, "title", val, |
|
| 61 |
- AV_METADATA_DONT_STRDUP_VAL); |
|
| 60 |
+ av_dict_set(&chapter->metadata, "title", val, |
|
| 61 |
+ AV_DICT_DONT_STRDUP_VAL); |
|
| 62 | 62 |
} else |
| 63 | 63 |
return 0; |
| 64 | 64 |
|
| ... | ... |
@@ -67,7 +68,7 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
int |
| 70 |
-ff_vorbis_comment(AVFormatContext * as, AVMetadata **m, const uint8_t *buf, int size) |
|
| 70 |
+ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, int size) |
|
| 71 | 71 |
{
|
| 72 | 72 |
const uint8_t *p = buf; |
| 73 | 73 |
const uint8_t *end = buf + size; |
| ... | ... |
@@ -127,9 +128,9 @@ ff_vorbis_comment(AVFormatContext * as, AVMetadata **m, const uint8_t *buf, int |
| 127 | 127 |
ct[vl] = 0; |
| 128 | 128 |
|
| 129 | 129 |
if (!ogm_chapter(as, tt, ct)) |
| 130 |
- av_metadata_set2(m, tt, ct, |
|
| 131 |
- AV_METADATA_DONT_STRDUP_KEY | |
|
| 132 |
- AV_METADATA_DONT_STRDUP_VAL); |
|
| 130 |
+ av_dict_set(m, tt, ct, |
|
| 131 |
+ AV_DICT_DONT_STRDUP_KEY | |
|
| 132 |
+ AV_DICT_DONT_STRDUP_VAL); |
|
| 133 | 133 |
} |
| 134 | 134 |
} |
| 135 | 135 |
|
| ... | ... |
@@ -22,6 +22,7 @@ |
| 22 | 22 |
//#define DEBUG |
| 23 | 23 |
|
| 24 | 24 |
#include "libavutil/intreadwrite.h" |
| 25 |
+#include "libavutil/dict.h" |
|
| 25 | 26 |
#include "avformat.h" |
| 26 | 27 |
|
| 27 | 28 |
typedef struct {
|
| ... | ... |
@@ -98,7 +99,7 @@ static int r3d_read_red1(AVFormatContext *s) |
| 98 | 98 |
|
| 99 | 99 |
avio_read(s->pb, filename, 257); |
| 100 | 100 |
filename[sizeof(filename)-1] = 0; |
| 101 |
- av_metadata_set2(&st->metadata, "filename", filename, 0); |
|
| 101 |
+ av_dict_set(&st->metadata, "filename", filename, 0); |
|
| 102 | 102 |
|
| 103 | 103 |
av_dlog(s, "filename %s\n", filename); |
| 104 | 104 |
av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height); |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/avstring.h" |
| 23 | 23 |
#include "libavutil/intreadwrite.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "avformat.h" |
| 25 | 26 |
#include "riff.h" |
| 26 | 27 |
#include "rm.h" |
| ... | ... |
@@ -104,7 +105,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) |
| 104 | 104 |
for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
|
| 105 | 105 |
int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb); |
| 106 | 106 |
get_strl(s->pb, buf, sizeof(buf), len); |
| 107 |
- av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0); |
|
| 107 |
+ av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); |
|
| 108 | 108 |
} |
| 109 | 109 |
} |
| 110 | 110 |
|
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
#include "avformat.h" |
| 22 | 22 |
#include "avio_internal.h" |
| 23 | 23 |
#include "rm.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
|
| 25 | 26 |
typedef struct {
|
| 26 | 27 |
int nb_packets; |
| ... | ... |
@@ -71,7 +72,7 @@ static int rv10_write_header(AVFormatContext *ctx, |
| 71 | 71 |
const char *desc, *mimetype; |
| 72 | 72 |
int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i; |
| 73 | 73 |
int bit_rate, v, duration, flags, data_pos; |
| 74 |
- AVMetadataTag *tag; |
|
| 74 |
+ AVDictionaryEntry *tag; |
|
| 75 | 75 |
|
| 76 | 76 |
start_ptr = s->buf_ptr; |
| 77 | 77 |
|
| ... | ... |
@@ -127,13 +128,13 @@ static int rv10_write_header(AVFormatContext *ctx, |
| 127 | 127 |
ffio_wfourcc(s,"CONT"); |
| 128 | 128 |
size = 4 * 2 + 10; |
| 129 | 129 |
for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
|
| 130 |
- tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); |
|
| 130 |
+ tag = av_dict_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); |
|
| 131 | 131 |
if(tag) size += strlen(tag->value); |
| 132 | 132 |
} |
| 133 | 133 |
avio_wb32(s,size); |
| 134 | 134 |
avio_wb16(s,0); |
| 135 | 135 |
for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
|
| 136 |
- tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); |
|
| 136 |
+ tag = av_dict_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); |
|
| 137 | 137 |
put_str(s, tag ? tag->value : ""); |
| 138 | 138 |
} |
| 139 | 139 |
|
| ... | ... |
@@ -20,6 +20,7 @@ |
| 20 | 20 |
*/ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/avstring.h" |
| 23 |
+#include "libavutil/dict.h" |
|
| 23 | 24 |
#include "avformat.h" |
| 24 | 25 |
#include <stdlib.h> |
| 25 | 26 |
|
| ... | ... |
@@ -131,11 +132,11 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 131 | 131 |
// for the text in a few cases; samples needed.) |
| 132 | 132 |
error |= read_line(pb, line, sizeof(line)); // ARMovie |
| 133 | 133 |
error |= read_line(pb, line, sizeof(line)); // movie name |
| 134 |
- av_metadata_set2(&s->metadata, "title" , line, 0); |
|
| 134 |
+ av_dict_set(&s->metadata, "title" , line, 0); |
|
| 135 | 135 |
error |= read_line(pb, line, sizeof(line)); // date/copyright |
| 136 |
- av_metadata_set2(&s->metadata, "copyright", line, 0); |
|
| 136 |
+ av_dict_set(&s->metadata, "copyright", line, 0); |
|
| 137 | 137 |
error |= read_line(pb, line, sizeof(line)); // author and other |
| 138 |
- av_metadata_set2(&s->metadata, "author" , line, 0); |
|
| 138 |
+ av_dict_set(&s->metadata, "author" , line, 0); |
|
| 139 | 139 |
|
| 140 | 140 |
// video headers |
| 141 | 141 |
vst = av_new_stream(s, 0); |
| ... | ... |
@@ -113,7 +113,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) |
| 113 | 113 |
ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &ff_asf_demuxer, NULL); |
| 114 | 114 |
if (ret < 0) |
| 115 | 115 |
return ret; |
| 116 |
- av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0); |
|
| 116 |
+ av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0); |
|
| 117 | 117 |
rt->asf_pb_pos = avio_tell(&pb); |
| 118 | 118 |
av_free(buf); |
| 119 | 119 |
rt->asf_ctx->pb = NULL; |
| ... | ... |
@@ -24,6 +24,7 @@ |
| 24 | 24 |
#include "libavutil/intreadwrite.h" |
| 25 | 25 |
#include "libavutil/parseutils.h" |
| 26 | 26 |
#include "libavutil/random_seed.h" |
| 27 |
+#include "libavutil/dict.h" |
|
| 27 | 28 |
#include "avformat.h" |
| 28 | 29 |
#include "avio_internal.h" |
| 29 | 30 |
|
| ... | ... |
@@ -281,11 +282,11 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, |
| 281 | 281 |
} |
| 282 | 282 |
break; |
| 283 | 283 |
case 's': |
| 284 |
- av_metadata_set2(&s->metadata, "title", p, 0); |
|
| 284 |
+ av_dict_set(&s->metadata, "title", p, 0); |
|
| 285 | 285 |
break; |
| 286 | 286 |
case 'i': |
| 287 | 287 |
if (s->nb_streams == 0) {
|
| 288 |
- av_metadata_set2(&s->metadata, "comment", p, 0); |
|
| 288 |
+ av_dict_set(&s->metadata, "comment", p, 0); |
|
| 289 | 289 |
break; |
| 290 | 290 |
} |
| 291 | 291 |
break; |
| ... | ... |
@@ -25,6 +25,7 @@ |
| 25 | 25 |
*/ |
| 26 | 26 |
|
| 27 | 27 |
#include "libavutil/intreadwrite.h" |
| 28 |
+#include "libavutil/dict.h" |
|
| 28 | 29 |
#include "avformat.h" |
| 29 | 30 |
#include "sauce.h" |
| 30 | 31 |
|
| ... | ... |
@@ -44,7 +45,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g |
| 44 | 44 |
#define GET_SAUCE_META(name,size) \ |
| 45 | 45 |
if (avio_read(pb, buf, size) == size && buf[0]) { \
|
| 46 | 46 |
buf[size] = 0; \ |
| 47 |
- av_metadata_set2(&avctx->metadata, name, buf, 0); \ |
|
| 47 |
+ av_dict_set(&avctx->metadata, name, buf, 0); \ |
|
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
GET_SAUCE_META("title", 35)
|
| ... | ... |
@@ -95,7 +96,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g |
| 95 | 95 |
str[65*i + 64] = '\n'; |
| 96 | 96 |
} |
| 97 | 97 |
str[65*i] = 0; |
| 98 |
- av_metadata_set2(&avctx->metadata, "comment", str, AV_METADATA_DONT_STRDUP_VAL); |
|
| 98 |
+ av_dict_set(&avctx->metadata, "comment", str, AV_DICT_DONT_STRDUP_VAL); |
|
| 99 | 99 |
} |
| 100 | 100 |
} |
| 101 | 101 |
|
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
#include <string.h> |
| 22 | 22 |
#include "libavutil/avstring.h" |
| 23 | 23 |
#include "libavutil/base64.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "libavutil/parseutils.h" |
| 25 | 26 |
#include "libavcodec/xiph.h" |
| 26 | 27 |
#include "avformat.h" |
| ... | ... |
@@ -476,7 +477,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des |
| 476 | 476 |
|
| 477 | 477 |
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size) |
| 478 | 478 |
{
|
| 479 |
- AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); |
|
| 479 |
+ AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0); |
|
| 480 | 480 |
struct sdp_session_level s; |
| 481 | 481 |
int i, j, port, ttl, is_multicast; |
| 482 | 482 |
char dst[32], dst_type[5]; |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
*/ |
| 31 | 31 |
|
| 32 | 32 |
#include "libavutil/intreadwrite.h" |
| 33 |
+#include "libavutil/dict.h" |
|
| 33 | 34 |
#include "avformat.h" |
| 34 | 35 |
#include "pcm.h" |
| 35 | 36 |
#include "sox.h" |
| ... | ... |
@@ -101,8 +102,8 @@ static int sox_read_header(AVFormatContext *s, |
| 101 | 101 |
} |
| 102 | 102 |
comment[comment_size] = 0; |
| 103 | 103 |
|
| 104 |
- av_metadata_set2(&s->metadata, "comment", comment, |
|
| 105 |
- AV_METADATA_DONT_STRDUP_VAL); |
|
| 104 |
+ av_dict_set(&s->metadata, "comment", comment, |
|
| 105 |
+ AV_DICT_DONT_STRDUP_VAL); |
|
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 | 108 |
avio_skip(pb, header_size - SOX_FIXED_HDR - comment_size); |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
*/ |
| 31 | 31 |
|
| 32 | 32 |
#include "libavutil/intreadwrite.h" |
| 33 |
+#include "libavutil/dict.h" |
|
| 33 | 34 |
#include "avformat.h" |
| 34 | 35 |
#include "avio_internal.h" |
| 35 | 36 |
#include "sox.h" |
| ... | ... |
@@ -43,10 +44,10 @@ static int sox_write_header(AVFormatContext *s) |
| 43 | 43 |
SoXContext *sox = s->priv_data; |
| 44 | 44 |
AVIOContext *pb = s->pb; |
| 45 | 45 |
AVCodecContext *enc = s->streams[0]->codec; |
| 46 |
- AVMetadataTag *comment; |
|
| 46 |
+ AVDictionaryEntry *comment; |
|
| 47 | 47 |
size_t comment_len = 0, comment_size; |
| 48 | 48 |
|
| 49 |
- comment = av_metadata_get(s->metadata, "comment", NULL, 0); |
|
| 49 |
+ comment = av_dict_get(s->metadata, "comment", NULL, 0); |
|
| 50 | 50 |
if (comment) |
| 51 | 51 |
comment_len = strlen(comment->value); |
| 52 | 52 |
comment_size = (comment_len + 7) & ~7; |
| ... | ... |
@@ -22,6 +22,7 @@ |
| 22 | 22 |
#include "libavcodec/get_bits.h" |
| 23 | 23 |
#include "avformat.h" |
| 24 | 24 |
#include "id3v1.h" |
| 25 |
+#include "libavutil/dict.h" |
|
| 25 | 26 |
|
| 26 | 27 |
typedef struct {
|
| 27 | 28 |
int totalframes, currentframe; |
| ... | ... |
@@ -43,7 +44,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 43 | 43 |
int i, channels, bps, samplerate, datalen, framelen; |
| 44 | 44 |
uint64_t framepos, start_offset; |
| 45 | 45 |
|
| 46 |
- if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
|
| 46 |
+ if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) |
|
| 47 | 47 |
ff_id3v1_read(s); |
| 48 | 48 |
|
| 49 | 49 |
start_offset = avio_tell(s->pb); |
| ... | ... |
@@ -27,6 +27,7 @@ |
| 27 | 27 |
#include "libavutil/intreadwrite.h" |
| 28 | 28 |
#include "libavutil/avstring.h" |
| 29 | 29 |
#include "libavutil/log.h" |
| 30 |
+#include "libavutil/dict.h" |
|
| 30 | 31 |
#include "libavutil/opt.h" |
| 31 | 32 |
#include "libavutil/parseutils.h" |
| 32 | 33 |
#include "avformat.h" |
| ... | ... |
@@ -60,7 +61,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) |
| 60 | 60 |
return -1; \ |
| 61 | 61 |
if (avio_read(pb, buf, size) == size) { \
|
| 62 | 62 |
buf[len] = 0; \ |
| 63 |
- av_metadata_set2(&avctx->metadata, name, buf, 0); \ |
|
| 63 |
+ av_dict_set(&avctx->metadata, name, buf, 0); \ |
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
GET_EFI_META("filename", 12)
|
| ... | ... |
@@ -26,6 +26,7 @@ |
| 26 | 26 |
#include "internal.h" |
| 27 | 27 |
#include "libavcodec/internal.h" |
| 28 | 28 |
#include "libavutil/opt.h" |
| 29 |
+#include "libavutil/dict.h" |
|
| 29 | 30 |
#include "metadata.h" |
| 30 | 31 |
#include "id3v2.h" |
| 31 | 32 |
#include "libavutil/avstring.h" |
| ... | ... |
@@ -2560,7 +2561,7 @@ void avformat_free_context(AVFormatContext *s) |
| 2560 | 2560 |
av_parser_close(st->parser); |
| 2561 | 2561 |
av_free_packet(&st->cur_pkt); |
| 2562 | 2562 |
} |
| 2563 |
- av_metadata_free(&st->metadata); |
|
| 2563 |
+ av_dict_free(&st->metadata); |
|
| 2564 | 2564 |
av_free(st->index_entries); |
| 2565 | 2565 |
av_free(st->codec->extradata); |
| 2566 | 2566 |
av_free(st->codec->subtitle_header); |
| ... | ... |
@@ -2570,18 +2571,18 @@ void avformat_free_context(AVFormatContext *s) |
| 2570 | 2570 |
av_free(st); |
| 2571 | 2571 |
} |
| 2572 | 2572 |
for(i=s->nb_programs-1; i>=0; i--) {
|
| 2573 |
- av_metadata_free(&s->programs[i]->metadata); |
|
| 2573 |
+ av_dict_free(&s->programs[i]->metadata); |
|
| 2574 | 2574 |
av_freep(&s->programs[i]->stream_index); |
| 2575 | 2575 |
av_freep(&s->programs[i]); |
| 2576 | 2576 |
} |
| 2577 | 2577 |
av_freep(&s->programs); |
| 2578 | 2578 |
av_freep(&s->priv_data); |
| 2579 | 2579 |
while(s->nb_chapters--) {
|
| 2580 |
- av_metadata_free(&s->chapters[s->nb_chapters]->metadata); |
|
| 2580 |
+ av_dict_free(&s->chapters[s->nb_chapters]->metadata); |
|
| 2581 | 2581 |
av_free(s->chapters[s->nb_chapters]); |
| 2582 | 2582 |
} |
| 2583 | 2583 |
av_freep(&s->chapters); |
| 2584 |
- av_metadata_free(&s->metadata); |
|
| 2584 |
+ av_dict_free(&s->metadata); |
|
| 2585 | 2585 |
av_freep(&s->streams); |
| 2586 | 2586 |
av_free(s); |
| 2587 | 2587 |
} |
| ... | ... |
@@ -2685,7 +2686,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6 |
| 2685 | 2685 |
return NULL; |
| 2686 | 2686 |
dynarray_add(&s->chapters, &s->nb_chapters, chapter); |
| 2687 | 2687 |
} |
| 2688 |
- av_metadata_set2(&chapter->metadata, "title", title, 0); |
|
| 2688 |
+ av_dict_set(&chapter->metadata, "title", title, 0); |
|
| 2689 | 2689 |
chapter->id = id; |
| 2690 | 2690 |
chapter->time_base= time_base; |
| 2691 | 2691 |
chapter->start = start; |
| ... | ... |
@@ -2824,7 +2825,7 @@ int av_write_header(AVFormatContext *s) |
| 2824 | 2824 |
|
| 2825 | 2825 |
/* set muxer identification string */ |
| 2826 | 2826 |
if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
|
| 2827 |
- av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); |
|
| 2827 |
+ av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); |
|
| 2828 | 2828 |
} |
| 2829 | 2829 |
|
| 2830 | 2830 |
if(s->oformat->write_header){
|
| ... | ... |
@@ -3138,13 +3139,13 @@ static void print_fps(double d, const char *postfix){
|
| 3138 | 3138 |
else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix); |
| 3139 | 3139 |
} |
| 3140 | 3140 |
|
| 3141 |
-static void dump_metadata(void *ctx, AVMetadata *m, const char *indent) |
|
| 3141 |
+static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) |
|
| 3142 | 3142 |
{
|
| 3143 |
- if(m && !(m->count == 1 && av_metadata_get(m, "language", NULL, 0))){
|
|
| 3144 |
- AVMetadataTag *tag=NULL; |
|
| 3143 |
+ if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){
|
|
| 3144 |
+ AVDictionaryEntry *tag=NULL; |
|
| 3145 | 3145 |
|
| 3146 | 3146 |
av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); |
| 3147 |
- while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 3147 |
+ while((tag=av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 3148 | 3148 |
if(strcmp("language", tag->key))
|
| 3149 | 3149 |
av_log(ctx, AV_LOG_INFO, "%s %-16s: %s\n", indent, tag->key, tag->value); |
| 3150 | 3150 |
} |
| ... | ... |
@@ -3158,7 +3159,7 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out |
| 3158 | 3158 |
int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); |
| 3159 | 3159 |
AVStream *st = ic->streams[i]; |
| 3160 | 3160 |
int g = av_gcd(st->time_base.num, st->time_base.den); |
| 3161 |
- AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL, 0); |
|
| 3161 |
+ AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); |
|
| 3162 | 3162 |
avcodec_string(buf, sizeof(buf), st->codec, is_output); |
| 3163 | 3163 |
av_log(NULL, AV_LOG_INFO, " Stream #%d.%d", index, i); |
| 3164 | 3164 |
/* the pid is an important information, so we display it */ |
| ... | ... |
@@ -3282,7 +3283,7 @@ void av_dump_format(AVFormatContext *ic, |
| 3282 | 3282 |
if(ic->nb_programs) {
|
| 3283 | 3283 |
int j, k, total = 0; |
| 3284 | 3284 |
for(j=0; j<ic->nb_programs; j++) {
|
| 3285 |
- AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata, |
|
| 3285 |
+ AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata, |
|
| 3286 | 3286 |
"name", NULL, 0); |
| 3287 | 3287 |
av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, |
| 3288 | 3288 |
name ? name->value : ""); |
| ... | ... |
@@ -23,6 +23,7 @@ |
| 23 | 23 |
#include "metadata.h" |
| 24 | 24 |
#include "vorbiscomment.h" |
| 25 | 25 |
#include "libavcodec/bytestream.h" |
| 26 |
+#include "libavutil/dict.h" |
|
| 26 | 27 |
|
| 27 | 28 |
/** |
| 28 | 29 |
* VorbisComment metadata conversion mapping. |
| ... | ... |
@@ -36,15 +37,15 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
|
| 36 | 36 |
{ 0 }
|
| 37 | 37 |
}; |
| 38 | 38 |
|
| 39 |
-int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, |
|
| 39 |
+int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, |
|
| 40 | 40 |
unsigned *count) |
| 41 | 41 |
{
|
| 42 | 42 |
int len = 8; |
| 43 | 43 |
len += strlen(vendor_string); |
| 44 | 44 |
*count = 0; |
| 45 | 45 |
if (m) {
|
| 46 |
- AVMetadataTag *tag = NULL; |
|
| 47 |
- while ((tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 46 |
+ AVDictionaryEntry *tag = NULL; |
|
| 47 |
+ while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 48 | 48 |
len += 4 +strlen(tag->key) + 1 + strlen(tag->value); |
| 49 | 49 |
(*count)++; |
| 50 | 50 |
} |
| ... | ... |
@@ -52,15 +53,15 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, |
| 52 | 52 |
return len; |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
-int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, |
|
| 55 |
+int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, |
|
| 56 | 56 |
const char *vendor_string, const unsigned count) |
| 57 | 57 |
{
|
| 58 | 58 |
bytestream_put_le32(p, strlen(vendor_string)); |
| 59 | 59 |
bytestream_put_buffer(p, vendor_string, strlen(vendor_string)); |
| 60 | 60 |
if (*m) {
|
| 61 |
- AVMetadataTag *tag = NULL; |
|
| 61 |
+ AVDictionaryEntry *tag = NULL; |
|
| 62 | 62 |
bytestream_put_le32(p, count); |
| 63 |
- while ((tag = av_metadata_get(*m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
|
|
| 63 |
+ while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
|
| 64 | 64 |
unsigned int len1 = strlen(tag->key); |
| 65 | 65 |
unsigned int len2 = strlen(tag->value); |
| 66 | 66 |
bytestream_put_le32(p, len1+1+len2); |
| ... | ... |
@@ -35,13 +35,13 @@ |
| 35 | 35 |
* @param count Pointer to store the number of tags in m because m->count is "not allowed" |
| 36 | 36 |
* @return The length in bytes. |
| 37 | 37 |
*/ |
| 38 |
-int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, |
|
| 38 |
+int ff_vorbiscomment_length(AVDictionary *m, const char *vendor_string, |
|
| 39 | 39 |
unsigned *count); |
| 40 | 40 |
|
| 41 | 41 |
/** |
| 42 | 42 |
* Writes a VorbisComment into a buffer. The buffer, p, must have enough |
| 43 | 43 |
* data to hold the whole VorbisComment. The minimum size required can be |
| 44 |
- * obtained by passing the same AVMetadata and vendor_string to |
|
| 44 |
+ * obtained by passing the same AVDictionary and vendor_string to |
|
| 45 | 45 |
* ff_vorbiscomment_length() |
| 46 | 46 |
* |
| 47 | 47 |
* @param p The buffer in which to write. |
| ... | ... |
@@ -49,7 +49,7 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string, |
| 49 | 49 |
* @param vendor_string The vendor string to write. |
| 50 | 50 |
* @param count The number of tags in m because m->count is "not allowed" |
| 51 | 51 |
*/ |
| 52 |
-int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, |
|
| 52 |
+int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m, |
|
| 53 | 53 |
const char *vendor_string, const unsigned count); |
| 54 | 54 |
|
| 55 | 55 |
extern const AVMetadataConv ff_vorbiscomment_metadata_conv[]; |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "avformat.h" |
| 23 | 23 |
#include "libavutil/intreadwrite.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
|
| 25 | 26 |
typedef struct VqfContext {
|
| 26 | 27 |
int frame_bit_len; |
| ... | ... |
@@ -56,7 +57,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, |
| 56 | 56 |
return; |
| 57 | 57 |
avio_read(s->pb, buf, len); |
| 58 | 58 |
buf[len] = 0; |
| 59 |
- av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); |
|
| 59 |
+ av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); |
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 | 62 |
static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| ... | ... |
@@ -28,6 +28,7 @@ |
| 28 | 28 |
*/ |
| 29 | 29 |
|
| 30 | 30 |
#include "libavutil/intreadwrite.h" |
| 31 |
+#include "libavutil/dict.h" |
|
| 31 | 32 |
#include "avformat.h" |
| 32 | 33 |
|
| 33 | 34 |
#define FORM_TAG MKTAG('F', 'O', 'R', 'M')
|
| ... | ... |
@@ -130,8 +131,8 @@ static int wc3_read_header(AVFormatContext *s, |
| 130 | 130 |
if ((ret = avio_read(pb, buffer, size)) != size) |
| 131 | 131 |
return AVERROR(EIO); |
| 132 | 132 |
buffer[size] = 0; |
| 133 |
- av_metadata_set2(&s->metadata, "title", buffer, |
|
| 134 |
- AV_METADATA_DONT_STRDUP_VAL); |
|
| 133 |
+ av_dict_set(&s->metadata, "title", buffer, |
|
| 134 |
+ AV_DICT_DONT_STRDUP_VAL); |
|
| 135 | 135 |
break; |
| 136 | 136 |
|
| 137 | 137 |
case SIZE_TAG: |
| ... | ... |
@@ -27,6 +27,7 @@ |
| 27 | 27 |
|
| 28 | 28 |
#include "libavutil/intreadwrite.h" |
| 29 | 29 |
#include "libavutil/intfloat_readwrite.h" |
| 30 |
+#include "libavutil/dict.h" |
|
| 30 | 31 |
#include "avformat.h" |
| 31 | 32 |
#include "internal.h" |
| 32 | 33 |
#include "riff.h" |
| ... | ... |
@@ -483,7 +484,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) |
| 483 | 483 |
st = av_new_stream(s, 0); |
| 484 | 484 |
if (!st) |
| 485 | 485 |
goto done; |
| 486 |
- av_metadata_set2(&st->metadata, "title", description, 0); |
|
| 486 |
+ av_dict_set(&st->metadata, "title", description, 0); |
|
| 487 | 487 |
st->codec->codec_id = CODEC_ID_MJPEG; |
| 488 | 488 |
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; |
| 489 | 489 |
st->codec->extradata = av_mallocz(filesize); |
| ... | ... |
@@ -543,7 +544,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty |
| 543 | 543 |
return; |
| 544 | 544 |
} |
| 545 | 545 |
|
| 546 |
- av_metadata_set2(&s->metadata, key, buf, 0); |
|
| 546 |
+ av_dict_set(&s->metadata, key, buf, 0); |
|
| 547 | 547 |
av_freep(&buf); |
| 548 | 548 |
} |
| 549 | 549 |
|
| ... | ... |
@@ -867,7 +868,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p |
| 867 | 867 |
avio_read(pb, language, 3); |
| 868 | 868 |
if (language[0]) {
|
| 869 | 869 |
language[3] = 0; |
| 870 |
- av_metadata_set2(&st->metadata, "language", language, 0); |
|
| 870 |
+ av_dict_set(&st->metadata, "language", language, 0); |
|
| 871 | 871 |
if (!strcmp(language, "nar") || !strcmp(language, "NAR")) |
| 872 | 872 |
st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; |
| 873 | 873 |
} |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
|
| 22 | 22 |
#include "libavutil/audioconvert.h" |
| 23 | 23 |
#include "libavutil/intreadwrite.h" |
| 24 |
+#include "libavutil/dict.h" |
|
| 24 | 25 |
#include "avformat.h" |
| 25 | 26 |
#include "apetag.h" |
| 26 | 27 |
#include "id3v1.h" |
| ... | ... |
@@ -226,7 +227,7 @@ static int wv_read_header(AVFormatContext *s, |
| 226 | 226 |
if(s->pb->seekable) {
|
| 227 | 227 |
int64_t cur = avio_tell(s->pb); |
| 228 | 228 |
ff_ape_parse_tag(s); |
| 229 |
- if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) |
|
| 229 |
+ if(!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) |
|
| 230 | 230 |
ff_id3v1_read(s); |
| 231 | 231 |
avio_seek(s->pb, cur, SEEK_SET); |
| 232 | 232 |
} |