1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 /**
22  * SECTION:element-gtksink
23  * @title: gtksink
24  *
25  */
26 
27 /**
28  * SECTION:element-gtk4sink
29  * @title: gtk4sink
30  *
31  */
32 
33 #ifdef HAVE_CONFIG_H
34 #include "config.h"
35 #endif
36 
37 #include "gtkconfig.h"
38 #include "gtkgstwidget.h"
39 #include "gstgtksink.h"
40 
41 GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
42 #define GST_CAT_DEFAULT gst_debug_gtk_sink
43 
44 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
45 #define FORMATS "{ BGRx, BGRA }"
46 #else
47 #define FORMATS "{ xRGB, ARGB }"
48 #endif
49 
50 static GstStaticPadTemplate gst_gtk_sink_template =
51 GST_STATIC_PAD_TEMPLATE ("sink",
52     GST_PAD_SINK,
53     GST_PAD_ALWAYS,
54     GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
55     );
56 
57 #define gst_gtk_sink_parent_class parent_class
58 G_DEFINE_TYPE_WITH_CODE (GstGtkSink, gst_gtk_sink, GST_TYPE_GTK_BASE_SINK,
59     GST_DEBUG_CATEGORY_INIT (gst_debug_gtk_sink, GTKCONFIG_SINK, 0,
60         GTKCONFIG_NAME " Video Sink"));
61 
62 static void
gst_gtk_sink_class_init(GstGtkSinkClass * klass)63 gst_gtk_sink_class_init (GstGtkSinkClass * klass)
64 {
65   GstElementClass *gstelement_class;
66   GstGtkBaseSinkClass *base_class;
67 
68   gstelement_class = (GstElementClass *) klass;
69   base_class = (GstGtkBaseSinkClass *) klass;
70 
71   base_class->create_widget = gtk_gst_widget_new;
72   base_class->window_title = GTKCONFIG_NAME " Cairo Renderer";
73 
74   gst_element_class_set_metadata (gstelement_class,
75       GTKCONFIG_NAME " Video Sink",
76       "Sink/Video", "A video sink that renders to a GtkWidget",
77       "Matthew Waters <matthew@centricular.com>");
78 
79   gst_element_class_add_static_pad_template (gstelement_class,
80       &gst_gtk_sink_template);
81 }
82 
83 static void
gst_gtk_sink_init(GstGtkSink * gtk_sink)84 gst_gtk_sink_init (GstGtkSink * gtk_sink)
85 {
86 }
87