1 /* PipeWire GStreamer Elements
2  *
3  * Copyright © 2018 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 /**
26  * SECTION:element-pipewiresrc
27  *
28  * <refsect2>
29  * <title>Example launch line</title>
30  * |[
31  * gst-launch -v pipewiresrc ! ximagesink
32  * ]| Shows PipeWire output in an X window.
33  * </refsect2>
34  */
35 
36 #include "config.h"
37 
38 #include "gstpipewiresrc.h"
39 #include "gstpipewiresink.h"
40 #include "gstpipewiredeviceprovider.h"
41 
42 GST_DEBUG_CATEGORY (pipewire_debug);
43 
44 static gboolean
plugin_init(GstPlugin * plugin)45 plugin_init (GstPlugin *plugin)
46 {
47   pw_init (NULL, NULL);
48 
49   gst_element_register (plugin, "pipewiresrc", GST_RANK_PRIMARY + 1,
50       GST_TYPE_PIPEWIRE_SRC);
51   gst_element_register (plugin, "pipewiresink", GST_RANK_NONE,
52       GST_TYPE_PIPEWIRE_SINK);
53 
54 #if HAVE_GSTREAMER_DEVICE_PROVIDER
55   if (!gst_device_provider_register (plugin, "pipewiredeviceprovider",
56        GST_RANK_PRIMARY + 1, GST_TYPE_PIPEWIRE_DEVICE_PROVIDER))
57     return FALSE;
58 #endif
59 
60   GST_DEBUG_CATEGORY_INIT (pipewire_debug, "pipewire", 0, "PipeWire elements");
61 
62   return TRUE;
63 }
64 
65 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
66     GST_VERSION_MINOR,
67     pipewire,
68     "Uses PipeWire to handle media streams",
69     plugin_init, PACKAGE_VERSION, "MIT/X11", "pipewire", "pipewire.org")
70