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-gtkgstsink
23 * @title: gtkgstsink
24 *
25 */
26
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31 #include "gtkgstwidget.h"
32 #include "gstgtksink.h"
33
34 GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
35 #define GST_CAT_DEFAULT gst_debug_gtk_sink
36
37 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
38 #define FORMATS "{ BGRx, BGRA }"
39 #else
40 #define FORMATS "{ xRGB, ARGB }"
41 #endif
42
43 static GstStaticPadTemplate gst_gtk_sink_template =
44 GST_STATIC_PAD_TEMPLATE ("sink",
45 GST_PAD_SINK,
46 GST_PAD_ALWAYS,
47 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
48 );
49
50 #define gst_gtk_sink_parent_class parent_class
51 G_DEFINE_TYPE_WITH_CODE (GstGtkSink, gst_gtk_sink, GST_TYPE_GTK_BASE_SINK,
52 GST_DEBUG_CATEGORY_INIT (gst_debug_gtk_sink, "gtksink", 0,
53 "Gtk Video Sink"));
54
55 static void
gst_gtk_sink_class_init(GstGtkSinkClass * klass)56 gst_gtk_sink_class_init (GstGtkSinkClass * klass)
57 {
58 GstElementClass *gstelement_class;
59 GstGtkBaseSinkClass *base_class;
60
61 gstelement_class = (GstElementClass *) klass;
62 base_class = (GstGtkBaseSinkClass *) klass;
63
64 base_class->create_widget = gtk_gst_widget_new;
65 base_class->window_title = "Gtk+ Cairo renderer";
66
67 gst_element_class_set_metadata (gstelement_class, "Gtk Video Sink",
68 "Sink/Video", "A video sink that renders to a GtkWidget",
69 "Matthew Waters <matthew@centricular.com>");
70
71 gst_element_class_add_static_pad_template (gstelement_class,
72 &gst_gtk_sink_template);
73 }
74
75 static void
gst_gtk_sink_init(GstGtkSink * gtk_sink)76 gst_gtk_sink_init (GstGtkSink * gtk_sink)
77 {
78 }
79