2001-12-22 23:27:17 +00:00
|
|
|
/* -*- c-basic-offset: 2 -*-
|
2005-08-22 09:35:57 +00:00
|
|
|
* vi:si:et:sw=2:sts=8:ts=8:expandtab
|
|
|
|
*
|
2001-12-22 23:27:17 +00:00
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-08-20 18:07:10 +00:00
|
|
|
* Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
|
2010-02-17 18:18:29 +00:00
|
|
|
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2001-12-22 23:27:17 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2005-09-11 21:45:24 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-volume
|
|
|
|
*
|
2006-03-01 17:39:28 +00:00
|
|
|
* The volume element changes the volume of the audio data.
|
2008-07-11 06:10:24 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2007-05-04 13:10:07 +00:00
|
|
|
* <title>Example launch line</title>
|
2008-07-11 06:10:24 +00:00
|
|
|
* |[
|
2005-11-23 15:36:58 +00:00
|
|
|
* gst-launch -v -m audiotestsrc ! volume volume=0.5 ! level ! fakesink silent=TRUE
|
2008-07-11 06:10:24 +00:00
|
|
|
* ]| This pipeline shows that the level of audiotestsrc has been halved
|
2005-09-23 18:14:54 +00:00
|
|
|
* (peak values are around -6 dB and RMS around -9 dB) compared to
|
2005-09-11 21:45:24 +00:00
|
|
|
* the same pipeline without the volume element.
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-08-22 09:35:57 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <gst/gst.h>
|
2005-05-09 21:37:17 +00:00
|
|
|
#include <gst/base/gstbasetransform.h>
|
2001-12-23 12:18:18 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2005-06-30 11:58:40 +00:00
|
|
|
#include <gst/interfaces/mixer.h>
|
2005-09-09 14:57:12 +00:00
|
|
|
#include <gst/controller/gstcontroller.h>
|
2008-01-03 20:33:58 +00:00
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
#include <gst/audio/gstaudiofilter.h>
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
#include <liboil/liboil.h>
|
2005-08-29 19:32:19 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
#include "gstvolume.h"
|
|
|
|
|
2004-02-02 14:34:52 +00:00
|
|
|
/* some defines for audio processing */
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
/* the volume factor is a range from 0.0 to (arbitrary) VOLUME_MAX_DOUBLE = 10.0
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
* we map 1.0 to VOLUME_UNITY_INT*
|
2004-02-02 14:34:52 +00:00
|
|
|
*/
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#define VOLUME_UNITY_INT8 32 /* internal int for unity 2^(8-3) */
|
|
|
|
#define VOLUME_UNITY_INT8_BIT_SHIFT 5 /* number of bits to shift for unity */
|
|
|
|
#define VOLUME_UNITY_INT16 8192 /* internal int for unity 2^(16-3) */
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
#define VOLUME_UNITY_INT16_BIT_SHIFT 13 /* number of bits to shift for unity */
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#define VOLUME_UNITY_INT24 2097152 /* internal int for unity 2^(24-3) */
|
|
|
|
#define VOLUME_UNITY_INT24_BIT_SHIFT 21 /* number of bits to shift for unity */
|
2007-09-09 04:08:48 +00:00
|
|
|
#define VOLUME_UNITY_INT32 134217728 /* internal int for unity 2^(32-5) */
|
|
|
|
#define VOLUME_UNITY_INT32_BIT_SHIFT 27
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
#define VOLUME_MAX_DOUBLE 10.0
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#define VOLUME_MAX_INT8 G_MAXINT8
|
|
|
|
#define VOLUME_MIN_INT8 G_MININT8
|
|
|
|
#define VOLUME_MAX_INT16 G_MAXINT16
|
|
|
|
#define VOLUME_MIN_INT16 G_MININT16
|
|
|
|
#define VOLUME_MAX_INT24 8388607
|
|
|
|
#define VOLUME_MIN_INT24 -8388608
|
|
|
|
#define VOLUME_MAX_INT32 G_MAXINT32
|
|
|
|
#define VOLUME_MIN_INT32 G_MININT32
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2004-02-02 14:34:52 +00:00
|
|
|
/* number of steps we use for the mixer interface to go from 0.0 to 1.0 */
|
2005-08-22 09:35:57 +00:00
|
|
|
# define VOLUME_STEPS 100
|
2001-12-22 23:27:17 +00:00
|
|
|
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_volume_debug
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
/* Filter signals and args */
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:27:17 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
#define DEFAULT_PROP_MUTE FALSE
|
|
|
|
#define DEFAULT_PROP_VOLUME 1.0
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-05-09 21:37:17 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_MUTE,
|
|
|
|
PROP_VOLUME
|
2001-12-22 23:27:17 +00:00
|
|
|
};
|
|
|
|
|
2008-01-03 20:33:58 +00:00
|
|
|
#define ALLOWED_CAPS \
|
|
|
|
"audio/x-raw-float, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) {32, 64}; " \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 8, " \
|
|
|
|
"depth = (int) 8, " \
|
|
|
|
"signed = (bool) TRUE; " \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 16, " \
|
|
|
|
"depth = (int) 16, " \
|
|
|
|
"signed = (bool) TRUE; " \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 24, " \
|
|
|
|
"depth = (int) 24, " \
|
|
|
|
"signed = (bool) TRUE; " \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"width = (int) 32, " \
|
|
|
|
"depth = (int) 32, " \
|
|
|
|
"signed = (bool) TRUE"
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
static void gst_volume_interface_init (GstImplementsInterfaceClass * klass);
|
|
|
|
static void gst_volume_mixer_init (GstMixerClass * iface);
|
|
|
|
|
2005-08-22 09:35:57 +00:00
|
|
|
#define _init_interfaces(type) \
|
2005-08-20 18:07:10 +00:00
|
|
|
{ \
|
2009-09-11 13:04:42 +00:00
|
|
|
static const GInterfaceInfo voliface_info = { \
|
2005-08-20 18:07:10 +00:00
|
|
|
(GInterfaceInitFunc) gst_volume_interface_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL \
|
|
|
|
}; \
|
2009-09-11 13:04:42 +00:00
|
|
|
static const GInterfaceInfo volmixer_info = { \
|
2005-08-20 18:07:10 +00:00
|
|
|
(GInterfaceInitFunc) gst_volume_mixer_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL \
|
2009-09-11 13:04:42 +00:00
|
|
|
}; \
|
|
|
|
static const GInterfaceInfo svol_info = { \
|
|
|
|
NULL, \
|
|
|
|
NULL, \
|
|
|
|
NULL \
|
2005-08-20 18:07:10 +00:00
|
|
|
}; \
|
|
|
|
\
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
|
|
|
|
&voliface_info); \
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_MIXER, &volmixer_info); \
|
2009-09-11 13:04:42 +00:00
|
|
|
g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_info); \
|
2005-05-09 21:37:17 +00:00
|
|
|
}
|
|
|
|
|
2008-01-03 20:33:58 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstVolume, gst_volume, GstAudioFilter,
|
|
|
|
GST_TYPE_AUDIO_FILTER, _init_interfaces);
|
2005-05-09 21:37:17 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void volume_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void volume_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2008-12-08 18:44:22 +00:00
|
|
|
static void volume_before_transform (GstBaseTransform * base,
|
|
|
|
GstBuffer * buffer);
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
static GstFlowReturn volume_transform_ip (GstBaseTransform * base,
|
|
|
|
GstBuffer * outbuf);
|
2010-02-17 18:18:29 +00:00
|
|
|
static gboolean volume_stop (GstBaseTransform * base);
|
2008-01-03 20:33:58 +00:00
|
|
|
static gboolean volume_setup (GstAudioFilter * filter,
|
|
|
|
GstRingBufferSpec * format);
|
2005-08-20 18:07:10 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_double (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_double (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_float (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_float (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int32 (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int32_clamp (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_int32_clamp (GstVolume * self,
|
|
|
|
gpointer bytes, gdouble * volume, guint channels, guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int24 (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int24_clamp (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_int24_clamp (GstVolume * self,
|
|
|
|
gpointer bytes, gdouble * volume, guint channels, guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int16 (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int16_clamp (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_int16_clamp (GstVolume * self,
|
|
|
|
gpointer bytes, gdouble * volume, guint channels, guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int8 (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-13 00:08:05 +00:00
|
|
|
static void volume_process_int8_clamp (GstVolume * self, gpointer bytes,
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint n_bytes);
|
2010-02-17 18:18:29 +00:00
|
|
|
static void volume_process_controlled_int8_clamp (GstVolume * self,
|
|
|
|
gpointer bytes, gdouble * volume, guint channels, guint n_bytes);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
/* helper functions */
|
|
|
|
|
2008-01-03 20:33:58 +00:00
|
|
|
static gboolean
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_choose_func (GstVolume * self)
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = NULL;
|
2010-02-17 18:18:29 +00:00
|
|
|
self->process_controlled = NULL;
|
2008-01-03 20:33:58 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
if (GST_AUDIO_FILTER (self)->format.caps == NULL)
|
2008-01-03 20:33:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
switch (GST_AUDIO_FILTER (self)->format.type) {
|
2008-01-03 20:33:58 +00:00
|
|
|
case GST_BUFTYPE_LINEAR:
|
2010-02-13 00:08:05 +00:00
|
|
|
switch (GST_AUDIO_FILTER (self)->format.width) {
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
case 32:
|
|
|
|
/* only clamp if the gain is greater than 1.0
|
|
|
|
*/
|
2010-02-17 18:18:29 +00:00
|
|
|
if (self->current_vol_i32 > VOLUME_UNITY_INT32) {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int32_clamp;
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int32;
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int32_clamp;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
/* only clamp if the gain is greater than 1.0
|
|
|
|
*/
|
2010-02-17 18:18:29 +00:00
|
|
|
if (self->current_vol_i24 > VOLUME_UNITY_INT24) {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int24_clamp;
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int24;
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int24_clamp;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
/* only clamp if the gain is greater than 1.0
|
|
|
|
*/
|
2010-02-17 18:18:29 +00:00
|
|
|
if (self->current_vol_i16 > VOLUME_UNITY_INT16) {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int16_clamp;
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int16;
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int16_clamp;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
/* only clamp if the gain is greater than 1.0
|
|
|
|
*/
|
2010-02-17 18:18:29 +00:00
|
|
|
if (self->current_vol_i16 > VOLUME_UNITY_INT8) {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int8_clamp;
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_int8;
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int8_clamp;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
break;
|
2008-01-03 20:33:58 +00:00
|
|
|
case GST_BUFTYPE_FLOAT:
|
2010-02-13 00:08:05 +00:00
|
|
|
switch (GST_AUDIO_FILTER (self)->format.width) {
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
case 32:
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_float;
|
2010-02-17 18:18:29 +00:00
|
|
|
self->process_controlled = volume_process_controlled_float;
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
break;
|
|
|
|
case 64:
|
2010-02-13 00:08:05 +00:00
|
|
|
self->process = volume_process_double;
|
2010-02-17 18:18:29 +00:00
|
|
|
self->process_controlled = volume_process_controlled_double;
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
break;
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
}
|
2008-01-03 20:33:58 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
return (self->process != NULL);
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
}
|
|
|
|
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
static gboolean
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_update_volume (GstVolume * self, gfloat volume, gboolean mute)
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
{
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
gboolean passthrough;
|
|
|
|
gboolean res;
|
2010-02-17 18:18:29 +00:00
|
|
|
GstController *controller;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "configure mute %d, volume %f", mute, volume);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
|
|
|
if (mute) {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->current_mute = TRUE;
|
|
|
|
self->current_volume = 0.0;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
self->current_vol_i8 = 0;
|
|
|
|
self->current_vol_i16 = 0;
|
|
|
|
self->current_vol_i24 = 0;
|
|
|
|
self->current_vol_i32 = 0;
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
passthrough = FALSE;
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
} else {
|
2010-02-13 00:08:05 +00:00
|
|
|
self->current_mute = FALSE;
|
|
|
|
self->current_volume = volume;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
self->current_vol_i8 = volume * VOLUME_UNITY_INT8;
|
|
|
|
self->current_vol_i16 = volume * VOLUME_UNITY_INT16;
|
|
|
|
self->current_vol_i24 = volume * VOLUME_UNITY_INT24;
|
|
|
|
self->current_vol_i32 = volume * VOLUME_UNITY_INT32;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
passthrough = (self->current_vol_i16 == VOLUME_UNITY_INT16);
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
}
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
/* If a controller is used, never use passthrough mode
|
|
|
|
* because the property can change from 1.0 to something
|
|
|
|
* else in the middle of a buffer.
|
|
|
|
*/
|
|
|
|
controller = gst_object_get_controller (G_OBJECT (self));
|
|
|
|
passthrough = passthrough && (controller == NULL);
|
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "set passthrough %d", passthrough);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (self), passthrough);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
res = self->negotiated = volume_choose_func (self);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
|
|
|
return res;
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Mixer interface */
|
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_interface_supported (GstImplementsInterface * iface, GType type)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2009-09-11 13:04:42 +00:00
|
|
|
return (type == GST_TYPE_MIXER || type == GST_TYPE_STREAM_VOLUME);
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_interface_init (GstImplementsInterfaceClass * klass)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
|
|
|
klass->supported = gst_volume_interface_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GList *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_list_tracks (GstMixer * mixer)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
g_return_val_if_fail (self != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_VOLUME (self), NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
return self->tracklist;
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
g_return_if_fail (self != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (self));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->volume = (gfloat) volumes[0] / VOLUME_STEPS;
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
g_return_if_fail (self != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (self));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
volumes[0] = (gint) self->volume * VOLUME_STEPS;
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
g_return_if_fail (self != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (self));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->mute = mute;
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_mixer_init (GstMixerClass * klass)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
|
|
|
GST_MIXER_TYPE (klass) = GST_MIXER_SOFTWARE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
/* default virtual functions */
|
|
|
|
klass->list_tracks = gst_volume_list_tracks;
|
|
|
|
klass->set_volume = gst_volume_set_volume;
|
|
|
|
klass->get_volume = gst_volume_get_volume;
|
|
|
|
klass->set_mute = gst_volume_set_mute;
|
|
|
|
}
|
|
|
|
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
/* Element class */
|
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_dispose (GObject * object)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2005-08-01 16:20:33 +00:00
|
|
|
GstVolume *volume = GST_VOLUME (object);
|
2004-05-07 20:26:47 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (volume->tracklist) {
|
|
|
|
if (volume->tracklist->data)
|
|
|
|
g_object_unref (volume->tracklist->data);
|
|
|
|
g_list_free (volume->tracklist);
|
|
|
|
volume->tracklist = NULL;
|
|
|
|
}
|
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2003-10-31 20:03:29 +00:00
|
|
|
static void
|
2005-05-09 21:37:17 +00:00
|
|
|
gst_volume_base_init (gpointer g_class)
|
2003-10-31 20:03:29 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2008-01-03 20:33:58 +00:00
|
|
|
GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (g_class);
|
|
|
|
GstCaps *caps;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2008-03-21 16:46:33 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "Volume",
|
|
|
|
"Filter/Effect/Audio",
|
|
|
|
"Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
|
2008-01-03 20:33:58 +00:00
|
|
|
|
|
|
|
caps = gst_caps_from_string (ALLOWED_CAPS);
|
|
|
|
gst_audio_filter_class_add_pad_templates (filter_class, caps);
|
|
|
|
gst_caps_unref (caps);
|
2003-10-31 20:03:29 +00:00
|
|
|
}
|
2005-05-09 21:37:17 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
static void
|
2005-05-09 21:37:17 +00:00
|
|
|
gst_volume_class_init (GstVolumeClass * klass)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GstBaseTransformClass *trans_class;
|
2008-01-03 20:33:58 +00:00
|
|
|
GstAudioFilterClass *filter_class;
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
trans_class = (GstBaseTransformClass *) klass;
|
2008-01-03 20:33:58 +00:00
|
|
|
filter_class = (GstAudioFilterClass *) (klass);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
gobject_class->set_property = volume_set_property;
|
|
|
|
gobject_class->get_property = volume_get_property;
|
|
|
|
gobject_class->dispose = gst_volume_dispose;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MUTE,
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
g_param_spec_boolean ("mute", "Mute", "mute channel",
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
DEFAULT_PROP_MUTE,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_VOLUME,
|
2009-06-30 11:46:38 +00:00
|
|
|
g_param_spec_double ("volume", "Volume", "volume factor, 1.0=100%",
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2008-12-08 18:44:22 +00:00
|
|
|
trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip);
|
2010-02-17 18:18:29 +00:00
|
|
|
trans_class->stop = GST_DEBUG_FUNCPTR (volume_stop);
|
2008-01-03 20:33:58 +00:00
|
|
|
filter_class->setup = GST_DEBUG_FUNCPTR (volume_setup);
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
gst_volume_init (GstVolume * self, GstVolumeClass * g_class)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
GstMixerTrack *track = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
self->mute = DEFAULT_PROP_MUTE;;
|
|
|
|
self->volume = DEFAULT_PROP_VOLUME;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
self->tracklist = NULL;
|
|
|
|
self->negotiated = FALSE;
|
2002-04-28 16:07:41 +00:00
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
track = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (GST_IS_MIXER_TRACK (track)) {
|
|
|
|
track->label = g_strdup ("volume");
|
|
|
|
track->num_channels = 1;
|
|
|
|
track->min_volume = 0;
|
|
|
|
track->max_volume = VOLUME_STEPS;
|
|
|
|
track->flags = GST_MIXER_TRACK_SOFTWARE;
|
2010-02-13 00:08:05 +00:00
|
|
|
self->tracklist = g_list_append (self->tracklist, track);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2007-12-15 03:40:34 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (self), TRUE);
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 16:07:41 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_double (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
{
|
|
|
|
gdouble *data = (gdouble *) bytes;
|
2008-03-21 15:54:54 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gdouble);
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
gdouble vol = self->current_volume;
|
2008-03-21 15:54:54 +00:00
|
|
|
|
|
|
|
oil_scalarmultiply_f64_ns (data, data, &vol, num_samples);
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_double (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gdouble *data = (gdouble *) bytes;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gdouble) * channels);
|
|
|
|
guint i, j;
|
|
|
|
gdouble vol;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
*data++ *= vol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_float (GstVolume * self, gpointer bytes, guint n_bytes)
|
2002-04-28 16:07:41 +00:00
|
|
|
{
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
gfloat *data = (gfloat *) bytes;
|
2007-08-22 11:20:28 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gfloat);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2008-03-21 16:46:33 +00:00
|
|
|
#if 0
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
2010-02-13 00:08:05 +00:00
|
|
|
*data++ *= self->real_vol_f;
|
2008-03-21 16:46:33 +00:00
|
|
|
}
|
|
|
|
/* time "gst-launch 2>/dev/null audiotestsrc wave=7 num-buffers=10000 ! audio/x-raw-float !
|
|
|
|
* volume volume=1.5 ! fakesink" goes from 0m0.850s -> 0m0.717s with liboil
|
2007-08-22 11:20:28 +00:00
|
|
|
*/
|
2008-03-21 16:46:33 +00:00
|
|
|
#endif
|
2010-02-13 00:08:05 +00:00
|
|
|
oil_scalarmultiply_f32_ns (data, data, &self->current_volume, num_samples);
|
2005-05-09 21:37:17 +00:00
|
|
|
}
|
2002-04-28 16:07:41 +00:00
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_float (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gfloat *data = (gfloat *) bytes;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gfloat) * channels);
|
|
|
|
guint i, j;
|
|
|
|
gdouble vol;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
*data++ *= vol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int32 (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
2010-02-17 18:18:29 +00:00
|
|
|
gint32 *data = (gint32 *) bytes;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint i, num_samples;
|
|
|
|
gint64 val;
|
|
|
|
|
|
|
|
num_samples = n_bytes / sizeof (gint);
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint64) * data;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val =
|
2010-02-13 00:08:05 +00:00
|
|
|
(((gint64) self->current_vol_i32 *
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val) >> VOLUME_UNITY_INT32_BIT_SHIFT);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
*data++ = (gint32) val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int32_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
2010-02-17 18:18:29 +00:00
|
|
|
gint32 *data = (gint32 *) bytes;
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
guint i, num_samples;
|
|
|
|
gint64 val;
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
num_samples = n_bytes / sizeof (gint32);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint64) * data;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val =
|
2010-02-13 00:08:05 +00:00
|
|
|
(((gint64) self->current_vol_i32 *
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val) >> VOLUME_UNITY_INT32_BIT_SHIFT);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
*data++ = (gint32) CLAMP (val, VOLUME_MIN_INT32, VOLUME_MAX_INT32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_int32_clamp (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gint32 *data = (gint32 *) bytes;
|
|
|
|
guint i, j;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gint32) * channels);
|
|
|
|
gdouble vol, val;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
2010-03-12 14:47:40 +00:00
|
|
|
val = *data * vol;
|
2010-02-17 18:18:29 +00:00
|
|
|
*data++ = (gint32) CLAMP (val, VOLUME_MIN_INT32, VOLUME_MAX_INT32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
|
|
|
#define get_unaligned_i24(_x) ( (((guint8*)_x)[0]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[2]) << 16) )
|
2008-03-21 16:46:33 +00:00
|
|
|
|
|
|
|
#define write_unaligned_u24(_x,samp) \
|
|
|
|
G_STMT_START { \
|
|
|
|
*(_x)++ = samp & 0xFF; \
|
|
|
|
*(_x)++ = (samp >> 8) & 0xFF; \
|
|
|
|
*(_x)++ = (samp >> 16) & 0xFF; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#else /* BIG ENDIAN */
|
|
|
|
#define get_unaligned_i24(_x) ( (((guint8*)_x)[2]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[0]) << 16) )
|
2008-03-21 16:46:33 +00:00
|
|
|
#define write_unaligned_u24(_x,samp) \
|
|
|
|
G_STMT_START { \
|
|
|
|
*(_x)++ = (samp >> 16) & 0xFF; \
|
|
|
|
*(_x)++ = (samp >> 8) & 0xFF; \
|
|
|
|
*(_x)++ = samp & 0xFF; \
|
|
|
|
} G_STMT_END
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int24 (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */
|
|
|
|
guint i, num_samples;
|
|
|
|
guint32 samp;
|
|
|
|
gint64 val;
|
|
|
|
|
|
|
|
num_samples = n_bytes / (sizeof (gint8) * 3);
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
samp = get_unaligned_i24 (data);
|
|
|
|
|
|
|
|
val = (gint32) samp;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val =
|
2010-02-13 00:08:05 +00:00
|
|
|
(((gint64) self->current_vol_i24 *
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val) >> VOLUME_UNITY_INT24_BIT_SHIFT);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
samp = (guint32) val;
|
|
|
|
|
|
|
|
/* write the value back into the stream */
|
|
|
|
write_unaligned_u24 (data, samp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int24_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */
|
|
|
|
guint i, num_samples;
|
|
|
|
guint32 samp;
|
|
|
|
gint64 val;
|
|
|
|
|
|
|
|
num_samples = n_bytes / (sizeof (gint8) * 3);
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
samp = get_unaligned_i24 (data);
|
|
|
|
|
|
|
|
val = (gint32) samp;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val =
|
2010-02-13 00:08:05 +00:00
|
|
|
(((gint64) self->current_vol_i24 *
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val) >> VOLUME_UNITY_INT24_BIT_SHIFT);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
samp = (guint32) CLAMP (val, VOLUME_MIN_INT24, VOLUME_MAX_INT24);
|
|
|
|
|
|
|
|
/* write the value back into the stream */
|
|
|
|
write_unaligned_u24 (data, samp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_int24_clamp (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */
|
|
|
|
guint i, j;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gint8) * 3 * channels);
|
|
|
|
gdouble vol, val;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
2010-03-12 14:47:40 +00:00
|
|
|
val = get_unaligned_i24 (data) * vol;
|
2010-02-17 18:18:29 +00:00
|
|
|
val = CLAMP (val, VOLUME_MIN_INT24, VOLUME_MAX_INT24);
|
|
|
|
write_unaligned_u24 (data, (gint32) val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int16 (GstVolume * self, gpointer bytes, guint n_bytes)
|
2005-05-09 21:37:17 +00:00
|
|
|
{
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
gint16 *data = (gint16 *) bytes;
|
2007-08-22 11:20:28 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gint16);
|
2005-05-09 21:37:17 +00:00
|
|
|
|
2007-08-22 11:20:28 +00:00
|
|
|
guint i;
|
|
|
|
gint val;
|
2005-05-09 21:37:17 +00:00
|
|
|
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
*data++ =
|
2010-02-13 00:08:05 +00:00
|
|
|
(gint16) ((self->current_vol_i16 *
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
val) >> VOLUME_UNITY_INT16_BIT_SHIFT);
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
}
|
|
|
|
}
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int16_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
{
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
gint16 *data = (gint16 *) bytes;
|
2007-02-21 13:55:54 +00:00
|
|
|
guint i, num_samples;
|
|
|
|
gint val;
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
|
|
|
|
num_samples = n_bytes / sizeof (gint16);
|
|
|
|
|
2007-08-23 08:33:43 +00:00
|
|
|
/* FIXME: oil_scalarmultiply_s16_ns ?
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
* https://bugs.freedesktop.org/show_bug.cgi?id=7060
|
gst/adder/gstadder.c: Make it easier to copy&paste
Original commit message from CVS:
* gst/adder/gstadder.c: (gst_adder_get_type):
Make it easier to copy&paste
* gst/volume/Makefile.am:
* gst/volume/gstvolume.c: (volume_update_real_volume),
(gst_volume_set_volume), (gst_volume_set_mute),
(gst_volume_class_init), (volume_process_int16), (volume_set_caps),
(volume_transform_ip), (volume_update_mute),
(volume_update_volume):
* gst/volume/gstvolume.h:
Add own debug category, move duplicate code to helper function, fix
property texts, add more comments and prepare ffor liboil-goodness
* tests/check/Makefile.am:
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
add test for mute and passtrough case, be a bit more verbose to track
failure
* tests/check/generic/states.c: (GST_START_TEST):
catch elements that fail to instantiate
2006-05-28 19:42:27 +00:00
|
|
|
*/
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
|
|
|
*data++ =
|
2010-02-13 00:08:05 +00:00
|
|
|
(gint16) CLAMP ((self->current_vol_i16 *
|
gst/volume/gstvolume.*: Extend float audio support (double) and some int->uint cleanups.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_double), (volume_process_float),
(volume_process_int16), (volume_process_int16_clamp),
(volume_set_caps), (volume_transform_ip), (volume_update_volume):
* gst/volume/gstvolume.h:
Extend float audio support (double) and some int->uint cleanups.
2007-02-21 13:08:51 +00:00
|
|
|
val) >> VOLUME_UNITY_INT16_BIT_SHIFT, VOLUME_MIN_INT16,
|
|
|
|
VOLUME_MAX_INT16);
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_int16_clamp (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gint16 *data = (gint16 *) bytes;
|
|
|
|
guint i, j;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gint16) * channels);
|
|
|
|
gdouble vol, val;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
2010-03-12 14:47:40 +00:00
|
|
|
val = *data * vol;
|
2010-02-17 18:18:29 +00:00
|
|
|
*data++ = (gint16) CLAMP (val, VOLUME_MIN_INT16, VOLUME_MAX_INT16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int8 (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes;
|
|
|
|
guint num_samples = n_bytes / sizeof (gint8);
|
|
|
|
guint i;
|
|
|
|
gint val;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
|
|
|
*data++ =
|
2010-02-13 00:08:05 +00:00
|
|
|
(gint8) ((self->current_vol_i8 * val) >> VOLUME_UNITY_INT8_BIT_SHIFT);
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_process_int8_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes;
|
|
|
|
guint i, num_samples;
|
|
|
|
gint val;
|
|
|
|
|
|
|
|
num_samples = n_bytes / sizeof (gint8);
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
|
|
|
*data++ =
|
2010-02-13 00:08:05 +00:00
|
|
|
(gint8) CLAMP ((self->current_vol_i8 *
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
val) >> VOLUME_UNITY_INT8_BIT_SHIFT, VOLUME_MIN_INT8,
|
|
|
|
VOLUME_MAX_INT8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static void
|
|
|
|
volume_process_controlled_int8_clamp (GstVolume * self, gpointer bytes,
|
|
|
|
gdouble * volume, guint channels, guint n_bytes)
|
|
|
|
{
|
|
|
|
gint8 *data = (gint8 *) bytes;
|
|
|
|
guint i, j;
|
|
|
|
guint num_samples = n_bytes / (sizeof (gint8) * channels);
|
|
|
|
gdouble val, vol;
|
|
|
|
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
2010-03-12 14:47:40 +00:00
|
|
|
val = *data * vol;
|
2010-02-17 18:18:29 +00:00
|
|
|
*data++ = (gint8) CLAMP (val, VOLUME_MIN_INT8, VOLUME_MAX_INT8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
/* GstBaseTransform vmethod implementations */
|
|
|
|
|
|
|
|
/* get notified of caps and plug in the correct process function */
|
2005-08-24 21:32:59 +00:00
|
|
|
static gboolean
|
2008-01-03 20:33:58 +00:00
|
|
|
volume_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
|
2005-08-20 18:07:10 +00:00
|
|
|
{
|
2008-11-05 19:18:25 +00:00
|
|
|
gboolean res;
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (filter);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
gfloat volume;
|
|
|
|
gboolean mute;
|
2006-05-03 08:58:13 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
volume = self->volume;
|
|
|
|
mute = self->mute;
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
res = volume_update_volume (self, volume, mute);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
if (!res) {
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
|
2008-01-03 20:33:58 +00:00
|
|
|
("Invalid incoming format"), (NULL));
|
2005-08-20 18:07:10 +00:00
|
|
|
}
|
2010-02-13 00:08:05 +00:00
|
|
|
self->negotiated = res;
|
2008-11-05 19:18:25 +00:00
|
|
|
|
|
|
|
return res;
|
2005-08-20 18:07:10 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
static gboolean
|
|
|
|
volume_stop (GstBaseTransform * base)
|
|
|
|
{
|
|
|
|
GstVolume *self = GST_VOLUME (base);
|
|
|
|
|
|
|
|
g_free (self->volumes);
|
|
|
|
self->volumes = NULL;
|
|
|
|
self->volumes_count = 0;
|
|
|
|
|
|
|
|
g_free (self->mutes);
|
|
|
|
self->mutes = NULL;
|
|
|
|
self->mutes_count = 0;
|
|
|
|
|
|
|
|
return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_TRANSFORM_CLASS, stop, (base),
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
|
2008-12-08 18:44:22 +00:00
|
|
|
static void
|
|
|
|
volume_before_transform (GstBaseTransform * base, GstBuffer * buffer)
|
2005-08-20 18:07:10 +00:00
|
|
|
{
|
2006-05-03 08:58:13 +00:00
|
|
|
GstClockTime timestamp;
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (base);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
gfloat volume;
|
|
|
|
gboolean mute;
|
2008-05-06 12:35:09 +00:00
|
|
|
|
2008-12-08 18:44:22 +00:00
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
2006-10-27 17:13:35 +00:00
|
|
|
timestamp =
|
|
|
|
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (base, "sync to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
2005-08-20 18:07:10 +00:00
|
|
|
|
2006-05-03 08:58:13 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
2010-02-13 00:08:05 +00:00
|
|
|
gst_object_sync_values (G_OBJECT (self), timestamp);
|
2005-08-29 19:32:19 +00:00
|
|
|
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
/* get latest values */
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
volume = self->volume;
|
|
|
|
mute = self->mute;
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
if ((volume != self->current_volume) || (mute != self->current_mute)) {
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
/* the volume or mute was updated, update our internal state before
|
|
|
|
* we continue processing. */
|
2010-02-13 00:08:05 +00:00
|
|
|
volume_update_volume (self, volume, mute);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
}
|
2008-12-08 18:44:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (base);
|
2008-12-08 18:44:22 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint size;
|
2010-02-17 18:18:29 +00:00
|
|
|
GstControlSource *mute_csource, *volume_csource;
|
2008-12-08 18:44:22 +00:00
|
|
|
|
2010-02-13 00:08:05 +00:00
|
|
|
if (G_UNLIKELY (!self->negotiated))
|
2008-12-08 18:44:22 +00:00
|
|
|
goto not_negotiated;
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
|
2007-08-23 08:33:43 +00:00
|
|
|
/* don't process data in passthrough-mode */
|
2007-11-26 12:25:55 +00:00
|
|
|
if (gst_base_transform_is_passthrough (base) ||
|
|
|
|
GST_BUFFER_FLAG_IS_SET (outbuf, GST_BUFFER_FLAG_GAP))
|
2007-08-23 08:33:43 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
data = GST_BUFFER_DATA (outbuf);
|
|
|
|
size = GST_BUFFER_SIZE (outbuf);
|
2005-08-20 18:07:10 +00:00
|
|
|
|
2010-02-17 18:18:29 +00:00
|
|
|
mute_csource = gst_object_get_control_source (G_OBJECT (self), "mute");
|
|
|
|
volume_csource = gst_object_get_control_source (G_OBJECT (self), "volume");
|
|
|
|
if (mute_csource || (volume_csource && !self->current_mute)) {
|
|
|
|
gint rate = GST_AUDIO_FILTER_CAST (self)->format.rate;
|
|
|
|
gint width = GST_AUDIO_FILTER_CAST (self)->format.width / 8;
|
|
|
|
gint channels = GST_AUDIO_FILTER_CAST (self)->format.channels;
|
|
|
|
guint nsamples = size / (width * channels);
|
|
|
|
GstClockTime interval = gst_util_uint64_scale_int (1, GST_SECOND, rate);
|
|
|
|
GstClockTime ts = GST_BUFFER_TIMESTAMP (outbuf);
|
|
|
|
|
|
|
|
ts = gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, ts);
|
|
|
|
|
2010-03-12 14:44:50 +00:00
|
|
|
if (self->mutes_count < nsamples && mute_csource) {
|
2010-02-17 18:18:29 +00:00
|
|
|
self->mutes = g_realloc (self->mutes, sizeof (gboolean) * nsamples);
|
|
|
|
self->mutes_count = nsamples;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self->volumes_count < nsamples) {
|
|
|
|
self->volumes = g_realloc (self->volumes, sizeof (gdouble) * nsamples);
|
|
|
|
self->volumes_count = nsamples;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mute_csource) {
|
2010-03-15 21:49:53 +00:00
|
|
|
GstValueArray va =
|
|
|
|
{ (char *) "mute", nsamples, interval, (gpointer) self->mutes };
|
2010-02-17 18:18:29 +00:00
|
|
|
|
|
|
|
if (!gst_control_source_get_value_array (mute_csource, ts, &va))
|
|
|
|
goto controller_failure;
|
|
|
|
|
|
|
|
gst_object_unref (mute_csource);
|
|
|
|
mute_csource = NULL;
|
|
|
|
} else {
|
|
|
|
g_free (self->mutes);
|
|
|
|
self->mutes = NULL;
|
|
|
|
self->mutes_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (volume_csource) {
|
|
|
|
GstValueArray va =
|
2010-03-15 21:49:53 +00:00
|
|
|
{ (char *) "volume", nsamples, interval, (gpointer) self->volumes };
|
2010-02-17 18:18:29 +00:00
|
|
|
|
|
|
|
if (!gst_control_source_get_value_array (volume_csource, ts, &va))
|
|
|
|
goto controller_failure;
|
|
|
|
|
|
|
|
gst_object_unref (volume_csource);
|
|
|
|
volume_csource = NULL;
|
|
|
|
} else {
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < nsamples; i++)
|
|
|
|
self->volumes[i] = self->current_volume;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mute_csource) {
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < nsamples; i++)
|
|
|
|
self->volumes[i] *= (1.0 - self->mutes[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
self->process_controlled (self, data, self->volumes, channels, size);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
} else if (volume_csource) {
|
|
|
|
gst_object_unref (volume_csource);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self->current_volume == 0.0 || self->current_mute) {
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
memset (data, 0, size);
|
2007-11-26 12:25:55 +00:00
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
2010-02-13 00:08:05 +00:00
|
|
|
} else if (self->current_volume != 1.0) {
|
|
|
|
self->process (self, data, size);
|
gst/volume/gstvolume.*: Cleanup volume, define and use default values.
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_volume), (gst_volume_set_volume),
(gst_volume_get_volume), (gst_volume_set_mute),
(gst_volume_class_init), (gst_volume_init),
(volume_process_double), (volume_process_float),
(volume_process_int32), (volume_process_int32_clamp),
(volume_process_int24), (volume_process_int24_clamp),
(volume_process_int16), (volume_process_int16_clamp),
(volume_process_int8), (volume_process_int8_clamp), (volume_setup),
(volume_transform_ip), (volume_set_property),
(volume_get_property):
* gst/volume/gstvolume.h:
Cleanup volume, define and use default values.
Recalculate new volume and mute setup before processing. Fixes #561789.
* tests/check/elements/volume.c: (GST_START_TEST), (volume_suite):
Add controller unit test. Patch by: Jonathan Matthew
Fix bogus test that messed with basetransform's internal state.
2008-11-24 12:03:11 +00:00
|
|
|
}
|
2007-11-26 12:25:55 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
return GST_FLOW_OK;
|
2008-11-05 19:18:25 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_negotiated:
|
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
|
2008-11-05 19:18:25 +00:00
|
|
|
("No format was negotiated"), (NULL));
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
2010-02-17 18:18:29 +00:00
|
|
|
controller_failure:
|
|
|
|
{
|
|
|
|
if (mute_csource)
|
|
|
|
gst_object_unref (mute_csource);
|
|
|
|
if (volume_csource)
|
|
|
|
gst_object_unref (volume_csource);
|
|
|
|
|
|
|
|
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
|
|
|
("Failed to get values from controller"), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-08-20 18:07:10 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
volume_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (object);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_MUTE:
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->mute = g_value_get_boolean (value);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_VOLUME:
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->volume = g_value_get_double (value);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
volume_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (object);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
switch (prop_id) {
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_MUTE:
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
g_value_set_boolean (value, self->mute);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_VOLUME:
|
2010-02-13 00:08:05 +00:00
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
g_value_set_double (value, self->volume);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
gst/volume/gstvolume.*: Add support for int32, int24 and int8 to the volume element.
Original commit message from CVS:
Based on a patch by: Davyd <davyd at madeley dot id dot au>
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_set_volume),
(gst_volume_init), (volume_process_int32),
(volume_process_int32_clamp), (volume_process_int24),
(volume_process_int24_clamp), (volume_process_int16),
(volume_process_int16_clamp), (volume_process_int8),
(volume_process_int8_clamp), (volume_update_volume), (plugin_init):
* gst/volume/gstvolume.h:
Add support for int32, int24 and int8 to the volume element.
Fixes #445529.
2007-08-23 20:45:45 +00:00
|
|
|
oil_init ();
|
gst/volume/gstvolume.*: rewrite the passthrough check, split _int16 and _int16_clamp, fix another property desc., rem...
Original commit message from CVS:
* gst/volume/gstvolume.c: (volume_choose_func),
(volume_update_real_volume), (gst_volume_class_init),
(gst_volume_init), (volume_process_float), (volume_process_int16),
(volume_process_int16_clamp), (volume_set_caps),
(volume_transform_ip), (plugin_init):
* gst/volume/gstvolume.h:
rewrite the passthrough check, split _int16 and _int16_clamp, fix
another property desc., remove unused param from process function
* tests/check/elements/volume.c: (volume_suite):
reactivate the passthrough test
2006-06-01 20:39:30 +00:00
|
|
|
|
2006-01-31 17:19:09 +00:00
|
|
|
/* initialize gst controller library */
|
|
|
|
gst_controller_init (NULL, NULL);
|
|
|
|
|
2008-03-21 16:46:33 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "volume", 0, "Volume gain");
|
|
|
|
|
2008-04-06 20:16:27 +00:00
|
|
|
/* ref class from a thread-safe context to work around missing bit of
|
|
|
|
* thread-safety in GObject */
|
|
|
|
g_type_class_ref (GST_TYPE_MIXER_TRACK);
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return gst_element_register (plugin, "volume", GST_RANK_NONE,
|
|
|
|
GST_TYPE_VOLUME);
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"volume",
|
2006-03-06 20:52:25 +00:00
|
|
|
"plugin for controlling audio volume",
|
2005-10-16 13:54:44 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|