]> granicus.if.org Git - handbrake/commitdiff
libhb: restore writing of encoding tool tag to output file
authorjstebbins <jstebbins.hb@gmail.com>
Thu, 6 Mar 2014 20:42:30 +0000 (20:42 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Thu, 6 Mar 2014 20:42:30 +0000 (20:42 +0000)
We lost this when switching to avformat for muxing

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6102 b64f7644-9d1e-0410-96f1-a4d463321fa5

contrib/ffmpeg/A01-encoding-tool-tag.patch [new file with mode: 0644]
libhb/muxavformat.c

diff --git a/contrib/ffmpeg/A01-encoding-tool-tag.patch b/contrib/ffmpeg/A01-encoding-tool-tag.patch
new file mode 100644 (file)
index 0000000..8a93011
--- /dev/null
@@ -0,0 +1,40 @@
+diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
+index cc645a5..3ab3139 100644
+--- a/libavformat/matroskaenc.c
++++ b/libavformat/matroskaenc.c
+@@ -805,7 +805,8 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme
+     end_ebml_master(s->pb, targets);
+     while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
+-        if (av_strcasecmp(t->key, "title"))
++        if (av_strcasecmp(t->key, "title") &&
++            av_strcasecmp(t->key, "encoding_tool"))
+             mkv_write_simpletag(s->pb, t);
+     end_ebml_master(s->pb, tag);
+@@ -965,7 +966,10 @@ static int mkv_write_header(AVFormatContext *s)
+             segment_uid[i] = av_lfg_get(&lfg);
+         put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);
+-        put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
++        if ((tag = av_dict_get(s->metadata, "encoding_tool", NULL, 0)))
++            put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, tag->value);
++        else
++            put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
+         put_ebml_binary(pb, MATROSKA_ID_SEGMENTUID, segment_uid, 16);
+     }
+diff --git a/libavformat/movenc.c b/libavformat/movenc.c
+index 43a1647..5bc0ca3 100644
+--- a/libavformat/movenc.c
++++ b/libavformat/movenc.c
+@@ -1858,7 +1858,8 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
+     mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1);
+     mov_write_string_metadata(s, pb, "\251alb", "album"    , 1);
+     mov_write_string_metadata(s, pb, "\251day", "date"     , 1);
+-    mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
++    if (!mov_write_string_metadata(s, pb, "\251too", "encoding_tool", 1))
++        mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
+     mov_write_string_metadata(s, pb, "\251cmt", "comment"  , 1);
+     mov_write_string_metadata(s, pb, "\251gen", "genre"    , 1);
+     mov_write_string_metadata(s, pb, "\251cpy", "copyright", 1);
index a5ca6b5fa280ba41757b058dd73e225d175b64ad..d3c2cf56f8f60994ec70a1c455c63e3393df5e9a 100644 (file)
@@ -880,6 +880,11 @@ static int avformatInit( hb_mux_object_t * m )
         }
     }
 
+    char tool_string[80];
+    snprintf(tool_string, sizeof(tool_string), "HandBrake %s %i",
+             HB_PROJECT_VERSION, HB_PROJECT_BUILD);
+    av_dict_set(&m->oc->metadata, "encoding_tool", tool_string, 0);
+
     AVDictionary * av_opts = NULL;
     if (job->mp4_optimize && (job->mux & HB_MUX_MASK_MP4))
         av_dict_set( &av_opts, "movflags", "faststart", 0 );