changeset 5982:f74198942337 libavformat

Mark av_metadata_set() as deprecated, and use av_metadata_set2() in its place. av_metadata_set() is going to be dropped at the next major bump.
author stefano
date Sun, 25 Apr 2010 14:27:42 +0000
parents c1cd2ffd5cdc
children cb7e1e218016
files asfdec.c avformat.h cafdec.c flvdec.c id3v1.c id3v2.c matroskadec.c metadata.c metadata_compat.c mov.c mpegts.c nsvdec.c nutdec.c r3d.c rmdec.c rpl.c rtsp.c utils.c
diffstat 18 files changed, 42 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/asfdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/asfdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -616,7 +616,7 @@
                     const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any
                     const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL);
                     if (iso6392)
-                        av_metadata_set(&st->metadata, "language", iso6392);
+                        av_metadata_set2(&st->metadata, "language", iso6392, 0);
                 }
             }
         }
--- a/avformat.h	Thu Apr 22 20:34:30 2010 +0000
+++ b/avformat.h	Sun Apr 25 14:27:42 2010 +0000
@@ -145,8 +145,9 @@
  * @param key tag key to add to m (will be av_strduped)
  * @param value tag value to add to m (will be av_strduped)
  * @return >= 0 on success otherwise an error code <0
+ * @deprecated Use av_metadata_set2() instead.
  */
