gst-libs/gst/audio/gstaudiofilter.c: Implement get_unit_size() vmethod of GstBaseTransform.

Original commit message from CVS:
* gst-libs/gst/audio/gstaudiofilter.c:
(gst_audio_filter_class_init), (gst_audio_filter_get_unit_size):
Implement get_unit_size() vmethod of GstBaseTransform.
This commit is contained in:
Sebastian Dröge 2008-01-02 12:09:48 +00:00
parent 7701190c01
commit 0e5857ea26
2 changed files with 29 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2008-01-02 Sebastian Dröge <slomo@circular-chaos.org>
* gst-libs/gst/audio/gstaudiofilter.c:
(gst_audio_filter_class_init), (gst_audio_filter_get_unit_size):
Implement get_unit_size() vmethod of GstBaseTransform.
2008-01-01 Edward Hervey <edward.hervey@collabora.co.uk>
* gst-libs/gst/pbutils/Makefile.am:

View file

@ -65,6 +65,8 @@ static GstStateChangeReturn gst_audio_filter_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_audio_filter_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps);
static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
GstCaps * caps, guint * size);
static GstElementClass *parent_class = NULL;
@ -117,6 +119,8 @@ gst_audio_filter_class_init (gpointer klass, gpointer class_data)
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_audio_filter_change_state);
basetrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_filter_set_caps);
basetrans_class->get_unit_size =
GST_DEBUG_FUNCPTR (gst_audio_filter_get_unit_size);
}
static void
@ -189,6 +193,25 @@ gst_audio_filter_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
return ret;
}
static gboolean
gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
guint * size)
{
GstStructure *structure;
gboolean ret = TRUE;
gint width, channels;
structure = gst_caps_get_structure (caps, 0);
ret &= gst_structure_get_int (structure, "width", &width);
ret &= gst_structure_get_int (structure, "channels", &channels);
if (ret)
*size = (width / 8) * channels;
return ret;
}
/**
* gst_audio_filter_class_add_pad_templates:
* @klass: an #GstAudioFilterClass