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>
|
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
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* <para>
|
|
|
|
* <programlisting>
|
|
|
|
* gst-launch -v -m sinesrc ! volume volume=0.5 ! level ! fakesink silent=TRUE
|
|
|
|
* </programlisting>
|
2005-09-23 18:14:54 +00:00
|
|
|
* This pipeline shows that the level of sinesrc has been halved
|
|
|
|
* (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.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-08-22 09:35:57 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <gst/gst.h>
|
2005-05-09 21:37:17 +00:00
|
|
|
#include <gst/base/gstbasetransform.h>
|
2001-12-23 12:18:18 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2005-06-30 11:58:40 +00:00
|
|
|
#include <gst/interfaces/mixer.h>
|
2005-09-09 14:57:12 +00:00
|
|
|
#include <gst/controller/gstcontroller.h>
|
2005-08-29 19:32:19 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
#include "gstvolume.h"
|
|
|
|
|
2004-02-02 14:34:52 +00:00
|
|
|
/* some defines for audio processing */
|
|
|
|
/* the volume factor is a range from 0.0 to (arbitrary) 4.0
|
|
|
|
* we map 1.0 to VOLUME_UNITY_INT
|
|
|
|
*/
|
2005-08-22 09:35:57 +00:00
|
|
|
#define VOLUME_UNITY_INT 8192 /* internal int for unity */
|
|
|
|
#define VOLUME_UNITY_BIT_SHIFT 13 /* number of bits to shift for unity */
|
|
|
|
#define VOLUME_MAX_DOUBLE 4.0
|
|
|
|
#define VOLUME_MAX_INT16 32767
|
|
|
|
#define VOLUME_MIN_INT16 -32768
|
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
|
|
|
|
|
|
|
static GstElementDetails volume_details = {
|
|
|
|
"Volume",
|
2003-11-16 22:02:21 +00:00
|
|
|
"Filter/Effect/Audio",
|
2001-12-22 23:27:17 +00:00
|
|
|
"Set volume on audio/raw streams",
|
2005-05-09 21:37:17 +00:00
|
|
|
"Andy Wingo <wingo@pobox.com>",
|
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
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-05-09 21:37:17 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_SILENT,
|
|
|
|
PROP_MUTE,
|
|
|
|
PROP_VOLUME
|
2001-12-22 23:27:17 +00:00
|
|
|
};
|
|
|
|
|
2005-08-23 18:19:10 +00:00
|
|
|
static GstStaticPadTemplate volume_sink_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
2004-03-15 19:32:28 +00:00
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 32, "
|
2004-11-12 16:51:18 +00:00
|
|
|
"buffer-frames = (int) [ 0, MAX]; "
|
2004-03-15 19:32:28 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
|
|
|
|
2005-08-23 18:19:10 +00:00
|
|
|
static GstStaticPadTemplate volume_src_template = GST_STATIC_PAD_TEMPLATE
|
|
|
|
("src",
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
2004-03-15 19:32:28 +00:00
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 32, "
|
2004-11-12 16:51:18 +00:00
|
|
|
"buffer-frames = (int) [ 0, MAX]; "
|
2004-03-15 19:32:28 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) BYTE_ORDER, "
|
|
|
|
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
static void gst_volume_interface_init (GstImplementsInterfaceClass * klass);
|
|
|
|
static void gst_volume_mixer_init (GstMixerClass * iface);
|
|
|
|
|
2005-08-22 09:35:57 +00:00
|
|
|
#define _init_interfaces(type) \
|
2005-08-20 18:07:10 +00:00
|
|
|
{ \
|
|
|
|
static const GInterfaceInfo voliface_info = { \
|
|
|
|
(GInterfaceInitFunc) gst_volume_interface_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL \
|
|
|
|
}; \
|
|
|
|
static const GInterfaceInfo volmixer_info = { \
|
|
|
|
(GInterfaceInitFunc) gst_volume_mixer_init, \
|
|
|
|
NULL, \
|
|
|
|
NULL \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
|
|
|
|
&voliface_info); \
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_MIXER, &volmixer_info); \
|
2005-05-09 21:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstVolume, gst_volume, GstBaseTransform,
|
|
|
|
GST_TYPE_BASE_TRANSFORM, _init_interfaces);
|
|
|
|
|
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);
|
|
|
|
static void volume_update_volume (const GValue * value, gpointer data);
|
|
|
|
static void volume_update_mute (const GValue * value, gpointer data);
|
|
|
|
|
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);
|
2005-08-24 21:32:59 +00:00
|
|
|
static gboolean volume_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
2005-08-20 18:07:10 +00:00
|
|
|
GstCaps * outcaps);
|
|
|
|
|
|
|
|
static void volume_process_float (GstVolume * this, GstClockTime tstamp,
|
2005-05-09 21:37:17 +00:00
|
|
|
gpointer bytes, gint n_bytes);
|
2005-08-20 18:07:10 +00:00
|
|
|
static void volume_process_int16 (GstVolume * this, GstClockTime tstamp,
|
2005-05-09 21:37:17 +00:00
|
|
|
gpointer bytes, gint n_bytes);
|
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
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_interface_supported (GstImplementsInterface * iface, GType type)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
|
|
|
g_assert (type == GST_TYPE_MIXER);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_interface_init (GstImplementsInterfaceClass * klass)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
|
|
|
klass->supported = gst_volume_interface_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GList *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_list_tracks (GstMixer * mixer)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_val_if_fail (this != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_VOLUME (this), NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
return this->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
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_if_fail (this != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (this));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
this->volume_f = (gfloat) volumes[0] / VOLUME_STEPS;
|
|
|
|
this->volume_i = this->volume_f * VOLUME_UNITY_INT;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
if (this->mute) {
|
|
|
|
this->real_vol_f = 0.0;
|
|
|
|
this->real_vol_i = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->real_vol_f = this->volume_f;
|
|
|
|
this->real_vol_i = this->volume_i;
|
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
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_if_fail (this != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (this));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
volumes[0] = (gint) this->volume_f * VOLUME_STEPS;
|
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
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = GST_VOLUME (mixer);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_if_fail (this != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VOLUME (this));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
this->mute = mute;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
if (this->mute) {
|
|
|
|
this->real_vol_f = 0.0;
|
|
|
|
this->real_vol_i = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->real_vol_f = this->volume_f;
|
|
|
|
this->real_vol_i = this->volume_i;
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_mixer_init (GstMixerClass * klass)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
|
|
|
GST_MIXER_TYPE (klass) = GST_MIXER_SOFTWARE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
/* default virtual functions */
|
|
|
|
klass->list_tracks = gst_volume_list_tracks;
|
|
|
|
klass->set_volume = gst_volume_set_volume;
|
|
|
|
klass->get_volume = gst_volume_get_volume;
|
|
|
|
klass->set_mute = gst_volume_set_mute;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_volume_dispose (GObject * object)
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
{
|
2005-08-01 16:20:33 +00:00
|
|
|
GstVolume *volume = GST_VOLUME (object);
|
2004-05-07 20:26:47 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (volume->tracklist) {
|
|
|
|
if (volume->tracklist->data)
|
|
|
|
g_object_unref (volume->tracklist->data);
|
|
|
|
g_list_free (volume->tracklist);
|
|
|
|
volume->tracklist = NULL;
|
|
|
|
}
|
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2003-10-31 20:03:29 +00:00
|
|
|
static void
|
2005-05-09 21:37:17 +00:00
|
|
|
gst_volume_base_init (gpointer g_class)
|
2003-10-31 20:03:29 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2005-08-23 18:19:10 +00:00
|
|
|
gst_static_pad_template_get (&volume_src_template));
|
2003-12-22 21:06:03 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2005-08-23 18:19:10 +00:00
|
|
|
gst_static_pad_template_get (&volume_sink_template));
|
2003-10-31 20:03:29 +00:00
|
|
|
gst_element_class_set_details (element_class, &volume_details);
|
|
|
|
}
|
2005-05-09 21:37:17 +00:00
|
|
|
|
2001-12-22 23:27:17 +00:00
|
|
|
static void
|
2005-05-09 21:37:17 +00:00
|
|
|
gst_volume_class_init (GstVolumeClass * klass)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
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
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MUTE,
|
2005-08-29 19:32:19 +00:00
|
|
|
g_param_spec_boolean ("mute", "mute", "mute",
|
|
|
|
FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VOLUME,
|
2004-03-14 22:34:34 +00:00
|
|
|
g_param_spec_double ("volume", "volume", "volume",
|
2005-08-29 19:32:19 +00:00
|
|
|
0.0, VOLUME_MAX_DOUBLE, 1.0,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
|
2001-12-22 23:27:17 +00:00
|
|
|
|
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
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (volume_transform_ip);
|
2005-08-20 18:07:10 +00:00
|
|
|
GST_BASE_TRANSFORM_CLASS (klass)->set_caps =
|
|
|
|
GST_DEBUG_FUNCPTR (volume_set_caps);
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-08-28 17:52:45 +00:00
|
|
|
gst_volume_init (GstVolume * this, GstVolumeClass * g_class)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
GstMixerTrack *track = NULL;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
this->mute = FALSE;
|
|
|
|
this->volume_i = VOLUME_UNITY_INT;
|
|
|
|
this->volume_f = 1.0;
|
|
|
|
this->real_vol_i = VOLUME_UNITY_INT;
|
|
|
|
this->real_vol_f = 1.0;
|
|
|
|
this->tracklist = NULL;
|
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;
|
2005-08-20 18:07:10 +00:00
|
|
|
this->tracklist = g_list_append (this->tracklist, track);
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2001-12-22 23:27:17 +00:00
|
|
|
}
|
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
/* based on the caps' structure, install the correct volume_process method */
|
2001-12-22 23:27:17 +00:00
|
|
|
static void
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_funcfind (GstVolume * this, const GstStructure * structure)
|
2001-12-22 23:27:17 +00:00
|
|
|
{
|
2005-05-09 21:37:17 +00:00
|
|
|
const gchar *mimetype;
|
2002-04-28 16:07:41 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
mimetype = gst_structure_get_name (structure);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
if (strcmp (mimetype, "audio/x-raw-int") == 0)
|
2005-08-20 18:07:10 +00:00
|
|
|
this->process = volume_process_int16;
|
2005-05-09 21:37:17 +00:00
|
|
|
else if (strcmp (mimetype, "audio/x-raw-float") == 0)
|
2005-08-20 18:07:10 +00:00
|
|
|
this->process = volume_process_float;
|
2002-04-28 16:07:41 +00:00
|
|
|
}
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2002-04-28 16:07:41 +00:00
|
|
|
static void
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_process_float (GstVolume * this, GstClockTime tstamp,
|
2005-05-09 21:37:17 +00:00
|
|
|
gpointer bytes, gint n_bytes)
|
2002-04-28 16:07:41 +00:00
|
|
|
{
|
2005-05-09 21:37:17 +00:00
|
|
|
gfloat *data;
|
2002-05-29 18:56:23 +00:00
|
|
|
gint i, num_samples;
|
2002-04-28 16:07:41 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
data = (gfloat *) bytes;
|
|
|
|
num_samples = n_bytes / sizeof (gfloat);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-01 16:20:33 +00:00
|
|
|
for (i = 0; i < num_samples; i++) {
|
2005-08-20 18:07:10 +00:00
|
|
|
*data++ *= this->real_vol_f;
|
2005-05-09 21:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
2002-04-28 16:07:41 +00:00
|
|
|
|
2005-05-09 21:37:17 +00:00
|
|
|
static void
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_process_int16 (GstVolume * this, GstClockTime tstamp,
|
2005-05-09 21:37:17 +00:00
|
|
|
gpointer bytes, gint n_bytes)
|
|
|
|
{
|
|
|
|
gint16 *data;
|
2005-08-01 16:20:33 +00:00
|
|
|
gint i, val, num_samples;
|
2005-05-09 21:37:17 +00:00
|
|
|
|
|
|
|
data = (gint16 *) bytes;
|
|
|
|
num_samples = n_bytes / sizeof (gint16);
|
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
/* FIXME: need... liboil... */
|
2005-08-01 16:20:33 +00:00
|
|
|
/* only clamp if the gain is greater than 1.0 */
|
2005-08-20 18:07:10 +00:00
|
|
|
if (this->real_vol_i > VOLUME_UNITY_INT) {
|
2005-08-01 16:20:33 +00:00
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
|
|
|
*data++ =
|
2005-08-20 18:07:10 +00:00
|
|
|
(gint16) CLAMP ((this->real_vol_i *
|
2005-08-01 16:20:33 +00:00
|
|
|
val) >> VOLUME_UNITY_BIT_SHIFT, VOLUME_MIN_INT16,
|
|
|
|
VOLUME_MAX_INT16);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < num_samples; i++) {
|
|
|
|
/* we use bitshifting instead of dividing by UNITY_INT for speed */
|
|
|
|
val = (gint) * data;
|
2005-08-20 18:07:10 +00:00
|
|
|
*data++ = (gint16) ((this->real_vol_i * val) >> VOLUME_UNITY_BIT_SHIFT);
|
2002-05-29 18:56:23 +00:00
|
|
|
}
|
2001-12-22 23:27:17 +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
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps)
|
|
|
|
{
|
|
|
|
GstVolume *this = GST_VOLUME (base);
|
|
|
|
|
2005-08-20 20:40:25 +00:00
|
|
|
GST_DEBUG_OBJECT (this,
|
|
|
|
"set_caps: in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_funcfind (this, gst_caps_get_structure (incaps, 0));
|
|
|
|
|
|
|
|
if (!this->process) {
|
|
|
|
GST_ELEMENT_ERROR (this, CORE, NEGOTIATION,
|
|
|
|
("Invalid incoming caps: %" GST_PTR_FORMAT, incaps), NULL);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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
|
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
|
|
|
volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
|
2005-08-20 18:07:10 +00:00
|
|
|
{
|
|
|
|
GstVolume *this = GST_VOLUME (base);
|
|
|
|
|
2005-08-29 20:20:42 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf)))
|
2005-09-26 15:52:06 +00:00
|
|
|
gst_object_sync_values (G_OBJECT (this), GST_BUFFER_TIMESTAMP (outbuf));
|
2005-08-29 19:32:19 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
this->process (this, GST_BUFFER_TIMESTAMP (outbuf),
|
|
|
|
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2002-04-28 16:07:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
volume_update_mute (const GValue * value, gpointer data)
|
2002-04-28 16:07:41 +00:00
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = (GstVolume *) data;
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_if_fail (GST_IS_VOLUME (this));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
if (G_VALUE_HOLDS_BOOLEAN (value)) {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->mute = g_value_get_boolean (value);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else if (G_VALUE_HOLDS_INT (value)) {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->mute = (g_value_get_int (value) == 1);
|
2002-04-28 16:07:41 +00:00
|
|
|
}
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
if (this->mute) {
|
|
|
|
this->real_vol_f = 0.0;
|
|
|
|
this->real_vol_i = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->real_vol_f = this->volume_f;
|
|
|
|
this->real_vol_i = this->volume_i;
|
2002-04-28 16:07:41 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-22 23:27:17 +00:00
|
|
|
|
2002-04-28 16:07:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
volume_update_volume (const GValue * value, gpointer data)
|
2002-04-28 16:07:41 +00:00
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = (GstVolume *) data;
|
2002-04-28 16:07:41 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
g_return_if_fail (GST_IS_VOLUME (this));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-08-20 18:07:10 +00:00
|
|
|
this->volume_f = g_value_get_double (value);
|
|
|
|
this->volume_i = this->volume_f * VOLUME_UNITY_INT;
|
|
|
|
if (this->mute) {
|
|
|
|
this->real_vol_f = 0.0;
|
|
|
|
this->real_vol_i = 0;
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2005-08-20 18:07:10 +00:00
|
|
|
this->real_vol_f = this->volume_f;
|
|
|
|
this->real_vol_i = this->volume_i;
|
2002-04-28 16:07:41 +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
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = 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:
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_update_mute (value, this);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_VOLUME:
|
2005-08-20 18:07:10 +00:00
|
|
|
volume_update_volume (value, this);
|
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
|
|
|
{
|
2005-08-20 18:07:10 +00:00
|
|
|
GstVolume *this = 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:
|
2005-08-20 18:07:10 +00:00
|
|
|
g_value_set_boolean (value, this->mute);
|
2004-03-14 22:34:34 +00:00
|
|
|
break;
|
2005-05-09 21:37:17 +00:00
|
|
|
case PROP_VOLUME:
|
2005-08-20 18:07:10 +00:00
|
|
|
g_value_set_double (value, this->volume_f);
|
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
|
|
|
{
|
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",
|
|
|
|
"element for controlling audio volume",
|
2005-08-20 18:07:10 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|