tizen 2.3 release
[framework/multimedia/gst-plugins-base0.10.git] / gst-libs / gst / video / gstvideosink.h
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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, 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
29 G_BEGIN_DECLS
30
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))
42
43 /**
44  * GST_VIDEO_SINK_CAST:
45  * @obj: a #GstVideoSink or derived object
46  *
47  * Cast @obj to a #GstVideoSink without runtime type check.
48  *
49  * Since: 0.10.12
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
64 typedef struct _GstVideoSink GstVideoSink;
65 typedef struct _GstVideoSinkClass GstVideoSinkClass;
66 typedef struct _GstVideoRectangle GstVideoRectangle;
67 typedef 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  */
78 struct _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  */
93 struct _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 - 1];
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. Since: 0.10.25
112  *
113  * The video sink class structure. Derived classes should override the
114  * @show_frame virtual function.
115  */
116 struct _GstVideoSinkClass {
117   GstBaseSinkClass parent_class;
118
119   GstFlowReturn  (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
120
121   /*< private >*/
122   gpointer _gst_reserved[GST_PADDING - 1];
123 };
124
125 GType gst_video_sink_get_type (void);
126
127 void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
128                                  GstVideoRectangle *result, gboolean scaling);
129
130 G_END_DECLS
131
132 #endif  /* __GST_VIDEO_SINK_H__ */