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