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
This commit is contained in:
parent
f194a20c0b
commit
6f2a22eb93
@ -1,10 +1,10 @@
|
|||||||
plugindir = $(libdir)/gst
|
plugindir = $(libdir)/gst
|
||||||
|
|
||||||
plugin_LTLIBRARIES = libgstparseau.la
|
plugin_LTLIBRARIES = libgstauparse.la
|
||||||
|
|
||||||
libgstparseau_la_SOURCES = gstparseau.c
|
libgstauparse_la_SOURCES = gstauparse.c
|
||||||
libgstparseau_la_CFLAGS = $(GST_CFLAGS)
|
libgstauparse_la_CFLAGS = $(GST_CFLAGS)
|
||||||
libgstparseau_la_LIBADD = $(GST_LIBS)
|
libgstauparse_la_LIBADD = $(GST_LIBS)
|
||||||
libgstparseau_la_LDFLAGS = @GST_PLUGIN_LDFLAGS@
|
libgstauparse_la_LDFLAGS = @GST_PLUGIN_LDFLAGS@
|
||||||
|
|
||||||
noinst_HEADERS = gstparseau.h
|
noinst_HEADERS = gstauparse.h
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gstparseau.h>
|
#include <gstauparse.h>
|
||||||
|
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails gst_parseau_details = {
|
static GstElementDetails gst_auparse_details = {
|
||||||
".au parser",
|
".au parser",
|
||||||
"Parser/Audio",
|
"Parser/Audio",
|
||||||
"Parse an .au file into raw audio",
|
"Parse an .au file into raw audio",
|
||||||
@ -51,7 +51,7 @@ au_typefind (GstBuffer *buf, gpointer private)
|
|||||||
|
|
||||||
/* typefactory for 'au' */
|
/* typefactory for 'au' */
|
||||||
static GstTypeDefinition audefinition = {
|
static GstTypeDefinition audefinition = {
|
||||||
"parseau_audio/au",
|
"auparse_audio/au",
|
||||||
"audio/au",
|
"audio/au",
|
||||||
".au",
|
".au",
|
||||||
au_typefind,
|
au_typefind,
|
||||||
@ -96,7 +96,7 @@ GST_PADTEMPLATE_FACTORY (src_factory_templ,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* ParseAu signals and args */
|
/* AuParse signals and args */
|
||||||
enum {
|
enum {
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
@ -107,37 +107,37 @@ enum {
|
|||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_parseau_class_init (GstParseAuClass *klass);
|
static void gst_auparse_class_init (GstAuParseClass *klass);
|
||||||
static void gst_parseau_init (GstParseAu *parseau);
|
static void gst_auparse_init (GstAuParse *auparse);
|
||||||
|
|
||||||
static void gst_parseau_chain (GstPad *pad,GstBuffer *buf);
|
static void gst_auparse_chain (GstPad *pad,GstBuffer *buf);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
//static guint gst_parseau_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_auparse_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_parseau_get_type (void)
|
gst_auparse_get_type (void)
|
||||||
{
|
{
|
||||||
static GType parseau_type = 0;
|
static GType auparse_type = 0;
|
||||||
|
|
||||||
if (!parseau_type) {
|
if (!auparse_type) {
|
||||||
static const GTypeInfo parseau_info = {
|
static const GTypeInfo auparse_info = {
|
||||||
sizeof(GstParseAuClass), NULL,
|
sizeof(GstAuParseClass), NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc) gst_parseau_class_init,
|
(GClassInitFunc) gst_auparse_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(GstParseAu),
|
sizeof(GstAuParse),
|
||||||
0,
|
0,
|
||||||
(GInstanceInitFunc) gst_parseau_init,
|
(GInstanceInitFunc) gst_auparse_init,
|
||||||
};
|
};
|
||||||
parseau_type = g_type_register_static (GST_TYPE_ELEMENT, "GstParseAu", &parseau_info, 0);
|
auparse_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info, 0);
|
||||||
}
|
}
|
||||||
return parseau_type;
|
return auparse_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_parseau_class_init (GstParseAuClass *klass)
|
gst_auparse_class_init (GstAuParseClass *klass)
|
||||||
{
|
{
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
|
||||||
@ -147,28 +147,28 @@ gst_parseau_class_init (GstParseAuClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_parseau_init (GstParseAu *parseau)
|
gst_auparse_init (GstAuParse *auparse)
|
||||||
{
|
{
|
||||||
parseau->sinkpad = gst_pad_new_from_template (
|
auparse->sinkpad = gst_pad_new_from_template (
|
||||||
GST_PADTEMPLATE_GET (sink_factory_templ), "sink");
|
GST_PADTEMPLATE_GET (sink_factory_templ), "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (parseau), parseau->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad);
|
||||||
gst_pad_set_chain_function (parseau->sinkpad, gst_parseau_chain);
|
gst_pad_set_chain_function (auparse->sinkpad, gst_auparse_chain);
|
||||||
|
|
||||||
parseau->srcpad = gst_pad_new_from_template (
|
auparse->srcpad = gst_pad_new_from_template (
|
||||||
GST_PADTEMPLATE_GET (src_factory_templ), "src");
|
GST_PADTEMPLATE_GET (src_factory_templ), "src");
|
||||||
gst_element_add_pad (GST_ELEMENT (parseau), parseau->srcpad);
|
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
||||||
|
|
||||||
parseau->offset = 0;
|
auparse->offset = 0;
|
||||||
parseau->size = 0;
|
auparse->size = 0;
|
||||||
parseau->encoding = 0;
|
auparse->encoding = 0;
|
||||||
parseau->frequency = 0;
|
auparse->frequency = 0;
|
||||||
parseau->channels = 0;
|
auparse->channels = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_parseau_chain (GstPad *pad, GstBuffer *buf)
|
gst_auparse_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstParseAu *parseau;
|
GstAuParse *auparse;
|
||||||
gchar *data;
|
gchar *data;
|
||||||
glong size;
|
glong size;
|
||||||
GstCaps* tempcaps;
|
GstCaps* tempcaps;
|
||||||
@ -179,36 +179,36 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
|
|||||||
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);
|
||||||
|
|
||||||
parseau = GST_PARSEAU (gst_pad_get_parent (pad));
|
auparse = GST_AUPARSE (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
GST_DEBUG (0, "gst_parseau_chain: got buffer in '%s'\n",
|
GST_DEBUG (0, "gst_auparse_chain: got buffer in '%s'\n",
|
||||||
gst_element_get_name (GST_ELEMENT (parseau)));
|
gst_element_get_name (GST_ELEMENT (auparse)));
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (buf);
|
data = GST_BUFFER_DATA (buf);
|
||||||
size = GST_BUFFER_SIZE (buf);
|
size = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
/* if we haven't seen any data yet... */
|
/* if we haven't seen any data yet... */
|
||||||
if (parseau->size == 0) {
|
if (auparse->size == 0) {
|
||||||
GstBuffer *newbuf;
|
GstBuffer *newbuf;
|
||||||
gulong *head = (gulong *)data;
|
gulong *head = (gulong *)data;
|
||||||
|
|
||||||
/* normal format is big endian (au is a Sparc format) */
|
/* normal format is big endian (au is a Sparc format) */
|
||||||
if (GULONG_FROM_BE (*(head++)) == 0x2e736e64) {
|
if (GULONG_FROM_BE (*(head++)) == 0x2e736e64) {
|
||||||
parseau->le = 0;
|
auparse->le = 0;
|
||||||
parseau->offset = GULONG_FROM_BE (*(head++));
|
auparse->offset = GULONG_FROM_BE (*(head++));
|
||||||
parseau->size = GULONG_FROM_BE (*(head++));
|
auparse->size = GULONG_FROM_BE (*(head++));
|
||||||
parseau->encoding = GULONG_FROM_BE (*(head++));
|
auparse->encoding = GULONG_FROM_BE (*(head++));
|
||||||
parseau->frequency = GULONG_FROM_BE (*(head++));
|
auparse->frequency = GULONG_FROM_BE (*(head++));
|
||||||
parseau->channels = GULONG_FROM_BE (*(head++));
|
auparse->channels = GULONG_FROM_BE (*(head++));
|
||||||
|
|
||||||
/* but I wouldn't be surprised by a little endian version */
|
/* but I wouldn't be surprised by a little endian version */
|
||||||
} else if (GULONG_FROM_LE (*(head++)) == 0x2e736e64) {
|
} else if (GULONG_FROM_LE (*(head++)) == 0x2e736e64) {
|
||||||
parseau->le = 1;
|
auparse->le = 1;
|
||||||
parseau->offset = GULONG_FROM_LE(*(head++));
|
auparse->offset = GULONG_FROM_LE(*(head++));
|
||||||
parseau->size = GULONG_FROM_LE(*(head++));
|
auparse->size = GULONG_FROM_LE(*(head++));
|
||||||
parseau->encoding = GULONG_FROM_LE(*(head++));
|
auparse->encoding = GULONG_FROM_LE(*(head++));
|
||||||
parseau->frequency = GULONG_FROM_LE(*(head++));
|
auparse->frequency = GULONG_FROM_LE(*(head++));
|
||||||
parseau->channels = GULONG_FROM_LE(*(head++));
|
auparse->channels = GULONG_FROM_LE(*(head++));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
g_warning ("help, dunno what I'm looking at!\n");
|
g_warning ("help, dunno what I'm looking at!\n");
|
||||||
@ -217,13 +217,13 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_print ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
g_print ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
||||||
parseau->offset,parseau->size,parseau->encoding,
|
auparse->offset,auparse->size,auparse->encoding,
|
||||||
parseau->frequency,parseau->channels);
|
auparse->frequency,auparse->channels);
|
||||||
GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
||||||
parseau->offset,parseau->size,parseau->encoding,
|
auparse->offset,auparse->size,auparse->encoding,
|
||||||
parseau->frequency,parseau->channels);
|
auparse->frequency,auparse->channels);
|
||||||
|
|
||||||
switch (parseau->encoding) {
|
switch (auparse->encoding) {
|
||||||
case 1:
|
case 1:
|
||||||
law = 1;
|
law = 1;
|
||||||
depth = 8;
|
depth = 8;
|
||||||
@ -248,31 +248,31 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
|
|||||||
"audio/raw",
|
"audio/raw",
|
||||||
"format", GST_PROPS_STRING ("int"),
|
"format", GST_PROPS_STRING ("int"),
|
||||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||||
"rate", GST_PROPS_INT (parseau->frequency),
|
"rate", GST_PROPS_INT (auparse->frequency),
|
||||||
"channels", GST_PROPS_INT (parseau->channels),
|
"channels", GST_PROPS_INT (auparse->channels),
|
||||||
"law", GST_PROPS_INT (law),
|
"law", GST_PROPS_INT (law),
|
||||||
"depth", GST_PROPS_INT (depth),
|
"depth", GST_PROPS_INT (depth),
|
||||||
"width", GST_PROPS_INT (depth),
|
"width", GST_PROPS_INT (depth),
|
||||||
"signed", GST_PROPS_BOOLEAN (sign));
|
"signed", GST_PROPS_BOOLEAN (sign));
|
||||||
|
|
||||||
if (!gst_pad_try_set_caps (parseau->srcpad, tempcaps)) {
|
if (!gst_pad_try_set_caps (auparse->srcpad, tempcaps)) {
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
gst_element_error (GST_ELEMENT (parseau), "could not set audio caps");
|
gst_element_error (GST_ELEMENT (auparse), "could not set audio caps");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newbuf = gst_buffer_new ();
|
newbuf = gst_buffer_new ();
|
||||||
GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(parseau->offset));
|
GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(auparse->offset));
|
||||||
memcpy (GST_BUFFER_DATA (newbuf), data+24, size-(parseau->offset));
|
memcpy (GST_BUFFER_DATA (newbuf), data+24, size-(auparse->offset));
|
||||||
GST_BUFFER_SIZE (newbuf) = size-(parseau->offset);
|
GST_BUFFER_SIZE (newbuf) = size-(auparse->offset);
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
gst_pad_push (parseau->srcpad, newbuf);
|
gst_pad_push (auparse->srcpad, newbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_pad_push (parseau->srcpad, buf);
|
gst_pad_push (auparse->srcpad, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,9 +283,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||||||
GstTypeFactory *type;
|
GstTypeFactory *type;
|
||||||
|
|
||||||
/* create the plugin structure */
|
/* create the plugin structure */
|
||||||
/* create an elementfactory for the parseau element and list it */
|
/* create an elementfactory for the auparse element and list it */
|
||||||
factory = gst_elementfactory_new ("parseau", GST_TYPE_PARSEAU,
|
factory = gst_elementfactory_new ("auparse", GST_TYPE_AUPARSE,
|
||||||
&gst_parseau_details);
|
&gst_auparse_details);
|
||||||
g_return_val_if_fail (factory != NULL, FALSE);
|
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 (sink_factory_templ));
|
||||||
@ -302,7 +302,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||||||
GstPluginDesc plugin_desc = {
|
GstPluginDesc plugin_desc = {
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"parseau",
|
"auparse",
|
||||||
plugin_init
|
plugin_init
|
||||||
};
|
};
|
||||||
|
|
@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GST_PARSEAU_H__
|
#ifndef __GST_AUPARSE_H__
|
||||||
#define __GST_PARSEAU_H__
|
#define __GST_AUPARSE_H__
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -31,21 +31,21 @@ extern "C" {
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_PARSEAU \
|
#define GST_TYPE_AUPARSE \
|
||||||
(gst_parseau_get_type())
|
(gst_auparse_get_type())
|
||||||
#define GST_PARSEAU(obj) \
|
#define GST_AUPARSE(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PARSEAU,GstParseAu))
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUPARSE,GstAuParse))
|
||||||
#define GST_PARSEAU_CLASS(klass) \
|
#define GST_AUPARSE_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PARSEAU,GstParseAu))
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUPARSE,GstAuParse))
|
||||||
#define GST_IS_PARSEAU(obj) \
|
#define GST_IS_AUPARSE(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PARSEAU))
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUPARSE))
|
||||||
#define GST_IS_PARSEAU_CLASS(obj) \
|
#define GST_IS_AUPARSE_CLASS(obj) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PARSEAU))
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUPARSE))
|
||||||
|
|
||||||
typedef struct _GstParseAu GstParseAu;
|
typedef struct _GstAuParse GstAuParse;
|
||||||
typedef struct _GstParseAuClass GstParseAuClass;
|
typedef struct _GstAuParseClass GstAuParseClass;
|
||||||
|
|
||||||
struct _GstParseAu {
|
struct _GstAuParse {
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
GstPad *sinkpad,*srcpad;
|
GstPad *sinkpad,*srcpad;
|
||||||
@ -59,11 +59,11 @@ struct _GstParseAu {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstParseAuClass {
|
struct _GstAuParseClass {
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_parseau_get_type (void);
|
GType gst_auparse_get_type (void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -71,4 +71,4 @@ GType gst_parseau_get_type (void);
|
|||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_PARSEAU_H__ */
|
#endif /* __GST_AUPARSE_H__ */
|
@ -46,35 +46,33 @@ static void gst_mulawdec_chain (GstPad *pad, GstBuffer *buf);
|
|||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 };*/
|
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 };*/
|
||||||
|
|
||||||
/*
|
|
||||||
static GstPadNegotiateReturn
|
|
||||||
mulawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
|
|
||||||
{
|
|
||||||
GstCaps* tempcaps;
|
|
||||||
|
|
||||||
|
static GstPadConnectReturn
|
||||||
|
mulawdec_connect_sink (GstPad *pad, GstCaps *caps)
|
||||||
|
{
|
||||||
|
GstCaps *newcaps;
|
||||||
GstMuLawDec* mulawdec=GST_MULAWDEC (GST_OBJECT_PARENT (pad));
|
GstMuLawDec* mulawdec=GST_MULAWDEC (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
if (*caps==NULL)
|
if (caps==NULL)
|
||||||
return GST_PAD_NEGOTIATE_FAIL;
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
|
|
||||||
tempcaps = gst_caps_copy(*caps);
|
newcaps = gst_caps_copy(caps);
|
||||||
|
|
||||||
gst_caps_set(tempcaps,"format",GST_PROPS_STRING("int"));
|
gst_caps_set(newcaps,"format",GST_PROPS_STRING("int"));
|
||||||
gst_caps_set(tempcaps,"law",GST_PROPS_INT(0));
|
gst_caps_set(newcaps,"law",GST_PROPS_INT(0));
|
||||||
gst_caps_set(tempcaps,"depth",GST_PROPS_INT(16));
|
gst_caps_set(newcaps,"depth",GST_PROPS_INT(16));
|
||||||
gst_caps_set(tempcaps,"width",GST_PROPS_INT(16));
|
gst_caps_set(newcaps,"width",GST_PROPS_INT(16));
|
||||||
gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
|
gst_caps_set(newcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
|
||||||
|
|
||||||
if (gst_pad_try_set_caps (mulawdec->srcpad, tempcaps))
|
if (GST_CAPS_IS_FIXED (newcaps)) {
|
||||||
{
|
if (gst_pad_try_set_caps (mulawdec->srcpad, newcaps))
|
||||||
return GST_PAD_NEGOTIATE_AGREE;
|
return GST_PAD_CONNECT_OK;
|
||||||
|
else
|
||||||
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
gst_caps_unref (tempcaps);
|
return GST_PAD_CONNECT_DELAYED;
|
||||||
return GST_PAD_NEGOTIATE_FAIL;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_mulawdec_get_type(void) {
|
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->sinkpad = gst_pad_new_from_template(mulawdec_sink_template,"sink");
|
||||||
mulawdec->srcpad = gst_pad_new_from_template(mulawdec_src_template,"src");
|
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_element_add_pad(GST_ELEMENT(mulawdec),mulawdec->sinkpad);
|
||||||
gst_pad_set_chain_function(mulawdec->sinkpad,gst_mulawdec_chain);
|
gst_pad_set_chain_function(mulawdec->sinkpad,gst_mulawdec_chain);
|
||||||
|
@ -269,7 +269,8 @@ gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||||||
if (width != depth)
|
if (width != depth)
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
|
|
||||||
osssink->bps = 0;
|
/* laws 1 and 2 are 1 bps anyway */
|
||||||
|
osssink->bps = 1;
|
||||||
|
|
||||||
law = gst_caps_get_int (caps, "law");
|
law = gst_caps_get_int (caps, "law");
|
||||||
endianness = gst_caps_get_int (caps, "endianness");
|
endianness = gst_caps_get_int (caps, "endianness");
|
||||||
@ -300,6 +301,13 @@ gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||||||
}
|
}
|
||||||
osssink->bps = 1;
|
osssink->bps = 1;
|
||||||
}
|
}
|
||||||
|
} else if (law == 1) {
|
||||||
|
format = AFMT_MU_LAW;
|
||||||
|
} else if (law == 2) {
|
||||||
|
format = AFMT_A_LAW;
|
||||||
|
} else {
|
||||||
|
g_critical ("unknown law");
|
||||||
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == -1)
|
if (format == -1)
|
||||||
@ -416,6 +424,11 @@ gst_osssink_chain (GstPad *pad, GstBuffer *buf)
|
|||||||
|
|
||||||
buftime = GST_BUFFER_TIMESTAMP (buf);
|
buftime = GST_BUFFER_TIMESTAMP (buf);
|
||||||
|
|
||||||
|
if (!osssink->bps) {
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
gst_element_error (GST_ELEMENT (osssink), "capsnego was never performed, unknown data type");
|
||||||
|
}
|
||||||
|
|
||||||
if (osssink->fd >= 0) {
|
if (osssink->fd >= 0) {
|
||||||
if (!osssink->mute) {
|
if (!osssink->mute) {
|
||||||
guchar *data = GST_BUFFER_DATA (buf);
|
guchar *data = GST_BUFFER_DATA (buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user