From aff68553db67edc63d13ffbe49f83f98c85f12a8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 5 Feb 2002 21:58:41 +0000 Subject: [PATCH] Moved capsnego in ossrc to a more suitable place. Original commit message from CVS: Moved capsnego in ossrc to a more suitable place. --- sys/oss/gstosssrc.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index 30eb48fed5..89166c7f6a 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -203,6 +203,26 @@ gst_osssrc_get (GstPad *pad) gst_element_set_eos (GST_ELEMENT (src)); return NULL; } + if (!GST_PAD_CAPS (pad)) { + /* set caps on src pad */ + if (!gst_pad_try_set_caps (src->srcpad, + GST_CAPS_NEW ( + "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 + "width", GST_PROPS_INT (src->format), + "depth", GST_PROPS_INT (src->format), + "rate", GST_PROPS_INT (src->frequency), + "channels", GST_PROPS_INT (src->channels) + ))) + { + gst_element_error (GST_ELEMENT (src), "could not set caps"); + return NULL; + } + } GST_BUFFER_SIZE (buf) = readbytes; GST_BUFFER_OFFSET (buf) = src->curoffset; @@ -384,22 +404,6 @@ gst_osssrc_sync_parms (GstOssSrc *osssrc) osssrc->frequency, osssrc->format, (osssrc->channels == 2) ? "stereo" : "mono", ispace.bytes, frag); - /* set caps on src pad */ - gst_pad_try_set_caps (osssrc->srcpad, gst_caps_new ( - "oss_src", - "audio/raw", - gst_props_new ( - "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 - "width", GST_PROPS_INT (osssrc->format), - "depth", GST_PROPS_INT (osssrc->format), - "rate", GST_PROPS_INT (osssrc->frequency), - "channels", GST_PROPS_INT (osssrc->channels), - NULL - ) - )); } gboolean