gstgtksink.c 2.21 KB
Newer Older
Matthew Waters's avatar
Matthew Waters committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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.
 */

/**
22 23
 * SECTION:element-gtkgstsink
 * @title: gtkgstsink
Matthew Waters's avatar
Matthew Waters committed
24 25 26 27 28 29 30
 *
 */

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

31
#include "gtkgstwidget.h"
Matthew Waters's avatar
Matthew Waters committed
32 33
#include "gstgtksink.h"

34 35 36
GST_DEBUG_CATEGORY (gst_debug_gtk_sink);
#define GST_CAT_DEFAULT gst_debug_gtk_sink

37
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
38
#define FORMATS "{ BGRx, BGRA }"
39
#else
40
#define FORMATS "{ xRGB, ARGB }"
41 42
#endif

Matthew Waters's avatar
Matthew Waters committed
43 44 45 46
static GstStaticPadTemplate gst_gtk_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
47
    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (FORMATS))
Matthew Waters's avatar
Matthew Waters committed
48 49 50
    );

#define gst_gtk_sink_parent_class parent_class
51 52 53
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"));
Matthew Waters's avatar
Matthew Waters committed
54 55 56 57 58

static void
gst_gtk_sink_class_init (GstGtkSinkClass * klass)
{
  GstElementClass *gstelement_class;
59
  GstGtkBaseSinkClass *base_class;
Matthew Waters's avatar
Matthew Waters committed
60 61

  gstelement_class = (GstElementClass *) klass;
62
  base_class = (GstGtkBaseSinkClass *) klass;
Matthew Waters's avatar
Matthew Waters committed
63

64 65
  base_class->create_widget = gtk_gst_widget_new;
  base_class->window_title = "Gtk+ Cairo renderer";
Matthew Waters's avatar
Matthew Waters committed
66 67

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

71 72
  gst_element_class_add_static_pad_template (gstelement_class,
      &gst_gtk_sink_template);
Matthew Waters's avatar
Matthew Waters committed
73 74 75 76 77 78
}

static void
gst_gtk_sink_init (GstGtkSink * gtk_sink)
{
}