summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Baker <steve@stevebaker.org>2001-09-18 19:07:17 +0000
committerSteve Baker <steve@stevebaker.org>2001-09-18 19:07:17 +0000
commit3b3e5ecc5df6ca585f27a50cac582d0c3e4e4b60 (patch)
treefb85d9504896ba762bd3f841e3c263793784dcbf
parent99335d4c14fd4a07b09616e948ec20f7b1dff3b8 (diff)
downloadgstreamer-3b3e5ecc5df6ca585f27a50cac582d0c3e4e4b60.tar.gz
moved from include/gstaudio.h
Original commit message from CVS: moved from include/gstaudio.h
-rw-r--r--libs/audio/gstaudio.h68
1 files changed, 66 insertions, 2 deletions
diff --git a/libs/audio/gstaudio.h b/libs/audio/gstaudio.h
index 7cced9acf2..09ef3ec796 100644
--- a/libs/audio/gstaudio.h
+++ b/libs/audio/gstaudio.h
@@ -18,13 +18,76 @@
* Boston, MA 02111-1307, USA.
*/
+#include <gst/gst.h>
+
+/* for people that are looking at this source: the purpose of these defines is
+ * to make GstCaps a bit easier, in that you don't have to know all of the
+ * properties that need to be defined. you can just use these macros. currently
+ * (8/01) the only plugins that use these are the passthrough, speed, volume,
+ * and [de]interleave plugins. so. these are for convenience only, and do not
+ * specify the 'limits' of gstreamer. you might also use these definitions as a
+ * base for making your own caps, if need be.
+ *
+ * for example, to make a source pad that can output mono streams of either
+ * float or int:
+
+ template = gst_padtemplate_new
+ ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_append(gst_caps_new ("sink_int", "audio/raw",
+ GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
+ gst_caps_new ("sink_float", "audio/raw",
+ GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)),
+ NULL);
+
+ srcpad = gst_pad_new_from_template(template,"src");
+
+ * Andy Wingo, 18 August 2001 */
+
+#define GST_AUDIO_INT_PAD_TEMPLATE_PROPS \
+ gst_props_new (\
+ "format", GST_PROPS_STRING ("int"),\
+ "law", GST_PROPS_INT (0),\
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),\
+ "signed", GST_PROPS_LIST (\
+ GST_PROPS_BOOLEAN (TRUE),\
+ GST_PROPS_BOOLEAN(FALSE)\
+ ),\
+ "width", GST_PROPS_LIST (GST_PROPS_INT(8), GST_PROPS_INT(16)),\
+ "depth", GST_PROPS_LIST (GST_PROPS_INT(8), GST_PROPS_INT(16)),\
+ "rate", GST_PROPS_INT_RANGE (4000, 96000),\
+ "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
+ NULL)
+
+#define GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS \
+ gst_props_new (\
+ "format", GST_PROPS_STRING ("int"),\
+ "law", GST_PROPS_INT (0),\
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),\
+ "signed", GST_PROPS_LIST (\
+ GST_PROPS_BOOLEAN (TRUE),\
+ GST_PROPS_BOOLEAN(FALSE)\
+ ),\
+ "width", GST_PROPS_LIST (GST_PROPS_INT(8), GST_PROPS_INT(16)),\
+ "depth", GST_PROPS_LIST (GST_PROPS_INT(8), GST_PROPS_INT(16)),\
+ "rate", GST_PROPS_INT_RANGE (4000, 96000),\
+ "channels", GST_PROPS_INT (1),\
+ NULL)
+
+#define GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS \
+ gst_props_new (\
+ "format", GST_PROPS_STRING ("float"),\
+ "layout", GST_PROPS_STRING ("gfloat"),\
+ "intercept", GST_PROPS_FLOAT (0.0),\
+ "slope", GST_PROPS_FLOAT (1.0),\
+ "rate", GST_PROPS_INT_RANGE (4000, 96000),\
+ "channels", GST_PROPS_INT (1),\
+ NULL)
+
/*
* this library defines and implements some helper functions for audio
* handling
*/
-#include <gst/gst.h>
-
/* get byte size of audio frame (based on caps of pad */
int gst_audio_frame_byte_size (GstPad* pad);
@@ -43,3 +106,4 @@ long gst_audio_highest_sample_value (GstPad* pad);
/* check if the buffer size is a whole multiple of the frame size */
gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
+