Blame gst-libs/gst/pbutils/pbutils.c

Packit 971217
/* GStreamer base utils library
Packit 971217
 * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
/**
Packit 971217
 * SECTION:gstpbutils
Packit 971217
 * @title: Pbutils
Packit 971217
 * @short_description: General Application and Plugin Utility Library
Packit 971217
 *
Packit 971217
 * libgstpbutils is a general utility library for plugins and applications.
Packit 971217
 * It currently provides the
Packit 971217
 * following:
Packit 971217
 *
Packit 971217
 * * human-readable description strings of codecs, elements, sources, decoders,
Packit 971217
 * encoders, or sinks from decoder/encoder caps, element names, or protocol
Packit 971217
 * names.
Packit 971217
 *
Packit 971217
 * * support for applications to initiate installation of missing plugins (if
Packit 971217
 * this is supported by the distribution or operating system used)
Packit 971217
 *
Packit 971217
 * * API for GStreamer elements to create missing-plugin messages in order to
Packit 971217
 * communicate to the application that a certain type of plugin is missing
Packit 971217
 * (decoder, encoder, URI protocol source, URI protocol sink, named element)
Packit 971217
 *
Packit 971217
 * * API for applications to recognise and handle missing-plugin messages
Packit 971217
 *
Packit 971217
 * ## Linking to this library
Packit 971217
 *
Packit 971217
 * You should obtain the required CFLAGS and LIBS using pkg-config on the
Packit 971217
 * gstreamer-plugins-base-0.10 module. You will then also need to add
Packit 971217
 * '-lgstpbutils-0.10' manually to your LIBS line.
Packit 971217
 *
Packit 971217
 * ## Library initialisation
Packit 971217
 *
Packit 971217
 * Before using any of its functions, applications and plugins must call
Packit 971217
 * gst_pb_utils_init() to initialise the library.
Packit 971217
 *
Packit 971217
 */
Packit 971217
Packit 971217
#ifdef HAVE_CONFIG_H
Packit 971217
# include "config.h"
Packit 971217
#endif
Packit 971217
Packit 971217
#include "pbutils.h"
Packit 971217
#include "pbutils-private.h"
Packit 971217
Packit 971217
#include "gst/gst-i18n-plugin.h"
Packit 971217
Packit 971217
static gpointer
Packit 971217
_init_locale_text_domain (gpointer data)
Packit 971217
{
Packit 971217
#ifdef ENABLE_NLS
Packit 971217
  GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
Packit 971217
      LOCALEDIR);
Packit 971217
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
Packit 971217
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Packit 971217
#endif
Packit 971217
Packit 971217
  return NULL;
Packit 971217
}
Packit 971217
Packit 971217
void
Packit 971217
gst_pb_utils_init_locale_text_domain (void)
Packit 971217
{
Packit 971217
  static GOnce locale_init_once = G_ONCE_INIT;
Packit 971217
Packit 971217
  g_once (&locale_init_once, _init_locale_text_domain, NULL);
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_pb_utils_init:
Packit 971217
 *
Packit 971217
 * Initialises the base utils support library. This function is not
Packit 971217
 * thread-safe. Applications should call it after calling gst_init(),
Packit 971217
 * plugins should call it from their plugin_init function.
Packit 971217
 *
Packit 971217
 * This function may be called multiple times. It will do nothing if the
Packit 971217
 * library has already been initialised.
Packit 971217
 */
Packit 971217
void
Packit 971217
gst_pb_utils_init (void)
Packit 971217
{
Packit 971217
  static gboolean inited;       /* FALSE */
Packit 971217
Packit 971217
  if (inited) {
Packit 971217
    GST_LOG ("already initialised");
Packit 971217
    return;
Packit 971217
  }
Packit 971217
  gst_pb_utils_init_locale_text_domain ();
Packit 971217
Packit 971217
  inited = TRUE;
Packit 971217
}