Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / sys / v4l2 / gstv4l2.c
1 /* GStreamer
2  *
3  * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
4  *               2006 Edgard Lima <edgard.lima@indt.org.br>
5  *
6  * gstv4l2.c: plugin for v4l2 elements
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include "gst/gst-i18n-plugin.h"
29
30 #include <gst/gst.h>
31 #include <gst/controller/gstcontroller.h>
32
33 #include "gstv4l2object.h"
34 #include "gstv4l2src.h"
35 #ifdef HAVE_EXPERIMENTAL
36 #include "gstv4l2sink.h"
37 #endif
38 #include "gstv4l2radio.h"
39 /* #include "gstv4l2jpegsrc.h" */
40 /* #include "gstv4l2mjpegsrc.h" */
41 /* #include "gstv4l2mjpegsink.h" */
42
43 /* used in v4l2_calls.c and v4l2src_calls.c */
44 GST_DEBUG_CATEGORY (v4l2_debug);
45 GST_DEBUG_CATEGORY (GST_CAT_PERFORMANCE);
46
47 static gboolean
48 plugin_init (GstPlugin * plugin)
49 {
50   GST_DEBUG_CATEGORY_INIT (v4l2_debug, "v4l2", 0, "V4L2 API calls");
51   GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
52
53   /* initialize gst controller library */
54   gst_controller_init (NULL, NULL);
55
56   if (!gst_element_register (plugin, "v4l2src", GST_RANK_PRIMARY,
57           GST_TYPE_V4L2SRC) ||
58 #ifdef HAVE_EXPERIMENTAL
59       !gst_element_register (plugin, "v4l2sink", GST_RANK_NONE,
60           GST_TYPE_V4L2SINK) ||
61 #endif
62       !gst_element_register (plugin, "v4l2radio", GST_RANK_NONE,
63           GST_TYPE_V4L2RADIO) ||
64       /*       !gst_element_register (plugin, "v4l2jpegsrc", */
65       /*           GST_RANK_NONE, GST_TYPE_V4L2JPEGSRC) || */
66       /*       !gst_element_register (plugin, "v4l2mjpegsrc", */
67       /*           GST_RANK_NONE, GST_TYPE_V4L2MJPEGSRC) || */
68       /*       !gst_element_register (plugin, "v4l2mjpegsink", */
69       /*           GST_RANK_NONE, GST_TYPE_V4L2MJPEGSINK)) */
70       FALSE)
71     return FALSE;
72
73 #ifdef ENABLE_NLS
74   setlocale (LC_ALL, "");
75   bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
76   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
77 #endif /* ENABLE_NLS */
78
79   return TRUE;
80 }
81
82 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
83     GST_VERSION_MINOR,
84     "video4linux2",
85     "elements for Video 4 Linux",
86     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)