1 /* GStreamer video sink base class
2 * Copyright (C) <2003> Julien Moutte <julien@moutte.net>
3 * Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
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., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 /* FIXME 0.11: turn this into a proper base class */
23 #ifndef __GST_VIDEO_SINK_H__
24 #define __GST_VIDEO_SINK_H__
27 #include <gst/base/gstbasesink.h>
31 #define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
32 #define GST_VIDEO_SINK(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
34 #define GST_VIDEO_SINK_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
36 #define GST_IS_VIDEO_SINK(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
38 #define GST_IS_VIDEO_SINK_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
40 #define GST_VIDEO_SINK_GET_CLASS(klass) \
41 (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
44 * GST_VIDEO_SINK_CAST:
45 * @obj: a #GstVideoSink or derived object
47 * Cast @obj to a #GstVideoSink without runtime type check.
51 #define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
55 * @obj: a #GstVideoSink
57 * Get the sink #GstPad of @obj.
59 #define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
61 #define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
62 #define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
64 typedef struct _GstVideoSink GstVideoSink;
65 typedef struct _GstVideoSinkClass GstVideoSinkClass;
66 typedef struct _GstVideoRectangle GstVideoRectangle;
67 typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
71 * @x: X coordinate of rectangle's top-left point
72 * @y: Y coordinate of rectangle's top-left point
73 * @w: width of the rectangle
74 * @h: height of the rectangle
76 * Helper structure representing a rectangular area.
78 struct _GstVideoRectangle {
87 * @height: video height (derived class needs to set this)
88 * @width: video width (derived class needs to set this)
90 * The video sink instance structure. Derived video sinks should set the
91 * @height and @width members.
93 struct _GstVideoSink {
94 GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
100 GstVideoSinkPrivate *priv;
102 gpointer _gst_reserved[GST_PADDING - 1];
107 * @parent_class: the parent class structure
108 * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
109 * #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
110 * suppressed if the #GstVideoSink:show-preroll-frame property is set to
111 * %FALSE. Since: 0.10.25
113 * The video sink class structure. Derived classes should override the
114 * @show_frame virtual function.
116 struct _GstVideoSinkClass {
117 GstBaseSinkClass parent_class;
119 GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
122 gpointer _gst_reserved[GST_PADDING - 1];
125 GType gst_video_sink_get_type (void);
127 void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
128 GstVideoRectangle *result, gboolean scaling);
132 #endif /* __GST_VIDEO_SINK_H__ */