2 * Copyright (C) 2001 CodeFactory AB
3 * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
4 * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
5 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include "gstalsasink.h"
27 #include "gstalsasrc.h"
28 #include "gstalsamixerelement.h"
30 #include <gst/gst-i18n-plugin.h>
32 GST_DEBUG_CATEGORY (alsa_debug);
34 /* ALSA debugging wrapper */
36 gst_alsa_error_wrapper (const char *file, int line, const char *function,
37 int err, const char *fmt, ...)
39 #ifndef GST_DISABLE_GST_DEBUG
44 str = g_strdup_vprintf (fmt, args);
46 /* FIXME: use GST_LEVEL_ERROR here? Currently warning is used because we're
47 * able to catch enough of the errors that would be printed otherwise
49 gst_debug_log (alsa_debug, GST_LEVEL_WARNING, file, function, line, NULL,
50 "alsalib error: %s%s%s", str, err ? ": " : "",
51 err ? snd_strerror (err) : "");
57 plugin_init (GstPlugin * plugin)
61 if (!gst_element_register (plugin, "alsamixer", GST_RANK_NONE,
62 GST_TYPE_ALSA_MIXER_ELEMENT))
64 if (!gst_element_register (plugin, "alsasrc", GST_RANK_PRIMARY,
67 if (!gst_element_register (plugin, "alsasink", GST_RANK_PRIMARY,
71 GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins");
74 GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
76 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
77 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
80 err = snd_lib_error_set_handler (gst_alsa_error_wrapper);
82 GST_WARNING ("failed to set alsa error handler");
87 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
90 "ALSA plugin library",
91 plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)