Ported 2 more plugins. usgly hack in the Makefile.am though, I'm sure someone will fix it.

Original commit message from CVS:
* configure.ac:
* ext/aalib/Makefile.am:
* ext/aalib/gstaasink.c: (gst_aasink_get_type),
(gst_aasink_class_init), (gst_aasink_fixate), (gst_aasink_setcaps),
(gst_aasink_init), (gst_aasink_get_times), (gst_aasink_render),
(gst_aasink_set_property), (gst_aasink_get_property),
(gst_aasink_open), (gst_aasink_close), (gst_aasink_change_state):
* ext/aalib/gstaasink.h:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_setcaps), (gst_smpte_init),
(gst_smpte_collected):
* gst/smpte/gstsmpte.h:
Ported 2 more plugins. usgly hack in the Makefile.am though, I'm
sure someone will fix it.
This commit is contained in:
Wim Taymans 2005-05-06 19:55:22 +00:00
parent d0556a1534
commit f9bf6a7731
5 changed files with 76 additions and 39 deletions

View file

@ -1,3 +1,20 @@
2005-05-06 Wim Taymans <wim@fluendo.com>
* configure.ac:
* ext/aalib/Makefile.am:
* ext/aalib/gstaasink.c: (gst_aasink_get_type),
(gst_aasink_class_init), (gst_aasink_fixate), (gst_aasink_setcaps),
(gst_aasink_init), (gst_aasink_get_times), (gst_aasink_render),
(gst_aasink_set_property), (gst_aasink_get_property),
(gst_aasink_open), (gst_aasink_close), (gst_aasink_change_state):
* ext/aalib/gstaasink.h:
* gst/smpte/Makefile.am:
* gst/smpte/gstsmpte.c: (gst_smpte_setcaps), (gst_smpte_init),
(gst_smpte_collected):
* gst/smpte/gstsmpte.h:
Ported 2 more plugins. usgly hack in the Makefile.am though, I'm
sure someone will fix it.
2005-05-06 Christian Schaller <uraeus@gnome.org> 2005-05-06 Christian Schaller <uraeus@gnome.org>
* configure.ac: add sidplay * configure.ac: add sidplay

View file

@ -307,7 +307,8 @@ dnl these are all the gst plug-ins, compilable without additional libs
GST_PLUGINS_ALL="\ GST_PLUGINS_ALL="\
videofilter \ videofilter \
effectv \ effectv \
law" law \
smpte"
dnl see if we can build C++ plug-ins dnl see if we can build C++ plug-ins
if test "x$HAVE_CXX" = "xyes"; then if test "x$HAVE_CXX" = "xyes"; then
@ -360,16 +361,27 @@ dnl ])
dnl ]) dnl ])
dnl ]) dnl ])
<<<<<<< configure.ac
dnl *** aalib ***
translit(dnm, m, l) AM_CONDITIONAL(USE_AALIB, true)
GST_CHECK_FEATURE(AALIB, [aasink plug-in], aasink, [
AM_PATH_AALIB(, HAVE_AALIB=yes, HAVE_AALIB=no)
AS_SCRUB_INCLUDE(AALIB_CFLAGS)
])
=======
dnl ########################### dnl ###########################
dnl # Configure external libs # dnl # Configure external libs #
dnl ########################### dnl ###########################
>>>>>>> 1.538
dnl *** sidplay : works with libsidplay 1.36.x (not 2.x.x) *** dnl *** sidplay : works with libsidplay 1.36.x (not 2.x.x) ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true) translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true)
GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [ GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [
GST_PATH_SIDPLAY() GST_PATH_SIDPLAY()
]) ])
dnl *** mad *** dnl *** mad ***
dnl FIXME: we could use header checks here as well IMO dnl FIXME: we could use header checks here as well IMO
@ -446,9 +458,11 @@ gst-plugins.spec
gst/Makefile gst/Makefile
gst/effectv/Makefile gst/effectv/Makefile
gst/law/Makefile gst/law/Makefile
gst/smpte/Makefile
gst/videofilter/Makefile gst/videofilter/Makefile
sys/Makefile sys/Makefile
ext/Makefile ext/Makefile
ext/aalib/Makefile
ext/mad/Makefile ext/mad/Makefile
ext/sidplay/Makefile ext/sidplay/Makefile
common/Makefile common/Makefile

View file

