From 556e8a62393ac4816a9947d92fd07565e0bbf775 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 6 May 2005 19:55:22 +0000 Subject: [PATCH] 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. --- ChangeLog | 17 +++++ configure.ac | 18 ++++- ext/aalib/Makefile.am | 4 +- ext/aalib/gstaasink.c | 150 ++++++++++++++++++++++-------------------- ext/aalib/gstaasink.h | 15 +---- gst/smpte/Makefile.am | 6 +- gst/smpte/gstsmpte.c | 70 ++++++++++---------- gst/smpte/gstsmpte.h | 4 ++ 8 files changed, 158 insertions(+), 126 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0f7f4acb9..049af7b9e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-05-06 Wim Taymans + + * 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 * configure.ac: add sidplay diff --git a/configure.ac b/configure.ac index f2d77f9241..e018feb766 100644 --- a/configure.ac +++ b/configure.ac @@ -307,7 +307,8 @@ dnl these are all the gst plug-ins, compilable without additional libs GST_PLUGINS_ALL="\ videofilter \ effectv \ - law" + law \ + smpte" dnl see if we can build C++ plug-ins if test "x$HAVE_CXX" = "xyes"; then @@ -360,16 +361,27 @@ 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 # Configure external libs # dnl ########################### +>>>>>>> 1.538 dnl *** sidplay : works with libsidplay 1.36.x (not 2.x.x) *** translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true) GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [ GST_PATH_SIDPLAY() - ]) +]) dnl *** mad *** dnl FIXME: we could use header checks here as well IMO @@ -446,9 +458,11 @@ gst-plugins.spec gst/Makefile gst/effectv/Makefile gst/law/Makefile +gst/smpte/Makefile gst/videofilter/Makefile sys/Makefile ext/Makefile +ext/aalib/Makefile ext/mad/Makefile ext/sidplay/Makefile common/Makefile diff --git a/ext/aalib/Makefile.am b/ext/aalib/Makefile.am index 38e6c6d189..f7d3433b04 100644 --- a/ext/aalib/Makefile.am +++ b/ext/aalib/Makefile.am @@ -2,8 +2,8 @@ plugin_LTLIBRARIES = libgstaasink.la libgstaasink_la_SOURCES = gstaasink.c -libgstaasink_la_CFLAGS = $(GST_CFLAGS) $(AALIB_CFLAGS) +libgstaasink_la_CFLAGS = $(GST_CFLAGS) $(AALIB_CFLAGS) -I ../../../gst-plugins-base/gst-libs/ libgstaasink_la_LIBADD = $(AALIB_LIBS) -libgstaasink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstaasink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS) noinst_HEADERS = gstaasink.h diff --git a/ext/aalib/gstaasink.c b/ext/aalib/gstaasink.c index 8c0b7ce4fe..7434977226 100644 --- a/ext/aalib/gstaasink.c +++ b/ext/aalib/gstaasink.c @@ -70,8 +70,11 @@ static void gst_aasink_base_init (gpointer g_class); static void gst_aasink_class_init (GstAASinkClass * klass); static void gst_aasink_init (GstAASink * aasink); -static void gst_aasink_set_clock (GstElement * element, GstClock * clock); -static void gst_aasink_chain (GstPad * pad, GstData * _data); +static gboolean gst_aasink_setcaps (GstBaseSink * pad, GstCaps * caps); +static void gst_aasink_get_times (GstBaseSink * sink, GstBuffer * buffer, + GstClockTime * start, GstClockTime * end); +static GstFlowReturn gst_aasink_render (GstBaseSink * basesink, + GstBuffer * buffer); static void gst_aasink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -102,7 +105,8 @@ gst_aasink_get_type (void) }; aasink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0); + g_type_register_static (GST_TYPE_BASESINK, "GstAASink", &aasink_info, + 0); } return aasink_type; } @@ -186,11 +190,16 @@ gst_aasink_class_init (GstAASinkClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; + GstBaseSinkClass *gstbasesink_class; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; + gstbasesink_class = (GstBaseSinkClass *) klass; - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); + parent_class = g_type_class_ref (GST_TYPE_BASESINK); + + gobject_class->set_property = gst_aasink_set_property; + gobject_class->get_property = gst_aasink_get_property; g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ @@ -204,9 +213,6 @@ gst_aasink_class_init (GstAASinkClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ - gobject_class->set_property = gst_aasink_set_property; - gobject_class->get_property = gst_aasink_get_property; - gst_aasink_signals[SIGNAL_FRAME_DISPLAYED] = g_signal_new ("frame-displayed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAASinkClass, frame_displayed), @@ -216,12 +222,16 @@ gst_aasink_class_init (GstAASinkClass * klass) G_STRUCT_OFFSET (GstAASinkClass, have_size), NULL, NULL, gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); - gstelement_class->change_state = gst_aasink_change_state; - gstelement_class->set_clock = gst_aasink_set_clock; + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_aasink_change_state); + + gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_aasink_setcaps); + gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_aasink_get_times); + gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_aasink_render); + gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_aasink_render); } static GstCaps * -gst_aasink_fixate (GstPad * pad, const GstCaps * caps) +gst_aasink_fixate (GstPad * pad, GstCaps * caps) { GstStructure *structure; GstCaps *newcaps; @@ -247,19 +257,20 @@ gst_aasink_fixate (GstPad * pad, const GstCaps * caps) return NULL; } -static GstPadLinkReturn -gst_aasink_sinkconnect (GstPad * pad, const GstCaps * caps) +static gboolean +gst_aasink_setcaps (GstBaseSink * basesink, GstCaps * caps) { GstAASink *aasink; GstStructure *structure; - aasink = GST_AASINK (gst_pad_get_parent (pad)); + aasink = GST_AASINK (basesink); structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "width", &aasink->width); gst_structure_get_int (structure, "height", &aasink->height); /* FIXME aasink->format is never set */ + g_print ("%d %d\n", aasink->width, aasink->height); GST_DEBUG ("aasink: setting %08lx (" GST_FOURCC_FORMAT ")", aasink->format, GST_FOURCC_ARGS (aasink->format)); @@ -267,27 +278,16 @@ gst_aasink_sinkconnect (GstPad * pad, const GstCaps * caps) g_signal_emit (G_OBJECT (aasink), gst_aasink_signals[SIGNAL_HAVE_SIZE], 0, aasink->width, aasink->height); - return GST_PAD_LINK_OK; -} - -static void -gst_aasink_set_clock (GstElement * element, GstClock * clock) -{ - GstAASink *aasink = GST_AASINK (element); - - aasink->clock = clock; + return TRUE; } static void gst_aasink_init (GstAASink * aasink) { - aasink->sinkpad = - gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (aasink), "sink"), "sink"); - gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad); - gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain); - gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect); - gst_pad_set_fixate_function (aasink->sinkpad, gst_aasink_fixate); + GstPad *pad; + + pad = GST_BASESINK_PAD (aasink); + gst_pad_set_fixatecaps_function (pad, gst_aasink_fixate); memcpy (&aasink->ascii_surf, &aa_defparams, sizeof (struct aa_hardware_params)); @@ -302,9 +302,6 @@ gst_aasink_init (GstAASink * aasink) aasink->width = -1; aasink->height = -1; - aasink->clock = NULL; - - GST_FLAG_SET (aasink, GST_ELEMENT_THREAD_SUGGESTED); } static void @@ -345,40 +342,35 @@ gst_aasink_scale (GstAASink * aasink, gchar * src, gchar * dest, } static void -gst_aasink_chain (GstPad * pad, GstData * _data) +gst_aasink_get_times (GstBaseSink * sink, GstBuffer * buffer, + GstClockTime * start, GstClockTime * end) +{ + *start = GST_BUFFER_TIMESTAMP (buffer); + *end = *start + GST_BUFFER_DURATION (buffer); +} + +static GstFlowReturn +gst_aasink_render (GstBaseSink * basesink, GstBuffer * buffer) { - GstBuffer *buf = GST_BUFFER (_data); GstAASink *aasink; - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); + aasink = GST_AASINK (basesink); - aasink = GST_AASINK (gst_pad_get_parent (pad)); + GST_DEBUG ("render"); - gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */ + gst_aasink_scale (aasink, GST_BUFFER_DATA (buffer), /* src */ aa_image (aasink->context), /* dest */ aasink->width, /* sw */ aasink->height, /* sh */ aa_imgwidth (aasink->context), /* dw */ aa_imgheight (aasink->context)); /* dh */ - GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, - GST_BUFFER_TIMESTAMP (buf)); - - if (aasink->clock && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { - gst_element_wait (GST_ELEMENT (aasink), GST_BUFFER_TIMESTAMP (buf)); - } - aa_render (aasink->context, &aasink->ascii_parms, 0, 0, aa_imgwidth (aasink->context), aa_imgheight (aasink->context)); aa_flush (aasink->context); aa_getevent (aasink->context, FALSE); - g_signal_emit (G_OBJECT (aasink), gst_aasink_signals[SIGNAL_FRAME_DISPLAYED], - 0); - - gst_buffer_unref (buf); + return GST_FLOW_OK; } @@ -388,9 +380,6 @@ gst_aasink_set_property (GObject * object, guint prop_id, const GValue * value, { GstAASink *aasink; - /* it's not null if we got it, but it might not be ours */ - g_return_if_fail (GST_IS_AASINK (object)); - aasink = GST_AASINK (object); switch (prop_id) { @@ -439,7 +428,6 @@ gst_aasink_get_property (GObject * object, guint prop_id, GValue * value, { GstAASink *aasink; - /* it's not null if we got it, but it might not be ours */ aasink = GST_AASINK (object); switch (prop_id) { @@ -497,8 +485,6 @@ gst_aasink_get_property (GObject * object, guint prop_id, GValue * value, static gboolean gst_aasink_open (GstAASink * aasink) { - g_return_val_if_fail (!GST_FLAG_IS_SET (aasink, GST_AASINK_OPEN), FALSE); - aa_recommendhidisplay (aa_drivers[aasink->aa_driver]->shortname); aasink->context = aa_autoinit (&aasink->ascii_surf); @@ -510,40 +496,58 @@ gst_aasink_open (GstAASink * aasink) aa_autoinitkbd (aasink->context, 0); aa_resizehandler (aasink->context, (void *) aa_resize); - GST_FLAG_SET (aasink, GST_AASINK_OPEN); - return TRUE; } -static void +static gboolean gst_aasink_close (GstAASink * aasink) { - g_return_if_fail (GST_FLAG_IS_SET (aasink, GST_AASINK_OPEN)); - aa_close (aasink->context); - GST_FLAG_UNSET (aasink, GST_AASINK_OPEN); + return TRUE; } static GstElementStateReturn gst_aasink_change_state (GstElement * element) { - g_return_val_if_fail (GST_IS_AASINK (element), GST_STATE_FAILURE); + GstElementStateReturn ret; + gint transition; - if (GST_STATE_PENDING (element) == GST_STATE_NULL) { - if (GST_FLAG_IS_SET (element, GST_AASINK_OPEN)) - gst_aasink_close (GST_AASINK (element)); - } else { - if (!GST_FLAG_IS_SET (element, GST_AASINK_OPEN)) { + transition = GST_STATE_TRANSITION (element); + + switch (transition) { + case GST_STATE_NULL_TO_READY: + break; + case GST_STATE_READY_TO_PAUSED: if (!gst_aasink_open (GST_AASINK (element))) - return GST_STATE_FAILURE; - } + goto open_failed; + break; + case GST_STATE_PAUSED_TO_PLAYING: + break; + default: + break; } - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); - return GST_STATE_SUCCESS; + switch (transition) { + case GST_STATE_PLAYING_TO_PAUSED: + break; + case GST_STATE_PAUSED_TO_READY: + break; + case GST_STATE_READY_TO_NULL: + gst_aasink_close (GST_AASINK (element)); + break; + default: + break; + } + + return ret; + +open_failed: + { + return GST_STATE_FAILURE; + } } static gboolean diff --git a/ext/aalib/gstaasink.h b/ext/aalib/gstaasink.h index e50362f6ca..53bdabf859 100644 --- a/ext/aalib/gstaasink.h +++ b/ext/aalib/gstaasink.h @@ -22,6 +22,7 @@ #define __GST_AASINK_H__ #include +#include #include @@ -41,19 +42,11 @@ extern "C" { #define GST_IS_AASINK_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AASINK)) -typedef enum { - GST_AASINK_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_AASINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, -} GstAASinkFlags; - typedef struct _GstAASink GstAASink; typedef struct _GstAASinkClass GstAASinkClass; struct _GstAASink { - GstElement element; - - GstPad *sinkpad; + GstBaseSink parent; gulong format; gint width, height; @@ -61,8 +54,6 @@ struct _GstAASink { gint frames_displayed; guint64 frame_time; - GstClock *clock; - aa_context *context; struct aa_hardware_params ascii_surf; struct aa_renderparams ascii_parms; @@ -71,7 +62,7 @@ struct _GstAASink { }; struct _GstAASinkClass { - GstElementClass parent_class; + GstBaseSinkClass parent_class; /* signals */ void (*frame_displayed) (GstElement *element); diff --git a/gst/smpte/Makefile.am b/gst/smpte/Makefile.am index 26723c8d6e..f3d16c2195 100644 --- a/gst/smpte/Makefile.am +++ b/gst/smpte/Makefile.am @@ -5,9 +5,9 @@ libgstsmpte_la_SOURCES = gstsmpte.c gstmask.c barboxwipes.c paint.c noinst_HEADERS = gstsmpte.h gstmask.h paint.h -libgstsmpte_la_CFLAGS = $(GST_CFLAGS) -libgstsmpte_la_LIBADD = -libgstsmpte_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstsmpte_la_CFLAGS = $(GST_CFLAGS) -I ../../../gst-plugins-base/gst-libs/ +libgstsmpte_la_LIBADD = +libgstsmpte_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS) EXTRA_DIST = diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 2694575247..1c1f325b28 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -112,7 +112,8 @@ static void gst_smpte_class_init (GstSMPTEClass * klass); static void gst_smpte_base_init (GstSMPTEClass * klass); 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, const GValue * value, GParamSpec * pspec); @@ -234,13 +235,13 @@ gst_smpte_update_mask (GstSMPTE * smpte, gint type, gint depth, gint width, } static gboolean -gst_smpte_sinkconnect (GstPad * pad, const GstCaps * caps) +gst_smpte_setcaps (GstPad * pad, GstCaps * caps) { GstSMPTE *smpte; GstStructure *structure; gboolean ret; - smpte = GST_SMPTE (gst_pad_get_parent (pad)); + smpte = GST_SMPTE (GST_PAD_PARENT (pad)); 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_double (structure, "framerate", &smpte->fps); if (!ret) - return GST_PAD_LINK_REFUSED; + return FALSE; gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height); /* forward to the next plugin */ - return gst_pad_try_set_caps (smpte->srcpad, caps); + return TRUE; } static void @@ -263,13 +264,13 @@ gst_smpte_init (GstSMPTE * smpte) smpte->sinkpad1 = gst_pad_new_from_template (gst_static_pad_template_get (&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); smpte->sinkpad2 = gst_pad_new_from_template (gst_static_pad_template_get (&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); smpte->srcpad = @@ -277,12 +278,20 @@ gst_smpte_init (GstSMPTE * smpte) (&gst_smpte_src_template), "src"); 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->height = 200; smpte->fps = 25.; - smpte->duration = 64; + smpte->duration = 512; smpte->position = 0; smpte->type = 1; smpte->border = 0; @@ -332,33 +341,25 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask, } } -static void -gst_smpte_loop (GstElement * element) +static GstFlowReturn +gst_smpte_collected (GstCollectPads * pads, GstSMPTE * smpte) { - GstSMPTE *smpte; GstBuffer *outbuf; GstClockTime ts; GstBuffer *in1 = NULL, *in2 = NULL; - - smpte = GST_SMPTE (element); + GSList *collected; ts = smpte->position * GST_SECOND / smpte->fps; - while (GST_PAD_IS_USABLE (smpte->sinkpad1) && in1 == NULL) { - in1 = GST_BUFFER (gst_pad_pull (smpte->sinkpad1)); - if (GST_IS_EVENT (in1)) { - gst_pad_push (smpte->srcpad, GST_DATA (in1)); - in1 = NULL; - } else - ts = GST_BUFFER_TIMESTAMP (in1); - } - if (GST_PAD_IS_USABLE (smpte->sinkpad2) && in2 == NULL) { - 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); + for (collected = pads->data; collected; collected = g_slist_next (collected)) { + GstCollectData *data; + + data = (GstCollectData *) collected->data; + + if (data->pad == smpte->sinkpad1) + in1 = gst_collectpads_pop (pads, data); + else if (data->pad == smpte->sinkpad2) + in2 = gst_collectpads_pop (pads, data); } if (in1 == NULL) { @@ -373,6 +374,7 @@ gst_smpte_loop (GstElement * element) if (smpte->position < smpte->duration) { outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3); + /* set caps if not done yet */ if (!GST_PAD_CAPS (smpte->srcpad)) { GstCaps *caps; @@ -383,11 +385,9 @@ gst_smpte_loop (GstElement * element) G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps, NULL); - if (!gst_pad_try_set_caps (smpte->srcpad, caps)) { - GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL)); - return; - } + gst_pad_set_caps (smpte->srcpad, caps); } + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (smpte->srcpad)); gst_smpte_blend_i420 (GST_BUFFER_DATA (in1), GST_BUFFER_DATA (in2), @@ -396,6 +396,7 @@ gst_smpte_loop (GstElement * element) smpte->border, ((1 << smpte->depth) + smpte->border) * smpte->position / smpte->duration); + } else { outbuf = in2; gst_buffer_ref (in2); @@ -409,7 +410,8 @@ gst_smpte_loop (GstElement * element) gst_buffer_unref (in2); GST_BUFFER_TIMESTAMP (outbuf) = ts; - gst_pad_push (smpte->srcpad, GST_DATA (outbuf)); + + return gst_pad_push (smpte->srcpad, outbuf); } static void diff --git a/gst/smpte/gstsmpte.h b/gst/smpte/gstsmpte.h index 2142c05445..107ccc0d2c 100644 --- a/gst/smpte/gstsmpte.h +++ b/gst/smpte/gstsmpte.h @@ -22,6 +22,8 @@ #define __GST_SMPTE_H__ #include +#include + #include "gstmask.h" #define GST_TYPE_SMPTE \ @@ -53,6 +55,8 @@ struct _GstSMPTE { *sinkpad1, *sinkpad2; + GstCollectPads *collect; + gint type; gint border; gint depth;