qtmux: set stream language code from tag

https://bugzilla.gnome.org/show_bug.cgi?id=696358
This commit is contained in:
Matej Knopp 2013-03-22 02:24:01 +01:00 committed by Tim-Philipp Müller
parent 49d9050e9a
commit d8ac666137

View file

@ -119,7 +119,7 @@
#include <gst/base/gstcollectpads.h> #include <gst/base/gstcollectpads.h>
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/tag/xmpwriter.h> #include <gst/tag/tag.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -3308,6 +3308,7 @@ gst_qt_mux_sink_event (GstCollectPads * pads, GstCollectData * data,
GstTagList *list; GstTagList *list;
GstTagSetter *setter = GST_TAG_SETTER (qtmux); GstTagSetter *setter = GST_TAG_SETTER (qtmux);
GstTagMergeMode mode; GstTagMergeMode mode;
gchar *code;
GST_OBJECT_LOCK (qtmux); GST_OBJECT_LOCK (qtmux);
mode = gst_tag_setter_get_tag_merge_mode (setter); mode = gst_tag_setter_get_tag_merge_mode (setter);
@ -3330,6 +3331,21 @@ gst_qt_mux_sink_event (GstCollectPads * pads, GstCollectData * data,
qtpad->max_bitrate = max_bitrate; qtpad->max_bitrate = max_bitrate;
} }
if (gst_tag_list_get_string (list, GST_TAG_LANGUAGE_CODE, &code)) {
const char *iso_code = gst_tag_get_language_code_iso_639_2T (code);
if (iso_code) {
GstQTPad *qtpad = gst_pad_get_element_private (pad);
g_assert (qtpad);
if (qtpad->trak) {
/* https://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap4/qtff4.html */
qtpad->trak->mdia.mdhd.language_code =
(iso_code[0] - 0x60) * 0x400 + (iso_code[1] - 0x60) * 0x20 +
(iso_code[2] - 0x60);
}
}
g_free (code);
}
gst_event_unref (event); gst_event_unref (event);
event = NULL; event = NULL;
ret = TRUE; ret = TRUE;