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 --- sys/oss/gstosssink.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c index a225d203..433d5527 100644 --- a/sys/oss/gstosssink.c +++ b/sys/oss/gstosssink.c @@ -269,7 +269,8 @@ gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps) if (width != depth) 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"); endianness = gst_caps_get_int (caps, "endianness"); @@ -300,6 +301,13 @@ gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps) } 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) @@ -416,6 +424,11 @@ gst_osssink_chain (GstPad *pad, GstBuffer *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->mute) { guchar *data = GST_BUFFER_DATA (buf); -- cgit