2009-09-08 17:19:19 +00:00
|
|
|
/* GStreamer video sink base class
|
2003-09-14 12:21:06 +00:00
|
|
|
* Copyright (C) <2003> Julien Moutte <julien@moutte.net>
|
2009-09-08 17:19:19 +00:00
|
|
|
* Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
|
2003-09-14 12:21:06 +00:00
|
|
|
*
|
2004-08-11 21:19:13 +00:00
|
|
|
* 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.
|
2003-09-14 12:21:06 +00:00
|
|
|
*
|
2004-08-11 21:19:13 +00:00
|
|
|
* 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.
|
2003-09-14 12:21:06 +00:00
|
|
|
*
|
2004-08-11 21:19:13 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-09-14 12:21:06 +00:00
|
|
|
*/
|
2009-09-08 17:19:19 +00:00
|
|
|
|
|
|
|
/* FIXME 0.11: turn this into a proper base class */
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
#ifndef __GST_VIDEO_SINK_H__
|
|
|
|
#define __GST_VIDEO_SINK_H__
|
2003-09-14 12:21:06 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2005-03-31 09:43:49 +00:00
|
|
|
#include <gst/base/gstbasesink.h>
|
2018-03-13 11:48:31 +00:00
|
|
|
#include <gst/video/video-prelude.h>
|
2021-01-11 10:25:33 +00:00
|
|
|
#include <gst/video/video-info.h>
|
2003-09-14 12:21:06 +00:00
|
|
|
|
2005-02-09 22:31:05 +00:00
|
|
|
G_BEGIN_DECLS
|
2011-05-23 19:58:22 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
#define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
|
|
|
|
#define GST_VIDEO_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
|
|
|
|
#define GST_VIDEO_SINK_CLASS(klass) \
|
2006-04-08 18:09:17 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
|
2005-07-10 12:03:58 +00:00
|
|
|
#define GST_IS_VIDEO_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
|
2006-04-08 18:09:17 +00:00
|
|
|
#define GST_IS_VIDEO_SINK_CLASS(klass) \
|
2005-07-10 12:03:58 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
|
2006-04-08 18:09:17 +00:00
|
|
|
#define GST_VIDEO_SINK_GET_CLASS(klass) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
|
2006-12-15 10:52:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VIDEO_SINK_CAST:
|
|
|
|
* @obj: a #GstVideoSink or derived object
|
|
|
|
*
|
|
|
|
* Cast @obj to a #GstVideoSink without runtime type check.
|
|
|
|
*/
|
|
|
|
#define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VIDEO_SINK_PAD:
|
|
|
|
* @obj: a #GstVideoSink
|
|
|
|
*
|
|
|
|
* Get the sink #GstPad of @obj.
|
|
|
|
*/
|
|
|
|
#define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
|
|
|
|
|
|
|
|
#define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
|
|
|
|
#define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
|
2011-05-23 19:58:22 +00:00
|
|
|
|
2004-03-15 16:32:55 +00:00
|
|
|
typedef struct _GstVideoSink GstVideoSink;
|
|
|
|
typedef struct _GstVideoSinkClass GstVideoSinkClass;
|
2005-11-16 15:59:21 +00:00
|
|
|
typedef struct _GstVideoRectangle GstVideoRectangle;
|
2009-09-08 16:59:30 +00:00
|
|
|
typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
|
2005-11-16 15:59:21 +00:00
|
|
|
|
2005-11-30 18:57:48 +00:00
|
|
|
/**
|
|
|
|
* GstVideoRectangle:
|
|
|
|
* @x: X coordinate of rectangle's top-left point
|
|
|
|
* @y: Y coordinate of rectangle's top-left point
|
|
|
|
* @w: width of the rectangle
|
|
|
|
* @h: height of the rectangle
|
|
|
|
*
|
|
|
|
* Helper structure representing a rectangular area.
|
|
|
|
*/
|
2005-11-16 15:59:21 +00:00
|
|
|
struct _GstVideoRectangle {
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
gint w;
|
|
|
|
gint h;
|
|
|
|
};
|
2004-03-15 16:32:55 +00:00
|
|
|
|
2009-09-08 17:19:19 +00:00
|
|
|
/**
|
|
|
|
* GstVideoSink:
|
|
|
|
* @height: video height (derived class needs to set this)
|
|
|
|
* @width: video width (derived class needs to set this)
|
|
|
|
*
|
|
|
|
* The video sink instance structure. Derived video sinks should set the
|
|
|
|
* @height and @width members.
|
|
|
|
*/
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstVideoSink {
|
2009-09-08 17:19:19 +00:00
|
|
|
GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
|
2011-05-23 19:58:22 +00:00
|
|
|
|
|
|
|
/*< public >*/
|
2004-03-15 16:32:55 +00:00
|
|
|
gint width, height;
|
2011-05-23 19:58:22 +00:00
|
|
|
|
2009-09-08 17:19:19 +00:00
|
|
|
/*< private >*/
|
2009-09-08 16:59:30 +00:00
|
|
|
GstVideoSinkPrivate *priv;
|
|
|
|
|
2012-09-10 09:41:22 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2004-03-15 16:32:55 +00:00
|
|
|
};
|
|
|
|
|
2009-09-08 17:19:19 +00:00
|
|
|
/**
|
|
|
|
* GstVideoSinkClass:
|
|
|
|
* @parent_class: the parent class structure
|
2011-08-20 17:16:42 +00:00
|
|
|
* @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
|
|
|
|
* #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
|
2017-01-23 19:36:11 +00:00
|
|
|
* suppressed if the #GstVideoSink:show-preroll-frame property is set to
|
2012-07-13 10:11:06 +00:00
|
|
|
* %FALSE.
|
2009-09-08 17:19:19 +00:00
|
|
|
*
|
|
|
|
* The video sink class structure. Derived classes should override the
|
|
|
|
* @show_frame virtual function.
|
|
|
|
*/
|
2004-03-15 16:32:55 +00:00
|
|
|
struct _GstVideoSinkClass {
|
2005-03-31 09:43:49 +00:00
|
|
|
GstBaseSinkClass parent_class;
|
2009-09-08 17:19:19 +00:00
|
|
|
|
|
|
|
GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
|
|
|
|
|
2021-01-11 10:25:33 +00:00
|
|
|
/**
|
|
|
|
* GstVideoSinkClass::set_info:
|
|
|
|
* @caps: A #GstCaps.
|
|
|
|
* @info: A #GstVideoInfo corresponding to @caps.
|
|
|
|
*
|
|
|
|
* Notifies the subclass of changed #GstVideoInfo.
|
|
|
|
*
|
|
|
|
* Since: 1.20
|
|
|
|
*/
|
|
|
|
gboolean (*set_info) (GstVideoSink *video_sink, GstCaps *caps, const GstVideoInfo *info);
|
|
|
|
|
2009-09-08 17:19:19 +00:00
|
|
|
/*< private >*/
|
2021-01-11 10:25:33 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING-1];
|
2004-03-15 16:32:55 +00:00
|
|
|
};
|
|
|
|
|
2018-03-13 11:48:31 +00:00
|
|
|
GST_VIDEO_API
|
2005-07-10 12:03:58 +00:00
|
|
|
GType gst_video_sink_get_type (void);
|
2003-09-14 12:21:06 +00:00
|
|
|
|
2021-05-19 11:11:15 +00:00
|
|
|
GST_VIDEO_DEPRECATED_FOR(gst_video_center_rect)
|
2005-11-16 15:59:21 +00:00
|
|
|
void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
|
|
|
|
GstVideoRectangle *result, gboolean scaling);
|
|
|
|
|
2021-05-19 11:11:15 +00:00
|
|
|
GST_VIDEO_API
|
|
|
|
void gst_video_center_rect (const GstVideoRectangle * src,
|
|
|
|
const GstVideoRectangle * dst,
|
|
|
|
GstVideoRectangle * result,
|
|
|
|
gboolean scaling);
|
|
|
|
|
2015-11-10 17:54:23 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoSink, gst_object_unref)
|
|
|
|
|
2005-02-09 22:31:05 +00:00
|
|
|
G_END_DECLS
|
2003-09-14 12:21:06 +00:00
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
#endif /* __GST_VIDEO_SINK_H__ */
|