Moved 'shapewipe' from -bad to -good

Fixes bug #584536.
This commit is contained in:
Sebastian Dröge 2010-02-12 11:21:23 +01:00
parent 68b644a437
commit f79842e308
14 changed files with 6 additions and 1794 deletions

View file

@ -43,12 +43,14 @@ include $(top_srcdir)/common/coverage/lcov.mak
CRUFT_FILES = \
$(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib}
$(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib}
CRUFT_DIRS = \
$(top_srcdir)/gst/aacparse \
$(top_srcdir)/gst/amrparse \
$(top_srcdir)/gst/flacparse
$(top_srcdir)/gst/flacparse \
$(top_srcdir)/gst/shapewipe
include $(top_srcdir)/common/cruft.mak

View file

@ -290,7 +290,6 @@ AG_GST_CHECK_PLUGIN(rtpmux)
AG_GST_CHECK_PLUGIN(scaletempo)
AG_GST_CHECK_PLUGIN(sdp)
AG_GST_CHECK_PLUGIN(selector)
AG_GST_CHECK_PLUGIN(shapewipe)
AG_GST_CHECK_PLUGIN(siren)
AG_GST_CHECK_PLUGIN(speed)
AG_GST_CHECK_PLUGIN(subenc)
@ -1681,7 +1680,6 @@ gst/rtpmux/Makefile
gst/scaletempo/Makefile
gst/sdp/Makefile
gst/selector/Makefile
gst/shapewipe/Makefile
gst/siren/Makefile
gst/speed/Makefile
gst/subenc/Makefile
@ -1722,7 +1720,6 @@ tests/examples/camerabin/Makefile
tests/examples/directfb/Makefile
tests/examples/mxf/Makefile
tests/examples/scaletempo/Makefile
tests/examples/shapewipe/Makefile
tests/examples/switch/Makefile
tests/icles/Makefile
ext/alsaspdif/Makefile

View file

@ -159,7 +159,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/sdp/gstsdpdemux.h \
$(top_srcdir)/gst/selector/gstinputselector.h \
$(top_srcdir)/gst/selector/gstoutputselector.h \
$(top_srcdir)/gst/shapewipe/gstshapewipe.h \
$(top_srcdir)/gst/speed/gstspeed.h \
$(top_srcdir)/gst/stereo/gststereo.h \
$(top_srcdir)/gst/videosignal/gstvideoanalyse.h \

View file

@ -80,7 +80,6 @@
<xi:include href="xml/element-sdlaudiosink.xml" />
<xi:include href="xml/element-sdlvideosink.xml" />
<xi:include href="xml/element-sdpdemux.xml" />
<xi:include href="xml/element-shapewipe.xml" />
<xi:include href="xml/element-speed.xml" />
<xi:include href="xml/element-stereo.xml" />
<!--xi:include href="xml/element-theoradecexp.xml" /-->
@ -163,7 +162,6 @@
<xi:include href="xml/plugin-sdl.xml" />
<xi:include href="xml/plugin-sdp.xml" />
<xi:include href="xml/plugin-selector.xml" />
<xi:include href="xml/plugin-shapewipe.xml" />
<xi:include href="xml/plugin-sndfile.xml" />
<xi:include href="xml/plugin-soundtouch.xml" />
<xi:include href="xml/plugin-spcdec.xml" />

View file

@ -1031,21 +1031,6 @@ GST_TYPE_SPEED
gst_speed_get_type
</SECTION>
<SECTION>
<FILE>element-shapewipe</FILE>
<TITLE>shapewipe</TITLE>
GstShapeWipe
<SUBSECTION Standard>
GstShapeWipeClass
GST_SHAPE_WIPE
GST_SHAPE_WIPE_CLASS
GST_IS_SHAPE_WIPE
GST_IS_SHAPE_WIPE_CLASS
GST_TYPE_SHAPE_WIPE
gst_shape_wipe_get_type
</SECTION>
<SECTION>
<FILE>element-stereo</FILE>
<TITLE>stereo</TITLE>

View file

