From cf0efcbff9f08e4c520f517db9979329a1e74ca2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 8 Dec 2008 18:44:22 +0000 Subject: [PATCH] gst/volume/gstvolume.c: Use new basetransform vmethod to reconfigure the dynamic properties and any pending volume/mu... Original commit message from CVS: * gst/volume/gstvolume.c: (gst_volume_class_init), (volume_before_transform), (volume_transform_ip): Use new basetransform vmethod to reconfigure the dynamic properties and any pending volume/mute changes. Fixes #563508. --- ChangeLog | 7 +++++++ gst/volume/gstvolume.c | 35 ++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index aea2bd0..7f0dfea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-08 Wim Taymans + + * gst/volume/gstvolume.c: (gst_volume_class_init), + (volume_before_transform), (volume_transform_ip): + Use new basetransform vmethod to reconfigure the dynamic properties and + any pending volume/mute changes. Fixes #563508. + 2008-12-08 Sebastian Dröge * configure.ac: diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 87e0c9f..89f8394 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -161,6 +161,8 @@ static void volume_set_property (GObject * object, guint prop_id, static void volume_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); +static void volume_before_transform (GstBaseTransform * base, + GstBuffer * buffer); static GstFlowReturn volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf); static gboolean volume_setup (GstAudioFilter * filter, @@ -430,6 +432,7 @@ gst_volume_class_init (GstVolumeClass * klass) 0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); + trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform); trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip); filter_class->setup = GST_DEBUG_FUNCPTR (volume_setup); } @@ -705,27 +708,18 @@ volume_setup (GstAudioFilter * filter, GstRingBufferSpec * format) return res; } -/* call the plugged-in process function for this instance - * needs to be done with this indirection since volume_transform is - * a class-global method - */ -static GstFlowReturn -volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) +static void +volume_before_transform (GstBaseTransform * base, GstBuffer * buffer) { - GstVolume *this = GST_VOLUME (base); GstClockTime timestamp; + GstVolume *this = GST_VOLUME (base); gfloat volume; gboolean mute; - guint8 *data; - guint size; - - if (G_UNLIKELY (!this->negotiated)) - goto not_negotiated; /* FIXME: if controllers are bound, subdivide GST_BUFFER_SIZE into small * chunks for smooth fades, what is small? 1/10th sec. */ - timestamp = GST_BUFFER_TIMESTAMP (outbuf); + timestamp = GST_BUFFER_TIMESTAMP (buffer); timestamp = gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp); @@ -746,6 +740,21 @@ volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) * we continue processing. */ volume_update_volume (this, volume, mute); } +} + +/* call the plugged-in process function for this instance + * needs to be done with this indirection since volume_transform is + * a class-global method + */ +static GstFlowReturn +volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) +{ + GstVolume *this = GST_VOLUME (base); + guint8 *data; + guint size; + + if (G_UNLIKELY (!this->negotiated)) + goto not_negotiated; /* don't process data in passthrough-mode */ if (gst_base_transform_is_passthrough (base) || -- 2.7.4