diff options
38 files changed, 512 insertions, 54 deletions
diff --git a/common b/common -Subproject 9f37b3e515260c7b294222a502b2cc75dd0983b +Subproject cd5507ae3df8dc48c07df9e37878846b6b79faa diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c index c8771dac..0cfa010e 100644 --- a/gst/cdxaparse/gstcdxaparse.c +++ b/gst/cdxaparse/gstcdxaparse.c @@ -328,7 +328,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN) diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c index 2406db0d..c3c67228 100644 --- a/gst/chart/gstchart.c +++ b/gst/chart/gstchart.c @@ -403,6 +403,5 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index e58e1dbf..2a73ab01 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -377,7 +377,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ); diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index ad3a0c5c..d59a8518 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -450,7 +450,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ); diff --git a/gst/filter/gstfilter.c b/gst/filter/gstfilter.c index 85c15876..7a5d4248 100644 --- a/gst/filter/gstfilter.c +++ b/gst/filter/gstfilter.c @@ -78,7 +78,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ); diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index e7088d61..3fb0598c 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -651,7 +651,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c index 6bbdf1d7..726f9e02 100644 --- a/gst/mixmatrix/mixmatrix.c +++ b/gst/mixmatrix/mixmatrix.c @@ -516,7 +516,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index a6a4f2c9..75acae23 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -807,8 +807,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - "(c) 2001 Kenton Varda <temporal@gauge3d.org>\n" - "(c) 2001 Olivier Lapicque <olivierl@jps.net>", GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/mpeg1sys/gstmpeg1systemencode.c b/gst/mpeg1sys/gstmpeg1systemencode.c index 94f01d1d..52f88b44 100644 --- a/gst/mpeg1sys/gstmpeg1systemencode.c +++ b/gst/mpeg1sys/gstmpeg1systemencode.c @@ -567,7 +567,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "GPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/mpeg1videoparse/gstmp1videoparse.c b/gst/mpeg1videoparse/gstmp1videoparse.c index c37ce61f..51a29a4e 100644 --- a/gst/mpeg1videoparse/gstmp1videoparse.c +++ b/gst/mpeg1videoparse/gstmp1videoparse.c @@ -507,7 +507,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/mpeg2sub/gstmpeg2subt.c b/gst/mpeg2sub/gstmpeg2subt.c index 46681c6e..c98d9bee 100644 --- a/gst/mpeg2sub/gstmpeg2subt.c +++ b/gst/mpeg2sub/gstmpeg2subt.c @@ -439,8 +439,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - "(c) 2001 Samuel Hocevar <sam@via.ecp.fr>\n" - "(c) 2001 Michel Lespinasse <walken@via.ecp.fr>", GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index 193673fc..cc56bb01 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -583,7 +583,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/overlay/gstoverlay.c b/gst/overlay/gstoverlay.c index 8c7cb59b..a027ab89 100644 --- a/gst/overlay/gstoverlay.c +++ b/gst/overlay/gstoverlay.c @@ -357,7 +357,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c index 4f0b1a1d..9e1e6fa5 100644 --- a/gst/passthrough/gstpassthrough.c +++ b/gst/passthrough/gstpassthrough.c @@ -322,7 +322,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c index 8ad1abc9..3f01165a 100644 --- a/gst/playondemand/gstplayondemand.c +++ b/gst/playondemand/gstplayondemand.c @@ -568,7 +568,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 54181759..2bbe5819 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -252,7 +252,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/rtjpeg/gstrtjpeg.c b/gst/rtjpeg/gstrtjpeg.c index e5154291..2b9ff37d 100644 --- a/gst/rtjpeg/gstrtjpeg.c +++ b/gst/rtjpeg/gstrtjpeg.c @@ -44,7 +44,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "GPL", - "(c) 2000 Justin Schoeman <justin@suntiger.ee.up.ac.za>", GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/smooth/gstsmooth.c b/gst/smooth/gstsmooth.c index be41e88e..c30507d6 100644 --- a/gst/smooth/gstsmooth.c +++ b/gst/smooth/gstsmooth.c @@ -350,7 +350,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index a318bdc3..ebd5d3f1 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -482,7 +482,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c index 4b45ad7b..920d69ee 100644 --- a/gst/spectrum/gstspectrum.c +++ b/gst/spectrum/gstspectrum.c @@ -212,7 +212,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index a8fa40f7..1b7bcf69 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -317,7 +317,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/stereo/gststereo.c b/gst/stereo/gststereo.c index 0e315c7c..f2e9a79d 100644 --- a/gst/stereo/gststereo.c +++ b/gst/stereo/gststereo.c @@ -233,7 +233,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/switch/Makefile.am b/gst/switch/Makefile.am new file mode 100644 index 00000000..fcac882e --- /dev/null +++ b/gst/switch/Makefile.am @@ -0,0 +1,9 @@ + +plugin_LTLIBRARIES = libgstswitch.la + +libgstswitch_la_SOURCES = gstswitch.c +libgstswitch_la_CFLAGS = $(GST_CFLAGS) +libgstswitch_la_LIBADD = +libgstswitch_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) + +noinst_HEADERS = gstswitch.h diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c new file mode 100644 index 00000000..6b6ad06c --- /dev/null +++ b/gst/switch/gstswitch.c @@ -0,0 +1,337 @@ +/* GStreamer + * Copyright (C) 2003 Julien Moutte <julien@moutte.net> + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Object header */ +#include "gstswitch.h" + +enum { + ARG_0, + ARG_NB_SOURCES, + ARG_ACTIVE_SOURCE +}; + +/* ElementFactory information */ +static GstElementDetails gst_switch_details = GST_ELEMENT_DETAILS ( + "Switch", + "Generic", + "N-to-1 input switching", + "Julien Moutte <julien@moutte.net>" +); + +static GstStaticPadTemplate gst_switch_sink_factory = +GST_STATIC_PAD_TEMPLATE ( + "sink%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS2_ANY +); + +static GstElementClass *parent_class = NULL; + +/* ============================================================= */ +/* */ +/* Private Methods */ +/* */ +/* ============================================================= */ + +static GstPad* +gst_switch_request_new_pad (GstElement *element, + GstPadTemplate *templ, + const gchar *unused) +{ + char *name = NULL; + GstPad *sinkpad = NULL; + GstSwitch *gstswitch = NULL; + GstSwitchPad *switchpad = NULL; + + g_return_val_if_fail (GST_IS_SWITCH (element), NULL); + + if (templ->direction != GST_PAD_SINK) { + g_warning ("gstswitch: requested a non sink pad\n"); + return NULL; + } + + gstswitch = GST_SWITCH (element); + + name = g_strdup_printf ("sink%d", gstswitch->nb_sinkpads); + + sinkpad = gst_pad_new_from_template (templ, name); + + if (name) + g_free (name); + + gst_element_add_pad (GST_ELEMENT (gstswitch), sinkpad); + + switchpad = g_new0 (GstSwitchPad, 1); + if (!switchpad) + return NULL; + + switchpad->sinkpad = sinkpad; + switchpad->data = NULL; + switchpad->forwarded = FALSE; + + gstswitch->sinkpads = g_list_insert (gstswitch->sinkpads, switchpad, + gstswitch->nb_sinkpads); + gstswitch->nb_sinkpads++; + + return sinkpad; +} + +static gboolean +gst_switch_poll_sinkpads (GstSwitch *gstswitch) +{ + GList *pads; + + g_return_val_if_fail (gstswitch != NULL, FALSE); + g_return_val_if_fail (GST_IS_SWITCH (gstswitch), FALSE); + + pads = gstswitch->sinkpads; + + while (pads) { + GstSwitchPad *switchpad = pads->data; + GstData *data = gst_pad_pull (switchpad->sinkpad); + if (GST_IS_EVENT (data) && + (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS)) { + /* If that data was not forwarded we unref it */ + if (!switchpad->forwarded && switchpad->data) { + gst_data_unref (switchpad->data); + switchpad->data = NULL; + } + gst_event_unref (GST_EVENT (data)); + } + else { + /* If that data was not forwarded we unref it */ + if (!switchpad->forwarded && switchpad->data) { + gst_data_unref (switchpad->data); + switchpad->data = NULL; + } + switchpad->data = data; + switchpad->forwarded = FALSE; + } + pads = g_list_next (pads); + } + + return TRUE; +} + +static void +gst_switch_loop (GstElement *element) +{ + GstSwitch *gstswitch = NULL; + GstSwitchPad *switchpad = NULL; + + g_return_if_fail (element != NULL); + g_return_if_fail (GST_IS_SWITCH (element)); + + gstswitch = GST_SWITCH (element); + + /* We poll all our sinkpads */ + gst_switch_poll_sinkpads (gstswitch); + + /* We get the active sinkpad */ + switchpad = g_list_nth_data (gstswitch->sinkpads, gstswitch->active_sinkpad); + + if (switchpad) { + /* Pushing active sinkpad data to srcpad */ + gst_pad_push (gstswitch->srcpad, switchpad->data); + /* Mark this data as forwarded so that it won't get unrefed on next poll */ + switchpad->forwarded = TRUE; + } +} + +/* =========================================== */ +/* */ +/* Properties */ +/* */ +/* =========================================== */ + +static void +gst_switch_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + GstSwitch *gstswitch = NULL; + + g_return_if_fail (GST_IS_SWITCH (object)); + + gstswitch = GST_SWITCH (object); + + switch (prop_id) { + case ARG_ACTIVE_SOURCE: + gstswitch->active_sinkpad = g_value_get_int (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_switch_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + GstSwitch *gstswitch = NULL; + + g_return_if_fail (GST_IS_SWITCH (object)); + + gstswitch = GST_SWITCH (object); + + switch (prop_id) { + case ARG_ACTIVE_SOURCE: + g_value_set_int (value, gstswitch->active_sinkpad); + break; + case ARG_NB_SOURCES: + g_value_set_int (value, gstswitch->nb_sinkpads); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/* =========================================== */ +/* */ +/* Init & Class init */ +/* */ +/* =========================================== */ + +static void +gst_switch_dispose (GObject *object) +{ + GstSwitch *gstswitch = NULL; + + gstswitch = GST_SWITCH (object); + + if (gstswitch->sinkpads) { + g_list_free (gstswitch->sinkpads); + gstswitch->sinkpads = NULL; + } + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +gst_switch_init (GstSwitch *gstswitch) +{ + gstswitch->srcpad = gst_pad_new ("src", GST_PAD_SRC); + gst_element_add_pad (GST_ELEMENT (gstswitch), gstswitch->srcpad); + + gst_element_set_loop_function (GST_ELEMENT (gstswitch), gst_switch_loop); + + gstswitch->sinkpads = NULL; + gstswitch->active_sinkpad = 0; + gstswitch->nb_sinkpads = 0; +} + +static void +gst_switch_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (element_class, &gst_switch_details); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_switch_sink_factory)); +} + +static void +gst_switch_class_init (GstSwitchClass *klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + + parent_class = g_type_class_ref (GST_TYPE_ELEMENT); + + g_object_class_install_property (gobject_class, + ARG_NB_SOURCES, + g_param_spec_int ("nb_sources", + "number of sources", + "number of sources", + G_MININT, G_MAXINT, 0, + G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, + ARG_ACTIVE_SOURCE, + g_param_spec_int ("active_source", + "active source", + "active source", + G_MININT, G_MAXINT, 0, + G_PARAM_READWRITE)); + + gobject_class->dispose = gst_switch_dispose; + gobject_class->set_property = gst_switch_set_property; + gobject_class->get_property = gst_switch_get_property; + + gstelement_class->request_new_pad = gst_switch_request_new_pad; +} + +/* ============================================================= */ +/* */ +/* Public Methods */ +/* */ +/* ============================================================= */ + +GType +gst_switch_get_type (void) +{ + static GType switch_type = 0; + + if (!switch_type) { + static const GTypeInfo switch_info = { + sizeof(GstSwitchClass), + gst_switch_base_init, + NULL, + (GClassInitFunc) gst_switch_class_init, + NULL, + NULL, + sizeof(GstSwitch), + 0, + (GInstanceInitFunc) gst_switch_init, + }; + + switch_type = g_type_register_static (GST_TYPE_ELEMENT, + "GstSwitch", &switch_info, 0); + } + + return switch_type; +} + +static gboolean +plugin_init (GstPlugin *plugin) +{ + return gst_element_register (plugin, "switch", GST_RANK_NONE, + GST_TYPE_SWITCH); +} + +GST_PLUGIN_DEFINE ( + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "switch", + "N-to-1 input switching", + plugin_init, + VERSION, + GST_LICENSE, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst/switch/gstswitch.h b/gst/switch/gstswitch.h new file mode 100644 index 00000000..20256503 --- /dev/null +++ b/gst/switch/gstswitch.h @@ -0,0 +1,67 @@ +/* GStreamer + * Copyright (C) 2003 Julien Moutte <julien@moutte.net> + * + * 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_SWITCH_H__ +#define __GST_SWITCH_H__ + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_SWITCH \ + (gst_switch_get_type()) +#define GST_SWITCH(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_SWITCH, GstSwitch)) +#define GST_SWITCH_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_SWITCH, GstSwitch)) +#define GST_IS_SWITCH(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SWITCH)) +#define GST_IS_SWITCH_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SWITCH)) + +typedef struct _GstSwitchPad GstSwitchPad; + +typedef struct _GstSwitch GstSwitch; +typedef struct _GstSwitchClass GstSwitchClass; + +struct _GstSwitchPad { + GstPad *sinkpad; + GstData *data; + gboolean forwarded; +}; + +struct _GstSwitch { + GstElement element; + + GList *sinkpads; + GstPad *srcpad; + + guint nb_sinkpads; + guint active_sinkpad; +}; + +struct _GstSwitchClass { + GstElementClass parent_class; +}; + +GType gst_switch_get_type (void); + +G_END_DECLS + +#endif /* __GST_SWITCH_H__ */ diff --git a/gst/vbidec/gstvbidec.c b/gst/vbidec/gstvbidec.c index c5c0bd6d..8ceaee5b 100644 --- a/gst/vbidec/gstvbidec.c +++ b/gst/vbidec/gstvbidec.c @@ -375,7 +375,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "GPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c index acb049cd..b8bece14 100644 --- a/gst/videocrop/gstvideocrop.c +++ b/gst/videocrop/gstvideocrop.c @@ -421,7 +421,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/videodrop/gstvideodrop.c b/gst/videodrop/gstvideodrop.c index bf837126..481e535f 100644 --- a/gst/videodrop/gstvideodrop.c +++ b/gst/videodrop/gstvideodrop.c @@ -40,6 +40,7 @@ enum { enum { ARG_0, + ARG_SPEED /* FILL ME */ }; @@ -68,6 +69,18 @@ static void gst_videodrop_class_init (GstVideodropClass *klass); static void gst_videodrop_init (GstVideodrop *videodrop); static void gst_videodrop_chain (GstPad *pad, GstData *_data); +static void gst_videodrop_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gst_videodrop_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +static GstElementStateReturn + gst_videodrop_change_state (GstElement *element); + static GstElementClass *parent_class = NULL; /*static guint gst_videodrop_signals[LAST_SIGNAL] = { 0 }; */ @@ -112,7 +125,20 @@ gst_videodrop_base_init (gpointer g_class) static void gst_videodrop_class_init (GstVideodropClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + parent_class = g_type_class_peek_parent (klass); + + g_object_class_install_property (object_class, ARG_SPEED, + g_param_spec_float ("speed", "Speed", + "Output speed (relative to input)", + 0.01, 100, 1, G_PARAM_READWRITE)); + + object_class->set_property = gst_videodrop_set_property; + object_class->get_property = gst_videodrop_get_property; + + element_class->change_state = gst_videodrop_change_state; } #define gst_caps_get_float_range(caps, name, min, max) \ @@ -161,38 +187,90 @@ gst_videodrop_init (GstVideodrop *videodrop) videodrop->inited = FALSE; videodrop->total = videodrop->pass = 0; + videodrop->speed = 1.; } static void -gst_videodrop_chain (GstPad *pad, GstData *_data) +gst_videodrop_chain (GstPad *pad, GstData *data) { - GstBuffer *buf = GST_BUFFER (_data); - GstVideodrop *videodrop; - - GST_DEBUG ("gst_videodrop_chain"); + GstVideodrop *videodrop = GST_VIDEODROP (gst_pad_get_parent (pad)); + GstBuffer *buf; - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - videodrop = GST_VIDEODROP (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - gst_pad_push (videodrop->srcpad, GST_DATA (buf)); + if (GST_IS_EVENT (data)) { + gst_pad_event_default (videodrop->srcpad, GST_EVENT (data)); return; } + buf = GST_BUFFER (data); + videodrop->total++; - while (videodrop->to_fps / videodrop->from_fps > + while (videodrop->to_fps / (videodrop->from_fps * videodrop->speed) > (gfloat) videodrop->pass / videodrop->total) { videodrop->pass++; gst_buffer_ref (buf); + GST_BUFFER_TIMESTAMP (buf) /= videodrop->speed; gst_pad_push (videodrop->srcpad, GST_DATA (buf)); } gst_buffer_unref (buf); } +static void +gst_videodrop_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstVideodrop *videodrop = GST_VIDEODROP (object); + + switch (prop_id) { + case ARG_SPEED: + videodrop->speed = g_value_get_float (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_videodrop_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstVideodrop *videodrop = GST_VIDEODROP (object); + + switch (prop_id) { + case ARG_SPEED: + g_value_set_float (value, videodrop->speed); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstElementStateReturn +gst_videodrop_change_state (GstElement *element) +{ + GstVideodrop *videodrop = GST_VIDEODROP (element); + + switch (GST_STATE_TRANSITION (element)) { + case GST_STATE_PAUSED_TO_READY: + videodrop->inited = FALSE; + videodrop->total = videodrop->pass = 0; + break; + default: + break; + } + + if (parent_class->change_state) + return parent_class->change_state (element); + + return GST_STATE_SUCCESS; +} + static gboolean plugin_init (GstPlugin *plugin) { @@ -207,7 +285,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/videodrop/gstvideodrop.h b/gst/videodrop/gstvideodrop.h index f5209842..429be2c4 100644 --- a/gst/videodrop/gstvideodrop.h +++ b/gst/videodrop/gstvideodrop.h @@ -45,8 +45,9 @@ struct _GstVideodrop { /* video state */ gboolean inited; - float from_fps, - to_fps; + gfloat from_fps, + to_fps; + gfloat speed; guint64 pass, total; }; diff --git a/gst/y4m/gsty4mencode.c b/gst/y4m/gsty4mencode.c index 4f6276ed..2c0cb598 100644 --- a/gst/y4m/gsty4mencode.c +++ b/gst/y4m/gsty4mencode.c @@ -298,7 +298,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/cdrom/gstcdplayer.c b/sys/cdrom/gstcdplayer.c index dccf4cba..b0c768b2 100644 --- a/sys/cdrom/gstcdplayer.c +++ b/sys/cdrom/gstcdplayer.c @@ -367,7 +367,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, /* ? */ - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ); diff --git a/sys/dxr3/dxr3init.c b/sys/dxr3/dxr3init.c index 341523a4..fc441356 100644 --- a/sys/dxr3/dxr3init.c +++ b/sys/dxr3/dxr3init.c @@ -48,7 +48,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "GPL", - "(c) 2003 Martin Soto <martinsoto@users.sourceforge.net>", GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/glsink/gstglsink.c b/sys/glsink/gstglsink.c index 54d2938f..15e8926e 100644 --- a/sys/glsink/gstglsink.c +++ b/sys/glsink/gstglsink.c @@ -782,7 +782,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ); diff --git a/sys/qcam/gstqcamsrc.c b/sys/qcam/gstqcamsrc.c index 4cd68842..4f213f53 100644 --- a/sys/qcam/gstqcamsrc.c +++ b/sys/qcam/gstqcamsrc.c @@ -436,7 +436,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c index 0054d939..f91e10ce 100644 --- a/sys/v4l2/gstv4l2.c +++ b/sys/v4l2/gstv4l2.c @@ -51,7 +51,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/v4l2/gstv4l2element.c b/sys/v4l2/gstv4l2element.c index 53893fac..d99f6d6d 100644 --- a/sys/v4l2/gstv4l2element.c +++ b/sys/v4l2/gstv4l2element.c @@ -78,8 +78,8 @@ static guint gst_v4l2element_signals[LAST_SIGNAL] = { 0 }; static gboolean -gst_v4l2_iface_supported (GstInterface *iface, - GType iface_type) +gst_v4l2_iface_supported (GstImplementsInterface *iface, + GType iface_type) { GstV4l2Element *v4l2element = GST_V4L2ELEMENT (iface); @@ -99,7 +99,7 @@ gst_v4l2_iface_supported (GstInterface *iface, static void -gst_v4l2_interface_init (GstInterfaceClass *klass) +gst_v4l2_interface_init (GstImplementsInterfaceClass *klass) { /* default virtual functions */ klass->supported = gst_v4l2_iface_supported; @@ -315,7 +315,7 @@ gst_v4l2element_get_type (void) "GstV4l2Element", &v4l2element_info, 0); g_type_add_interface_static (v4l2element_type, - GST_TYPE_INTERFACE, + GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); g_type_add_interface_static (v4l2element_type, GST_TYPE_TUNER, diff --git a/sys/vcd/vcdsrc.c b/sys/vcd/vcdsrc.c index 0f559a8a..04db4410 100644 --- a/sys/vcd/vcdsrc.c +++ b/sys/vcd/vcdsrc.c @@ -410,7 +410,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) |