@ -1,40 +0,0 @@
<plugin>
<name>shapewipe</name>
<description>Shape Wipe transition filter</description>
<filename>../../gst/shapewipe/.libs/libgstshapewipe.so</filename>
<basename>libgstshapewipe.so</basename>
<version>0.10.17.1</version>
<license>LGPL</license>
<source>gst-plugins-bad</source>
<package>GStreamer Bad Plug-ins git</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>shapewipe</name>
<longname>Shape Wipe transition filter</longname>
<class>Filter/Editor/Video</class>
<description>Adds a shape wipe transition to a video stream</description>
<author>Sebastian Dröge &lt;sebastian.droege@collabora.co.uk&gt;</author>
<pads>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>mask_sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)0/1; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int)1234, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)0/1</details>
</caps>
<caps>
<name>video_sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
</pads>
</element>
</elements>
</plugin>

View file

@ -1,11 +0,0 @@
plugin_LTLIBRARIES = libgstshapewipe.la
libgstshapewipe_la_SOURCES = gstshapewipe.c
libgstshapewipe_la_CFLAGS = $(GIO_CFLAGS) $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstshapewipe_la_LIBADD = $(GIO_LIBS) $(GST_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@
libgstshapewipe_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstshapewipe_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstshapewipe.h

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
/* GStreamer
* Copyright (C) 2009,2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_SHAPE_WIPE_H__
#define __GST_SHAPE_WIPE_H__
#include <gst/gst.h>
#include <gst/video/video.h>
G_BEGIN_DECLS
#define GST_TYPE_SHAPE_WIPE \
(gst_shape_wipe_get_type())
#define GST_SHAPE_WIPE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SHAPE_WIPE,GstShapeWipe))
#define GST_SHAPE_WIPE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SHAPE_WIPE,GstShapeWipeClass))
#define GST_SHAPE_WIPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_SHAPE_WIPE,GstShapeWipeClass))
#define GST_IS_SHAPE_WIPE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SHAPE_WIPE))
#define GST_IS_SHAPE_WIPE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SHAPE_WIPE))
typedef struct _GstShapeWipe GstShapeWipe;
typedef struct _GstShapeWipeClass GstShapeWipeClass;
struct _GstShapeWipe
{
GstElement parent;
/* private */
GstPad *video_sinkpad;
GstPad *mask_sinkpad;
GstPad *srcpad;
GstSegment segment;
GstBuffer *mask;
gfloat mask_position;
gfloat mask_border;
GMutex *mask_mutex;
GCond *mask_cond;
gint mask_bpp;
GstVideoFormat fmt;
gint width, height;
gboolean shutdown;
gdouble proportion;
GstClockTime earliest_time;
GstClockTime frame_duration;
};
struct _GstShapeWipeClass
{
GstElementClass parent_class;
};
GType gst_shape_wipe_get_type (void);
G_END_DECLS
#endif /* __GST_SHAPE_WIPE_H__ */

View file

@ -123,7 +123,6 @@ check_PROGRAMS = \
elements/jpegparse \
elements/qtmux \
elements/selector \
elements/shapewipe \
elements/mxfdemux \
elements/mxfmux \
pipelines/mxf \

View file

