aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-09 04:47:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-09 04:47:19 +0200
commitf9ecb849ef39bc337d9439b829fe08da5c95cc3d (patch)
tree761e860a10084d8de4f07815911f697fe11610b9 /libavformat/utils.c
parent7b8ed831eb8432d202dad16dedc1758b018bb1fa (diff)
parenta71bcd1a7f66e210971c44452dc4cdae7bdbd98a (diff)
downloadffmpeg-f9ecb849ef39bc337d9439b829fe08da5c95cc3d.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: crypto: Use av_freep instead of av_free lavf: don't try to free private options if priv_data is NULL. swscale: fix types of assembly arguments. swscale: move two macros that are only used once into caller. swscale: remove unused function. options: Add missing braces around struct initializer. mov: Remove leftover crufty debug statement with references to a local file. dvbsubdec: Fix compilation of debug code. Remove all uses of now deprecated metadata functions. Move metadata API from lavf to lavu. Conflicts: doc/APIchanges libavformat/aiffdec.c libavformat/asfdec.c libavformat/avformat.h libavformat/avidec.c libavformat/cafdec.c libavformat/matroskaenc.c libavformat/mov.c libavformat/mp3enc.c libavformat/wtv.c libavutil/avutil.h libavutil/internal.h libswscale/swscale.c libswscale/x86/swscale_template.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a17fec3bd7..b625f2c3df 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -27,6 +27,7 @@
#include "libavcodec/internal.h"
#include "libavcodec/raw.h"
#include "libavutil/opt.h"
+#include "libavutil/dict.h"
#include "metadata.h"
#include "id3v2.h"
#include "libavutil/avstring.h"
@@ -2593,7 +2594,7 @@ void avformat_free_context(AVFormatContext *s)
AVStream *st;
av_opt_free(s);
- if (s->iformat && s->iformat->priv_class)
+ if (s->iformat && s->iformat->priv_class && s->priv_data)
av_opt_free(s->priv_data);
for(i=0;i<s->nb_streams;i++) {
@@ -2603,7 +2604,7 @@ void avformat_free_context(AVFormatContext *s)
av_parser_close(st->parser);
av_free_packet(&st->cur_pkt);
}
- av_metadata_free(&st->metadata);
+ av_dict_free(&st->metadata);
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec->subtitle_header);
@@ -2613,18 +2614,18 @@ void avformat_free_context(AVFormatContext *s)
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
- av_metadata_free(&s->programs[i]->metadata);
+ av_dict_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
av_freep(&s->priv_data);
while(s->nb_chapters--) {
- av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
+ av_dict_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
- av_metadata_free(&s->metadata);
+ av_dict_free(&s->metadata);
av_freep(&s->streams);
av_free(s);
}
@@ -2728,7 +2729,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6
return NULL;
dynarray_add(&s->chapters, &s->nb_chapters, chapter);
}
- av_metadata_set2(&chapter->metadata, "title", title, 0);
+ av_dict_set(&chapter->metadata, "title", title, 0);
chapter->id = id;
chapter->time_base= time_base;
chapter->start = start;
@@ -2923,7 +2924,7 @@ int av_write_header(AVFormatContext *s)
/* set muxer identification string */
if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
- av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
+ av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
}
if(s->oformat->write_header){
@@ -3245,13 +3246,13 @@ static void print_fps(double d, const char *postfix){
else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix);
}
-static void dump_metadata(void *ctx, AVMetadata *m, const char *indent)
+static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
{
- if(m && !(m->count == 1 && av_metadata_get(m, "language", NULL, 0))){
- AVMetadataTag *tag=NULL;
+ if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){
+ AVDictionaryEntry *tag=NULL;
av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
- while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
+ while((tag=av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
if(strcmp("language", tag->key))
av_log(ctx, AV_LOG_INFO, "%s %-16s: %s\n", indent, tag->key, tag->value);
}
@@ -3265,7 +3266,7 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
AVStream *st = ic->streams[i];
int g = av_gcd(st->time_base.num, st->time_base.den);
- AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL, 0);
+ AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
avcodec_string(buf, sizeof(buf), st->codec, is_output);
av_log(NULL, AV_LOG_INFO, " Stream #%d.%d", index, i);
/* the pid is an important information, so we display it */
@@ -3389,7 +3390,7 @@ void av_dump_format(AVFormatContext *ic,
if(ic->nb_programs) {
int j, k, total = 0;
for(j=0; j<ic->nb_programs; j++) {
- AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata,
+ AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
"name", NULL, 0);
av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
name ? name->value : "");