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.
This commit is contained in:
Wim Taymans 2008-12-08 18:44:22 +00:00
parent 9912a2270a
commit cf0efcbff9
2 changed files with 29 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2008-12-08 Wim Taymans <wim.taymans@collabora.co.uk>
* 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 <sebastian.droege@collabora.co.uk> 2008-12-08 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac: * configure.ac:

View file

@ -161,6 +161,8 @@ static void volume_set_property (GObject * object, guint prop_id,
static void volume_get_property (GObject * object, guint prop_id, static void volume_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void volume_before_transform (GstBaseTransform * base,
GstBuffer * buffer);
static GstFlowReturn volume_transform_ip (GstBaseTransform * base, static GstFlowReturn volume_transform_ip (GstBaseTransform * base,
GstBuffer * outbuf); GstBuffer * outbuf);
static gboolean volume_setup (GstAudioFilter * filter, static gboolean volume_setup (GstAudioFilter * filter,
@ -430,6 +432,7 @@ gst_volume_class_init (GstVolumeClass * klass)
0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME, 0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); 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); trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip);
filter_class->setup = GST_DEBUG_FUNCPTR (volume_setup); filter_class->setup = GST_DEBUG_FUNCPTR (volume_setup);
} }
@ -705,27 +708,18 @@ volume_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
return res; return res;
} }
/* call the plugged-in process function for this instance static void
* needs to be done with this indirection since volume_transform is volume_before_transform (GstBaseTransform * base, GstBuffer * buffer)
* a class-global method
*/
static GstFlowReturn
volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
{ {
GstVolume *this = GST_VOLUME (base);
GstClockTime timestamp; GstClockTime timestamp;
GstVolume *this = GST_VOLUME (base);
gfloat volume; gfloat volume;
gboolean mute; 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 /* FIXME: if controllers are bound, subdivide GST_BUFFER_SIZE into small
* chunks for smooth fades, what is small? 1/10th sec. * chunks for smooth fades, what is small? 1/10th sec.
*/ */
timestamp = GST_BUFFER_TIMESTAMP (outbuf); timestamp = GST_BUFFER_TIMESTAMP (buffer);
timestamp = timestamp =
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, 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. */ * we continue processing. */
volume_update_volume (this, volume, mute); 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 */ /* don't process data in passthrough-mode */
if (gst_base_transform_is_passthrough (base) || if (gst_base_transform_is_passthrough (base) ||