@ -1,307 +0,0 @@
/* GStreamer
*
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <unistd.h>
#include <gst/check/gstcheck.h>
gboolean have_eos = FALSE;
/* For ease of programming we use globals to keep refs for our floating
* src and sink pads we create; otherwise we always have to do get_pad,
* get_peer, and then remove references in every test function */
GstPad *myvideosrcpad, *mymasksrcpad, *mysinkpad;
#define SHAPEWIPE_VIDEO_CAPS_STRING \
"video/x-raw-yuv, " \
"format = (GstFourcc)AYUV, " \
"width = 400, " \
"height = 400, " \
"framerate = 0/1"
#define SHAPEWIPE_MASK_CAPS_STRING \
"video/x-raw-gray, " \
"bpp = 8, " \
"depth = 8, " \
"width = 400, " \
"height = 400, " \
"framerate = 0/1"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (SHAPEWIPE_VIDEO_CAPS_STRING)
);
static GstStaticPadTemplate videosrctemplate =
GST_STATIC_PAD_TEMPLATE ("videosrc",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (SHAPEWIPE_VIDEO_CAPS_STRING)
);
static GstStaticPadTemplate masksrctemplate =
GST_STATIC_PAD_TEMPLATE ("masksrc",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (SHAPEWIPE_MASK_CAPS_STRING)
);
static GstBuffer *output = NULL;
static GstFlowReturn
on_chain (GstPad * pad, GstBuffer * buffer)
{
g_return_val_if_fail (output == NULL, GST_FLOW_ERROR);
output = buffer;
return GST_FLOW_OK;
}
GST_START_TEST (test_general)
{
GstElement *shapewipe;
GstPad *p;
GstCaps *caps;
GstBuffer *mask, *input;
guint i, j;
guint8 *data;
myvideosrcpad =
gst_pad_new_from_static_template (&videosrctemplate, "videosrc");
gst_pad_set_active (myvideosrcpad, TRUE);
caps = gst_caps_from_string (SHAPEWIPE_VIDEO_CAPS_STRING);
gst_pad_set_caps (myvideosrcpad, caps);
gst_caps_unref (caps);
mymasksrcpad = gst_pad_new_from_static_template (&masksrctemplate, "masksrc");
gst_pad_set_active (mymasksrcpad, TRUE);
caps = gst_caps_from_string (SHAPEWIPE_MASK_CAPS_STRING);
gst_pad_set_caps (mymasksrcpad, caps);
gst_caps_unref (caps);
mysinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
gst_pad_set_chain_function (mysinkpad, on_chain);
gst_pad_set_active (mysinkpad, TRUE);
caps = gst_caps_from_string (SHAPEWIPE_VIDEO_CAPS_STRING);
gst_pad_set_caps (mysinkpad, caps);
gst_caps_unref (caps);
shapewipe = gst_element_factory_make ("shapewipe", NULL);
fail_unless (shapewipe != NULL);
p = gst_element_get_static_pad (shapewipe, "video_sink");
fail_unless (gst_pad_link (myvideosrcpad, p) == GST_PAD_LINK_OK);
gst_object_unref (p);
p = gst_element_get_static_pad (shapewipe, "mask_sink");
fail_unless (gst_pad_link (mymasksrcpad, p) == GST_PAD_LINK_OK);
gst_object_unref (p);
p = gst_element_get_static_pad (shapewipe, "src");
fail_unless (gst_pad_link (p, mysinkpad) == GST_PAD_LINK_OK);
gst_object_unref (p);
fail_unless (gst_element_set_state (shapewipe,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
mask = gst_buffer_new_and_alloc (400 * 400);
caps = gst_caps_from_string (SHAPEWIPE_MASK_CAPS_STRING);
gst_buffer_set_caps (mask, caps);
gst_caps_unref (caps);
data = GST_BUFFER_DATA (mask);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
if (i < 100 && j < 100)
data[0] = 0;
else if (i < 200 && j < 200)
data[0] = 85;
else if (i < 300 && j < 300)
data[0] = 170;
else
data[0] = 254;
data++;
}
}
fail_unless (gst_pad_push (mymasksrcpad, mask) == GST_FLOW_OK);
input = gst_buffer_new_and_alloc (400 * 400 * 4);
caps = gst_caps_from_string (SHAPEWIPE_VIDEO_CAPS_STRING);
gst_buffer_set_caps (input, caps);
gst_caps_unref (caps);
data = GST_BUFFER_DATA (input);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
/* This is green */
data[0] = 0; /* A */
data[1] = 173; /* Y */
data[2] = 42; /* U */
data[3] = 26; /* V */
data += 4;
}
}
g_object_set (G_OBJECT (shapewipe), "position", 0.0, NULL);
output = NULL;
fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL);
data = GST_BUFFER_DATA (output);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
fail_unless (data[0] == 255); /* A */
fail_unless (data[1] == 173); /* Y */
fail_unless (data[2] == 42); /* U */
fail_unless (data[3] == 26); /* V */
data += 4;
}
}
gst_buffer_unref (output);
output = NULL;
g_object_set (G_OBJECT (shapewipe), "position", 0.1, NULL);
output = NULL;
fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL);
data = GST_BUFFER_DATA (output);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
if (i < 100 && j < 100) {
fail_unless (data[0] == 0); /* A */
fail_unless (data[1] == 0); /* Y */
fail_unless (data[2] == 128); /* U */
fail_unless (data[3] == 128); /* V */
} else {
fail_unless (data[0] == 255); /* A */
fail_unless (data[1] == 173); /* Y */
fail_unless (data[2] == 42); /* U */
fail_unless (data[3] == 26); /* V */
}
data += 4;
}
}
gst_buffer_unref (output);
output = NULL;
g_object_set (G_OBJECT (shapewipe), "position", 0.34, NULL);
output = NULL;
fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL);
data = GST_BUFFER_DATA (output);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
if (i < 200 && j < 200) {
fail_unless (data[0] == 0); /* A */
fail_unless (data[1] == 0); /* Y */
fail_unless (data[2] == 128); /* U */
fail_unless (data[3] == 128); /* V */
} else {
fail_unless (data[0] == 255); /* A */
fail_unless (data[1] == 173); /* Y */
fail_unless (data[2] == 42); /* U */
fail_unless (data[3] == 26); /* V */
}
data += 4;
}
}
gst_buffer_unref (output);
output = NULL;
g_object_set (G_OBJECT (shapewipe), "position", 0.67, NULL);
output = NULL;
fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL);
data = GST_BUFFER_DATA (output);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
if (i < 300 && j < 300) {
fail_unless (data[0] == 0); /* A */
fail_unless (data[1] == 0); /* Y */
fail_unless (data[2] == 128); /* U */
fail_unless (data[3] == 128); /* V */
} else {
fail_unless (data[0] == 255); /* A */
fail_unless (data[1] == 173); /* Y */
fail_unless (data[2] == 42); /* U */
fail_unless (data[3] == 26); /* V */
}
data += 4;
}
}
gst_buffer_unref (output);
output = NULL;
g_object_set (G_OBJECT (shapewipe), "position", 1.0, NULL);
output = NULL;
fail_unless (gst_pad_push (myvideosrcpad,
gst_buffer_ref (input)) == GST_FLOW_OK);
fail_unless (output != NULL);
data = GST_BUFFER_DATA (output);
for (i = 0; i < 400; i++) {
for (j = 0; j < 400; j++) {
fail_unless (data[0] == 0); /* A */
fail_unless (data[1] == 0); /* Y */
fail_unless (data[2] == 128); /* U */
fail_unless (data[3] == 128); /* V */
data += 4;
}
}
gst_buffer_unref (output);
output = NULL;
gst_buffer_unref (input);
fail_unless (gst_element_set_state (shapewipe,
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
p = gst_element_get_static_pad (shapewipe, "video_sink");
fail_unless (gst_pad_unlink (myvideosrcpad, p));
gst_object_unref (p);
p = gst_element_get_static_pad (shapewipe, "mask_sink");
fail_unless (gst_pad_unlink (mymasksrcpad, p));
gst_object_unref (p);
p = gst_element_get_static_pad (shapewipe, "src");
fail_unless (gst_pad_unlink (p, mysinkpad));
gst_object_unref (p);
gst_object_unref (myvideosrcpad);
gst_object_unref (mymasksrcpad);
gst_object_unref (mysinkpad);
gst_object_unref (shapewipe);
}
GST_END_TEST;
Suite *
shapewipe_suite (void)
{
Suite *s = suite_create ("shapewipe");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_set_timeout (tc_chain, 180);
tcase_add_test (tc_chain, test_general);
return s;
}
GST_CHECK_MAIN (shapewipe);

View file

@ -10,5 +10,5 @@ else
DIRECTFB_DIR=
endif
SUBDIRS= $(DIRECTFB_DIR) $(GTK_EXAMPLES) shapewipe switch
DIST_SUBDIRS= camerabin directfb mxf scaletempo shapewipe switch
SUBDIRS= $(DIRECTFB_DIR) $(GTK_EXAMPLES) switch
DIST_SUBDIRS= camerabin directfb mxf scaletempo switch

View file

@ -1,8 +0,0 @@
noinst_PROGRAMS = shapewipe-example
shapewipe_example_SOURCES = shapewipe-example.c
shapewipe_example_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS)
shapewipe_example_LDFLAGS = $(GST_LIBS) $(GST_CONTROLLER_LIBS)
noinst_HEADERS =

