gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2008> Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
*
|
|
|
|
* 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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-smptealpha
|
|
|
|
*
|
|
|
|
* smptealpha can accept an I420 or AYUV video stream. An alpha channel is added
|
2009-01-28 10:29:42 +00:00
|
|
|
* using an effect specific SMPTE mask in the I420 input case. In the AYUV case,
|
|
|
|
* the alpha channel is modified using the effect specific SMPTE mask.
|
|
|
|
*
|
|
|
|
* The #GstSmpteAlpha:position property is a controllabe double between 0.0 and
|
|
|
|
* 1.0 that specifies the position in the transition. 0.0 is the start of the
|
|
|
|
* transition with the alpha channel to complete opaque where 1.0 has the alpha
|
|
|
|
* channel set to completely transparent.
|
|
|
|
*
|
|
|
|
* The #GstSmpteAlpha:depth property defines the precision in bits of the mask.
|
|
|
|
* A higher presision will create a mask with smoother gradients in order to
|
|
|
|
* avoid banding.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
* <title>Sample pipelines</title>
|
|
|
|
* <para>
|
|
|
|
* Here is a pipeline to demonstrate the smpte transition :
|
|
|
|
* <programlisting>
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v videotestsrc ! smptealpha border=20000 type=44
|
|
|
|
* position=0.5 ! videomixer ! videoconvert ! ximagesink
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
* </programlisting>
|
|
|
|
* This shows a midway bowtie-h transition a from a videotestsrc to a
|
|
|
|
* transparent image. The edges of the transition are smoothed with a
|
|
|
|
* 20000 big border.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gstsmptealpha.h"
|
|
|
|
#include "paint.h"
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_smpte_alpha_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_smpte_alpha_debug
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_smpte_alpha_src_template =
|
2010-04-17 15:43:51 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-03-22 17:21:52 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("AYUV") ";"
|
|
|
|
GST_VIDEO_CAPS_MAKE ("ARGB") ";" GST_VIDEO_CAPS_MAKE ("BGRA") ";"
|
|
|
|
GST_VIDEO_CAPS_MAKE ("RGBA") ";" GST_VIDEO_CAPS_MAKE ("ARGB"))
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_smpte_alpha_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-03-22 17:21:52 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420") ";"
|
|
|
|
GST_VIDEO_CAPS_MAKE ("YV12")
|
|
|
|
";" GST_VIDEO_CAPS_MAKE ("AYUV")
|
|
|
|
";" GST_VIDEO_CAPS_MAKE ("ARGB") ";" GST_VIDEO_CAPS_MAKE ("BGRA")
|
|
|
|
";" GST_VIDEO_CAPS_MAKE ("RGBA") ";" GST_VIDEO_CAPS_MAKE ("ARGB"))
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
);
|
|
|
|
|
2010-04-16 15:18:15 +00:00
|
|
|
/* SMPTE signals and properties */
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
#define DEFAULT_PROP_TYPE 1
|
|
|
|
#define DEFAULT_PROP_BORDER 0
|
|
|
|
#define DEFAULT_PROP_DEPTH 16
|
|
|
|
#define DEFAULT_PROP_POSITION 0.0
|
2010-04-15 20:28:58 +00:00
|
|
|
#define DEFAULT_PROP_INVERT FALSE
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_TYPE,
|
|
|
|
PROP_BORDER,
|
|
|
|
PROP_DEPTH,
|
|
|
|
PROP_POSITION,
|
2015-04-24 16:01:10 +00:00
|
|
|
PROP_INVERT
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define AYUV_SIZE(w,h) ((w) * (h) * 4)
|
|
|
|
|
|
|
|
#define GST_TYPE_SMPTE_TRANSITION_TYPE (gst_smpte_alpha_transition_type_get_type())
|
|
|
|
static GType
|
|
|
|
gst_smpte_alpha_transition_type_get_type (void)
|
|
|
|
{
|
|
|
|
static GType smpte_transition_type = 0;
|
|
|
|
GEnumValue *smpte_transitions;
|
|
|
|
|
|
|
|
if (!smpte_transition_type) {
|
|
|
|
const GList *definitions;
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
definitions = gst_mask_get_definitions ();
|
|
|
|
smpte_transitions =
|
|
|
|
g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
|
|
|
|
|
|
|
|
while (definitions) {
|
|
|
|
GstMaskDefinition *definition = (GstMaskDefinition *) definitions->data;
|
|
|
|
|
|
|
|
definitions = g_list_next (definitions);
|
|
|
|
|
|
|
|
smpte_transitions[i].value = definition->type;
|
|
|
|
/* older GLib versions have the two fields as non-const, hence the cast */
|
|
|
|
smpte_transitions[i].value_nick = (gchar *) definition->short_name;
|
|
|
|
smpte_transitions[i].value_name = (gchar *) definition->long_name;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
smpte_transition_type =
|
|
|
|
g_enum_register_static ("GstSMPTEAlphaTransitionType",
|
|
|
|
smpte_transitions);
|
|
|
|
}
|
|
|
|
return smpte_transition_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void gst_smpte_alpha_finalize (GstSMPTEAlpha * smpte);
|
|
|
|
|
|
|
|
static void gst_smpte_alpha_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_smpte_alpha_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
static gboolean gst_smpte_alpha_set_info (GstVideoFilter * vfilter,
|
|
|
|
GstCaps * incaps, GstVideoInfo * in_info,
|
|
|
|
GstCaps * outcaps, GstVideoInfo * out_info);
|
|
|
|
static GstFlowReturn gst_smpte_alpha_transform_frame (GstVideoFilter * vfilter,
|
|
|
|
GstVideoFrame * in_frame, GstVideoFrame * out_frame);
|
2010-04-19 12:45:33 +00:00
|
|
|
static void gst_smpte_alpha_before_transform (GstBaseTransform * trans,
|
|
|
|
GstBuffer * buf);
|
2010-04-17 15:43:51 +00:00
|
|
|
static GstCaps *gst_smpte_alpha_transform_caps (GstBaseTransform * trans,
|
2012-03-22 17:21:52 +00:00
|
|
|
GstPadDirection direction, GstCaps * from, GstCaps * filter);
|
2010-04-16 15:27:02 +00:00
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
#define gst_smpte_alpha_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstSMPTEAlpha, gst_smpte_alpha, GST_TYPE_VIDEO_FILTER);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_smpte_alpha_class_init (GstSMPTEAlphaClass * klass)
|
|
|
|
{
|
2010-04-16 15:18:15 +00:00
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
2012-03-22 17:21:52 +00:00
|
|
|
GstElementClass *element_class = (GstElementClass *) (klass);
|
2010-04-16 15:18:15 +00:00
|
|
|
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
|
2012-03-22 17:21:52 +00:00
|
|
|
GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_smpte_alpha_set_property;
|
|
|
|
gobject_class->get_property = gst_smpte_alpha_get_property;
|
|
|
|
|
|
|
|
gobject_class->finalize = (GObjectFinalizeFunc) gst_smpte_alpha_finalize;
|
|
|
|
|
|
|
|
_gst_mask_init ();
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TYPE,
|
|
|
|
g_param_spec_enum ("type", "Type", "The type of transition to use",
|
|
|
|
GST_TYPE_SMPTE_TRANSITION_TYPE, DEFAULT_PROP_TYPE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BORDER,
|
|
|
|
g_param_spec_int ("border", "Border",
|
|
|
|
"The border width of the transition", 0, G_MAXINT,
|
2010-04-16 15:18:15 +00:00
|
|
|
DEFAULT_PROP_BORDER,
|
|
|
|
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEPTH,
|
|
|
|
g_param_spec_int ("depth", "Depth", "Depth of the mask in bits", 1, 24,
|
|
|
|
DEFAULT_PROP_DEPTH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_POSITION,
|
|
|
|
g_param_spec_double ("position", "Position",
|
|
|
|
"Position of the transition effect", 0.0, 1.0, DEFAULT_PROP_POSITION,
|
|
|
|
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-04-29 19:08:43 +00:00
|
|
|
/**
|
|
|
|
* GstSMPTEAlpha:invert:
|
|
|
|
*
|
|
|
|
* Set to TRUE to invert the transition mask (ie. flip it horizontally).
|
|
|
|
*/
|
2010-04-15 20:28:58 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_INVERT,
|
|
|
|
g_param_spec_boolean ("invert", "Invert",
|
|
|
|
"Invert transition mask", DEFAULT_PROP_POSITION,
|
|
|
|
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
2010-04-19 12:45:33 +00:00
|
|
|
trans_class->before_transform =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_smpte_alpha_before_transform);
|
2010-04-17 15:43:51 +00:00
|
|
|
trans_class->transform_caps =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_smpte_alpha_transform_caps);
|
2012-03-22 17:21:52 +00:00
|
|
|
|
|
|
|
vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_smpte_alpha_set_info);
|
|
|
|
vfilter_class->transform_frame =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_smpte_alpha_transform_frame);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_smpte_alpha_sink_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_smpte_alpha_src_template));
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class, "SMPTE transitions",
|
2012-03-22 17:21:52 +00:00
|
|
|
"Filter/Editor/Video",
|
|
|
|
"Apply the standard SMPTE transitions as alpha on video images",
|
|
|
|
"Wim Taymans <wim.taymans@gmail.com>");
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-04-15 20:28:58 +00:00
|
|
|
gst_smpte_alpha_update_mask (GstSMPTEAlpha * smpte, gint type,
|
|
|
|
gboolean invert, gint depth, gint width, gint height)
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
{
|
|
|
|
GstMask *newmask;
|
|
|
|
|
|
|
|
/* try to avoid regenerating the mask if we already have one that is
|
|
|
|
* correct */
|
|
|
|
if (smpte->mask) {
|
|
|
|
if (smpte->type == type &&
|
2010-04-15 20:28:58 +00:00
|
|
|
smpte->invert == invert &&
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
smpte->depth == depth &&
|
|
|
|
smpte->width == width && smpte->height == height)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-04-15 20:27:57 +00:00
|
|
|
smpte->type = type;
|
2010-04-15 20:28:58 +00:00
|
|
|
smpte->invert = invert;
|
2010-04-15 20:27:57 +00:00
|
|
|
smpte->depth = depth;
|
|
|
|
smpte->width = width;
|
|
|
|
smpte->height = height;
|
|
|
|
|
|
|
|
/* Not negotiated yet */
|
|
|
|
if (width == 0 || height == 0) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-04-15 20:28:58 +00:00
|
|
|
newmask = gst_mask_factory_new (type, invert, depth, width, height);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
if (!newmask)
|
|
|
|
goto mask_failed;
|
|
|
|
|
|
|
|
if (smpte->mask)
|
|
|
|
gst_mask_destroy (smpte->mask);
|
|
|
|
|
|
|
|
smpte->mask = newmask;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
mask_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (smpte, "failed to create a mask");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_init (GstSMPTEAlpha * smpte)
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
{
|
|
|
|
smpte->type = DEFAULT_PROP_TYPE;
|
|
|
|
smpte->border = DEFAULT_PROP_BORDER;
|
|
|
|
smpte->depth = DEFAULT_PROP_DEPTH;
|
2010-04-15 20:27:57 +00:00
|
|
|
smpte->position = DEFAULT_PROP_POSITION;
|
2010-04-15 20:28:58 +00:00
|
|
|
smpte->invert = DEFAULT_PROP_INVERT;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
|
2010-04-17 15:43:51 +00:00
|
|
|
#define CREATE_ARGB_FUNC(name, A, R, G, B) \
|
|
|
|
static void \
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_process_##name##_##name (GstSMPTEAlpha * smpte, \
|
|
|
|
const GstVideoFrame * in_frame, GstVideoFrame * out_frame, GstMask * mask, \
|
|
|
|
gint border, gint pos) \
|
2010-04-17 15:43:51 +00:00
|
|
|
{ \
|
|
|
|
gint i, j; \
|
|
|
|
const guint32 *maskp; \
|
|
|
|
gint value; \
|
|
|
|
gint min, max; \
|
2012-03-22 17:21:52 +00:00
|
|
|
gint width, height; \
|
|
|
|
guint8 *in, *out; \
|
|
|
|
gint src_wrap, dest_wrap; \
|
2010-04-17 15:43:51 +00:00
|
|
|
\
|
|
|
|
if (border == 0) \
|
|
|
|
border++; \
|
|
|
|
\
|
|
|
|
min = pos - border; \
|
|
|
|
max = pos; \
|
|
|
|
GST_DEBUG_OBJECT (smpte, "pos %d, min %d, max %d, border %d", pos, min, max, \
|
|
|
|
border); \
|
|
|
|
\
|
|
|
|
maskp = mask->data; \
|
|
|
|
\
|
2012-03-22 17:21:52 +00:00
|
|
|
width = GST_VIDEO_FRAME_WIDTH (out_frame); \
|
|
|
|
height = GST_VIDEO_FRAME_HEIGHT (out_frame); \
|
|
|
|
\
|
|
|
|
in = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0); \
|
|
|
|
out = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0); \
|
|
|
|
src_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0) - (width << 2); \
|
|
|
|
dest_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0) - (width << 2); \
|
|
|
|
\
|
2010-04-17 15:43:51 +00:00
|
|
|
/* we basically copy the source to dest but we scale the alpha channel with \
|
|
|
|
* the mask */ \
|
|
|
|
for (i = 0; i < height; i++) { \
|
|
|
|
for (j = 0; j < width; j++) { \
|
|
|
|
value = *maskp++; \
|
|
|
|
out[A] = (in[A] * ((CLAMP (value, min, max) - min) << 8) / border) >> 8; \
|
|
|
|
out[R] = in[R]; \
|
|
|
|
out[G] = in[G]; \
|
|
|
|
out[B] = in[B]; \
|
|
|
|
out += 4; \
|
|
|
|
in += 4; \
|
|
|
|
} \
|
2012-03-22 17:21:52 +00:00
|
|
|
in += src_wrap; \
|
|
|
|
out += dest_wrap; \
|
2010-04-17 15:43:51 +00:00
|
|
|
} \
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
|
2010-04-17 15:43:51 +00:00
|
|
|
CREATE_ARGB_FUNC (argb, 0, 1, 2, 3);
|
|
|
|
CREATE_ARGB_FUNC (bgra, 3, 2, 1, 0);
|
|
|
|
CREATE_ARGB_FUNC (abgr, 0, 3, 2, 1);
|
|
|
|
CREATE_ARGB_FUNC (rgba, 3, 0, 1, 2);
|
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
static void
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_process_ayuv_ayuv (GstSMPTEAlpha * smpte,
|
|
|
|
const GstVideoFrame * in_frame, GstVideoFrame * out_frame, GstMask * mask,
|
|
|
|
gint border, gint pos)
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
{
|
|
|
|
gint i, j;
|
2010-04-16 15:27:02 +00:00
|
|
|
const guint32 *maskp;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
gint value;
|
|
|
|
gint min, max;
|
2012-03-22 17:21:52 +00:00
|
|
|
gint width, height;
|
|
|
|
guint8 *in, *out;
|
|
|
|
gint src_wrap, dest_wrap;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
if (border == 0)
|
|
|
|
border++;
|
|
|
|
|
|
|
|
min = pos - border;
|
|
|
|
max = pos;
|
|
|
|
GST_DEBUG_OBJECT (smpte, "pos %d, min %d, max %d, border %d", pos, min, max,
|
|
|
|
border);
|
|
|
|
|
|
|
|
maskp = mask->data;
|
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
width = GST_VIDEO_FRAME_WIDTH (out_frame);
|
|
|
|
height = GST_VIDEO_FRAME_HEIGHT (out_frame);
|
|
|
|
|
|
|
|
in = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
|
|
|
|
out = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
|
|
|
|
src_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0) - (width << 2);
|
|
|
|
dest_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0) - (width << 2);
|
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
/* we basically copy the source to dest but we scale the alpha channel with
|
|
|
|
* the mask */
|
|
|
|
for (i = 0; i < height; i++) {
|
|
|
|
for (j = 0; j < width; j++) {
|
|
|
|
value = *maskp++;
|
|
|
|
*out++ = (*in++ * ((CLAMP (value, min, max) - min) << 8) / border) >> 8;
|
|
|
|
*out++ = *in++;
|
|
|
|
*out++ = *in++;
|
|
|
|
*out++ = *in++;
|
|
|
|
}
|
2012-03-22 17:21:52 +00:00
|
|
|
in += src_wrap;
|
|
|
|
out += dest_wrap;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-28 10:29:42 +00:00
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
static void
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_process_i420_ayuv (GstSMPTEAlpha * smpte,
|
|
|
|
const GstVideoFrame * in_frame, GstVideoFrame * out_frame, GstMask * mask,
|
|
|
|
gint border, gint pos)
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
{
|
2010-04-16 15:27:02 +00:00
|
|
|
const guint8 *srcY;
|
|
|
|
const guint8 *srcU;
|
|
|
|
const guint8 *srcV;
|
2012-03-22 17:21:52 +00:00
|
|
|
guint8 *out;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
gint i, j;
|
2012-03-22 17:21:52 +00:00
|
|
|
gint src_wrap, src_u_wrap, src_v_wrap, dest_wrap;
|
|
|
|
gint y_stride, u_stride, v_stride;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
gboolean odd_width;
|
2010-04-16 15:27:02 +00:00
|
|
|
const guint32 *maskp;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
gint value;
|
|
|
|
gint min, max;
|
2012-03-22 17:21:52 +00:00
|
|
|
gint width, height;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
if (border == 0)
|
|
|
|
border++;
|
|
|
|
|
|
|
|
min = pos - border;
|
|
|
|
max = pos;
|
|
|
|
GST_DEBUG_OBJECT (smpte, "pos %d, min %d, max %d, border %d", pos, min, max,
|
|
|
|
border);
|
|
|
|
|
|
|
|
maskp = mask->data;
|
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
width = GST_VIDEO_FRAME_WIDTH (out_frame);
|
|
|
|
height = GST_VIDEO_FRAME_HEIGHT (out_frame);
|
|
|
|
|
|
|
|
y_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 0);
|
|
|
|
u_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 1);
|
|
|
|
v_stride = GST_VIDEO_FRAME_COMP_STRIDE (in_frame, 2);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
src_wrap = y_stride - width;
|
2012-03-22 17:21:52 +00:00
|
|
|
src_u_wrap = u_stride - (width / 2);
|
|
|
|
src_v_wrap = v_stride - (width / 2);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
srcY = GST_VIDEO_FRAME_COMP_DATA (in_frame, 0);
|
|
|
|
srcU = GST_VIDEO_FRAME_COMP_DATA (in_frame, 1);
|
|
|
|
srcV = GST_VIDEO_FRAME_COMP_DATA (in_frame, 2);
|
|
|
|
|
|
|
|
out = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
|
|
|
|
dest_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0) - (width << 2);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
odd_width = (width % 2 != 0);
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
|
|
|
for (j = 0; j < width / 2; j++) {
|
|
|
|
value = *maskp++;
|
|
|
|
*out++ = (0xff * ((CLAMP (value, min, max) - min) << 8) / border) >> 8;
|
|
|
|
*out++ = *srcY++;
|
|
|
|
*out++ = *srcU;
|
|
|
|
*out++ = *srcV;
|
|
|
|
value = *maskp++;
|
|
|
|
*out++ = (0xff * ((CLAMP (value, min, max) - min) << 8) / border) >> 8;
|
|
|
|
*out++ = *srcY++;
|
|
|
|
*out++ = *srcU++;
|
|
|
|
*out++ = *srcV++;
|
|
|
|
}
|
|
|
|
/* Might have one odd column left to do */
|
|
|
|
if (odd_width) {
|
|
|
|
value = *maskp++;
|
|
|
|
*out++ = (0xff * ((CLAMP (value, min, max) - min) << 8) / border) >> 8;
|
|
|
|
*out++ = *srcY++;
|
|
|
|
*out++ = *srcU;
|
|
|
|
*out++ = *srcV;
|
|
|
|
}
|
|
|
|
if (i % 2 == 0) {
|
|
|
|
srcU -= width / 2;
|
|
|
|
srcV -= width / 2;
|
|
|
|
} else {
|
2012-03-22 17:21:52 +00:00
|
|
|
srcU += src_u_wrap;
|
|
|
|
srcV += src_v_wrap;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
srcY += src_wrap;
|
2012-03-22 17:21:52 +00:00
|
|
|
out += dest_wrap;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-19 12:45:33 +00:00
|
|
|
static void
|
|
|
|
gst_smpte_alpha_before_transform (GstBaseTransform * trans, GstBuffer * buf)
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
{
|
2010-04-16 15:18:15 +00:00
|
|
|
GstSMPTEAlpha *smpte = GST_SMPTE_ALPHA (trans);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
GstClockTime timestamp, stream_time;
|
2010-04-16 15:27:02 +00:00
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
/* first sync the controller to the current stream_time of the buffer */
|
2010-04-19 12:45:33 +00:00
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
stream_time =
|
|
|
|
gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (smpte, "sync to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
2011-11-04 17:41:36 +00:00
|
|
|
gst_object_sync_values (GST_OBJECT (smpte), stream_time);
|
2010-04-19 12:45:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_transform_frame (GstVideoFilter * vfilter,
|
|
|
|
GstVideoFrame * in_frame, GstVideoFrame * out_frame)
|
2010-04-19 12:45:33 +00:00
|
|
|
{
|
2012-03-22 17:21:52 +00:00
|
|
|
GstSMPTEAlpha *smpte = GST_SMPTE_ALPHA (vfilter);
|
2010-04-19 12:45:33 +00:00
|
|
|
gdouble position;
|
|
|
|
gint border;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!smpte->process))
|
|
|
|
goto not_negotiated;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
position = smpte->position;
|
|
|
|
border = smpte->border;
|
|
|
|
|
|
|
|
/* run the type specific filter code */
|
2012-03-22 17:21:52 +00:00
|
|
|
smpte->process (smpte, in_frame, out_frame,
|
|
|
|
smpte->mask, border, ((1 << smpte->depth) + border) * position);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_negotiated:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL),
|
|
|
|
("No input format negotiated"));
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-17 15:43:51 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_smpte_alpha_transform_caps (GstBaseTransform * trans,
|
2012-03-22 17:21:52 +00:00
|
|
|
GstPadDirection direction, GstCaps * from, GstCaps * filter)
|
2010-04-17 15:43:51 +00:00
|
|
|
{
|
2012-03-22 17:21:52 +00:00
|
|
|
GstCaps *result, *tmp_caps, *tmpl_caps = NULL;
|
|
|
|
gint i, j;
|
2010-04-17 15:43:51 +00:00
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
tmp_caps = gst_caps_new_empty ();
|
2010-04-17 15:43:51 +00:00
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (from); i++) {
|
|
|
|
GstStructure *structure;
|
|
|
|
const GValue *val, *lval;
|
2010-04-17 15:43:51 +00:00
|
|
|
GValue list = { 0, };
|
2012-03-22 17:21:52 +00:00
|
|
|
GValue aval = { 0, };
|
|
|
|
const gchar *str;
|
|
|
|
|
|
|
|
structure = gst_structure_copy (gst_caps_get_structure (from, i));
|
|
|
|
/* we can transform I420 to AYUV,
|
|
|
|
* so need to locate and substitute AYUV for the both of them */
|
|
|
|
val = gst_structure_get_value (structure, "format");
|
|
|
|
if (val && GST_VALUE_HOLDS_LIST (val)) {
|
|
|
|
gboolean seen_ayuv = FALSE, seen_i420 = FALSE;
|
|
|
|
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
for (j = 0; j < gst_value_list_get_size (val); j++) {
|
|
|
|
lval = gst_value_list_get_value (val, j);
|
|
|
|
if ((str = g_value_get_string (lval))) {
|
|
|
|
if (strcmp (str, "AYUV") == 0) {
|
|
|
|
seen_ayuv = TRUE;
|
|
|
|
} else if (strcmp (str, "I420") == 0) {
|
|
|
|
seen_i420 = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (seen_ayuv && !seen_i420) {
|
|
|
|
str = "I420";
|
|
|
|
} else if (seen_i420 && !seen_ayuv) {
|
|
|
|
str = "AYUV";
|
|
|
|
} else
|
|
|
|
str = NULL;
|
|
|
|
if (str) {
|
|
|
|
g_value_copy (val, &list);
|
|
|
|
g_value_init (&aval, G_TYPE_STRING);
|
|
|
|
g_value_set_string (&aval, str);
|
|
|
|
gst_value_list_append_value (&list, &aval);
|
|
|
|
g_value_reset (&aval);
|
|
|
|
gst_structure_set_value (structure, "format", &list);
|
|
|
|
g_value_unset (&list);
|
|
|
|
}
|
|
|
|
} else if (val && G_VALUE_HOLDS_STRING (val)) {
|
|
|
|
if ((str = g_value_get_string (val)) &&
|
|
|
|
((strcmp (str, "AYUV") == 0) || (strcmp (str, "I420") == 0))) {
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
g_value_init (&aval, G_TYPE_STRING);
|
|
|
|
g_value_set_string (&aval, "AYUV");
|
|
|
|
gst_value_list_append_value (&list, &aval);
|
|
|
|
g_value_reset (&aval);
|
|
|
|
g_value_set_string (&aval, "I420");
|
|
|
|
gst_value_list_append_value (&list, &aval);
|
|
|
|
g_value_reset (&aval);
|
|
|
|
gst_structure_set_value (structure, "format", &list);
|
|
|
|
g_value_unset (&list);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gst_structure_remove_field (structure, "format");
|
|
|
|
}
|
|
|
|
|
2012-04-13 14:54:31 +00:00
|
|
|
gst_structure_remove_field (structure, "colorimetry");
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_structure_remove_field (structure, "chroma-site");
|
|
|
|
|
|
|
|
gst_caps_append_structure (tmp_caps, structure);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the appropriate template */
|
|
|
|
if (direction == GST_PAD_SINK) {
|
|
|
|
tmpl_caps =
|
|
|
|
gst_static_pad_template_get_caps (&gst_smpte_alpha_src_template);
|
|
|
|
} else if (direction == GST_PAD_SRC) {
|
|
|
|
tmpl_caps =
|
|
|
|
gst_static_pad_template_get_caps (&gst_smpte_alpha_sink_template);
|
|
|
|
} else {
|
|
|
|
g_assert_not_reached ();
|
2010-04-17 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
2012-03-22 17:21:52 +00:00
|
|
|
/* Intersect with our template caps */
|
|
|
|
result = gst_caps_intersect (tmp_caps, tmpl_caps);
|
|
|
|
gst_caps_unref (tmpl_caps);
|
|
|
|
gst_caps_unref (tmp_caps);
|
|
|
|
|
|
|
|
result = gst_caps_simplify (result);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (trans, "transformed %" GST_PTR_FORMAT " to %" GST_PTR_FORMAT,
|
|
|
|
from, result);
|
|
|
|
|
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (trans, "Using filter caps %" GST_PTR_FORMAT, filter);
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (result);
|
|
|
|
result = intersection;
|
|
|
|
GST_DEBUG_OBJECT (trans, "Intersection %" GST_PTR_FORMAT, result);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2010-04-17 15:43:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-22 17:21:52 +00:00
|
|
|
gst_smpte_alpha_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
|
|
|
|
GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
|
2010-04-17 15:43:51 +00:00
|
|
|
{
|
2012-03-22 17:21:52 +00:00
|
|
|
GstSMPTEAlpha *smpte = GST_SMPTE_ALPHA (vfilter);
|
2010-04-17 15:43:51 +00:00
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
smpte->process = NULL;
|
2012-03-22 17:21:52 +00:00
|
|
|
smpte->in_format = GST_VIDEO_INFO_FORMAT (in_info);
|
|
|
|
smpte->out_format = GST_VIDEO_INFO_FORMAT (out_info);
|
2010-04-17 15:43:51 +00:00
|
|
|
|
|
|
|
/* try to update the mask now, this will also adjust the width/height on
|
|
|
|
* success */
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
ret =
|
|
|
|
gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->invert,
|
2015-09-25 12:08:09 +00:00
|
|
|
smpte->depth, GST_VIDEO_INFO_WIDTH (out_info),
|
|
|
|
GST_VIDEO_INFO_HEIGHT (out_info));
|
2010-04-17 15:43:51 +00:00
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
2015-09-25 12:08:09 +00:00
|
|
|
|
2010-04-17 15:43:51 +00:00
|
|
|
if (!ret)
|
|
|
|
goto mask_failed;
|
|
|
|
|
|
|
|
switch (smpte->out_format) {
|
|
|
|
case GST_VIDEO_FORMAT_AYUV:
|
|
|
|
switch (smpte->in_format) {
|
|
|
|
case GST_VIDEO_FORMAT_AYUV:
|
|
|
|
smpte->process = gst_smpte_alpha_process_ayuv_ayuv;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_FORMAT_I420:
|
|
|
|
smpte->process = gst_smpte_alpha_process_i420_ayuv;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_FORMAT_ARGB:
|
|
|
|
switch (smpte->in_format) {
|
|
|
|
case GST_VIDEO_FORMAT_ARGB:
|
|
|
|
smpte->process = gst_smpte_alpha_process_argb_argb;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_FORMAT_RGBA:
|
|
|
|
switch (smpte->in_format) {
|
|
|
|
case GST_VIDEO_FORMAT_RGBA:
|
|
|
|
smpte->process = gst_smpte_alpha_process_rgba_rgba;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_FORMAT_ABGR:
|
|
|
|
switch (smpte->in_format) {
|
|
|
|
case GST_VIDEO_FORMAT_ABGR:
|
|
|
|
smpte->process = gst_smpte_alpha_process_abgr_abgr;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_FORMAT_BGRA:
|
|
|
|
switch (smpte->in_format) {
|
|
|
|
case GST_VIDEO_FORMAT_BGRA:
|
|
|
|
smpte->process = gst_smpte_alpha_process_bgra_bgra;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
mask_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (smpte, "failed creating the mask");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_smpte_alpha_finalize (GstSMPTEAlpha * smpte)
|
|
|
|
{
|
|
|
|
if (smpte->mask)
|
|
|
|
gst_mask_destroy (smpte->mask);
|
|
|
|
smpte->mask = NULL;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize ((GObject *) smpte);
|
|
|
|
}
|
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
static void
|
|
|
|
gst_smpte_alpha_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2010-04-16 15:18:15 +00:00
|
|
|
GstSMPTEAlpha *smpte = GST_SMPTE_ALPHA (object);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2010-04-15 20:27:57 +00:00
|
|
|
case PROP_TYPE:{
|
|
|
|
gint type;
|
|
|
|
|
|
|
|
type = g_value_get_enum (value);
|
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
GST_OBJECT_LOCK (smpte);
|
2010-04-15 20:28:58 +00:00
|
|
|
gst_smpte_alpha_update_mask (smpte, type, smpte->invert,
|
2010-04-15 20:27:57 +00:00
|
|
|
smpte->depth, smpte->width, smpte->height);
|
2010-04-16 15:18:15 +00:00
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
break;
|
2010-04-15 20:27:57 +00:00
|
|
|
}
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
case PROP_BORDER:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
smpte->border = g_value_get_int (value);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
2010-04-15 20:27:57 +00:00
|
|
|
case PROP_DEPTH:{
|
|
|
|
gint depth;
|
|
|
|
|
|
|
|
depth = g_value_get_int (value);
|
|
|
|
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
GST_OBJECT_LOCK (smpte);
|
2010-04-15 20:28:58 +00:00
|
|
|
gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->invert,
|
2010-04-15 20:27:57 +00:00
|
|
|
depth, smpte->width, smpte->height);
|
2010-04-16 15:18:15 +00:00
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
break;
|
2010-04-15 20:27:57 +00:00
|
|
|
}
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
case PROP_POSITION:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
smpte->position = g_value_get_double (value);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
2010-04-15 20:28:58 +00:00
|
|
|
case PROP_INVERT:{
|
|
|
|
gboolean invert;
|
|
|
|
|
|
|
|
invert = g_value_get_boolean (value);
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
gst_smpte_alpha_update_mask (smpte, smpte->type, invert,
|
|
|
|
smpte->depth, smpte->width, smpte->height);
|
2010-04-16 15:18:15 +00:00
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
2010-04-15 20:28:58 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_smpte_alpha_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstSMPTEAlpha *smpte;
|
|
|
|
|
|
|
|
smpte = GST_SMPTE_ALPHA (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_TYPE:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
g_value_set_enum (value, smpte->type);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
|
|
|
case PROP_BORDER:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
g_value_set_int (value, smpte->border);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
|
|
|
case PROP_DEPTH:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
g_value_set_int (value, smpte->depth);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
|
|
|
case PROP_POSITION:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
g_value_set_double (value, smpte->position);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
2010-04-15 20:28:58 +00:00
|
|
|
case PROP_INVERT:
|
|
|
|
GST_OBJECT_LOCK (smpte);
|
|
|
|
g_value_set_boolean (value, smpte->invert);
|
|
|
|
GST_OBJECT_UNLOCK (smpte);
|
|
|
|
break;
|
gst/smpte/: Add new plugin that adds the SMPTE transition in the alpha channel of
Original commit message from CVS:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_plugin_init):
* gst/smpte/gstsmpte.h:
* gst/smpte/gstsmptealpha.c:
(gst_smpte_alpha_transition_type_get_type),
(gst_smpte_alpha_get_type), (gst_smpte_alpha_base_init),
(gst_smpte_alpha_class_init), (gst_smpte_alpha_update_mask),
(gst_smpte_alpha_setcaps), (gst_smpte_alpha_get_unit_size),
(gst_smpte_alpha_init), (gst_smpte_alpha_finalize),
(gst_smpte_alpha_do_ayuv), (gst_smpte_alpha_do_i420),
(gst_smpte_alpha_transform), (gst_smpte_alpha_set_property),
(gst_smpte_alpha_get_property), (gst_smpte_alpha_plugin_init):
* gst/smpte/gstsmptealpha.h:
* gst/smpte/plugin.c: (plugin_init):
Add new plugin that adds the SMPTE transition in the alpha channel of
I420 and AYUV frames so that they can be blended with videomixer later
on. Uses all niceties such as using base transform for efficient alloc
and negotiation. It currently requires GstController to control the
position in the transition effect.
2008-05-20 09:29:28 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_smpte_alpha_plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_smpte_alpha_debug, "smptealpha", 0,
|
|
|
|
"SMPTE alpha effect");
|
|
|
|
|
|
|
|
return gst_element_register (plugin, "smptealpha", GST_RANK_NONE,
|
|
|
|
GST_TYPE_SMPTE_ALPHA);
|
|
|
|
}
|