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., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, 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>
28 #include <gst/video/video-prelude.h>
32 #define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
33 #define GST_VIDEO_SINK(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
35 #define GST_VIDEO_SINK_CLASS(klass) \
36 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
37 #define GST_IS_VIDEO_SINK(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
39 #define GST_IS_VIDEO_SINK_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
41 #define GST_VIDEO_SINK_GET_CLASS(klass) \
42 (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
45 * GST_VIDEO_SINK_CAST:
46 * @obj: a #GstVideoSink or derived object
48 * Cast @obj to a #GstVideoSink without runtime type check.
50 #define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
54 * @obj: a #GstVideoSink
56 * Get the sink #GstPad of @obj.
58 #define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
60 #define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
61 #define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
63 typedef struct _GstVideoSink GstVideoSink;
64 typedef struct _GstVideoSinkClass GstVideoSinkClass;
65 typedef struct _GstVideoRectangle GstVideoRectangle;
66 typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
70 * @x: X coordinate of rectangle's top-left point
71 * @y: Y coordinate of rectangle's top-left point
72 * @w: width of the rectangle
73 * @h: height of the rectangle
75 * Helper structure representing a rectangular area.
77 struct _GstVideoRectangle {
86 * @height: video height (derived class needs to set this)
87 * @width: video width (derived class needs to set this)
89 * The video sink instance structure. Derived video sinks should set the
90 * @height and @width members.
92 struct _GstVideoSink {
93 GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
99 GstVideoSinkPrivate *priv;
101 gpointer _gst_reserved[GST_PADDING];
106 * @parent_class: the parent class structure
107 * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
108 * #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
109 * suppressed if the #GstVideoSink:show-preroll-frame property is set to
112 * The video sink class structure. Derived classes should override the
113 * @show_frame virtual function.
115 struct _GstVideoSinkClass {
116 GstBaseSinkClass parent_class;
118 GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
121 gpointer _gst_reserved[GST_PADDING];
125 GType gst_video_sink_get_type (void);
128 void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
129 GstVideoRectangle *result, gboolean scaling);
131 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
132 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoSink, gst_object_unref)
137 #endif /* __GST_VIDEO_SINK_H__ */