sf's back

Original commit message from CVS:
sf's back
This commit is contained in:
Thomas Vander Stichele 2002-08-27 17:45:07 +00:00
parent c4ba06ace6
commit 509a2d42b1
3 changed files with 75 additions and 51 deletions

2
common

@ -1 +1 @@
Subproject commit f0da7b89bea3eb2ed1d149166f28afa5e670dec2 Subproject commit bca2dfba7bfc36020b5ba26b640ebde4cc76a5f0

View file

@ -647,7 +647,7 @@ gst_avi_demux_parse_index (GstAviDemux *avi_demux,
GstEvent *event; GstEvent *event;
gst_bytestream_get_status (avi_demux->bs, &remaining, &event); gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
gst_event_unref (event); gst_data_unref (GST_DATA (event));
got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8); got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8);
} }

View file

@ -100,54 +100,49 @@ static GstElementClass *parent_class = NULL;
/*static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */ /*static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */
GType GType
gst_level_get_type(void) { gst_level_get_type (void)
{
static GType level_type = 0; static GType level_type = 0;
if (!level_type) { if (!level_type)
static const GTypeInfo level_info = { {
sizeof(GstLevelClass), NULL, static const GTypeInfo level_info =
NULL, {
(GClassInitFunc)gst_level_class_init, sizeof (GstLevelClass), NULL, NULL,
NULL, (GClassInitFunc) gst_level_class_init, NULL, NULL,
NULL, sizeof (GstLevel), 0,
sizeof(GstLevel), (GInstanceInitFunc) gst_level_init
0,
(GInstanceInitFunc)gst_level_init,
}; };
level_type = g_type_register_static(GST_TYPE_ELEMENT, "GstLevel", &level_info, 0); level_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLevel",
&level_info, 0);
} }
return level_type; return level_type;
} }
static void static GstPadConnectReturn
gst_level_class_init (GstLevelClass *klass) gst_level_connect (GstPad *pad, GstCaps *caps)
{ {
GObjectClass *gobject_class; GstLevel *filter;
GstElementClass *gstelement_class; GstPad *otherpad;
gobject_class = (GObjectClass*)klass; filter = GST_LEVEL (gst_pad_get_parent (pad));
gstelement_class = (GstElementClass*)klass; g_return_val_if_fail (filter != NULL, GST_PAD_CONNECT_REFUSED);
g_return_val_if_fail (GST_IS_LEVEL (filter), GST_PAD_CONNECT_REFUSED);
parent_class = g_type_class_ref(GST_TYPE_ELEMENT); otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
gobject_class->set_property = gst_level_set_property; if (GST_CAPS_IS_FIXED (caps))
gobject_class->get_property = gst_level_get_property; {
if (/* !volume_parse_caps (filter, caps) || */
!gst_pad_try_set_caps (otherpad, caps))
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_CONNECT_OK;
}
return GST_PAD_CONNECT_DELAYED;
} }
static void static void
gst_level_init (GstLevel *filter) gst_level_chain (GstPad *pad, GstBuffer *buf)
{
filter->sinkpad = gst_pad_new_from_template(level_sink_factory (),"sink");
filter->srcpad = gst_pad_new_from_template(level_src_factory (),"src");
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_pad_set_chain_function(filter->sinkpad,gst_level_chain);
filter->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
}
static void
gst_level_chain (GstPad *pad,GstBuffer *buf)
{ {
GstLevel *filter; GstLevel *filter;
gint16 *in_data; gint16 *in_data;
@ -157,28 +152,28 @@ gst_level_chain (GstPad *pad,GstBuffer *buf)
GstCaps *caps; GstCaps *caps;
g_return_if_fail(pad != NULL); g_return_if_fail (pad != NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail(buf != NULL); g_return_if_fail (buf != NULL);
filter = GST_LEVEL(GST_OBJECT_PARENT (pad)); filter = GST_LEVEL (GST_OBJECT_PARENT (pad));
g_return_if_fail(filter != NULL); g_return_if_fail (filter != NULL);
g_return_if_fail(GST_IS_LEVEL(filter)); g_return_if_fail (GST_IS_LEVEL (filter));
caps = NULL; caps = NULL;
caps = GST_PAD_CAPS(pad); caps = GST_PAD_CAPS (pad);
if (caps == NULL) if (caps == NULL)
{ {
/* FIXME : Please change this to a better warning method ! */ /* FIXME : Please change this to a better warning method ! */
printf ("WARNING : chain : Could not get caps of pad !\n"); g_error ("WARNING: level: Could not get pad caps - caps nego failed !\n");
} }
gst_caps_get_int(caps, "width", &width); gst_caps_get_int (caps, "width", &width);
in_data = (gint16 *)GST_BUFFER_DATA(buf); in_data = (gint16 *) GST_BUFFER_DATA(buf);
outbuf=gst_buffer_new(); outbuf = gst_buffer_new();
GST_BUFFER_DATA(outbuf) = (gchar*)g_new(gint16,GST_BUFFER_SIZE(buf)/2); GST_BUFFER_DATA (outbuf) = (gchar*) g_new (gint16, GST_BUFFER_SIZE(buf)/2);
GST_BUFFER_SIZE(outbuf) = GST_BUFFER_SIZE(buf); GST_BUFFER_SIZE (outbuf) = GST_BUFFER_SIZE(buf);
out_data = (gint16*)GST_BUFFER_DATA(outbuf); out_data = (gint16*)GST_BUFFER_DATA(outbuf);
@ -235,6 +230,35 @@ gst_level_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
} }
} }
static void
gst_level_class_init (GstLevelClass *klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass*) klass;
gstelement_class = (GstElementClass*) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_level_set_property;
gobject_class->get_property = gst_level_get_property;
}
static void
gst_level_init (GstLevel *filter)
{
filter->sinkpad = gst_pad_new_from_template (level_sink_factory (), "sink");
gst_pad_set_connect_function (filter->sinkpad, gst_level_connect);
filter->srcpad = gst_pad_new_from_template (level_src_factory (), "src");
gst_pad_set_connect_function (filter->srcpad, gst_level_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_pad_set_chain_function (filter->sinkpad, gst_level_chain);
filter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
}
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GModule *module, GstPlugin *plugin)
{ {