Commit 4895640d authored by Benjamin Otte's avatar Benjamin Otte
Browse files

EVENTS2 BRANCH: adjusted mad and osssink to work with newer buffers

Original commit message from CVS:
EVENTS2 BRANCH:
adjusted mad and osssink to work with newer buffers
parent 91ef3fe7
......@@ -51,7 +51,7 @@ static GstElementStateReturn gst_ossgst_change_state (GstElement *element);
static void gst_ossgst_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_ossgst_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static GstBuffer* gst_ossgst_get (GstPad *pad);
static GstData * gst_ossgst_get (GstPad *pad);
/* OssGst signals and args */
enum {
......@@ -241,7 +241,7 @@ gst_ossgst_format_to_caps (gint format, gint stereo, gint rate)
return caps;
}
static GstBuffer*
static GstData *
gst_ossgst_get (GstPad *pad)
{
GstOssGst *ossgst;
......@@ -261,9 +261,7 @@ gst_ossgst_get (GstPad *pad)
switch (cmd.id) {
case CMD_DATA:
buf = gst_buffer_new ();
GST_BUFFER_SIZE (buf) = cmd.cmd.length;
GST_BUFFER_DATA (buf) = g_malloc (GST_BUFFER_SIZE (buf));
buf = gst_pad_new_buffer (pad, cmd.cmd.length);
GST_BUFFER_SIZE (buf) = read (ossgst->fdout[0], GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
have_data = TRUE;
......
......@@ -150,16 +150,6 @@ gst_osssink_get_type (void)
return osssink_type;
}
static GstBufferPool*
gst_osssink_get_bufferpool (GstPad *pad)
{
GstOssSink *oss;
oss = GST_OSSSINK (gst_pad_get_parent(pad));
return oss->sinkpool;
}
static void
gst_osssink_finalize (GObject *object)
{
......@@ -231,7 +221,6 @@ gst_osssink_init (GstOssSink *osssink)
GST_PADTEMPLATE_GET (osssink_sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (osssink), osssink->sinkpad);
gst_pad_set_connect_function (osssink->sinkpad, gst_osssink_sinkconnect);
gst_pad_set_bufferpool_function (osssink->sinkpad, gst_osssink_get_bufferpool);
gst_pad_set_chain_function (osssink->sinkpad, gst_osssink_chain);
......@@ -249,8 +238,6 @@ gst_osssink_init (GstOssSink *osssink)
/* gst_clock_register (osssink->clock, GST_OBJECT (osssink)); */
osssink->bufsize = 4096;
osssink->offset = 0LL;
/* 6 buffers per chunk by default */
osssink->sinkpool = gst_buffer_pool_get_default (osssink->bufsize, 6);
osssink->length = 0;
......@@ -586,7 +573,6 @@ gst_osssink_set_property (GObject *object, guint prop_id, const GValue *value, G
case ARG_BUFFER_SIZE:
if (osssink->bufsize == g_value_get_int (value)) break;
osssink->bufsize = g_value_get_int (value);
osssink->sinkpool = gst_buffer_pool_get_default (osssink->bufsize, 6);
g_object_notify (object, "buffer_size");
break;
default:
......
......@@ -59,7 +59,6 @@ struct _GstOssSink {
GstElement element;
GstPad *sinkpad;
GstBufferPool *sinkpool;
GstClock *provided_clock;
GstClock *clock;
......
......@@ -93,7 +93,7 @@ static void gst_osssrc_close_audio (GstOssSrc *src);
static gboolean gst_osssrc_open_audio (GstOssSrc *src);
static void gst_osssrc_sync_parms (GstOssSrc *osssrc);
static GstBuffer * gst_osssrc_get (GstPad *pad);
static GstData * gst_osssrc_get (GstPad *pad);
static GstElementClass *parent_class = NULL;
//static guint gst_osssrc_signals[LAST_SIGNAL] = { 0 };
......@@ -178,7 +178,7 @@ gst_osssrc_init (GstOssSrc *osssrc)
osssrc->samples_since_basetime = 0;
}
static GstBuffer *
static GstData *
gst_osssrc_get (GstPad *pad)
{
GstOssSrc *src;
......@@ -191,11 +191,9 @@ gst_osssrc_get (GstPad *pad)
GST_DEBUG (GST_CAT_PLUGIN_INFO, "attempting to read something from soundcard\n");
buf = gst_buffer_new ();
buf = gst_pad_new_buffer (pad, src->bytes_per_read);
g_return_val_if_fail (buf, NULL);
GST_BUFFER_DATA (buf) = (gpointer)g_malloc (src->bytes_per_read);
readbytes = read (src->fd,GST_BUFFER_DATA (buf),
src->bytes_per_read);
......@@ -210,9 +208,9 @@ gst_osssrc_get (GstPad *pad)
"oss_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0), //FIXME
"endianness", GST_PROPS_INT (G_BYTE_ORDER), //FIXME
"signed", GST_PROPS_BOOLEAN (TRUE), //FIXME
"law", GST_PROPS_INT (0), /* FIXME */
"endianness", GST_PROPS_INT (G_BYTE_ORDER), /* FIXME */
"signed", GST_PROPS_BOOLEAN (TRUE), /* FIXME */
"width", GST_PROPS_INT (src->format),
"depth", GST_PROPS_INT (src->format),
"rate", GST_PROPS_INT (src->frequency),
......@@ -235,7 +233,7 @@ gst_osssrc_get (GstPad *pad)
src->samples_since_basetime += readsamples;
GST_DEBUG (GST_CAT_PLUGIN_INFO, "pushed buffer from soundcard of %ld bytes, timestamp %lld\n", readbytes, GST_BUFFER_TIMESTAMP (buf));
return buf;
return GST_DATA (buf);
}
static void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment