2012-03-17 20:18:19 +00:00
|
|
|
/* GStreamer GdkPixbuf overlay
|
2014-11-29 13:53:03 +00:00
|
|
|
* Copyright (C) 2012-2014 Tim-Philipp Müller <tim centricular net>
|
2012-03-17 20:18:19 +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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
|
|
|
|
* Boston, MA 02110-1335, USA.
|
|
|
|
*/
|
2012-03-17 20:53:31 +00:00
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-gdkpixbufoverlay
|
2018-10-22 09:39:24 +00:00
|
|
|
* @title: gdkpixbufoverlay
|
2012-03-17 20:18:19 +00:00
|
|
|
*
|
2022-11-15 13:38:18 +00:00
|
|
|
* The gdkpixbufoverlay element overlays a provided GdkPixbuf or an image
|
|
|
|
* loaded from file onto a video stream.
|
2012-03-17 20:18:19 +00:00
|
|
|
*
|
2012-03-17 23:41:38 +00:00
|
|
|
* Changing the positioning or overlay width and height properties at runtime
|
|
|
|
* is supported, but it might be prudent to to protect the property setting
|
|
|
|
* code with GST_BASE_TRANSFORM_LOCK and GST_BASE_TRANSFORM_UNLOCK, as
|
|
|
|
* g_object_set() is not atomic for multiple properties passed in one go.
|
|
|
|
*
|
2022-11-15 13:38:18 +00:00
|
|
|
* Changing the image at runtime is supported.
|
2012-03-17 23:41:38 +00:00
|
|
|
*
|
2018-10-22 09:39:24 +00:00
|
|
|
* ## Example launch line
|
2012-03-17 20:18:19 +00:00
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! gdkpixbufoverlay location=image.png ! autovideosink
|
2012-03-17 20:18:19 +00:00
|
|
|
* ]|
|
|
|
|
* Overlays the image in image.png onto the test video picture produced by
|
|
|
|
* videotestsrc.
|
2018-10-22 09:39:24 +00:00
|
|
|
*
|
2012-03-17 20:18:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include "gstgdkpixbufoverlay.h"
|
|
|
|
|
2021-02-12 07:57:55 +00:00
|
|
|
#include "gstgdkpixbufelements.h"
|
2012-08-22 09:08:08 +00:00
|
|
|
#include <gst/video/gstvideometa.h>
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gdkpixbufoverlay_debug);
|
|
|
|
#define GST_CAT_DEFAULT gdkpixbufoverlay_debug
|
|
|
|
|
|
|
|
static void gst_gdk_pixbuf_overlay_set_property (GObject * object,
|
|
|
|
guint property_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_gdk_pixbuf_overlay_get_property (GObject * object,
|
|
|
|
guint property_id, GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_gdk_pixbuf_overlay_finalize (GObject * object);
|
|
|
|
|
|
|
|
static gboolean gst_gdk_pixbuf_overlay_start (GstBaseTransform * trans);
|
|
|
|
static gboolean gst_gdk_pixbuf_overlay_stop (GstBaseTransform * trans);
|
|
|
|
static GstFlowReturn
|
2012-08-22 09:08:08 +00:00
|
|
|
gst_gdk_pixbuf_overlay_transform_frame_ip (GstVideoFilter * filter,
|
|
|
|
GstVideoFrame * frame);
|
2012-03-18 00:11:19 +00:00
|
|
|
static void gst_gdk_pixbuf_overlay_before_transform (GstBaseTransform * trans,
|
|
|
|
GstBuffer * outbuf);
|
2012-08-22 09:08:08 +00:00
|
|
|
static gboolean gst_gdk_pixbuf_overlay_set_info (GstVideoFilter * filter,
|
|
|
|
GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
|
|
|
|
GstVideoInfo * out_info);
|
2013-06-24 15:29:37 +00:00
|
|
|
static gboolean
|
|
|
|
gst_gdk_pixbuf_overlay_load_image (GstGdkPixbufOverlay * overlay,
|
|
|
|
GError ** err);
|
2014-11-29 13:53:03 +00:00
|
|
|
static void gst_gdk_pixbuf_overlay_set_pixbuf (GstGdkPixbufOverlay * overlay,
|
|
|
|
GdkPixbuf * pixbuf);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2012-03-17 23:41:38 +00:00
|
|
|
PROP_LOCATION,
|
2014-11-29 13:53:03 +00:00
|
|
|
PROP_PIXBUF,
|
2014-12-25 14:53:09 +00:00
|
|
|
PROP_POSITIONING_MODE,
|
2012-03-17 23:41:38 +00:00
|
|
|
PROP_OFFSET_X,
|
|
|
|
PROP_OFFSET_Y,
|
|
|
|
PROP_RELATIVE_X,
|
|
|
|
PROP_RELATIVE_Y,
|
2017-01-09 20:04:51 +00:00
|
|
|
PROP_COEF_X,
|
|
|
|
PROP_COEF_Y,
|
2012-03-17 23:41:38 +00:00
|
|
|
PROP_OVERLAY_WIDTH,
|
2012-03-25 00:00:59 +00:00
|
|
|
PROP_OVERLAY_HEIGHT,
|
|
|
|
PROP_ALPHA
|
2012-03-17 20:18:19 +00:00
|
|
|
};
|
|
|
|
|
2014-12-25 14:53:09 +00:00
|
|
|
/* FIXME 2.0: change to absolute positioning */
|
|
|
|
#define DEFAULT_POSITIONING_MODE \
|
|
|
|
GST_GDK_PIXBUF_POSITIONING_PIXELS_RELATIVE_TO_EDGES
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2020-03-12 13:16:44 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE
|
|
|
|
(GST_VIDEO_OVERLAY_COMPOSITION_BLEND_FORMATS))
|
2012-03-17 20:18:19 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2020-03-12 13:16:44 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE
|
|
|
|
(GST_VIDEO_OVERLAY_COMPOSITION_BLEND_FORMATS))
|
2012-03-17 20:18:19 +00:00
|
|
|
);
|
|
|
|
|
2012-08-22 09:08:08 +00:00
|
|
|
G_DEFINE_TYPE (GstGdkPixbufOverlay, gst_gdk_pixbuf_overlay,
|
|
|
|
GST_TYPE_VIDEO_FILTER);
|
2021-02-12 07:57:55 +00:00
|
|
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (gdkpixbufoverlay, "gdkpixbufoverlay",
|
|
|
|
GST_RANK_NONE, GST_TYPE_GDK_PIXBUF_OVERLAY,
|
|
|
|
gdk_pixbuf_element_init (plugin));
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2014-12-25 14:53:09 +00:00
|
|
|
#define GST_TYPE_GDK_PIXBUF_POSITIONING_MODE \
|
|
|
|
(gst_gdk_pixbuf_positioning_mode_get_type())
|
|
|
|
|
|
|
|
static GType
|
|
|
|
gst_gdk_pixbuf_positioning_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static const GEnumValue pos_modes[] = {
|
|
|
|
{GST_GDK_PIXBUF_POSITIONING_PIXELS_RELATIVE_TO_EDGES,
|
|
|
|
"pixels-relative-to-edges", "pixels-relative-to-edges"},
|
|
|
|
{GST_GDK_PIXBUF_POSITIONING_PIXELS_ABSOLUTE, "pixels-absolute",
|
|
|
|
"pixels-absolute"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
static GType type; /* 0 */
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
type = g_enum_register_static ("GstGdkPixbufPositioningMode", pos_modes);
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
static void
|
|
|
|
gst_gdk_pixbuf_overlay_class_init (GstGdkPixbufOverlayClass * klass)
|
|
|
|
{
|
2012-08-22 09:08:08 +00:00
|
|
|
GstVideoFilterClass *videofilter_class = GST_VIDEO_FILTER_CLASS (klass);
|
2012-03-17 20:18:19 +00:00
|
|
|
GstBaseTransformClass *basetrans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
2012-08-22 09:08:08 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
2012-03-17 20:18:19 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->set_property = gst_gdk_pixbuf_overlay_set_property;
|
|
|
|
gobject_class->get_property = gst_gdk_pixbuf_overlay_get_property;
|
|
|
|
gobject_class->finalize = gst_gdk_pixbuf_overlay_finalize;
|
|
|
|
|
|
|
|
basetrans_class->start = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_overlay_start);
|
|
|
|
basetrans_class->stop = GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_overlay_stop);
|
2012-08-22 09:08:08 +00:00
|
|
|
|
2012-03-18 00:11:19 +00:00
|
|
|
basetrans_class->before_transform =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_overlay_before_transform);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2012-08-22 09:08:08 +00:00
|
|
|
videofilter_class->set_info =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_overlay_set_info);
|
|
|
|
videofilter_class->transform_frame_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_gdk_pixbuf_overlay_transform_frame_ip);
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LOCATION,
|
|
|
|
g_param_spec_string ("location", "location",
|
2013-06-24 15:29:37 +00:00
|
|
|
"Location of image file to overlay", NULL, GST_PARAM_CONTROLLABLE
|
|
|
|
| GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_OFFSET_X,
|
|
|
|
g_param_spec_int ("offset-x", "X Offset",
|
2013-06-21 16:10:28 +00:00
|
|
|
"For positive value, horizontal offset of overlay image in pixels from"
|
|
|
|
" left of video image. For negative value, horizontal offset of overlay"
|
|
|
|
" image in pixels from right of video image", G_MININT, G_MAXINT, 0,
|
2012-03-18 00:11:19 +00:00
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_OFFSET_Y,
|
|
|
|
g_param_spec_int ("offset-y", "Y Offset",
|
2013-06-21 16:10:28 +00:00
|
|
|
"For positive value, vertical offset of overlay image in pixels from"
|
|
|
|
" top of video image. For negative value, vertical offset of overlay"
|
|
|
|
" image in pixels from bottom of video image", G_MININT, G_MAXINT, 0,
|
2012-03-18 00:11:19 +00:00
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_RELATIVE_X,
|
|
|
|
g_param_spec_double ("relative-x", "Relative X Offset",
|
2012-03-18 00:11:19 +00:00
|
|
|
"Horizontal offset of overlay image in fractions of video image "
|
2017-01-09 20:04:51 +00:00
|
|
|
"width, from top-left corner of video image"
|
|
|
|
" (in relative positioning)", -1.0, 1.0, 0.0,
|
2012-03-18 00:11:19 +00:00
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_RELATIVE_Y,
|
|
|
|
g_param_spec_double ("relative-y", "Relative Y Offset",
|
2012-03-18 00:11:19 +00:00
|
|
|
"Vertical offset of overlay image in fractions of video image "
|
2017-01-09 20:04:51 +00:00
|
|
|
"height, from top-left corner of video image"
|
|
|
|
" (in relative positioning)", -1.0, 1.0, 0.0,
|
2012-03-18 00:11:19 +00:00
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_OVERLAY_WIDTH,
|
|
|
|
g_param_spec_int ("overlay-width", "Overlay Width",
|
2012-03-18 00:11:19 +00:00
|
|
|
"Width of overlay image in pixels (0 = same as overlay image)", 0,
|
|
|
|
G_MAXINT, 0,
|
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-17 23:41:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_OVERLAY_HEIGHT,
|
|
|
|
g_param_spec_int ("overlay-height", "Overlay Height",
|
2012-03-18 00:11:19 +00:00
|
|
|
"Height of overlay image in pixels (0 = same as overlay image)", 0,
|
|
|
|
G_MAXINT, 0,
|
|
|
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | G_PARAM_READWRITE
|
|
|
|
| G_PARAM_STATIC_STRINGS));
|
2012-03-25 00:00:59 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ALPHA,
|
|
|
|
g_param_spec_double ("alpha", "Alpha", "Global alpha of overlay image",
|
|
|
|
0.0, 1.0, 1.0, GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING
|
|
|
|
| G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2014-11-29 13:53:03 +00:00
|
|
|
/**
|
|
|
|
* GstGdkPixbufOverlay:pixbuf:
|
|
|
|
*
|
|
|
|
* GdkPixbuf object to render.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PIXBUF,
|
|
|
|
g_param_spec_object ("pixbuf", "Pixbuf", "GdkPixbuf object to render",
|
|
|
|
GDK_TYPE_PIXBUF, GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING
|
|
|
|
| G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2014-12-25 14:53:09 +00:00
|
|
|
/**
|
|
|
|
* GstGdkPixbufOverlay:positioning-mode:
|
|
|
|
*
|
|
|
|
* Positioning mode of offset-x and offset-y properties. Determines how
|
|
|
|
* negative x/y offsets will be interpreted. By default negative values
|
|
|
|
* are for positioning relative to the right/bottom edge of the video
|
|
|
|
* image, but you can use this property to select absolute positioning
|
|
|
|
* relative to a (0, 0) origin in the top-left corner. That way negative
|
|
|
|
* offsets will be to the left/above the video image, which allows you to
|
|
|
|
* smoothly slide logos into and out of the frame if desired.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_POSITIONING_MODE,
|
|
|
|
g_param_spec_enum ("positioning-mode", "Positioning mode",
|
|
|
|
"Positioning mode of offset-x and offset-y properties",
|
|
|
|
GST_TYPE_GDK_PIXBUF_POSITIONING_MODE, DEFAULT_POSITIONING_MODE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2017-01-09 20:04:51 +00:00
|
|
|
/* FIXME the following actually act as a RELATIVE_X/RELATIVE_Y,
|
|
|
|
* but those were already slightly mutated/abused with ABSOLUTE positioning,
|
|
|
|
* so let's keep that and follow suit
|
|
|
|
* Suffice it to say all that could do with cleanup (2.0 ??) */
|
|
|
|
/**
|
|
|
|
* GstGdkPixbufOverlay:coef-x:
|
|
|
|
*
|
|
|
|
* In absolute positioning mode, the x coordinate of overlay image's
|
|
|
|
* top-left corner is now given by
|
|
|
|
* offset-x + (relative-x * overlay_width) + (coef-x * video_width).
|
|
|
|
* This allows to align the image absolutely and relatively
|
|
|
|
* to any edge or center position.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_COEF_X,
|
|
|
|
g_param_spec_double ("coef-x", "Relative X Offset",
|
|
|
|
"Horizontal offset of overlay image in fractions of video image "
|
|
|
|
"width, from top-left corner of video image (absolute positioning)",
|
|
|
|
-1.0, 1.0, 0.0, GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING
|
|
|
|
| G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
/**
|
|
|
|
* GstGdkPixbufOverlay:coef-y:
|
|
|
|
*
|
|
|
|
* In absolute positioning mode, the y coordinate of overlay image's
|
|
|
|
* top-left corner is now given by
|
|
|
|
* offset-y + (relative-y * overlay_height) + (coef-y * video_height).
|
|
|
|
* This allows to align the image absolutely and relatively
|
|
|
|
* to any edge or center position.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_COEF_Y,
|
|
|
|
g_param_spec_double ("coef-y", "Relative Y Offset",
|
|
|
|
"Vertical offset of overlay image in fractions of video image "
|
|
|
|
"height, from top-left corner of video image (absolute positioning)",
|
|
|
|
-1.0, 1.0, 0.0, GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING
|
|
|
|
| G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class, &sink_template);
|
|
|
|
gst_element_class_add_static_pad_template (element_class, &src_template);
|
2012-08-22 09:08:08 +00:00
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (element_class,
|
|
|
|
"GdkPixbuf Overlay", "Filter/Effect/Video",
|
|
|
|
"Overlay an image onto a video stream",
|
|
|
|
"Tim-Philipp Müller <tim centricular net>");
|
2012-03-17 20:18:19 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gdkpixbufoverlay_debug, "gdkpixbufoverlay", 0,
|
|
|
|
"debug category for gdkpixbufoverlay element");
|
2020-05-29 23:29:03 +00:00
|
|
|
|
2020-06-05 22:42:25 +00:00
|
|
|
gst_type_mark_as_plugin_api (GST_TYPE_GDK_PIXBUF_POSITIONING_MODE, 0);
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-22 09:08:08 +00:00
|
|
|
gst_gdk_pixbuf_overlay_init (GstGdkPixbufOverlay * overlay)
|
2012-03-17 20:18:19 +00:00
|
|
|
{
|
2012-03-17 23:41:38 +00:00
|
|
|
overlay->offset_x = 0;
|
|
|
|
overlay->offset_y = 0;
|
|
|
|
|
|
|
|
overlay->relative_x = 0.0;
|
|
|
|
overlay->relative_y = 0.0;
|
|
|
|
|
2017-01-09 20:04:51 +00:00
|
|
|
overlay->coef_x = 0.0;
|
|
|
|
overlay->coef_y = 0.0;
|
|
|
|
|
2014-12-25 14:53:09 +00:00
|
|
|
overlay->positioning_mode = DEFAULT_POSITIONING_MODE;
|
|
|
|
|
2012-03-17 23:41:38 +00:00
|
|
|
overlay->overlay_width = 0;
|
|
|
|
overlay->overlay_height = 0;
|
2012-03-25 00:00:59 +00:00
|
|
|
|
|
|
|
overlay->alpha = 1.0;
|
2014-11-29 13:53:03 +00:00
|
|
|
|
|
|
|
overlay->pixbuf = NULL;
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_gdk_pixbuf_overlay_set_property (GObject * object, guint property_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (object);
|
|
|
|
|
2012-03-17 23:41:38 +00:00
|
|
|
GST_OBJECT_LOCK (overlay);
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
switch (property_id) {
|
2013-06-24 15:29:37 +00:00
|
|
|
case PROP_LOCATION:{
|
|
|
|
GError *err = NULL;
|
2012-03-17 20:18:19 +00:00
|
|
|
g_free (overlay->location);
|
|
|
|
overlay->location = g_value_dup_string (value);
|
2013-06-24 15:29:37 +00:00
|
|
|
if (!gst_gdk_pixbuf_overlay_load_image (overlay, &err)) {
|
|
|
|
GST_ERROR_OBJECT (overlay, "Could not load overlay image: %s",
|
|
|
|
err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
2014-11-29 13:53:03 +00:00
|
|
|
break;
|
2013-06-24 15:29:37 +00:00
|
|
|
}
|
2014-11-29 13:53:03 +00:00
|
|
|
case PROP_PIXBUF:{
|
|
|
|
GdkPixbuf *pixbuf = g_value_get_object (value);
|
|
|
|
|
|
|
|
if (overlay->pixbuf != NULL)
|
|
|
|
g_object_unref (overlay->pixbuf);
|
2017-01-07 19:11:13 +00:00
|
|
|
if (pixbuf) {
|
|
|
|
overlay->pixbuf = g_object_ref (pixbuf);
|
|
|
|
gst_gdk_pixbuf_overlay_set_pixbuf (overlay, g_object_ref (pixbuf));
|
|
|
|
} else {
|
|
|
|
overlay->pixbuf = NULL;
|
|
|
|
gst_buffer_replace (&overlay->pixels, NULL);
|
|
|
|
}
|
2012-03-17 20:18:19 +00:00
|
|
|
break;
|
2014-11-29 13:53:03 +00:00
|
|
|
}
|
2012-03-17 23:41:38 +00:00
|
|
|
case PROP_OFFSET_X:
|
|
|
|
overlay->offset_x = g_value_get_int (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
|
|
|
case PROP_OFFSET_Y:
|
|
|
|
overlay->offset_y = g_value_get_int (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
|
|
|
case PROP_RELATIVE_X:
|
|
|
|
overlay->relative_x = g_value_get_double (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
|
|
|
case PROP_RELATIVE_Y:
|
|
|
|
overlay->relative_y = g_value_get_double (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
2017-01-09 20:04:51 +00:00
|
|
|
case PROP_COEF_X:
|
|
|
|
overlay->coef_x = g_value_get_double (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
|
|
|
case PROP_COEF_Y:
|
|
|
|
overlay->coef_y = g_value_get_double (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
2012-03-17 23:41:38 +00:00
|
|
|
case PROP_OVERLAY_WIDTH:
|
|
|
|
overlay->overlay_width = g_value_get_int (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
|
|
|
case PROP_OVERLAY_HEIGHT:
|
|
|
|
overlay->overlay_height = g_value_get_int (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
2012-03-25 00:00:59 +00:00
|
|
|
case PROP_ALPHA:
|
|
|
|
overlay->alpha = g_value_get_double (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
2014-12-25 14:53:09 +00:00
|
|
|
case PROP_POSITIONING_MODE:
|
|
|
|
overlay->positioning_mode = g_value_get_enum (value);
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
break;
|
2012-03-17 20:18:19 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2012-03-17 23:41:38 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (overlay);
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_gdk_pixbuf_overlay_get_property (GObject * object, guint property_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (object);
|
|
|
|
|
2012-03-17 23:41:38 +00:00
|
|
|
GST_OBJECT_LOCK (overlay);
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
switch (property_id) {
|
|
|
|
case PROP_LOCATION:
|
|
|
|
g_value_set_string (value, overlay->location);
|
|
|
|
break;
|
2014-11-29 13:53:03 +00:00
|
|
|
case PROP_PIXBUF:
|
|
|
|
g_value_set_object (value, overlay->pixbuf);
|
|
|
|
break;
|
2012-03-17 23:41:38 +00:00
|
|
|
case PROP_OFFSET_X:
|
|
|
|
g_value_set_int (value, overlay->offset_x);
|
|
|
|
break;
|
|
|
|
case PROP_OFFSET_Y:
|
|
|
|
g_value_set_int (value, overlay->offset_y);
|
|
|
|
break;
|
|
|
|
case PROP_RELATIVE_X:
|
|
|
|
g_value_set_double (value, overlay->relative_x);
|
|
|
|
break;
|
|
|
|
case PROP_RELATIVE_Y:
|
|
|
|
g_value_set_double (value, overlay->relative_y);
|
|
|
|
break;
|
2017-01-09 20:04:51 +00:00
|
|
|
case PROP_COEF_X:
|
|
|
|
g_value_set_double (value, overlay->coef_x);
|
|
|
|
break;
|
|
|
|
case PROP_COEF_Y:
|
|
|
|
g_value_set_double (value, overlay->coef_y);
|
|
|
|
break;
|
2012-03-17 23:41:38 +00:00
|
|
|
case PROP_OVERLAY_WIDTH:
|
|
|
|
g_value_set_int (value, overlay->overlay_width);
|
|
|
|
break;
|
|
|
|
case PROP_OVERLAY_HEIGHT:
|
|
|
|
g_value_set_int (value, overlay->overlay_height);
|
|
|
|
break;
|
2012-03-25 00:00:59 +00:00
|
|
|
case PROP_ALPHA:
|
|
|
|
g_value_set_double (value, overlay->alpha);
|
|
|
|
break;
|
2014-12-25 14:53:09 +00:00
|
|
|
case PROP_POSITIONING_MODE:
|
|
|
|
g_value_set_enum (value, overlay->positioning_mode);
|
|
|
|
break;
|
2012-03-17 20:18:19 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2012-03-17 23:41:38 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (overlay);
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_gdk_pixbuf_overlay_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (object);
|
|
|
|
|
|
|
|
g_free (overlay->location);
|
|
|
|
overlay->location = NULL;
|
|
|
|
|
2012-08-22 09:08:08 +00:00
|
|
|
G_OBJECT_CLASS (gst_gdk_pixbuf_overlay_parent_class)->finalize (object);
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_gdk_pixbuf_overlay_load_image (GstGdkPixbufOverlay * overlay, GError ** err)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
pixbuf = gdk_pixbuf_new_from_file (overlay->location, err);
|
|
|
|
|
|
|
|
if (pixbuf == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2014-11-29 13:53:03 +00:00
|
|
|
gst_gdk_pixbuf_overlay_set_pixbuf (overlay, pixbuf);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Takes ownership of pixbuf; call with OBJECT_LOCK */
|
|
|
|
static void
|
|
|
|
gst_gdk_pixbuf_overlay_set_pixbuf (GstGdkPixbufOverlay * overlay,
|
|
|
|
GdkPixbuf * pixbuf)
|
|
|
|
{
|
|
|
|
GstVideoMeta *video_meta;
|
|
|
|
guint8 *pixels, *p;
|
|
|
|
gint width, height, stride, w, h, plane;
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
if (!gdk_pixbuf_get_has_alpha (pixbuf)) {
|
|
|
|
GdkPixbuf *alpha_pixbuf;
|
|
|
|
|
|
|
|
/* FIXME: we could do this much more efficiently ourselves below, but
|
|
|
|
* we're lazy for now */
|
|
|
|
/* FIXME: perhaps expose substitute_color via properties */
|
|
|
|
alpha_pixbuf = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
pixbuf = alpha_pixbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
width = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
height = gdk_pixbuf_get_height (pixbuf);
|
|
|
|
stride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
|
|
|
|
|
|
|
/* the memory layout in GdkPixbuf is R-G-B-A, we want:
|
|
|
|
* - B-G-R-A on little-endian platforms
|
|
|
|
* - A-R-G-B on big-endian platforms
|
|
|
|
*/
|
|
|
|
for (h = 0; h < height; ++h) {
|
|
|
|
p = pixels + (h * stride);
|
|
|
|
for (w = 0; w < width; ++w) {
|
|
|
|
guint8 tmp;
|
|
|
|
|
|
|
|
/* R-G-B-A ==> B-G-R-A */
|
|
|
|
tmp = p[0];
|
|
|
|
p[0] = p[2];
|
|
|
|
p[2] = tmp;
|
|
|
|
|
|
|
|
if (G_BYTE_ORDER == G_BIG_ENDIAN) {
|
|
|
|
/* B-G-R-A ==> A-R-G-B */
|
|
|
|
/* we can probably assume sane alignment */
|
|
|
|
*((guint32 *) p) = GUINT32_SWAP_LE_BE (*((guint32 *) p));
|
|
|
|
}
|
|
|
|
|
|
|
|
p += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-29 10:12:48 +00:00
|
|
|
if (overlay->pixels)
|
|
|
|
gst_buffer_unref (overlay->pixels);
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
/* assume we have row padding even for the last row */
|
2012-08-22 09:08:08 +00:00
|
|
|
/* transfer ownership of pixbuf to the buffer */
|
|
|
|
overlay->pixels = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
|
|
|
|
pixels, height * stride, 0, height * stride, pixbuf,
|
|
|
|
(GDestroyNotify) g_object_unref);
|
|
|
|
|
|
|
|
video_meta = gst_buffer_add_video_meta (overlay->pixels,
|
|
|
|
GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB,
|
|
|
|
width, height);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2012-08-22 09:08:08 +00:00
|
|
|
for (plane = 0; plane < video_meta->n_planes; ++plane)
|
|
|
|
video_meta->stride[plane] = stride;
|
2012-03-17 20:18:19 +00:00
|
|
|
|
|
|
|
overlay->update_composition = TRUE;
|
|
|
|
|
2014-11-29 13:53:03 +00:00
|
|
|
GST_INFO_OBJECT (overlay, "Updated pixbuf, %d x %d", width, height);
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_gdk_pixbuf_overlay_start (GstBaseTransform * trans)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (trans);
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
if (overlay->location != NULL) {
|
|
|
|
if (!gst_gdk_pixbuf_overlay_load_image (overlay, &err))
|
|
|
|
goto error_loading_image;
|
|
|
|
|
|
|
|
gst_base_transform_set_passthrough (trans, FALSE);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (overlay, "no image location set, doing nothing");
|
|
|
|
gst_base_transform_set_passthrough (trans, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
error_loading_image:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (overlay, RESOURCE, OPEN_READ,
|
|
|
|
("Could not load overlay image."), ("%s", err->message));
|
|
|
|
g_error_free (err);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_gdk_pixbuf_overlay_stop (GstBaseTransform * trans)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (trans);
|
|
|
|
|
|
|
|
if (overlay->comp) {
|
|
|
|
gst_video_overlay_composition_unref (overlay->comp);
|
|
|
|
overlay->comp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_replace (&overlay->pixels, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-08-22 09:08:08 +00:00
|
|
|
gst_gdk_pixbuf_overlay_set_info (GstVideoFilter * filter, GstCaps * incaps,
|
|
|
|
GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
|
2012-03-17 20:18:19 +00:00
|
|
|
{
|
2012-08-22 09:08:08 +00:00
|
|
|
GST_INFO_OBJECT (filter, "caps: %" GST_PTR_FORMAT, incaps);
|
2012-03-17 20:18:19 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
|
|
|
|
{
|
2014-12-25 14:53:09 +00:00
|
|
|
GstGdkPixbufPositioningMode positioning_mode;
|
2012-03-17 20:18:19 +00:00
|
|
|
GstVideoOverlayComposition *comp;
|
|
|
|
GstVideoOverlayRectangle *rect;
|
2012-08-22 09:08:08 +00:00
|
|
|
GstVideoMeta *overlay_meta;
|
2012-03-17 23:41:38 +00:00
|
|
|
gint x, y, width, height;
|
2013-06-24 15:29:37 +00:00
|
|
|
gint video_width =
|
|
|
|
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_FILTER (overlay)->in_info);
|
|
|
|
gint video_height =
|
|
|
|
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_FILTER (overlay)->in_info);
|
2012-03-17 23:41:38 +00:00
|
|
|
|
2012-03-25 00:00:59 +00:00
|
|
|
if (overlay->comp) {
|
|
|
|
gst_video_overlay_composition_unref (overlay->comp);
|
|
|
|
overlay->comp = NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-24 15:29:37 +00:00
|
|
|
if (overlay->alpha == 0.0 || overlay->pixels == NULL)
|
2012-03-25 00:00:59 +00:00
|
|
|
return;
|
|
|
|
|
2012-08-22 09:08:08 +00:00
|
|
|
overlay_meta = gst_buffer_get_video_meta (overlay->pixels);
|
|
|
|
|
2014-12-25 14:53:09 +00:00
|
|
|
positioning_mode = overlay->positioning_mode;
|
2017-01-09 20:04:51 +00:00
|
|
|
GST_DEBUG_OBJECT (overlay, "overlay positioning mode %d", positioning_mode);
|
2014-12-25 14:53:09 +00:00
|
|
|
|
2012-03-17 23:41:38 +00:00
|
|
|
width = overlay->overlay_width;
|
|
|
|
if (width == 0)
|
2012-08-22 09:08:08 +00:00
|
|
|
width = overlay_meta->width;
|
2012-03-17 23:41:38 +00:00
|
|
|
|
|
|
|
height = overlay->overlay_height;
|
|
|
|
if (height == 0)
|
2012-08-22 09:08:08 +00:00
|
|
|
height = overlay_meta->height;
|
2012-03-17 23:41:38 +00:00
|
|
|
|
2016-10-26 07:16:28 +00:00
|
|
|
if (positioning_mode == GST_GDK_PIXBUF_POSITIONING_PIXELS_ABSOLUTE) {
|
2017-01-09 20:04:51 +00:00
|
|
|
x = overlay->offset_x + (overlay->relative_x * width) +
|
|
|
|
(overlay->coef_x * video_width);
|
|
|
|
y = overlay->offset_y + (overlay->relative_y * height) +
|
|
|
|
(overlay->coef_y * video_height);
|
2016-10-26 07:16:28 +00:00
|
|
|
} else {
|
|
|
|
x = overlay->offset_x < 0 ?
|
|
|
|
video_width + overlay->offset_x - width +
|
|
|
|
(overlay->relative_x * video_width) :
|
|
|
|
overlay->offset_x + (overlay->relative_x * video_width);
|
|
|
|
y = overlay->offset_y < 0 ?
|
|
|
|
video_height + overlay->offset_y - height +
|
|
|
|
(overlay->relative_y * video_height) :
|
|
|
|
overlay->offset_y + (overlay->relative_y * video_height);
|
|
|
|
}
|
|
|
|
|
2012-03-25 00:00:59 +00:00
|
|
|
GST_DEBUG_OBJECT (overlay, "overlay image dimensions: %d x %d, alpha=%.2f",
|
2012-08-22 09:08:08 +00:00
|
|
|
overlay_meta->width, overlay_meta->height, overlay->alpha);
|
2017-01-09 20:04:51 +00:00
|
|
|
GST_DEBUG_OBJECT (overlay, "properties: x,y: %d,%d "
|
|
|
|
"(%g%%,%g%%) coef (%g%%,%g%%) - WxH: %dx%d",
|
2012-03-17 23:41:38 +00:00
|
|
|
overlay->offset_x, overlay->offset_y,
|
|
|
|
overlay->relative_x * 100.0, overlay->relative_y * 100.0,
|
2017-01-09 20:04:51 +00:00
|
|
|
overlay->coef_x * 100.0, overlay->coef_y * 100.0,
|
2012-03-17 23:41:38 +00:00
|
|
|
overlay->overlay_height, overlay->overlay_width);
|
|
|
|
GST_DEBUG_OBJECT (overlay, "overlay rendered: %d x %d @ %d,%d (onto %d x %d)",
|
2013-06-24 15:29:37 +00:00
|
|
|
width, height, x, y, video_width, video_height);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2012-08-30 10:21:01 +00:00
|
|
|
rect = gst_video_overlay_rectangle_new_raw (overlay->pixels,
|
2012-03-17 23:41:38 +00:00
|
|
|
x, y, width, height, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2012-03-25 00:00:59 +00:00
|
|
|
if (overlay->alpha != 1.0)
|
|
|
|
gst_video_overlay_rectangle_set_global_alpha (rect, overlay->alpha);
|
|
|
|
|
2012-03-17 20:18:19 +00:00
|
|
|
comp = gst_video_overlay_composition_new (rect);
|
|
|
|
gst_video_overlay_rectangle_unref (rect);
|
|
|
|
|
|
|
|
overlay->comp = comp;
|
|
|
|
}
|
|
|
|
|
2012-03-18 00:11:19 +00:00
|
|
|
static void
|
|
|
|
gst_gdk_pixbuf_overlay_before_transform (GstBaseTransform * trans,
|
|
|
|
GstBuffer * outbuf)
|
|
|
|
{
|
|
|
|
GstClockTime stream_time;
|
2017-01-21 19:48:22 +00:00
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (trans);
|
|
|
|
gboolean set_passthrough = FALSE;
|
2012-03-18 00:11:19 +00:00
|
|
|
|
|
|
|
stream_time = gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME,
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf));
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
2012-08-22 09:08:08 +00:00
|
|
|
gst_object_sync_values (GST_OBJECT (trans), stream_time);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
2017-01-21 19:48:22 +00:00
|
|
|
/* now properties have been sync'ed; maybe need to update composition */
|
2012-03-17 23:41:38 +00:00
|
|
|
GST_OBJECT_LOCK (overlay);
|
2012-03-17 20:18:19 +00:00
|
|
|
if (G_UNLIKELY (overlay->update_composition)) {
|
|
|
|
gst_gdk_pixbuf_overlay_update_composition (overlay);
|
|
|
|
overlay->update_composition = FALSE;
|
2017-01-21 19:48:22 +00:00
|
|
|
set_passthrough = TRUE;
|
2012-03-17 20:18:19 +00:00
|
|
|
}
|
2012-03-17 23:41:38 +00:00
|
|
|
GST_OBJECT_UNLOCK (overlay);
|
|
|
|
|
2017-01-21 19:48:22 +00:00
|
|
|
/* determine passthrough mode so the buffer is writable if needed
|
|
|
|
* when passed into _transform_ip */
|
|
|
|
if (G_UNLIKELY (set_passthrough))
|
|
|
|
gst_base_transform_set_passthrough (trans, overlay->comp == NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_gdk_pixbuf_overlay_transform_frame_ip (GstVideoFilter * filter,
|
|
|
|
GstVideoFrame * frame)
|
|
|
|
{
|
|
|
|
GstGdkPixbufOverlay *overlay = GST_GDK_PIXBUF_OVERLAY (filter);
|
|
|
|
|
2012-03-25 00:00:59 +00:00
|
|
|
if (overlay->comp != NULL)
|
2012-08-22 09:08:08 +00:00
|
|
|
gst_video_overlay_composition_blend (overlay->comp, frame);
|
2012-03-17 20:18:19 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|