From 7e4720f88ce8c0aac3047bf4404dd3afdac2f088 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 30 Jan 2003 17:44:35 +0000 Subject: [PATCH] make 8 bit output use the right caps Original commit message from CVS: make 8 bit output use the right caps --- ext/mikmod/gstmikmod.c | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c index 87616e3..284b4be 100644 --- a/ext/mikmod/gstmikmod.c +++ b/ext/mikmod/gstmikmod.c @@ -71,19 +71,33 @@ mikmod_src_factory (void) "src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_new ( + gst_caps_new ( /* use16bit = TRUE */ + "mikmod_src", + "audio/raw", + gst_props_new ( + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), + "width", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), + "rate", GST_PROPS_INT_RANGE (8000, 48000), + "channels", GST_PROPS_INT_RANGE (1, 2), + NULL)), + gst_caps_new ( /* use16bit = FALSE */ "mikmod_src", "audio/raw", - gst_props_new ( - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT_RANGE (8000, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2), - NULL)),NULL); + gst_props_new ( + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (FALSE), + "width", GST_PROPS_INT (8), + "depth", GST_PROPS_INT (8), + "rate", GST_PROPS_INT_RANGE (8000, 48000), + "channels", GST_PROPS_INT_RANGE (1, 2), + NULL)), + NULL); } return template; } @@ -264,7 +278,7 @@ gst_mikmod_loop (GstElement *element) { GstMikMod *mikmod; GstBuffer *buffer_in; - gint mode16bits; + gint width, sign; g_return_if_fail (element != NULL); g_return_if_fail (GST_IS_MIKMOD (element)); @@ -291,10 +305,13 @@ gst_mikmod_loop (GstElement *element) } } - if ( mikmod->_16bit ) - mode16bits = 16; - else - mode16bits = 8; + if ( mikmod->_16bit ) { + width = 16; + sign = TRUE; + } else { + width = 8; + sign = FALSE; + } gst_mikmod_setup( mikmod ); @@ -317,9 +334,9 @@ gst_mikmod_loop (GstElement *element) "format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0), "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (mode16bits), - "depth", GST_PROPS_INT (mode16bits), + "signed", GST_PROPS_BOOLEAN (sign), + "width", GST_PROPS_INT (width), + "depth", GST_PROPS_INT (width), "rate", GST_PROPS_INT (mikmod->mixfreq), "channels", GST_PROPS_INT (2))); -- 2.7.4