@ -5,9 +5,9 @@ libgstsmpte_la_SOURCES = gstsmpte.c gstmask.c barboxwipes.c paint.c
noinst_HEADERS = gstsmpte.h gstmask.h paint.h noinst_HEADERS = gstsmpte.h gstmask.h paint.h
libgstsmpte_la_CFLAGS = $(GST_CFLAGS) libgstsmpte_la_CFLAGS = $(GST_CFLAGS) -I ../../../gst-plugins-base/gst-libs/
libgstsmpte_la_LIBADD = libgstsmpte_la_LIBADD =
libgstsmpte_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstsmpte_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS)
EXTRA_DIST = EXTRA_DIST =

View file

@ -112,7 +112,8 @@ static void gst_smpte_class_init (GstSMPTEClass * klass);
static void gst_smpte_base_init (GstSMPTEClass * klass); static void gst_smpte_base_init (GstSMPTEClass * klass);
static void gst_smpte_init (GstSMPTE * smpte); static void gst_smpte_init (GstSMPTE * smpte);
static void gst_smpte_loop (GstElement * element); static GstFlowReturn gst_smpte_collected (GstCollectPads * pads,
GstSMPTE * smpte);
static void gst_smpte_set_property (GObject * object, guint prop_id, static void gst_smpte_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -234,13 +235,13 @@ gst_smpte_update_mask (GstSMPTE * smpte, gint type, gint depth, gint width,
} }
static gboolean static gboolean
gst_smpte_sinkconnect (GstPad * pad, const GstCaps * caps) gst_smpte_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstSMPTE *smpte; GstSMPTE *smpte;
GstStructure *structure; GstStructure *structure;
gboolean ret; gboolean ret;
smpte = GST_SMPTE (gst_pad_get_parent (pad)); smpte = GST_SMPTE (GST_PAD_PARENT (pad));
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
@ -248,13 +249,13 @@ gst_smpte_sinkconnect (GstPad * pad, const GstCaps * caps)
ret &= gst_structure_get_int (structure, "height", &smpte->height); ret &= gst_structure_get_int (structure, "height", &smpte->height);
ret &= gst_structure_get_double (structure, "framerate", &smpte->fps); ret &= gst_structure_get_double (structure, "framerate", &smpte->fps);
if (!ret) if (!ret)
return GST_PAD_LINK_REFUSED; return FALSE;
gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width,
smpte->height); smpte->height);
/* forward to the next plugin */ /* forward to the next plugin */
return gst_pad_try_set_caps (smpte->srcpad, caps); return TRUE;
} }
static void static void
@ -263,13 +264,13 @@ gst_smpte_init (GstSMPTE * smpte)
smpte->sinkpad1 = smpte->sinkpad1 =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_smpte_sink1_template), "sink1"); (&gst_smpte_sink1_template), "sink1");
gst_pad_set_link_function (smpte->sinkpad1, gst_smpte_sinkconnect); gst_pad_set_setcaps_function (smpte->sinkpad1, gst_smpte_setcaps);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1); gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1);
smpte->sinkpad2 = smpte->sinkpad2 =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_smpte_sink2_template), "sink2"); (&gst_smpte_sink2_template), "sink2");
gst_pad_set_link_function (smpte->sinkpad2, gst_smpte_sinkconnect); gst_pad_set_setcaps_function (smpte->sinkpad2, gst_smpte_setcaps);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2); gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2);
smpte->srcpad = smpte->srcpad =
@ -277,12 +278,20 @@ gst_smpte_init (GstSMPTE * smpte)
(&gst_smpte_src_template), "src"); (&gst_smpte_src_template), "src");
gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad); gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad);
gst_element_set_loop_function (GST_ELEMENT (smpte), gst_smpte_loop); smpte->collect = gst_collectpads_new ();
gst_collectpads_set_function (smpte->collect,
(GstCollectPadsFunction) gst_smpte_collected, smpte);
gst_collectpads_start (smpte->collect);
gst_collectpads_add_pad (smpte->collect, smpte->sinkpad1,
sizeof (GstCollectData));
gst_collectpads_add_pad (smpte->collect, smpte->sinkpad2,
sizeof (GstCollectData));
smpte->width = 320; smpte->width = 320;
smpte->height = 200; smpte->height = 200;
smpte->fps = 25.; smpte->fps = 25.;
smpte->duration = 64; smpte->duration = 512;
smpte->position = 0; smpte->position = 0;
smpte->type = 1; smpte->type = 1;
smpte->border = 0; smpte->border = 0;
@ -332,33 +341,25 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
} }
} }
static void static GstFlowReturn
gst_smpte_loop (GstElement * element) gst_smpte_collected (GstCollectPads * pads, GstSMPTE * smpte)
{ {
GstSMPTE *smpte;
GstBuffer *outbuf; GstBuffer *outbuf;
GstClockTime ts; GstClockTime ts;
GstBuffer *in1 = NULL, *in2 = NULL; GstBuffer *in1 = NULL, *in2 = NULL;
GSList *collected;
smpte = GST_SMPTE (element);
ts = smpte->position * GST_SECOND / smpte->fps; ts = smpte->position * GST_SECOND / smpte->fps;
while (GST_PAD_IS_USABLE (smpte->sinkpad1) && in1 == NULL) { for (collected = pads->data; collected; collected = g_slist_next (collected)) {
in1 = GST_BUFFER (gst_pad_pull (smpte->sinkpad1)); GstCollectData *data;
if (GST_IS_EVENT (in1)) {
gst_pad_push (smpte->srcpad, GST_DATA (in1)); data = (GstCollectData *) collected->data;
in1 = NULL;
} else if (data->pad == smpte->sinkpad1)
ts = GST_BUFFER_TIMESTAMP (in1); in1 = gst_collectpads_pop (pads, data);
} else if (data->pad == smpte->sinkpad2)
if (GST_PAD_IS_USABLE (smpte->sinkpad2) && in2 == NULL) { in2 = gst_collectpads_pop (pads, data);
in2 = GST_BUFFER (gst_pad_pull (smpte->sinkpad2));
if (GST_IS_EVENT (in2)) {
gst_pad_push (smpte->srcpad, GST_DATA (in2));
in2 = NULL;
} else
ts = GST_BUFFER_TIMESTAMP (in2);
} }
if (in1 == NULL) { if (in1 == NULL) {
@ -373,6 +374,7 @@ gst_smpte_loop (GstElement * element)
if (smpte->position < smpte->duration) { if (smpte->position < smpte->duration) {
outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3); outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3);
/* set caps if not done yet */
if (!GST_PAD_CAPS (smpte->srcpad)) { if (!GST_PAD_CAPS (smpte->srcpad)) {
GstCaps *caps; GstCaps *caps;
@ -383,11 +385,9 @@ gst_smpte_loop (GstElement * element)
G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps, G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
NULL); NULL);
if (!gst_pad_try_set_caps (smpte->srcpad, caps)) { gst_pad_set_caps (smpte->srcpad, caps);
GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
return;
}
} }
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (smpte->srcpad));
gst_smpte_blend_i420 (GST_BUFFER_DATA (in1), gst_smpte_blend_i420 (GST_BUFFER_DATA (in1),
GST_BUFFER_DATA (in2), GST_BUFFER_DATA (in2),
@ -396,6 +396,7 @@ gst_smpte_loop (GstElement * element)
smpte->border, smpte->border,
((1 << smpte->depth) + smpte->border) * ((1 << smpte->depth) + smpte->border) *
smpte->position / smpte->duration); smpte->position / smpte->duration);
} else { } else {
outbuf = in2; outbuf = in2;
gst_buffer_ref (in2); gst_buffer_ref (in2);
@ -409,7 +410,8 @@ gst_smpte_loop (GstElement * element)
gst_buffer_unref (in2); gst_buffer_unref (in2);
GST_BUFFER_TIMESTAMP (outbuf) = ts; GST_BUFFER_TIMESTAMP (outbuf) = ts;
gst_pad_push (smpte->srcpad, GST_DATA (outbuf));
return gst_pad_push (smpte->srcpad, outbuf);
} }
static void static void

View file

@ -22,6 +22,8 @@
#define __GST_SMPTE_H__ #define __GST_SMPTE_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include "gstmask.h" #include "gstmask.h"
#define GST_TYPE_SMPTE \ #define GST_TYPE_SMPTE \
@ -53,6 +55,8 @@ struct _GstSMPTE {
*sinkpad1, *sinkpad1,
*sinkpad2; *sinkpad2;
GstCollectPads *collect;
gint type; gint type;
gint border; gint border;
gint depth; gint depth;