From 4c76427ba778da3f7491de6b9fd57db3021a9e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 7 Jan 2013 10:37:53 +0000 Subject: [PATCH] resindvd: handle non-utf8 dvd disc titles better Maybe something based on the code in bug #688367 and the language encodings would work even better though (now it will try things based on the locale). https://bugzilla.gnome.org/show_bug.cgi?id=690097 --- ext/resindvd/Makefile.am | 1 + ext/resindvd/resindvdsrc.c | 11 ++++++++++- ext/resindvd/resindvdsrc.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ext/resindvd/Makefile.am b/ext/resindvd/Makefile.am index bc51f9b130..1dceac6c20 100644 --- a/ext/resindvd/Makefile.am +++ b/ext/resindvd/Makefile.am @@ -18,6 +18,7 @@ $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ $(GST_CFLAGS) $(DVDNAV_CFLAGS) libgstresindvd_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ -lgstvideo-$(GST_API_VERSION) -lgstpbutils-$(GST_API_VERSION) \ +-lgsttag-$(GST_API_VERSION) \ $(GST_BASE_LIBS) $(GST_LIBS) $(GMODULE_NO_EXPORT_LIBS) $(DVDNAV_LIBS) libgstresindvd_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstresindvd_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c index f13418a137..cb43e2a679 100644 --- a/ext/resindvd/resindvdsrc.c +++ b/ext/resindvd/resindvdsrc.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "resindvdsrc.h" @@ -351,6 +352,7 @@ rsn_dvdsrc_start (GstBaseSrc * bsrc) { resinDvdSrc *src = RESINDVDSRC (bsrc); const gchar *const *langs, *const *cur; + const char *disc_name; gchar lang[8]; g_mutex_lock (src->dvd_lock); @@ -397,7 +399,13 @@ rsn_dvdsrc_start (GstBaseSrc * bsrc) } } - dvdnav_get_title_string (src->dvdnav, &src->disc_name); + /* Get disc name and convert to UTF-8 */ + g_free (src->disc_name); + dvdnav_get_title_string (src->dvdnav, &disc_name); + if (disc_name != NULL && *disc_name != '\0') + src->disc_name = gst_tag_freeform_string_to_utf8 (disc_name, -1, NULL); + else + src->disc_name = NULL; src->first_seek = TRUE; src->running = TRUE; @@ -576,6 +584,7 @@ rsn_dvdsrc_stop (GstBaseSrc * bsrc) src->highlight_event = NULL; } + g_free (src->disc_name); src->disc_name = NULL; if (src->dvdnav) { diff --git a/ext/resindvd/resindvdsrc.h b/ext/resindvd/resindvdsrc.h index e53fb2b12c..5804c07b2c 100644 --- a/ext/resindvd/resindvdsrc.h +++ b/ext/resindvd/resindvdsrc.h @@ -58,7 +58,7 @@ struct _resinDvdSrc gchar *device; dvdnav_t *dvdnav; - const char *disc_name; + gchar *disc_name; /* dvd_reader instance is used to load and cache VTS/VMG ifo info */ dvd_reader_t *dvdread;