[FFmpeg-cvslog] libavf/avienc: store language metadata for XSUB streams

Erik Olofsson git at videolan.org
Sat Nov 9 20:53:18 CET 2013


ffmpeg | branch: master | Erik Olofsson <eaj.olofsson at gmail.com> | Sat Nov  9 20:26:00 2013 +0100| [f5bffd3a1a1aea5d478161b86ce2029179282d6c] | committer: Michael Niedermayer

libavf/avienc: store language metadata for XSUB streams

Formatted in such a way that DivX certified players can decode it.
Verified on Sony Playstation 3 and Philips DVP3380.

Fixes ticket 2385

Signed-off-by: Erik Olofsson <eaj.olofsson at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/avienc.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 27db3f1..45f7a20 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -26,6 +26,8 @@
 #include "avi.h"
 #include "avio_internal.h"
 #include "riff.h"
+#include "libavformat/avlanguage.h"
+#include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
 #include "libavutil/avassert.h"
@@ -309,6 +311,16 @@ static int avi_write_header(AVFormatContext *s)
             ff_riff_write_info_tag(s->pb, "strn", t->value);
             t = NULL;
         }
+        if(stream->codec_id == AV_CODEC_ID_XSUB
+           && (t = av_dict_get(s->streams[i]->metadata, "language", NULL, 0))) {
+            const char* langstr = av_convert_lang_to(t->value, AV_LANG_ISO639_1);
+            t = NULL;
+            if (langstr) {
+                char* str = av_asprintf("Subtitle - %s-xx;02", langstr);
+                ff_riff_write_info_tag(s->pb, "strn", str);
+                av_free(str);
+            }
+        }
       }
 
         if (pb->seekable) {



More information about the ffmpeg-cvslog mailing list