3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
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.
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.
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.
22 * SECTION:element-gtkgstsink
31 #include "gtkgstwidget.h"
32 #include "gstgtksink.h"
34 GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
35 #define GST_CAT_DEFAULT gst_debug_gtk_sink
37 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
38 #define FORMATS "{ BGRx, BGRA }"
40 #define FORMATS "{ xRGB, ARGB }"
43 static GstStaticPadTemplate gst_gtk_sink_template =
44 GST_STATIC_PAD_TEMPLATE ("sink",
47 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
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,
56 gst_gtk_sink_class_init (GstGtkSinkClass * klass)
58 GstElementClass *gstelement_class;
59 GstGtkBaseSinkClass *base_class;
61 gstelement_class = (GstElementClass *) klass;
62 base_class = (GstGtkBaseSinkClass *) klass;
64 base_class->create_widget = gtk_gst_widget_new;
65 base_class->window_title = "Gtk+ Cairo renderer";
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>");
71 gst_element_class_add_static_pad_template (gstelement_class,
72 &gst_gtk_sink_template);
76 gst_gtk_sink_init (GstGtkSink * gtk_sink)