[FFmpeg-cvslog] Merge commit 'f12a705ee570e16ca692c66b62821a2dbdf82566'

Clément Bœsch git at videolan.org
Fri Jun 24 11:01:12 CEST 2016


ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Fri Jun 24 11:01:40 2016 +0200| [7a1785014b3b20617854642e0078b86939e450de] | committer: Clément Bœsch

Merge commit 'f12a705ee570e16ca692c66b62821a2dbdf82566'

* commit 'f12a705ee570e16ca692c66b62821a2dbdf82566':
  movenc: Factorize a function for finding a metadata entry and the associated language

Merged-by: Clément Bœsch <clement at stupeflix.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a1785014b3b20617854642e0078b86939e450de
---

 libavformat/movenc.c |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 3d35477..4a6184e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2910,16 +2910,17 @@ static int mov_write_string_tag(AVIOContext *pb, const char *name,
     return size;
 }
 
-static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
-                                     const char *name, const char *tag,
-                                     int long_style)
+static AVDictionaryEntry *get_metadata_lang(AVFormatContext *s,
+                                            const char *tag, int *lang)
 {
-    int l, lang = 0, len, len2;
+    int l, len, len2;
     AVDictionaryEntry *t, *t2 = NULL;
     char tag2[16];
 
+    *lang = 0;
+
     if (!(t = av_dict_get(s->metadata, tag, NULL, 0)))
-        return 0;
+        return NULL;
 
     len = strlen(t->key);
     snprintf(tag2, sizeof(tag2), "%s-", tag);
@@ -2927,10 +2928,21 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
         len2 = strlen(t2->key);
         if (len2 == len + 4 && !strcmp(t->value, t2->value)
             && (l = ff_mov_iso639_to_lang(&t2->key[len2 - 3], 1)) >= 0) {
-            lang = l;
-            break;
+            *lang = l;
+            return t;
         }
     }
+    return t;
+}
+
+static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
+                                     const char *name, const char *tag,
+                                     int long_style)
+{
+    int lang;
+    AVDictionaryEntry *t = get_metadata_lang(s, tag, &lang);
+    if (!t)
+        return 0;
     return mov_write_string_tag(pb, name, t->value, lang, long_style);
 }
 


======================================================================




More information about the ffmpeg-cvslog mailing list