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>
4 *
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.
9 *
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.
14 *
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.
19 */
20
21/* FIXME 0.11: turn this into a proper base class */
22
23#ifndef __GST_VIDEO_SINK_H__
24#define __GST_VIDEO_SINK_H__
25
26#include <gst/gst.h>
27#include <gst/base/gstbasesink.h>
28#include <gst/video/video-prelude.h>
29#include <gst/video/video-info.h>
30
31G_BEGIN_DECLS
32
33#define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
34#define GST_VIDEO_SINK(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
36#define GST_VIDEO_SINK_CLASS(klass) \
37 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
38#define GST_IS_VIDEO_SINK(obj) \
39 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
40#define GST_IS_VIDEO_SINK_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
42#define GST_VIDEO_SINK_GET_CLASS(klass) \
43 (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
44
45/**
46 * GST_VIDEO_SINK_CAST:
47 * @obj: a #GstVideoSink or derived object
48 *
49 * Cast @obj to a #GstVideoSink without runtime type check.
50 */
51#define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
52
53/**
54 * GST_VIDEO_SINK_PAD:
55 * @obj: a #GstVideoSink
56 *
57 * Get the sink #GstPad of @obj.
58 */
59#define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
60
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)
63
64typedef struct _GstVideoSink GstVideoSink;
65typedef struct _GstVideoSinkClass GstVideoSinkClass;
66typedef struct _GstVideoRectangle GstVideoRectangle;
67typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
68
69/**
70 * GstVideoRectangle:
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
75 *
76 * Helper structure representing a rectangular area.
77 */
78struct _GstVideoRectangle {
79 gint x;
80 gint y;
81 gint w;
82 gint h;
83};
84
85/**
86 * GstVideoSink:
87 * @height: video height (derived class needs to set this)
88 * @width: video width (derived class needs to set this)
89 *
90 * The video sink instance structure. Derived video sinks should set the
91 * @height and @width members.
92 */
93struct _GstVideoSink {
94 GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
95
96 /*< public >*/
97 gint width, height;
98
99 /*< private >*/
100 GstVideoSinkPrivate *priv;
101
102 gpointer _gst_reserved[GST_PADDING];
103};
104
105/**
106 * GstVideoSinkClass:
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.
112 *
113 * The video sink class structure. Derived classes should override the
114 * @show_frame virtual function.
115 */
116struct _GstVideoSinkClass {
117 GstBaseSinkClass parent_class;
118
119 GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
120
121 /**
122 * GstVideoSinkClass::set_info:
123 * @caps: A #GstCaps.
124 * @info: A #GstVideoInfo corresponding to @caps.
125 *
126 * Notifies the subclass of changed #GstVideoInfo.
127 *
128 * Since: 1.20
129 */
130 gboolean (*set_info) (GstVideoSink *video_sink, GstCaps *caps, const GstVideoInfo *info);
131
132 /*< private >*/
133 gpointer _gst_reserved[GST_PADDING-1];
134};
135
136GST_VIDEO_API
137GType gst_video_sink_get_type (void);
138
139GST_VIDEO_DEPRECATED_FOR(gst_video_center_rect)
140void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
141 GstVideoRectangle *result, gboolean scaling);
142
143GST_VIDEO_API
144void gst_video_center_rect (const GstVideoRectangle * src,
145 const GstVideoRectangle * dst,
146 GstVideoRectangle * result,
147 gboolean scaling);
148
149G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoSink, gst_object_unref)
150
151G_END_DECLS
152
153#endif /* __GST_VIDEO_SINK_H__ */
154

source code of include/gstreamer-1.0/gst/video/gstvideosink.h