Blame gst-libs/gst/video/gstvideosink.h

Packit 0652a1
/*  GStreamer video sink base class
Packit 0652a1
 *  Copyright (C) <2003> Julien Moutte <julien@moutte.net>
Packit 0652a1
 *  Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
Packit 0652a1
 *
Packit 0652a1
 * This library is free software; you can redistribute it and/or
Packit 0652a1
 * modify it under the terms of the GNU Library General Public
Packit 0652a1
 * License as published by the Free Software Foundation; either
Packit 0652a1
 * version 2 of the License, or (at your option) any later version.
Packit 0652a1
 *
Packit 0652a1
 * This library is distributed in the hope that it will be useful,
Packit 0652a1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0652a1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 0652a1
 * Library General Public License for more details.
Packit 0652a1
 *
Packit 0652a1
 * You should have received a copy of the GNU Library General Public
Packit 0652a1
 * License along with this library; if not, write to the
Packit 0652a1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 0652a1
 * Boston, MA 02110-1301, USA.
Packit 0652a1
 */
Packit 0652a1
Packit 0652a1
/* FIXME 0.11: turn this into a proper base class */
Packit 0652a1
Packit 0652a1
#ifndef __GST_VIDEO_SINK_H__
Packit 0652a1
#define __GST_VIDEO_SINK_H__
Packit 0652a1
Packit 0652a1
#include <gst/gst.h>
Packit 0652a1
#include <gst/base/gstbasesink.h>
Packit 0652a1
#include <gst/video/video-prelude.h>
Packit 0652a1
Packit 0652a1
G_BEGIN_DECLS
Packit 0652a1
Packit 0652a1
#define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
Packit 0652a1
#define GST_VIDEO_SINK(obj) \
Packit 0652a1
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
Packit 0652a1
#define GST_VIDEO_SINK_CLASS(klass) \
Packit 0652a1
  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
Packit 0652a1
#define GST_IS_VIDEO_SINK(obj) \
Packit 0652a1
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
Packit 0652a1
#define GST_IS_VIDEO_SINK_CLASS(klass) \
Packit 0652a1
  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
Packit 0652a1
#define GST_VIDEO_SINK_GET_CLASS(klass) \
Packit 0652a1
  (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GST_VIDEO_SINK_CAST:
Packit 0652a1
 * @obj: a #GstVideoSink or derived object
Packit 0652a1
 *
Packit 0652a1
 * Cast @obj to a #GstVideoSink without runtime type check.
Packit 0652a1
 */
Packit 0652a1
#define GST_VIDEO_SINK_CAST(obj)  ((GstVideoSink *) (obj))
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GST_VIDEO_SINK_PAD:
Packit 0652a1
 * @obj: a #GstVideoSink
Packit 0652a1
 *
Packit 0652a1
 * Get the sink #GstPad of @obj.
Packit 0652a1
 */
Packit 0652a1
#define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
Packit 0652a1
Packit 0652a1
#define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
Packit 0652a1
#define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
Packit 0652a1
Packit 0652a1
typedef struct _GstVideoSink GstVideoSink;
Packit 0652a1
typedef struct _GstVideoSinkClass GstVideoSinkClass;
Packit 0652a1
typedef struct _GstVideoRectangle GstVideoRectangle;
Packit 0652a1
typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GstVideoRectangle:
Packit 0652a1
 * @x: X coordinate of rectangle's top-left point
Packit 0652a1
 * @y: Y coordinate of rectangle's top-left point
Packit 0652a1
 * @w: width of the rectangle
Packit 0652a1
 * @h: height of the rectangle
Packit 0652a1
 *
Packit 0652a1
 * Helper structure representing a rectangular area.
Packit 0652a1
 */
Packit 0652a1
struct _GstVideoRectangle {
Packit 0652a1
  gint x;
Packit 0652a1
  gint y;
Packit 0652a1
  gint w;
Packit 0652a1
  gint h;
Packit 0652a1
};
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GstVideoSink:
Packit 0652a1
 * @height: video height (derived class needs to set this)
Packit 0652a1
 * @width: video width (derived class needs to set this)
Packit 0652a1
 *
Packit 0652a1
 * The video sink instance structure. Derived video sinks should set the
Packit 0652a1
 * @height and @width members.
Packit 0652a1
 */
Packit 0652a1
struct _GstVideoSink {
Packit 0652a1
  GstBaseSink element;    /* FIXME 0.11: this should not be called 'element' */
Packit 0652a1
Packit 0652a1
  /*< public >*/
Packit 0652a1
  gint width, height;
Packit 0652a1
Packit 0652a1
  /*< private >*/
Packit 0652a1
  GstVideoSinkPrivate *priv;
Packit 0652a1
Packit 0652a1
  gpointer _gst_reserved[GST_PADDING];
Packit 0652a1
};
Packit 0652a1
Packit 0652a1
/**
Packit 0652a1
 * GstVideoSinkClass:
Packit 0652a1
 * @parent_class: the parent class structure
Packit 0652a1
 * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
Packit 0652a1
 *     #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
Packit 0652a1
 *     suppressed if the #GstVideoSink:show-preroll-frame property is set to
Packit 0652a1
 *     %FALSE.
Packit 0652a1
 *
Packit 0652a1
 * The video sink class structure. Derived classes should override the
Packit 0652a1
 * @show_frame virtual function.
Packit 0652a1
 */
Packit 0652a1
struct _GstVideoSinkClass {
Packit 0652a1
  GstBaseSinkClass parent_class;
Packit 0652a1
Packit 0652a1
  GstFlowReturn  (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
Packit 0652a1
Packit 0652a1
  /*< private >*/
Packit 0652a1
  gpointer _gst_reserved[GST_PADDING];
Packit 0652a1
};
Packit 0652a1
Packit 0652a1
GST_VIDEO_API
Packit 0652a1
GType gst_video_sink_get_type (void);
Packit 0652a1
Packit 0652a1
GST_VIDEO_API
Packit 0652a1
void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
Packit 0652a1
                                 GstVideoRectangle *result, gboolean scaling);
Packit 0652a1
Packit 0652a1
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit 0652a1
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVideoSink, gst_object_unref)
Packit 0652a1
#endif
Packit 0652a1
Packit 0652a1
G_END_DECLS
Packit 0652a1
Packit 0652a1
#endif  /* __GST_VIDEO_SINK_H__ */