-int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
+attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
 #endif
 
 /**
--- a/cafdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/cafdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -172,7 +172,7 @@
         char value[1024];
         get_strz(pb, key, sizeof(key));
         get_strz(pb, value, sizeof(value));
-        av_metadata_set(&s->metadata, key, value);
+        av_metadata_set2(&s->metadata, key, value, 0);
     }
 }
 
--- a/flvdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/flvdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -188,17 +188,17 @@
 
         if(amf_type == AMF_DATA_TYPE_BOOL) {
             av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val));
-            av_metadata_set(&s->metadata, key, str_val);
+            av_metadata_set2(&s->metadata, key, str_val, 0);
         } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
             snprintf(str_val, sizeof(str_val), "%.f", num_val);
-            av_metadata_set(&s->metadata, key, str_val);
+            av_metadata_set2(&s->metadata, key, str_val, 0);
             if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE;
             else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
                 vcodec->bit_rate = num_val * 1024.0;
             else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0))
                 acodec->bit_rate = num_val * 1024.0;
         } else if (amf_type == AMF_DATA_TYPE_STRING)
-          av_metadata_set(&s->metadata, key, str_val);
+            av_metadata_set2(&s->metadata, key, str_val, 0);
     }
 
     return 0;
--- a/id3v1.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/id3v1.c	Sun Apr 25 14:27:42 2010 +0000
@@ -192,7 +192,7 @@
     *q = '\0';
 
     if (*str)
-        av_metadata_set(&s->metadata, key, str);
+        av_metadata_set2(&s->metadata, key, str, 0);
 }
 
 /**
@@ -217,7 +217,7 @@
         av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL);
     genre = buf[127];
     if (genre <= ID3v1_GENRE_MAX)
-        av_metadata_set(&s->metadata, "genre", ff_id3v1_genre_str[genre]);
+        av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0);
     return 0;
 }
 
--- a/id3v2.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/id3v2.c	Sun Apr 25 14:27:42 2010 +0000
@@ -150,7 +150,7 @@
         val = dst;
 
     if (val)
-        av_metadata_set(&s->metadata, key, val);
+        av_metadata_set2(&s->metadata, key, val, 0);
 }
 
 void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
--- a/matroskadec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/matroskadec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -1001,14 +1001,14 @@
         if (prefix)  snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name);
         else         av_strlcpy(key, tags[i].name, sizeof(key));
         if (tags[i].def || !lang) {
-        av_metadata_set(metadata, key, tags[i].string);
+        av_metadata_set2(metadata, key, tags[i].string, 0);
         if (tags[i].sub.nb_elem)
             matroska_convert_tag(s, &tags[i].sub, metadata, key);
         }
         if (lang) {
             av_strlcat(key, "-", sizeof(key));
             av_strlcat(key, lang, sizeof(key));
-            av_metadata_set(metadata, key, tags[i].string);
+            av_metadata_set2(metadata, key, tags[i].string, 0);
             if (tags[i].sub.nb_elem)
                 matroska_convert_tag(s, &tags[i].sub, metadata, key);
         }
@@ -1157,7 +1157,7 @@
     if (matroska->duration)
         matroska->ctx->duration = matroska->duration * matroska->time_scale
                                   * 1000 / AV_TIME_BASE;
-    av_metadata_set(&s->metadata, "title", matroska->title);
+    av_metadata_set2(&s->metadata, "title", matroska->title, 0);
 
     tracks = matroska->tracks.elem;
     for (i=0; i < matroska->tracks.nb_elem; i++) {
@@ -1352,8 +1352,8 @@
         st->codec->codec_id = codec_id;
         st->start_time = 0;
         if (strcmp(track->language, "und"))
-            av_metadata_set(&st->metadata, "language", track->language);
-        av_metadata_set(&st->metadata, "title", track->name);
+            av_metadata_set2(&st->metadata, "language", track->language, 0);
+        av_metadata_set2(&st->metadata, "title", track->name, 0);
 
         if (track->flag_default)
             st->disposition |= AV_DISPOSITION_DEFAULT;
@@ -1410,7 +1410,7 @@
             AVStream *st = av_new_stream(s, 0);
             if (st == NULL)
                 break;
-            av_metadata_set(&st->metadata, "filename",attachements[j].filename);
+            av_metadata_set2(&st->metadata, "filename",attachements[j].filename, 0);
             st->codec->codec_id = CODEC_ID_NONE;
             st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
             st->codec->extradata  = av_malloc(attachements[j].bin.size);
@@ -1438,8 +1438,8 @@
             ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
                            chapters[i].start, chapters[i].end,
                            chapters[i].title);
-            av_metadata_set(&chapters[i].chapter->metadata,
-                            "title", chapters[i].title);
+            av_metadata_set2(&chapters[i].chapter->metadata,
+                             "title", chapters[i].title, 0);
             max_start = chapters[i].start;
         }
 
--- a/metadata.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/metadata.c	Sun Apr 25 14:27:42 2010 +0000
@@ -133,7 +133,7 @@
                         break;
                     }
         }
-        av_metadata_set(&dst, key, mtag->value);
+        av_metadata_set2(&dst, key, mtag->value, 0);
     }
     av_metadata_free(pm);
     *pm = dst;
--- a/metadata_compat.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/metadata_compat.c	Sun Apr 25 14:27:42 2010 +0000
@@ -109,7 +109,7 @@
 
 #define FILL_METADATA(s, key, value) {                                        \
     if (value && *value && !av_metadata_get(s->metadata, #key, NULL, 0))      \
-        av_metadata_set(&s->metadata, #key, value);                           \
+        av_metadata_set2(&s->metadata, #key, value, 0);                       \
     }
 #define FILL_METADATA_STR(s, key)  FILL_METADATA(s, key, s->key)
 #define FILL_METADATA_INT(s, key) {                                           \
--- a/mov.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/mov.c	Sun Apr 25 14:27:42 2010 +0000
@@ -86,7 +86,7 @@
 
     get_be16(pb); // unknown
     snprintf(buf, sizeof(buf), "%d", get_be16(pb));
-    av_metadata_set(&c->fc->metadata, "track", buf);
+    av_metadata_set2(&c->fc->metadata, "track", buf, 0);
 
     get_be16(pb); // total tracks
 
@@ -204,10 +204,10 @@
             get_buffer(pb, str, str_size);
             str[str_size] = 0;
         }
-        av_metadata_set(&c->fc->metadata, key, str);
+        av_metadata_set2(&c->fc->metadata, key, str, 0);
         if (*language && strcmp(language, "und")) {
             snprintf(key2, sizeof(key2), "%s-%s", key, language);
-            av_metadata_set(&c->fc->metadata, key2, str);
+            av_metadata_set2(&c->fc->metadata, key2, str, 0);
         }
     }
 #ifdef DEBUG_METADATA
@@ -569,10 +569,10 @@
     if (strcmp(type, "qt  "))
         c->isom = 1;
     av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
-    av_metadata_set(&c->fc->metadata, "major_brand", type);
+    av_metadata_set2(&c->fc->metadata, "major_brand", type, 0);
     minor_ver = get_be32(pb); /* minor version */
     snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
-    av_metadata_set(&c->fc->metadata, "minor_version", minor_ver_str);
+    av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0);
 
     comp_brand_size = atom.size - 8;
     if (comp_brand_size < 0)
@@ -582,7 +582,7 @@
         return AVERROR(ENOMEM);
     get_buffer(pb, comp_brands_str, comp_brand_size);
     comp_brands_str[comp_brand_size] = 0;
-    av_metadata_set(&c->fc->metadata, "compatible_brands", comp_brands_str);
+    av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0);
     av_freep(&comp_brands_str);
 
     return 0;
@@ -637,7 +637,7 @@
 
     lang = get_be16(pb); /* language */
     if (ff_mov_lang_to_iso639(lang, language))
-        av_metadata_set(&st->metadata, "language", language);
+        av_metadata_set2(&st->metadata, "language", language, 0);
     get_be16(pb); /* quality */
 
     return 0;
--- a/mpegts.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/mpegts.c	Sun Apr 25 14:27:42 2010 +0000
@@ -963,7 +963,7 @@
                 language[1] = get8(&p, desc_end);
                 language[2] = get8(&p, desc_end);
                 language[3] = 0;
-                av_metadata_set(&st->metadata, "language", language);
+                av_metadata_set2(&st->metadata, "language", language, 0);
                 break;
             case 0x59: /* subtitling descriptor */
                 language[0] = get8(&p, desc_end);
