summaryrefslogtreecommitdiff
path: root/ext/gtk/gstgtksink.c
blob: ba8ea33ca00847a0a4d4046edc60a772bfe2ecde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * GStreamer
 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

/**
 * SECTION:element-gtkgstsink
 * @title: gtkgstsink
 *
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gtkgstwidget.h"
#include "gstgtksink.h"

GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
#define GST_CAT_DEFAULT gst_debug_gtk_sink

#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define FORMATS "{ BGRx, BGRA }"
#else
#define FORMATS "{ xRGB, ARGB }"
#endif

static GstStaticPadTemplate gst_gtk_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
    );

#define gst_gtk_sink_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGtkSink, gst_gtk_sink, GST_TYPE_GTK_BASE_SINK,
    GST_DEBUG_CATEGORY_INIT (gst_debug_gtk_sink, "gtksink", 0,
        "Gtk Video Sink"));

static void
gst_gtk_sink_class_init (GstGtkSinkClass * klass)
{
  GstElementClass *gstelement_class;
  GstGtkBaseSinkClass *base_class;

  gstelement_class = (GstElementClass *) klass;
  base_class = (GstGtkBaseSinkClass *) klass;

  base_class->create_widget = gtk_gst_widget_new;
  base_class->window_title = "Gtk+ Cairo renderer";

  gst_element_class_set_metadata (gstelement_class, "Gtk Video Sink",
      "Sink/Video", "A video sink that renders to a GtkWidget",
      "Matthew Waters <matthew@centricular.com>");

  gst_element_class_add_static_pad_template (gstelement_class,
      &gst_gtk_sink_template);
}

static void
gst_gtk_sink_init (GstGtkSink * gtk_sink)
{
}