From 6f2a22eb93ce68abf25a6c5845d6ac5322a09557 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 17 Feb 2002 02:06:04 +0000 Subject: better capsnego in osssink s/parseau/auparse/ update volume, mulawdecode, auparse to new capsnego Original commit message from CVS: * better capsnego in osssink * s/parseau/auparse/ * update volume, mulawdecode, auparse to new capsnego --- gst/auparse/Makefile.am | 12 +- gst/auparse/gstauparse.c | 308 +++++++++++++++++++++++++++++++++++++++++++++++ gst/auparse/gstauparse.h | 74 ++++++++++++ gst/auparse/gstparseau.c | 308 ----------------------------------------------- gst/auparse/gstparseau.h | 74 ------------ gst/law/mulaw-decode.c | 48 ++++---- 6 files changed, 411 insertions(+), 413 deletions(-) create mode 100644 gst/auparse/gstauparse.c create mode 100644 gst/auparse/gstauparse.h delete mode 100644 gst/auparse/gstparseau.c delete mode 100644 gst/auparse/gstparseau.h (limited to 'gst') diff --git a/gst/auparse/Makefile.am b/gst/auparse/Makefile.am index 0ea4918a..b6e0c2a6 100644 --- a/gst/auparse/Makefile.am +++ b/gst/auparse/Makefile.am @@ -1,10 +1,10 @@ plugindir = $(libdir)/gst -plugin_LTLIBRARIES = libgstparseau.la +plugin_LTLIBRARIES = libgstauparse.la -libgstparseau_la_SOURCES = gstparseau.c -libgstparseau_la_CFLAGS = $(GST_CFLAGS) -libgstparseau_la_LIBADD = $(GST_LIBS) -libgstparseau_la_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +libgstauparse_la_SOURCES = gstauparse.c +libgstauparse_la_CFLAGS = $(GST_CFLAGS) +libgstauparse_la_LIBADD = $(GST_LIBS) +libgstauparse_la_LDFLAGS = @GST_PLUGIN_LDFLAGS@ -noinst_HEADERS = gstparseau.h +noinst_HEADERS = gstauparse.h diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c new file mode 100644 index 00000000..9c1c6c7d --- /dev/null +++ b/gst/auparse/gstauparse.c @@ -0,0 +1,308 @@ +/* Gnome-Streamer + * Copyright (C) <1999> Erik Walthinsen + * + * 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. + */ + +/* 2001/04/03 - Updated parseau to use caps nego + * Zaheer Merali +#include + +#include + + +/* elementfactory information */ +static GstElementDetails gst_auparse_details = { + ".au parser", + "Parser/Audio", + "Parse an .au file into raw audio", + VERSION, + "Erik Walthinsen ", + "(C) 1999", +}; + +static GstCaps* +au_typefind (GstBuffer *buf, gpointer private) +{ + GstCaps *new = NULL; + gulong *head = (gulong *) GST_BUFFER_DATA (buf); + + if (*head == 0x2e736e64 || *head == 0x646e732e) + new = gst_caps_new ("au_typefind", "audio/au", NULL); + + return new; +} + +/* typefactory for 'au' */ +static GstTypeDefinition audefinition = { + "auparse_audio/au", + "audio/au", + ".au", + au_typefind, +}; + +GST_PADTEMPLATE_FACTORY (sink_factory_templ, + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_CAPS_NEW ( + "auparse_sink", + "audio/au", + NULL + ) +) + + +GST_PADTEMPLATE_FACTORY (src_factory_templ, + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_CAPS_NEW ( + "auparse_src", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT_RANGE (0, 1), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_LIST( + GST_PROPS_BOOLEAN (FALSE), + GST_PROPS_BOOLEAN (TRUE) + ), + "width", GST_PROPS_LIST( + GST_PROPS_INT (8), + GST_PROPS_INT (16) + ), + "depth", GST_PROPS_LIST( + GST_PROPS_INT (8), + GST_PROPS_INT (16) + ), + "rate", GST_PROPS_INT_RANGE (8000,48000), + "channels", GST_PROPS_INT_RANGE (1, 2) + ) +) + +/* AuParse signals and args */ +enum { + /* FILL ME */ + LAST_SIGNAL +}; + +enum { + ARG_0, + /* FILL ME */ +}; + +static void gst_auparse_class_init (GstAuParseClass *klass); +static void gst_auparse_init (GstAuParse *auparse); + +static void gst_auparse_chain (GstPad *pad,GstBuffer *buf); + +static GstElementClass *parent_class = NULL; +//static guint gst_auparse_signals[LAST_SIGNAL] = { 0 }; + +GType +gst_auparse_get_type (void) +{ + static GType auparse_type = 0; + + if (!auparse_type) { + static const GTypeInfo auparse_info = { + sizeof(GstAuParseClass), NULL, + NULL, + (GClassInitFunc) gst_auparse_class_init, + NULL, + NULL, + sizeof(GstAuParse), + 0, + (GInstanceInitFunc) gst_auparse_init, + }; + auparse_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info, 0); + } + return auparse_type; +} + +static void +gst_auparse_class_init (GstAuParseClass *klass) +{ + GstElementClass *gstelement_class; + + gstelement_class = (GstElementClass*) klass; + + parent_class = g_type_class_ref (GST_TYPE_ELEMENT); +} + +static void +gst_auparse_init (GstAuParse *auparse) +{ + auparse->sinkpad = gst_pad_new_from_template ( + GST_PADTEMPLATE_GET (sink_factory_templ), "sink"); + gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad); + gst_pad_set_chain_function (auparse->sinkpad, gst_auparse_chain); + + auparse->srcpad = gst_pad_new_from_template ( + GST_PADTEMPLATE_GET (src_factory_templ), "src"); + gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad); + + auparse->offset = 0; + auparse->size = 0; + auparse->encoding = 0; + auparse->frequency = 0; + auparse->channels = 0; +} + +static void +gst_auparse_chain (GstPad *pad, GstBuffer *buf) +{ + GstAuParse *auparse; + gchar *data; + glong size; + GstCaps* tempcaps; + gint law, depth; + gboolean sign; + + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_PAD (pad)); + g_return_if_fail (buf != NULL); + + auparse = GST_AUPARSE (gst_pad_get_parent (pad)); + + GST_DEBUG (0, "gst_auparse_chain: got buffer in '%s'\n", + gst_element_get_name (GST_ELEMENT (auparse))); + + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + + /* if we haven't seen any data yet... */ + if (auparse->size == 0) { + GstBuffer *newbuf; + gulong *head = (gulong *)data; + + /* normal format is big endian (au is a Sparc format) */ + if (GULONG_FROM_BE (*(head++)) == 0x2e736e64) { + auparse->le = 0; + auparse->offset = GULONG_FROM_BE (*(head++)); + auparse->size = GULONG_FROM_BE (*(head++)); + auparse->encoding = GULONG_FROM_BE (*(head++)); + auparse->frequency = GULONG_FROM_BE (*(head++)); + auparse->channels = GULONG_FROM_BE (*(head++)); + + /* but I wouldn't be surprised by a little endian version */ + } else if (GULONG_FROM_LE (*(head++)) == 0x2e736e64) { + auparse->le = 1; + auparse->offset = GULONG_FROM_LE(*(head++)); + auparse->size = GULONG_FROM_LE(*(head++)); + auparse->encoding = GULONG_FROM_LE(*(head++)); + auparse->frequency = GULONG_FROM_LE(*(head++)); + auparse->channels = GULONG_FROM_LE(*(head++)); + + } else { + g_warning ("help, dunno what I'm looking at!\n"); + gst_buffer_unref(buf); + return; + } + + g_print ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", + auparse->offset,auparse->size,auparse->encoding, + auparse->frequency,auparse->channels); + GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", + auparse->offset,auparse->size,auparse->encoding, + auparse->frequency,auparse->channels); + + switch (auparse->encoding) { + case 1: + law = 1; + depth = 8; + sign = FALSE; + break; + case 2: + law = 0; + depth = 8; + sign = TRUE; + break; + case 3: + law = 0; + depth = 16; + sign = TRUE; + break; + default: + g_warning ("help!, dont know how to deal with this format yet\n"); + return; + } + + tempcaps = GST_CAPS_NEW ("auparse_src", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "rate", GST_PROPS_INT (auparse->frequency), + "channels", GST_PROPS_INT (auparse->channels), + "law", GST_PROPS_INT (law), + "depth", GST_PROPS_INT (depth), + "width", GST_PROPS_INT (depth), + "signed", GST_PROPS_BOOLEAN (sign)); + + if (!gst_pad_try_set_caps (auparse->srcpad, tempcaps)) { + gst_buffer_unref (buf); + gst_element_error (GST_ELEMENT (auparse), "could not set audio caps"); + return; + } + + newbuf = gst_buffer_new (); + GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(auparse->offset)); + memcpy (GST_BUFFER_DATA (newbuf), data+24, size-(auparse->offset)); + GST_BUFFER_SIZE (newbuf) = size-(auparse->offset); + + gst_buffer_unref (buf); + + gst_pad_push (auparse->srcpad, newbuf); + return; + } + + gst_pad_push (auparse->srcpad, buf); +} + + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + GstElementFactory *factory; + GstTypeFactory *type; + + /* create the plugin structure */ + /* create an elementfactory for the auparse element and list it */ + factory = gst_elementfactory_new ("auparse", GST_TYPE_AUPARSE, + &gst_auparse_details); + g_return_val_if_fail (factory != NULL, FALSE); + + gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sink_factory_templ)); + gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (src_factory_templ)); + + type = gst_typefactory_new (&audefinition); + + gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); + gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); + + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "auparse", + plugin_init +}; + diff --git a/gst/auparse/gstauparse.h b/gst/auparse/gstauparse.h new file mode 100644 index 00000000..0bee4a03 --- /dev/null +++ b/gst/auparse/gstauparse.h @@ -0,0 +1,74 @@ +/* Gnome-Streamer + * Copyright (C) <1999> Erik Walthinsen + * + * 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_AUPARSE_H__ +#define __GST_AUPARSE_H__ + + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GST_TYPE_AUPARSE \ + (gst_auparse_get_type()) +#define GST_AUPARSE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUPARSE,GstAuParse)) +#define GST_AUPARSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUPARSE,GstAuParse)) +#define GST_IS_AUPARSE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUPARSE)) +#define GST_IS_AUPARSE_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUPARSE)) + +typedef struct _GstAuParse GstAuParse; +typedef struct _GstAuParseClass GstAuParseClass; + +struct _GstAuParse { + GstElement element; + + GstPad *sinkpad,*srcpad; + + guchar le; + glong offset; + glong size; + glong encoding; + glong frequency; + glong channels; + +}; + +struct _GstAuParseClass { + GstElementClass parent_class; +}; + +GType gst_auparse_get_type (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GST_AUPARSE_H__ */ diff --git a/gst/auparse/gstparseau.c b/gst/auparse/gstparseau.c deleted file mode 100644 index 92466582..00000000 --- a/gst/auparse/gstparseau.c +++ /dev/null @@ -1,308 +0,0 @@ -/* Gnome-Streamer - * Copyright (C) <1999> Erik Walthinsen - * - * 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. - */ - -/* 2001/04/03 - Updated parseau to use caps nego - * Zaheer Merali -#include - -#include - - -/* elementfactory information */ -static GstElementDetails gst_parseau_details = { - ".au parser", - "Parser/Audio", - "Parse an .au file into raw audio", - VERSION, - "Erik Walthinsen ", - "(C) 1999", -}; - -static GstCaps* -au_typefind (GstBuffer *buf, gpointer private) -{ - GstCaps *new = NULL; - gulong *head = (gulong *) GST_BUFFER_DATA (buf); - - if (*head == 0x2e736e64 || *head == 0x646e732e) - new = gst_caps_new ("au_typefind", "audio/au", NULL); - - return new; -} - -/* typefactory for 'au' */ -static GstTypeDefinition audefinition = { - "parseau_audio/au", - "audio/au", - ".au", - au_typefind, -}; - -GST_PADTEMPLATE_FACTORY (sink_factory_templ, - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "auparse_sink", - "audio/au", - NULL - ) -) - - -GST_PADTEMPLATE_FACTORY (src_factory_templ, - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "auparse_src", - "audio/raw", - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT_RANGE (0, 1), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_LIST( - GST_PROPS_BOOLEAN (FALSE), - GST_PROPS_BOOLEAN (TRUE) - ), - "width", GST_PROPS_LIST( - GST_PROPS_INT (8), - GST_PROPS_INT (16) - ), - "depth", GST_PROPS_LIST( - GST_PROPS_INT (8), - GST_PROPS_INT (16) - ), - "rate", GST_PROPS_INT_RANGE (8000,48000), - "channels", GST_PROPS_INT_RANGE (1, 2) - ) -) - -/* ParseAu signals and args */ -enum { - /* FILL ME */ - LAST_SIGNAL -}; - -enum { - ARG_0, - /* FILL ME */ -}; - -static void gst_parseau_class_init (GstParseAuClass *klass); -static void gst_parseau_init (GstParseAu *parseau); - -static void gst_parseau_chain (GstPad *pad,GstBuffer *buf); - -static GstElementClass *parent_class = NULL; -//static guint gst_parseau_signals[LAST_SIGNAL] = { 0 }; - -GType -gst_parseau_get_type (void) -{ - static GType parseau_type = 0; - - if (!parseau_type) { - static const GTypeInfo parseau_info = { - sizeof(GstParseAuClass), NULL, - NULL, - (GClassInitFunc) gst_parseau_class_init, - NULL, - NULL, - sizeof(GstParseAu), - 0, - (GInstanceInitFunc) gst_parseau_init, - }; - parseau_type = g_type_register_static (GST_TYPE_ELEMENT, "GstParseAu", &parseau_info, 0); - } - return parseau_type; -} - -static void -gst_parseau_class_init (GstParseAuClass *klass) -{ - GstElementClass *gstelement_class; - - gstelement_class = (GstElementClass*) klass; - - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); -} - -static void -gst_parseau_init (GstParseAu *parseau) -{ - parseau->sinkpad = gst_pad_new_from_template ( - GST_PADTEMPLATE_GET (sink_factory_templ), "sink"); - gst_element_add_pad (GST_ELEMENT (parseau), parseau->sinkpad); - gst_pad_set_chain_function (parseau->sinkpad, gst_parseau_chain); - - parseau->srcpad = gst_pad_new_from_template ( - GST_PADTEMPLATE_GET (src_factory_templ), "src"); - gst_element_add_pad (GST_ELEMENT (parseau), parseau->srcpad); - - parseau->offset = 0; - parseau->size = 0; - parseau->encoding = 0; - parseau->frequency = 0; - parseau->channels = 0; -} - -static void -gst_parseau_chain (GstPad *pad, GstBuffer *buf) -{ - GstParseAu *parseau; - gchar *data; - glong size; - GstCaps* tempcaps; - gint law, depth; - gboolean sign; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - parseau = GST_PARSEAU (gst_pad_get_parent (pad)); - - GST_DEBUG (0, "gst_parseau_chain: got buffer in '%s'\n", - gst_element_get_name (GST_ELEMENT (parseau))); - - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - /* if we haven't seen any data yet... */ - if (parseau->size == 0) { - GstBuffer *newbuf; - gulong *head = (gulong *)data; - - /* normal format is big endian (au is a Sparc format) */ - if (GULONG_FROM_BE (*(head++)) == 0x2e736e64) { - parseau->le = 0; - parseau->offset = GULONG_FROM_BE (*(head++)); - parseau->size = GULONG_FROM_BE (*(head++)); - parseau->encoding = GULONG_FROM_BE (*(head++)); - parseau->frequency = GULONG_FROM_BE (*(head++)); - parseau->channels = GULONG_FROM_BE (*(head++)); - - /* but I wouldn't be surprised by a little endian version */ - } else if (GULONG_FROM_LE (*(head++)) == 0x2e736e64) { - parseau->le = 1; - parseau->offset = GULONG_FROM_LE(*(head++)); - parseau->size = GULONG_FROM_LE(*(head++)); - parseau->encoding = GULONG_FROM_LE(*(head++)); - parseau->frequency = GULONG_FROM_LE(*(head++)); - parseau->channels = GULONG_FROM_LE(*(head++)); - - } else { - g_warning ("help, dunno what I'm looking at!\n"); - gst_buffer_unref(buf); - return; - } - - g_print ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", - parseau->offset,parseau->size,parseau->encoding, - parseau->frequency,parseau->channels); - GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", - parseau->offset,parseau->size,parseau->encoding, - parseau->frequency,parseau->channels); - - switch (parseau->encoding) { - case 1: - law = 1; - depth = 8; - sign = FALSE; - break; - case 2: - law = 0; - depth = 8; - sign = TRUE; - break; - case 3: - law = 0; - depth = 16; - sign = TRUE; - break; - default: - g_warning ("help!, dont know how to deal with this format yet\n"); - return; - } - - tempcaps = GST_CAPS_NEW ("auparse_src", - "audio/raw", - "format", GST_PROPS_STRING ("int"), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "rate", GST_PROPS_INT (parseau->frequency), - "channels", GST_PROPS_INT (parseau->channels), - "law", GST_PROPS_INT (law), - "depth", GST_PROPS_INT (depth), - "width", GST_PROPS_INT (depth), - "signed", GST_PROPS_BOOLEAN (sign)); - - if (!gst_pad_try_set_caps (parseau->srcpad, tempcaps)) { - gst_buffer_unref (buf); - gst_element_error (GST_ELEMENT (parseau), "could not set audio caps"); - return; - } - - newbuf = gst_buffer_new (); - GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(parseau->offset)); - memcpy (GST_BUFFER_DATA (newbuf), data+24, size-(parseau->offset)); - GST_BUFFER_SIZE (newbuf) = size-(parseau->offset); - - gst_buffer_unref (buf); - - gst_pad_push (parseau->srcpad, newbuf); - return; - } - - gst_pad_push (parseau->srcpad, buf); -} - - -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) -{ - GstElementFactory *factory; - GstTypeFactory *type; - - /* create the plugin structure */ - /* create an elementfactory for the parseau element and list it */ - factory = gst_elementfactory_new ("parseau", GST_TYPE_PARSEAU, - &gst_parseau_details); - g_return_val_if_fail (factory != NULL, FALSE); - - gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sink_factory_templ)); - gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (src_factory_templ)); - - type = gst_typefactory_new (&audefinition); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - - return TRUE; -} - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "parseau", - plugin_init -}; - diff --git a/gst/auparse/gstparseau.h b/gst/auparse/gstparseau.h deleted file mode 100644 index 1bfd852e..00000000 --- a/gst/auparse/gstparseau.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Gnome-Streamer - * Copyright (C) <1999> Erik Walthinsen - * - * 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_PARSEAU_H__ -#define __GST_PARSEAU_H__ - - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define GST_TYPE_PARSEAU \ - (gst_parseau_get_type()) -#define GST_PARSEAU(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PARSEAU,GstParseAu)) -#define GST_PARSEAU_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PARSEAU,GstParseAu)) -#define GST_IS_PARSEAU(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PARSEAU)) -#define GST_IS_PARSEAU_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PARSEAU)) - -typedef struct _GstParseAu GstParseAu; -typedef struct _GstParseAuClass GstParseAuClass; - -struct _GstParseAu { - GstElement element; - - GstPad *sinkpad,*srcpad; - - guchar le; - glong offset; - glong size; - glong encoding; - glong frequency; - glong channels; - -}; - -struct _GstParseAuClass { - GstElementClass parent_class; -}; - -GType gst_parseau_get_type (void); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GST_PARSEAU_H__ */ diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 5e485a33..2f95f056 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -46,35 +46,33 @@ static void gst_mulawdec_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; /*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 };*/ -/* -static GstPadNegotiateReturn -mulawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) + +static GstPadConnectReturn +mulawdec_connect_sink (GstPad *pad, GstCaps *caps) { - GstCaps* tempcaps; - + GstCaps *newcaps; GstMuLawDec* mulawdec=GST_MULAWDEC (GST_OBJECT_PARENT (pad)); - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - tempcaps = gst_caps_copy(*caps); - - gst_caps_set(tempcaps,"format",GST_PROPS_STRING("int")); - gst_caps_set(tempcaps,"law",GST_PROPS_INT(0)); - gst_caps_set(tempcaps,"depth",GST_PROPS_INT(16)); - gst_caps_set(tempcaps,"width",GST_PROPS_INT(16)); - gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE)); - - if (gst_pad_try_set_caps (mulawdec->srcpad, tempcaps)) - { - return GST_PAD_NEGOTIATE_AGREE; - } - else { - gst_caps_unref (tempcaps); - return GST_PAD_NEGOTIATE_FAIL; + if (caps==NULL) + return GST_PAD_CONNECT_REFUSED; + + newcaps = gst_caps_copy(caps); + + gst_caps_set(newcaps,"format",GST_PROPS_STRING("int")); + gst_caps_set(newcaps,"law",GST_PROPS_INT(0)); + gst_caps_set(newcaps,"depth",GST_PROPS_INT(16)); + gst_caps_set(newcaps,"width",GST_PROPS_INT(16)); + gst_caps_set(newcaps,"signed",GST_PROPS_BOOLEAN(TRUE)); + + if (GST_CAPS_IS_FIXED (newcaps)) { + if (gst_pad_try_set_caps (mulawdec->srcpad, newcaps)) + return GST_PAD_CONNECT_OK; + else + return GST_PAD_CONNECT_REFUSED; } + + return GST_PAD_CONNECT_DELAYED; } -*/ GType gst_mulawdec_get_type(void) { @@ -116,7 +114,7 @@ gst_mulawdec_init (GstMuLawDec *mulawdec) { mulawdec->sinkpad = gst_pad_new_from_template(mulawdec_sink_template,"sink"); mulawdec->srcpad = gst_pad_new_from_template(mulawdec_src_template,"src"); - /*gst_pad_set_negotiate_function(mulawdec->sinkpad, mulawdec_negotiate_sink);*/ + gst_pad_set_connect_function(mulawdec->sinkpad, mulawdec_connect_sink); gst_element_add_pad(GST_ELEMENT(mulawdec),mulawdec->sinkpad); gst_pad_set_chain_function(mulawdec->sinkpad,gst_mulawdec_chain); -- cgit