@@ -974,14 +974,14 @@
                 comp_page = get16(&p, desc_end);
                 anc_page = get16(&p, desc_end);
                 st->codec->sub_id = (anc_page << 16) | comp_page;
-                av_metadata_set(&st->metadata, "language", language);
+                av_metadata_set2(&st->metadata, "language", language, 0);
                 break;
             case 0x0a: /* ISO 639 language descriptor */
                 language[0] = get8(&p, desc_end);
                 language[1] = get8(&p, desc_end);
                 language[2] = get8(&p, desc_end);
                 language[3] = 0;
-                av_metadata_set(&st->metadata, "language", language);
+                av_metadata_set2(&st->metadata, "language", language, 0);
                 break;
             case 0x05: /* registration descriptor */
                 st->codec->codec_tag = bytestream_get_le32(&p);
@@ -1109,8 +1109,8 @@
                 if (name) {
                     AVProgram *program = av_new_program(ts->stream, sid);
                     if(program) {
-                        av_metadata_set(&program->metadata, "name", name);
-                        av_metadata_set(&program->metadata, "provider_name", provider_name);
+                        av_metadata_set2(&program->metadata, "name", name, 0);
+                        av_metadata_set2(&program->metadata, "provider_name", provider_name, 0);
                     }
                 }
                 av_free(name);
--- a/nsvdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/nsvdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -339,7 +339,7 @@
                 break;
             *p++ = '\0';
             PRINT(("NSV NSVf INFO: %s='%s'\n", token, value));
-            av_metadata_set(&s->metadata, token, value);
+            av_metadata_set2(&s->metadata, token, value, 0);
         }
         av_free(strings);
     }
--- a/nutdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/nutdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -452,7 +452,7 @@
             else                      metadata= &s->metadata;
             if(metadata && strcasecmp(name,"Uses")
                && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces"))
-                av_metadata_set(metadata, name, str_value);
+                av_metadata_set2(metadata, name, str_value, 0);
         }
     }
 
--- a/r3d.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/r3d.c	Sun Apr 25 14:27:42 2010 +0000
@@ -97,7 +97,7 @@
 
     get_buffer(s->pb, filename, 257);
     filename[sizeof(filename)-1] = 0;
-    av_metadata_set(&st->metadata, "filename", filename);
+    av_metadata_set2(&st->metadata, "filename", filename, 0);
 
     dprintf(s, "filename %s\n", filename);
     dprintf(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
--- a/rmdec.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/rmdec.c	Sun Apr 25 14:27:42 2010 +0000
@@ -121,7 +121,7 @@
     for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
         int len = wide ? get_be16(s->pb) : get_byte(s->pb);
         get_strl(s->pb, buf, sizeof(buf), len);
-        av_metadata_set(&s->metadata, ff_rm_metadata[i], buf);
+        av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0);
     }
 }
 
--- a/rpl.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/rpl.c	Sun Apr 25 14:27:42 2010 +0000
@@ -131,11 +131,11 @@
     // for the text in a few cases; samples needed.)
     error |= read_line(pb, line, sizeof(line));      // ARMovie
     error |= read_line(pb, line, sizeof(line));      // movie name
-    av_metadata_set(&s->metadata, "title"    , line);
+    av_metadata_set2(&s->metadata, "title"    , line, 0);
     error |= read_line(pb, line, sizeof(line));      // date/copyright
-    av_metadata_set(&s->metadata, "copyright", line);
+    av_metadata_set2(&s->metadata, "copyright", line, 0);
     error |= read_line(pb, line, sizeof(line));      // author and other
-    av_metadata_set(&s->metadata, "author"   , line);
+    av_metadata_set2(&s->metadata, "author"   , line, 0);
 
     // video headers
     vst = av_new_stream(s, 0);
--- a/rtsp.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/rtsp.c	Sun Apr 25 14:27:42 2010 +0000
@@ -379,11 +379,11 @@
         }
         break;
     case 's':
-        av_metadata_set(&s->metadata, "title", p);
+        av_metadata_set2(&s->metadata, "title", p, 0);
         break;
     case 'i':
         if (s->nb_streams == 0) {
-            av_metadata_set(&s->metadata, "comment", p);
+            av_metadata_set2(&s->metadata, "comment", p, 0);
             break;
         }
         break;
--- a/utils.c	Thu Apr 22 20:34:30 2010 +0000
+++ b/utils.c	Sun Apr 25 14:27:42 2010 +0000
@@ -2544,7 +2544,7 @@
 #if LIBAVFORMAT_VERSION_INT < (53<<16)
     av_free(chapter->title);
 #endif
-    av_metadata_set(&chapter->metadata, "title", title);
+    av_metadata_set2(&chapter->metadata, "title", title, 0);
     chapter->id    = id;
     chapter->time_base= time_base;
     chapter->start = start;