From 4f10b0983da132368b641c4ef4cb012413959958 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 27 Jan 2006 01:06:29 +0000 Subject: [PATCH] ext/: - a library should not call setlocale. see Libraries node in gettext manual Original commit message from CVS: * ext/alsa/gstalsaplugin.c: (plugin_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_base_init), (plugin_init): * ext/gnomevfs/gstgnomevfs.c: (plugin_init): * ext/ogg/gstoggdemux.c: (gst_ogg_demux_plugin_init): - a library should not call setlocale. see Libraries node in gettext manual - make sure all plugins that use translation do bindtextdomain to point to the localedir * gst/playback/gstplaybin.c: (gen_vis_element), (add_sink), (setup_sinks), (plugin_init): all this, and check for NULL when creating sinks --- ChangeLog | 15 +++++++++++++++ ext/alsa/gstalsaplugin.c | 9 +++++++++ ext/cdparanoia/gstcdparanoiasrc.c | 13 ++++++++++--- ext/gnomevfs/gstgnomevfs.c | 4 +++- ext/ogg/gstoggdemux.c | 6 ++++++ gst/playback/gstplaybin.c | 29 +++++++++++++++++++++++------ 6 files changed, 66 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbbad7f..89a389f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-01-27 Thomas Vander Stichele + + * ext/alsa/gstalsaplugin.c: (plugin_init): + * ext/cdparanoia/gstcdparanoiasrc.c: + (gst_cd_paranoia_src_base_init), (plugin_init): + * ext/gnomevfs/gstgnomevfs.c: (plugin_init): + * ext/ogg/gstoggdemux.c: (gst_ogg_demux_plugin_init): + - a library should not call setlocale. see "Libraries" node in + gettext manual + - make sure all plugins that use translation do bindtextdomain + to point to the localedir + * gst/playback/gstplaybin.c: (gen_vis_element), (add_sink), + (setup_sinks), (plugin_init): + all this, and check for NULL when creating sinks + 2006-01-27 Julien MOUTTE * gst/subparse/gstsubparse.c: (gst_subparse_type_find), diff --git a/ext/alsa/gstalsaplugin.c b/ext/alsa/gstalsaplugin.c index 448bfcc..87a6aa5 100644 --- a/ext/alsa/gstalsaplugin.c +++ b/ext/alsa/gstalsaplugin.c @@ -27,6 +27,8 @@ #include "gstalsasrc.h" #include "gstalsamixerelement.h" +#include + GST_DEBUG_CATEGORY (alsa_debug); /* ALSA debugging wrapper */ @@ -67,6 +69,13 @@ plugin_init (GstPlugin * plugin) return FALSE; GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins"); + +#if ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#endif + err = snd_lib_error_set_handler (gst_alsa_error_wrapper); if (err != 0) GST_WARNING ("failed to set alsa error handler"); diff --git a/ext/cdparanoia/gstcdparanoiasrc.c b/ext/cdparanoia/gstcdparanoiasrc.c index 6747f1b..455253e 100644 --- a/ext/cdparanoia/gstcdparanoiasrc.c +++ b/ext/cdparanoia/gstcdparanoiasrc.c @@ -97,9 +97,6 @@ gst_cd_paranoia_src_base_init (gpointer g_class) GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); gst_element_class_set_details (element_class, &cdparanoia_details); - - GST_DEBUG_CATEGORY_INIT (gst_cd_paranoia_src_debug, "cdparanoiasrc", 0, - "CD Paranoia Source"); } static void @@ -389,10 +386,20 @@ gst_cd_paranoia_src_get_property (GObject * object, guint prop_id, static gboolean plugin_init (GstPlugin * plugin) { + GST_DEBUG_CATEGORY_INIT (gst_cd_paranoia_src_debug, "cdparanoiasrc", 0, + "CD Paranoia Source"); + if (!gst_element_register (plugin, "cdparanoiasrc", GST_RANK_SECONDARY, GST_TYPE_CD_PARANOIA_SRC)) return FALSE; +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#endif + + return TRUE; } diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c index 1e6fb64..6eb5a46 100644 --- a/ext/gnomevfs/gstgnomevfs.c +++ b/ext/gnomevfs/gstgnomevfs.c @@ -89,7 +89,9 @@ plugin_init (GstPlugin * plugin) return FALSE; #ifdef ENABLE_NLS - setlocale (LC_ALL, ""); +/* FIXME: add category + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR); + */ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #endif /* ENABLE_NLS */ diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 475f469..45d3a15 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -2709,6 +2709,12 @@ gst_ogg_demux_plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_ogg_demux_setup_debug, "oggdemux_setup", 0, "ogg demuxer setup stage when parsing pipeline"); +#if ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#endif + return gst_element_register (plugin, "oggdemux", GST_RANK_PRIMARY, GST_TYPE_OGG_DEMUX); } diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 87d6054..049b327 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -689,7 +689,7 @@ gen_text_element (GstPlayBin * play_bin) } /* make the element (bin) that contains the elements needed to perform - * audio playback. + * audio playback. * * +-------------------------------------------------------------+ * | abin | @@ -699,7 +699,7 @@ gen_text_element (GstPlayBin * play_bin) * | | +---------+ +----------+ +---------+ +---------+ | * sink-+ | * +-------------------------------------------------------------+ - * + * */ static GstElement * gen_audio_element (GstPlayBin * play_bin) @@ -799,15 +799,21 @@ gen_vis_element (GstPlayBin * play_bin) GstElement *vqueue, *aqueue; GstPad *pad, *rpad; + asink = gen_audio_element (play_bin); + if (!asink) + return NULL; + vsink = gen_video_element (play_bin); + if (!vsink) { + gst_object_unref (asink); + return NULL; + } + element = gst_bin_new ("visbin"); tee = gst_element_factory_make ("tee", "tee"); vqueue = gst_element_factory_make ("queue", "vqueue"); aqueue = gst_element_factory_make ("queue", "aqueue"); - asink = gen_audio_element (play_bin); - vsink = gen_video_element (play_bin); - gst_bin_add (GST_BIN (element), asink); gst_bin_add (GST_BIN (element), vqueue); gst_bin_add (GST_BIN (element), aqueue); @@ -956,6 +962,7 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad) GstElement *parent; GstStateChangeReturn stateret; + g_return_val_if_fail (sink != NULL, FALSE); /* this is only for debugging */ parent = gst_pad_get_parent_element (srcpad); if (parent) { @@ -1028,7 +1035,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) if (play_bin->sinks) { remove_sinks (play_bin); } - GST_DEBUG ("setupsinks"); + GST_DEBUG_OBJECT (play_base_bin, "setupsinks"); /* find out what to do */ if (group->type[GST_STREAM_TYPE_VIDEO - 1].npads > 0 && @@ -1058,6 +1065,8 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) } else { sink = gen_audio_element (play_bin); } + if (!sink) + return FALSE; pad = gst_element_get_pad (group->type[GST_STREAM_TYPE_AUDIO - 1].preroll, "src"); res = add_sink (play_bin, sink, pad); @@ -1079,6 +1088,8 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) } else { sink = gen_video_element (play_bin); } + if (!sink) + return FALSE; pad = gst_element_get_pad (group->type[GST_STREAM_TYPE_VIDEO - 1].preroll, "src"); res = add_sink (play_bin, sink, pad); @@ -1243,6 +1254,12 @@ plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin", 0, "play bin"); +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#endif /* ENABLE_NLS */ + return gst_element_register (plugin, "playbin", GST_RANK_NONE, GST_TYPE_PLAY_BIN); } -- 2.7.4