From b32305d015765ad269e949ed0043dd9cea662ff4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 13 Dec 2009 13:49:38 +0000 Subject: [PATCH] mpegtsdemux: fix language extraction The descriptor contains ISO 639-2 language codes, but we want two-letter ISO 639-1 codes in GST_TAG_LANGUAGE. --- gst/mpegdemux/Makefile.am | 8 ++++++-- gst/mpegdemux/gstmpegtsdemux.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gst/mpegdemux/Makefile.am b/gst/mpegdemux/Makefile.am index f9b2e365bd..5e76dcc250 100644 --- a/gst/mpegdemux/Makefile.am +++ b/gst/mpegdemux/Makefile.am @@ -13,8 +13,12 @@ libgstmpegdemux_la_SOURCES = \ mpegtsparse.c \ mpegtspacketizer.c -libgstmpegdemux_la_CFLAGS = $(GST_CFLAGS) $(LIBOIL_CFLAGS) -libgstmpegdemux_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBOIL_LIBS) +libgstmpegdemux_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LIBOIL_CFLAGS) +libgstmpegdemux_la_LIBADD = \ + $(GST_PLUGINS_BASE_CFLAGS) -lgsttag-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) $(GST_LIBS) $(LIBOIL_LIBS) libgstmpegdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstmpegdemux_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index 74634254be..6cf37a67e7 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -50,6 +50,8 @@ #include +#include + #include "gstmpegdefs.h" #include "gstmpegtsdemux.h" #include "flutspatinfo.h" @@ -949,17 +951,25 @@ gst_mpegts_demux_send_tags_for_stream (GstMpegTSDemux * demux, gst_mpeg_descriptor_find (stream->ES_info, DESC_ISO_639_LANGUAGE); if (iso639_languages) { if (DESC_ISO_639_LANGUAGE_codes_n (iso639_languages)) { + const gchar *lc; gchar lang_code[4]; - gchar *language_n = (gchar *) + gchar *language_n; + + language_n = (gchar *) DESC_ISO_639_LANGUAGE_language_code_nth (iso639_languages, 0); + lang_code[0] = language_n[0]; lang_code[1] = language_n[1]; lang_code[2] = language_n[2]; lang_code[3] = 0; + if (!list) list = gst_tag_list_new (); + + /* descriptor contains ISO 639-2 code, we want the ISO 639-1 code */ + lc = gst_tag_get_language_code (lang_code); gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_LANGUAGE_CODE, lang_code, NULL); + GST_TAG_LANGUAGE_CODE, (lc) ? lc : lang_code, NULL); } } } -- 2.34.1