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>
|
2011-11-30 06:57:02 +00:00
|
|
|
#include <gst/audio/mixer.h>
|
2008-01-03 20:33:58 +00:00
|
|
|
#include <gst/audio/gstaudiofilter.h>
|
2005-08-29 19:32:19 +00:00
|
|
|
|
2010-10-01 09:00:54 +00:00
|
|
|
#ifdef HAVE_ORC
|
|
|
|
#include <orc/orcfunctions.h>
|
|
|
|
#else
|
|
|
|
#define orc_memset memset
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstvolumeorc.h"
|
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
|
|
|
*/
|
2011-05-31 09:05:03 +00:00
|
|
|
#define VOLUME_UNITY_INT8 8 /* internal int for unity 2^(8-5) */
|
|
|
|
#define VOLUME_UNITY_INT8_BIT_SHIFT 3 /* number of bits to shift for unity */
|
|
|
|
#define VOLUME_UNITY_INT16 2048 /* internal int for unity 2^(16-5) */
|
|
|
|
#define VOLUME_UNITY_INT16_BIT_SHIFT 11 /* number of bits to shift for unity */
|
|
|
|
#define VOLUME_UNITY_INT24 524288 /* internal int for unity 2^(24-5) */
|
|
|
|
#define VOLUME_UNITY_INT24_BIT_SHIFT 19 /* 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
|
|
|
};
|
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
2008-01-03 20:33:58 +00:00
|
|
|
#define ALLOWED_CAPS \
|
2011-12-31 13:31:08 +00:00
|
|
|
GST_AUDIO_CAPS_MAKE ("{ F32LE, F64LE, S8, S16LE, S24LE, S32LE }") \
|
|
|
|
", layout = (string) interleaved"
|
2011-08-18 17:15:03 +00:00
|
|
|
#else
|
|
|
|
#define ALLOWED_CAPS \
|
2011-12-31 13:31:08 +00:00
|
|
|
GST_AUDIO_CAPS_MAKE ("{ F32BE, F64BE, S8, S16BE, S24BE, S32BE }") \
|
|
|
|
", layout = (string) { interleaved, non-interleaved }"
|
2011-08-18 17:15:03 +00:00
|
|
|
#endif
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2011-10-21 12:37:31 +00:00
|
|
|
static void gst_volume_mixer_init (GstMixerInterface * iface);
|
2005-05-09 21:37:17 +00:00
|
|
|
|
2011-04-19 09:35:53 +00:00
|
|
|
#define gst_volume_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstVolume, gst_volume,
|
2011-06-26 22:16:08 +00:00
|
|
|
GST_TYPE_AUDIO_FILTER,
|
2011-04-19 09:35:53 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_MIXER, gst_volume_mixer_init);
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
|
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);
|
2011-08-19 08:06:39 +00:00
|
|
|
static gboolean volume_setup (GstAudioFilter * filter,
|
|
|
|
const GstAudioInfo * info);
|
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
|
2012-02-06 15:08:24 +00:00
|
|
|
volume_choose_func (GstVolume * self, const GstAudioInfo * info)
|
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
|
|
|
{
|
2011-08-18 17:15:03 +00:00
|
|
|
GstAudioFormat format;
|
|
|
|
|
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
|
|
|
|
2012-02-06 15:08:24 +00:00
|
|
|
format = GST_AUDIO_INFO_FORMAT (info);
|
2011-08-18 17:15:03 +00:00
|
|
|
|
|
|
|
if (format == GST_AUDIO_FORMAT_UNKNOWN)
|
2008-01-03 20:33:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
switch (format) {
|
|
|
|
case GST_AUDIO_FORMAT_S32:
|
|
|
|
/* only clamp if the gain is greater than 1.0 */
|
|
|
|
if (self->current_vol_i32 > VOLUME_UNITY_INT32) {
|
|
|
|
self->process = volume_process_int32_clamp;
|
|
|
|
} else {
|
|
|
|
self->process = volume_process_int32;
|
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int32_clamp;
|
|
|
|
break;
|
2011-09-06 10:06:39 +00:00
|
|
|
case GST_AUDIO_FORMAT_S24:
|
2011-08-18 17:15:03 +00:00
|
|
|
/* only clamp if the gain is greater than 1.0 */
|
|
|
|
if (self->current_vol_i24 > VOLUME_UNITY_INT24) {
|
|
|
|
self->process = volume_process_int24_clamp;
|
|
|
|
} else {
|
|
|
|
self->process = volume_process_int24;
|
|
|
|
}
|
|
|
|
self->process_controlled = volume_process_controlled_int24_clamp;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_FORMAT_S16:
|
|
|
|
/* only clamp if the gain is greater than 1.0 */
|
|
|
|
if (self->current_vol_i16 > VOLUME_UNITY_INT16) {
|
|
|
|
self->process = volume_process_int16_clamp;
|
|
|
|
} else {
|
|
|
|
self->process = volume_process_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
|
|
|
}
|
2011-08-18 17:15:03 +00:00
|
|
|
self->process_controlled = volume_process_controlled_int16_clamp;
|
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;
|
2011-08-18 17:15:03 +00:00
|
|
|
case GST_AUDIO_FORMAT_S8:
|
|
|
|
/* only clamp if the gain is greater than 1.0 */
|
|
|
|
if (self->current_vol_i8 > VOLUME_UNITY_INT8) {
|
|
|
|
self->process = volume_process_int8_clamp;
|
|
|
|
} else {
|
|
|
|
self->process = volume_process_int8;
|
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
|
|
|
}
|
2011-08-18 17:15:03 +00:00
|
|
|
self->process_controlled = volume_process_controlled_int8_clamp;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_FORMAT_F32:
|
|
|
|
self->process = volume_process_float;
|
|
|
|
self->process_controlled = volume_process_controlled_float;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_FORMAT_F64:
|
|
|
|
self->process = volume_process_double;
|
|
|
|
self->process_controlled = volume_process_controlled_double;
|
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
|
2012-02-06 15:08:24 +00:00
|
|
|
volume_update_volume (GstVolume * self, const GstAudioInfo * info,
|
|
|
|
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-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.
|
|
|
|
*/
|
2011-12-20 21:58:26 +00:00
|
|
|
passthrough &= !gst_object_has_active_control_bindings (GST_OBJECT (self));
|
2010-02-17 18:18:29 +00:00
|
|
|
|
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
|
|
|
|
2012-02-06 15:08:24 +00:00
|
|
|
res = self->negotiated = volume_choose_func (self, info);
|
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 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
|
|
|
}
|
|
|
|
|
2012-03-02 09:00:59 +00:00
|
|
|
static GstMixerType
|
|
|
|
gst_volume_get_mixer_type (GstMixer * mixer)
|
|
|
|
{
|
|
|
|
return GST_MIXER_SOFTWARE;
|
|
|
|
}
|
|
|
|
|
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
|
2011-10-21 12:37:31 +00:00
|
|
|
gst_volume_mixer_init (GstMixerInterface * iface)
|
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 */
|
2011-10-21 12:37:31 +00:00
|
|
|
iface->list_tracks = gst_volume_list_tracks;
|
|
|
|
iface->set_volume = gst_volume_set_volume;
|
|
|
|
iface->get_volume = gst_volume_get_volume;
|
|
|
|
iface->set_mute = gst_volume_set_mute;
|
2012-03-02 09:00:59 +00:00
|
|
|
iface->get_mixer_type = gst_volume_get_mixer_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
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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;
|
2011-04-19 09:35:53 +00:00
|
|
|
GstElementClass *element_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;
|
2011-04-19 09:35:53 +00:00
|
|
|
GstCaps *caps;
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2011-04-19 09:35:53 +00:00
|
|
|
element_class = (GstElementClass *) 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
|
|
|
|
2011-04-19 09:35:53 +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>");
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (ALLOWED_CAPS);
|
|
|
|
gst_audio_filter_class_add_pad_templates (filter_class, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
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
|
2011-04-19 09:35:53 +00:00
|
|
|
gst_volume_init (GstVolume * self)
|
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-10-01 08:44:37 +00:00
|
|
|
orc_scalarmultiply_f64_ns (data, self->current_volume, 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;
|
|
|
|
|
2010-10-01 09:13:01 +00:00
|
|
|
if (channels == 1) {
|
|
|
|
orc_process_controlled_f64_1ch (data, volume, num_samples);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
*data++ *= vol;
|
|
|
|
}
|
2010-02-17 18:18:29 +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
|
|
|
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
|
|
|
|
2010-10-01 08:42:27 +00:00
|
|
|
orc_scalarmultiply_f32_ns (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;
|
|
|
|
|
2010-10-01 09:13:01 +00:00
|
|
|
if (channels == 1) {
|
|
|
|
orc_process_controlled_f32_1ch (data, volume, num_samples);
|
|
|
|
} else if (channels == 2) {
|
|
|
|
orc_process_controlled_f32_2ch (data, volume, num_samples);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
*data++ *= vol;
|
|
|
|
}
|
2010-02-17 18:18:29 +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
|
|
|
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;
|
2010-10-03 09:20:37 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gint);
|
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-10-03 09:20:37 +00:00
|
|
|
/* hard coded in volume.orc */
|
2010-10-03 09:24:29 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT32_BIT_SHIFT == 27);
|
2010-10-03 09:20:37 +00:00
|
|
|
orc_process_int32 (data, self->current_vol_i32, num_samples);
|
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_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;
|
2010-10-03 09:20:37 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gint);
|
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-10-03 09:20:37 +00:00
|
|
|
/* hard coded in volume.orc */
|
2010-10-03 09:24:29 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT32_BIT_SHIFT == 27);
|
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-10-03 09:20:37 +00:00
|
|
|
orc_process_int32_clamp (data, self->current_vol_i32, num_samples);
|
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
|
|
|
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;
|
|
|
|
|
2010-10-03 09:20:37 +00:00
|
|
|
if (channels == 1) {
|
|
|
|
orc_process_controlled_int32_1ch (data, volume, num_samples);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
val = *data * vol;
|
|
|
|
*data++ = (gint32) CLAMP (val, VOLUME_MIN_INT32, VOLUME_MAX_INT32);
|
|
|
|
}
|
2010-02-17 18:18:29 +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
|
|
|
#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
|
|
|
|
2010-06-09 13:59:10 +00:00
|
|
|
/* hard coded in volume.orc */
|
2011-05-31 09:05:03 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 11);
|
2010-06-09 13:59:10 +00:00
|
|
|
|
|
|
|
orc_process_int16 (data, self->current_vol_i16, num_samples);
|
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;
|
2010-06-07 06:48:15 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gint16);
|
2010-06-09 13:59:10 +00:00
|
|
|
|
2010-06-07 06:48:15 +00:00
|
|
|
/* hard coded in volume.orc */
|
2011-05-31 09:05:03 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 11);
|
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-06-09 13:59:10 +00:00
|
|
|
orc_process_int16_clamp (data, self->current_vol_i16, num_samples);
|
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;
|
|
|
|
|
2010-10-01 10:21:52 +00:00
|
|
|
if (channels == 1) {
|
|
|
|
orc_process_controlled_int16_1ch (data, volume, num_samples);
|
|
|
|
} else if (channels == 2) {
|
|
|
|
orc_process_controlled_int16_2ch (data, volume, num_samples);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
val = *data * vol;
|
|
|
|
*data++ = (gint16) CLAMP (val, VOLUME_MIN_INT16, VOLUME_MAX_INT16);
|
|
|
|
}
|
2010-02-17 18:18:29 +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
|
|
|
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);
|
2010-06-09 13:59:10 +00:00
|
|
|
|
2010-06-07 06:48:15 +00:00
|
|
|
/* hard coded in volume.orc */
|
2011-05-31 09:05:03 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 3);
|
2010-06-07 06:48:15 +00:00
|
|
|
|
2010-06-09 13:59:10 +00:00
|
|
|
orc_process_int8 (data, self->current_vol_i8, num_samples);
|
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;
|
2010-06-07 06:48:15 +00:00
|
|
|
guint num_samples = n_bytes / sizeof (gint8);
|
2010-06-09 13:59:10 +00:00
|
|
|
|
2010-06-07 06:48:15 +00:00
|
|
|
/* hard coded in volume.orc */
|
2011-05-31 09:05:03 +00:00
|
|
|
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 3);
|
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-06-09 13:59:10 +00:00
|
|
|
orc_process_int8_clamp (data, self->current_vol_i8, num_samples);
|
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
|
|
|
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;
|
|
|
|
|
2010-10-01 10:21:52 +00:00
|
|
|
if (channels == 1) {
|
|
|
|
orc_process_controlled_int8_1ch (data, volume, num_samples);
|
|
|
|
} else if (channels == 2) {
|
|
|
|
orc_process_controlled_int8_2ch (data, volume, num_samples);
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
vol = *volume++;
|
|
|
|
for (j = 0; j < channels; j++) {
|
|
|
|
val = *data * vol;
|
|
|
|
*data++ = (gint8) CLAMP (val, VOLUME_MIN_INT8, VOLUME_MAX_INT8);
|
|
|
|
}
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
2011-08-19 08:06:39 +00:00
|
|
|
volume_setup (GstAudioFilter * filter, const GstAudioInfo * info)
|
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
|
|
|
|
2012-02-06 15:08:24 +00:00
|
|
|
res = volume_update_volume (self, info, 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))
|
2011-11-04 14:23:25 +00:00
|
|
|
gst_object_sync_values (GST_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. */
|
2012-02-06 15:08:24 +00:00
|
|
|
volume_update_volume (self, GST_AUDIO_FILTER_INFO (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)
|
|
|
|
{
|
2011-08-18 17:15:03 +00:00
|
|
|
GstAudioFilter *filter = GST_AUDIO_FILTER_CAST (base);
|
2010-02-13 00:08:05 +00:00
|
|
|
GstVolume *self = GST_VOLUME (base);
|
2012-01-20 15:11:54 +00:00
|
|
|
GstMapInfo map;
|
2012-01-20 07:29:02 +00:00
|
|
|
GstControlBinding *mute_cb, *volume_cb;
|
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;
|
|
|
|
|
2012-01-20 15:11:54 +00:00
|
|
|
gst_buffer_map (outbuf, &map, GST_MAP_READWRITE);
|
2005-08-20 18:07:10 +00:00
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
mute_cb = gst_object_get_control_binding (GST_OBJECT (self), "mute");
|
|
|
|
volume_cb = gst_object_get_control_binding (GST_OBJECT (self), "volume");
|
2011-08-18 17:15:03 +00:00
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
if (mute_cb || (volume_cb && !self->current_mute)) {
|
2011-08-18 17:15:03 +00:00
|
|
|
gint rate = GST_AUDIO_INFO_RATE (&filter->info);
|
|
|
|
gint width = GST_AUDIO_FORMAT_INFO_WIDTH (filter->info.finfo) / 8;
|
|
|
|
gint channels = GST_AUDIO_INFO_CHANNELS (&filter->info);
|
2012-01-20 15:11:54 +00:00
|
|
|
guint nsamples = map.size / (width * channels);
|
2010-02-17 18:18:29 +00:00
|
|
|
GstClockTime interval = gst_util_uint64_scale_int (1, GST_SECOND, rate);
|
|
|
|
GstClockTime ts = GST_BUFFER_TIMESTAMP (outbuf);
|
2011-05-25 11:28:18 +00:00
|
|
|
gboolean use_mutes = FALSE;
|
2010-02-17 18:18:29 +00:00
|
|
|
|
|
|
|
ts = gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, ts);
|
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
if (self->mutes_count < nsamples && mute_cb) {
|
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;
|
|
|
|
}
|
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
if (mute_cb) {
|
|
|
|
if (!gst_control_binding_get_value_array (mute_cb, ts, interval,
|
2011-12-06 07:37:32 +00:00
|
|
|
nsamples, (gpointer) self->mutes))
|
2010-02-17 18:18:29 +00:00
|
|
|
goto controller_failure;
|
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
gst_object_replace ((GstObject **) & mute_cb, NULL);
|
2011-05-25 11:28:18 +00:00
|
|
|
use_mutes = TRUE;
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
|
|
|
g_free (self->mutes);
|
|
|
|
self->mutes = NULL;
|
|
|
|
self->mutes_count = 0;
|
|
|
|
}
|
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
if (volume_cb) {
|
|
|
|
if (!gst_control_binding_get_value_array (volume_cb, ts, interval,
|
2011-12-06 07:37:32 +00:00
|
|
|
nsamples, (gpointer) self->volumes))
|
2010-02-17 18:18:29 +00:00
|
|
|
goto controller_failure;
|
|
|
|
|
2012-01-20 07:29:02 +00:00
|
|
|
gst_object_replace ((GstObject **) & volume_cb, NULL);
|
2010-02-17 18:18:29 +00:00
|
|
|
} else {
|
2010-10-01 09:00:54 +00:00
|
|
|
orc_memset_f64 (self->volumes, self->current_volume, nsamples);
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
|
2011-05-25 11:28:18 +00:00
|
|
|
if (use_mutes) {
|
2010-10-01 09:00:54 +00:00
|
|
|
orc_prepare_volumes (self->volumes, self->mutes, nsamples);
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
|
2012-01-20 15:11:54 +00:00
|
|
|
self->process_controlled (self, map.data, self->volumes, channels,
|
|
|
|
map.size);
|
2010-02-17 18:18:29 +00:00
|
|
|
|
2012-01-20 15:11:54 +00:00
|
|
|
goto done;
|
2012-01-20 07:29:02 +00:00
|
|
|
} else if (volume_cb) {
|
|
|
|
gst_object_unref (volume_cb);
|
2010-02-17 18:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (self->current_volume == 0.0 || self->current_mute) {
|
2012-01-20 15:11:54 +00:00
|
|
|
orc_memset (map.data, 0, map.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) {
|
2012-01-20 15:11:54 +00:00
|
|
|
self->process (self, map.data, map.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
|
|
|
}
|
2012-01-20 15:11:54 +00:00
|
|
|
|
|
|
|
done:
|
|
|
|
gst_buffer_unmap (outbuf, &map);
|
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:
|
|
|
|
{
|
2012-01-20 07:29:02 +00:00
|
|
|
if (mute_cb)
|
|
|
|
gst_object_unref (mute_cb);
|
|
|
|
if (volume_cb)
|
|
|
|
gst_object_unref (volume_cb);
|
2010-02-17 18:18:29 +00:00
|
|
|
|
|
|
|
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
|
|
|
("Failed to get values from controller"), (NULL));
|
2012-01-20 15:11:54 +00:00
|
|
|
gst_buffer_unmap (outbuf, &map);
|
2010-02-17 18:18:29 +00:00
|
|
|
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
|
|
|
{
|
2010-09-09 08:57:41 +00:00
|
|
|
gst_volume_orc_init ();
|
|
|
|
|
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);
|