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.
30 #include "gtkgstwidget.h"
31 #include "gstgtksink.h"
33 GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
34 #define GST_CAT_DEFAULT gst_debug_gtk_sink
36 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
37 #define FORMATS "{ BGRx, BGRA }"
39 #define FORMATS "{ xRGB, ARGB }"
42 static GstStaticPadTemplate gst_gtk_sink_template =
43 GST_STATIC_PAD_TEMPLATE ("sink",
46 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
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,
55 gst_gtk_sink_class_init (GstGtkSinkClass * klass)
57 GstElementClass *gstelement_class;
58 GstGtkBaseSinkClass *base_class;
60 gstelement_class = (GstElementClass *) klass;
61 base_class = (GstGtkBaseSinkClass *) klass;
63 base_class->create_widget = gtk_gst_widget_new;
64 base_class->window_title = "Gtk+ Cairo renderer";
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>");
70 gst_element_class_add_static_pad_template (gstelement_class,
71 &gst_gtk_sink_template);
75 gst_gtk_sink_init (GstGtkSink * gtk_sink)