1 /* GStreamer Jack plugins
2  * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include "gstjack.h"
25 #include "gstjackaudiosrc.h"
26 #include "gstjackaudiosink.h"
27 
28 GType
gst_jack_connect_get_type(void)29 gst_jack_connect_get_type (void)
30 {
31   static volatile gsize jack_connect_type = 0;
32 
33   if (g_once_init_enter (&jack_connect_type)) {
34     static const GEnumValue jack_connect_enums[] = {
35       {GST_JACK_CONNECT_NONE,
36           "Don't automatically connect ports to physical ports", "none"},
37       {GST_JACK_CONNECT_AUTO,
38           "Automatically connect ports to physical ports", "auto"},
39       {GST_JACK_CONNECT_AUTO_FORCED,
40             "Automatically connect ports to as many physical ports as possible",
41           "auto-forced"},
42       {0, NULL, NULL},
43     };
44     GType tmp = g_enum_register_static ("GstJackConnect", jack_connect_enums);
45     g_once_init_leave (&jack_connect_type, tmp);
46   }
47   return (GType) jack_connect_type;
48 }
49 
50 GType
gst_jack_transport_get_type(void)51 gst_jack_transport_get_type (void)
52 {
53   static volatile gsize type = 0;
54 
55   if (g_once_init_enter (&type)) {
56     static const GFlagsValue flag_values[] = {
57       {GST_JACK_TRANSPORT_MASTER,
58           "Start and stop transport with state changes", "master"},
59       {GST_JACK_TRANSPORT_SLAVE,
60           "Follow transport state changes", "slave"},
61       {0, NULL, NULL},
62     };
63     GType tmp = g_flags_register_static ("GstJackTransport", flag_values);
64     g_once_init_leave (&type, tmp);
65   }
66   return (GType) type;
67 }
68 
69 
70 static gpointer
gst_jack_client_copy(gpointer jclient)71 gst_jack_client_copy (gpointer jclient)
72 {
73   return jclient;
74 }
75 
76 
77 static void
gst_jack_client_free(gpointer jclient)78 gst_jack_client_free (gpointer jclient)
79 {
80   return;
81 }
82 
83 
84 GType
gst_jack_client_get_type(void)85 gst_jack_client_get_type (void)
86 {
87   static volatile gsize jack_client_type = 0;
88 
89   if (g_once_init_enter (&jack_client_type)) {
90     /* hackish, but makes it show up nicely in gst-inspect */
91     GType tmp = g_boxed_type_register_static ("JackClient",
92         (GBoxedCopyFunc) gst_jack_client_copy,
93         (GBoxedFreeFunc) gst_jack_client_free);
94     g_once_init_leave (&jack_client_type, tmp);
95   }
96 
97   return (GType) jack_client_type;
98 }
99 
100 static gboolean
plugin_init(GstPlugin * plugin)101 plugin_init (GstPlugin * plugin)
102 {
103   if (!gst_element_register (plugin, "jackaudiosrc", GST_RANK_PRIMARY,
104           GST_TYPE_JACK_AUDIO_SRC))
105     return FALSE;
106   if (!gst_element_register (plugin, "jackaudiosink", GST_RANK_PRIMARY,
107           GST_TYPE_JACK_AUDIO_SINK))
108     return FALSE;
109 
110   return TRUE;
111 }
112 
113 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
114     GST_VERSION_MINOR,
115     jack,
116     "JACK audio elements",
117     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
118