View file

@ -1,140 +0,0 @@
/* GStreamer
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#include <gst/controller/gstcontroller.h>
#include <gst/controller/gstlfocontrolsource.h>
static gboolean
on_message (GstBus * bus, GstMessage * message, gpointer user_data)
{
GMainLoop *loop = (GMainLoop *) user_data;
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:{
GError *err = NULL;
gchar *debug = NULL;
g_warning ("Got ERROR");
gst_message_parse_error (message, &err, &debug);
g_warning ("%s: %s", err->message, debug);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_WARNING:{
GError *err = NULL;
gchar *debug = NULL;
g_warning ("Got WARNING");
gst_message_parse_error (message, &err, &debug);
g_warning ("%s: %s", err->message, debug);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_EOS:
g_main_loop_quit (loop);
break;
default:
break;
}
return TRUE;
}
gint
main (gint argc, gchar ** argv)
{
GstElement *pipeline;
GstElement *shapewipe;
GstController *ctrl;
GstLFOControlSource *csource;
GValue val = { 0, };
GMainLoop *loop;
GstBus *bus;
gchar *pipeline_string;
if (argc != 2) {
g_print ("Usage: shapewipe mask.png\n");
return -1;
}
gst_init (&argc, &argv);
gst_controller_init (&argc, &argv);
pipeline_string =
g_strdup_printf
("videotestsrc ! video/x-raw-yuv,width=640,height=480 ! shapewipe name=shape border=0.05 ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink filesrc location=%s ! typefind ! decodebin2 ! ffmpegcolorspace ! videoscale ! queue ! shape.mask_sink videotestsrc pattern=snow ! video/x-raw-yuv,width=640,height=480 ! queue ! mixer.",
argv[1]);
pipeline = gst_parse_launch (pipeline_string, NULL);
g_free (pipeline_string);
if (pipeline == NULL) {
g_print ("Failed to create pipeline\n");
return -2;
}
shapewipe = gst_bin_get_by_name (GST_BIN (pipeline), "shape");
if (!(ctrl = gst_controller_new (G_OBJECT (shapewipe), "position", NULL))) {
g_print ("can't control shapewipe element\n");
return -3;
}
csource = gst_lfo_control_source_new ();
gst_controller_set_control_source (ctrl, "position",
GST_CONTROL_SOURCE (csource));
g_value_init (&val, G_TYPE_FLOAT);
g_value_set_float (&val, 0.5);
g_object_set (G_OBJECT (csource), "amplitude", &val, NULL);
g_value_set_float (&val, 0.5);
g_object_set (G_OBJECT (csource), "offset", &val, NULL);
g_value_unset (&val);
g_object_set (G_OBJECT (csource), "frequency", 0.5, NULL);
g_object_set (G_OBJECT (csource), "timeshift", 500 * GST_MSECOND, NULL);
g_object_unref (csource);
loop = g_main_loop_new (NULL, FALSE);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_signal_watch (bus);
g_signal_connect (G_OBJECT (bus), "message", G_CALLBACK (on_message), loop);
gst_object_unref (GST_OBJECT (bus));
if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
g_error ("Failed to go into PLAYING state");
return -4;
}
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
g_main_loop_unref (loop);
g_object_unref (G_OBJECT (ctrl));
gst_object_unref (G_OBJECT (pipeline));
return 0;
}