Commit d99eb6d2 authored by Sebastian Dröge's avatar Sebastian Dröge

Update everything for the removal of the interface library and mixer/tuner interfaces

parent 71fc2584
......@@ -79,7 +79,6 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/taglib/gstid3v2mux.h \
$(top_srcdir)/ext/pulse/pulsesink.h \
$(top_srcdir)/ext/pulse/pulsesrc.h \
$(top_srcdir)/ext/pulse/pulsemixer.h \
$(top_srcdir)/ext/speex/gstspeexenc.h \
$(top_srcdir)/ext/speex/gstspeexdec.h \
$(top_srcdir)/ext/wavpack/gstwavpackdec.h \
......
......@@ -2,9 +2,6 @@ plugin_LTLIBRARIES = libgstpulse.la
libgstpulse_la_SOURCES = \
plugin.c \
pulsemixer.c \
pulsemixerctrl.c \
pulsemixertrack.c \
pulseprobe.c \
pulsesink.c \
pulsesrc.c \
......@@ -12,15 +9,12 @@ libgstpulse_la_SOURCES = \
libgstpulse_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(PULSE_CFLAGS)
libgstpulse_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
-lgstinterfaces-$(GST_API_VERSION) -lgstpbutils-$(GST_API_VERSION) \
-lgstpbutils-$(GST_API_VERSION) \
$(GST_BASE_LIBS) $(GST_LIBS) $(PULSE_LIBS)
libgstpulse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstpulse_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
pulsemixerctrl.h \
pulsemixer.h \
pulsemixertrack.h \
pulseprobe.h \
pulsesink.h \
pulsesrc.h \
......
......@@ -27,7 +27,6 @@
#include "pulsesink.h"
#include "pulsesrc.h"
#include "pulsemixer.h"
GST_DEBUG_CATEGORY (pulse_debug);
......@@ -49,10 +48,6 @@ plugin_init (GstPlugin * plugin)
GST_TYPE_PULSESRC))
return FALSE;
if (!gst_element_register (plugin, "pulsemixer", GST_RANK_NONE,
GST_TYPE_PULSEMIXER))
return FALSE;
GST_DEBUG_CATEGORY_INIT (pulse_debug, "pulse", 0, "PulseAudio elements");
return TRUE;
}
......
/*
* GStreamer pulseaudio plugin
*
* Copyright (c) 2004-2008 Lennart Poettering
*
* gst-pulse is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* gst-pulse 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with gst-pulse; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
/**
* SECTION:element-pulsemixer
* @see_also: pulsesrc, pulsesink
*
* This element lets you adjust sound input and output levels for the
* PulseAudio sound server. It supports the GstMixer interface, which can be
* used to obtain a list of available mixer tracks. Set the mixer element to
* READY state before using the GstMixer interface on it.
*
* <refsect2>
* <title>Example pipelines</title>
* <para>
* pulsemixer can't be used in a sensible way in gst-launch.
* </para>
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdio.h>
#include "pulsemixer.h"
enum
{
PROP_SERVER = 1,
PROP_DEVICE,
PROP_DEVICE_NAME
};
GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
#define GST_CAT_DEFAULT pulse_debug
static void gst_pulsemixer_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_pulsemixer_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_pulsemixer_finalize (GObject * object);
static GstStateChangeReturn gst_pulsemixer_change_state (GstElement * element,
GstStateChange transition);
GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS (GstPulseMixer, gst_pulsemixer);
#define gst_pulsemixer_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstPulseMixer, gst_pulsemixer, GST_TYPE_ELEMENT,
G_IMPLEMENT_INTERFACE (GST_TYPE_MIXER,
gst_pulsemixer_mixer_interface_init));
static void
gst_pulsemixer_class_init (GstPulseMixerClass * g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_pulsemixer_change_state);
gobject_class->finalize = gst_pulsemixer_finalize;
gobject_class->get_property = gst_pulsemixer_get_property;
gobject_class->set_property = gst_pulsemixer_set_property;
g_object_class_install_property (gobject_class,
PROP_SERVER,
g_param_spec_string ("server", "Server",
"The PulseAudio server to connect to", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DEVICE,
g_param_spec_string ("device", "Device",
"The PulseAudio sink or source to control", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DEVICE_NAME,
g_param_spec_string ("device-name", "Device name",
"Human-readable name of the sound device", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (g_class),
"PulseAudio Mixer",
"Generic/Audio",
"Control sound input and output levels for PulseAudio",
"Lennart Poettering");
}
static void
gst_pulsemixer_init (GstPulseMixer * this)
{
this->mixer = NULL;
this->server = NULL;
this->device = NULL;
this->probe =
gst_pulseprobe_new (G_OBJECT (this), G_OBJECT_GET_CLASS (this),
PROP_DEVICE, this->device, TRUE, TRUE);
}
static void
gst_pulsemixer_finalize (GObject * object)
{
GstPulseMixer *this = GST_PULSEMIXER (object);
g_free (this->server);
g_free (this->device);
if (this->mixer) {
gst_pulsemixer_ctrl_free (this->mixer);
this->mixer = NULL;
}
if (this->probe) {
gst_pulseprobe_free (this->probe);
this->probe = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_pulsemixer_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstPulseMixer *this = GST_PULSEMIXER (object);
switch (prop_id) {
case PROP_SERVER:
g_free (this->server);
this->server = g_value_dup_string (value);
if (this->probe)
gst_pulseprobe_set_server (this->probe, this->server);
break;
case PROP_DEVICE:
g_free (this->device);
this->device = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_pulsemixer_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstPulseMixer *this = GST_PULSEMIXER (object);
switch (prop_id) {
case PROP_SERVER:
g_value_set_string (value, this->server);
break;
case PROP_DEVICE:
g_value_set_string (value, this->device);
break;
case PROP_DEVICE_NAME:
if (this->mixer) {
char *t = g_strdup_printf ("%s: %s",
this->mixer->type == GST_PULSEMIXER_SINK ? "Playback" : "Capture",
this->mixer->description);
g_value_take_string (value, t);
} else
g_value_set_string (value, NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GstStateChangeReturn
gst_pulsemixer_change_state (GstElement * element, GstStateChange transition)
{
GstPulseMixer *this = GST_PULSEMIXER (element);
GstStateChangeReturn res;
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!this->mixer)
this->mixer =
gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server,
this->device, GST_PULSEMIXER_UNKNOWN);
break;
default:
;
}
res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) {
gst_pulsemixer_ctrl_free (this->mixer);
this->mixer = NULL;
}
break;
default:
;
}
return res;
}
/*
* GStreamer pulseaudio plugin
*
* Copyright (c) 2004-2008 Lennart Poettering
*
* gst-pulse is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* gst-pulse 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with gst-pulse; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifndef __GST_PULSEMIXER_H__
#define __GST_PULSEMIXER_H__
#include <gst/gst.h>
#include <pulse/pulseaudio.h>
#include <pulse/thread-mainloop.h>
#include "pulsemixerctrl.h"
#include "pulseprobe.h"
G_BEGIN_DECLS
#define GST_TYPE_PULSEMIXER \
(gst_pulsemixer_get_type())
#define GST_PULSEMIXER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PULSEMIXER,GstPulseMixer))
#define GST_PULSEMIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PULSEMIXER,GstPulseMixerClass))
#define GST_IS_PULSEMIXER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PULSEMIXER))
#define GST_IS_PULSEMIXER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSEMIXER))
typedef struct _GstPulseMixer GstPulseMixer;
typedef struct _GstPulseMixerClass GstPulseMixerClass;
struct _GstPulseMixer
{
GstElement parent;
gchar *server, *device;
GstPulseMixerCtrl *mixer;
GstPulseProbe *probe;
};
struct _GstPulseMixerClass
{
GstElementClass parent_class;
};
GType gst_pulsemixer_get_type (void);
G_END_DECLS
#endif /* __GST_PULSEMIXER_H__ */
This diff is collapsed.
/*-*- Mode: C; c-basic-offset: 2 -*-*/
/*
* GStreamer pulseaudio plugin
*
* Copyright (c) 2004-2008 Lennart Poettering
*
* gst-pulse is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* gst-pulse 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with gst-pulse; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifndef __GST_PULSEMIXERCTRL_H__
#define __GST_PULSEMIXERCTRL_H__
#include <gst/gst.h>
#include <gst/audio/mixer.h>
#include <pulse/pulseaudio.h>
#include <pulse/thread-mainloop.h>
G_BEGIN_DECLS
#define GST_PULSEMIXER_CTRL(obj) ((GstPulseMixerCtrl*)(obj))
typedef struct _GstPulseMixerCtrl GstPulseMixerCtrl;
typedef enum
{
GST_PULSEMIXER_UNKNOWN,
GST_PULSEMIXER_SINK,
GST_PULSEMIXER_SOURCE
} GstPulseMixerType;
struct _GstPulseMixerCtrl
{
GObject *object;
GList *tracklist;
gchar *server, *device;
pa_threaded_mainloop *mainloop;
pa_context *context;
gchar *name, *description;
pa_channel_map channel_map;
pa_cvolume volume;
gboolean muted:1;
gboolean update_volume:1;
gboolean update_mute:1;
gboolean operation_success:1;
guint32 index;
GstPulseMixerType type;
GstMixerTrack *track;
pa_time_event *time_event;
int outstandig_queries;
int ignore_queries;
};
GstPulseMixerCtrl *gst_pulsemixer_ctrl_new (GObject *object, const gchar * server,
const gchar * device, GstPulseMixerType type);
void gst_pulsemixer_ctrl_free (GstPulseMixerCtrl * mixer);
const GList *gst_pulsemixer_ctrl_list_tracks (GstPulseMixerCtrl * mixer);
void gst_pulsemixer_ctrl_set_volume (GstPulseMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes);
void gst_pulsemixer_ctrl_get_volume (GstPulseMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes);
void gst_pulsemixer_ctrl_set_mute (GstPulseMixerCtrl * mixer,
GstMixerTrack * track, gboolean mute);
void gst_pulsemixer_ctrl_set_record (GstPulseMixerCtrl * mixer,
GstMixerTrack * track, gboolean record);
GstMixerFlags gst_pulsemixer_ctrl_get_mixer_flags (GstPulseMixerCtrl * mixer);
#define GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS(Type, interface_as_function) \
static const GList* \
interface_as_function ## _list_tracks (GstMixer * mixer) \
{ \
Type *this = (Type*) mixer; \
\
g_return_val_if_fail (this != NULL, NULL); \
g_return_val_if_fail (this->mixer != NULL, NULL); \
\
return gst_pulsemixer_ctrl_list_tracks (this->mixer); \
} \
static void \
interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \
gint * volumes) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_pulsemixer_ctrl_set_volume (this->mixer, track, volumes); \
} \
static void \
interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
gint * volumes) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_pulsemixer_ctrl_get_volume (this->mixer, track, volumes); \
} \
static void \
interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
gboolean record) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_pulsemixer_ctrl_set_record (this->mixer, track, record); \
} \
static void \
interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
gboolean mute) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_pulsemixer_ctrl_set_mute (this->mixer, track, mute); \
} \
static GstMixerFlags \
interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
{ \
Type *this = (Type*) mixer; \
\
g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
\
return gst_pulsemixer_ctrl_get_mixer_flags (this->mixer); \
} \
static GstMixerType \
interface_as_function ## _get_mixer_type (GstMixer * mixer) \
{ \
return GST_MIXER_HARDWARE; \
} \
static void \
interface_as_function ## _mixer_interface_init (GstMixerInterface * iface) \
{ \
iface->list_tracks = interface_as_function ## _list_tracks; \
iface->set_volume = interface_as_function ## _set_volume; \
iface->get_volume = interface_as_function ## _get_volume; \
iface->set_mute = interface_as_function ## _set_mute; \
iface->set_record = interface_as_function ## _set_record; \
iface->get_mixer_flags = interface_as_function ## _get_mixer_flags; \
iface->get_mixer_type = interface_as_function ## _get_mixer_type; \
}
G_END_DECLS
#endif
/*
* GStreamer pulseaudio plugin
*
* Copyright (c) 2004-2008 Lennart Poettering
*
* gst-pulse is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* gst-pulse 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with gst-pulse; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include "pulsemixertrack.h"
GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
#define GST_CAT_DEFAULT pulse_debug
G_DEFINE_TYPE (GstPulseMixerTrack, gst_pulsemixer_track, GST_TYPE_MIXER_TRACK);
static void
gst_pulsemixer_track_class_init (GstPulseMixerTrackClass * klass)
{
}
static void
gst_pulsemixer_track_init (GstPulseMixerTrack * track)
{
track->control = NULL;
}
GstMixerTrack *
gst_pulsemixer_track_new (GstPulseMixerCtrl * control)
{
GstPulseMixerTrack *pulsetrack;
GstMixerTrack *track;
pulsetrack = g_object_new (GST_TYPE_PULSEMIXER_TRACK, NULL);
pulsetrack->control = control;
track = GST_MIXER_TRACK (pulsetrack);
track->label = g_strdup ("Master");
track->num_channels = control->channel_map.channels;
track->flags =
(control->type ==
GST_PULSEMIXER_SINK ? GST_MIXER_TRACK_OUTPUT | GST_MIXER_TRACK_MASTER :
GST_MIXER_TRACK_INPUT | GST_MIXER_TRACK_RECORD) | (control->muted ?
GST_MIXER_TRACK_MUTE : 0);
track->min_volume = PA_VOLUME_MUTED;
track->max_volume = PA_VOLUME_NORM;
return track;
}
/*
* GStreamer pulseaudio plugin
*
* Copyright (c) 2004-2008 Lennart Poettering
*
* gst-pulse is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* gst-pulse 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with gst-pulse; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifndef __GST_PULSEMIXERTRACK_H__
#define __GST_PULSEMIXERTRACK_H__
#include <gst/gst.h>
#include "pulsemixerctrl.h"
G_BEGIN_DECLS
#define GST_TYPE_PULSEMIXER_TRACK \
(gst_pulsemixer_track_get_type())
#define GST_PULSEMIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PULSEMIXER_TRACK, GstPulseMixerTrack))
#define GST_PULSEMIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PULSEMIXER_TRACK, GstPulseMixerTrackClass))
#define GST_IS_PULSEMIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PULSEMIXER_TRACK))
#define GST_IS_PULSEMIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PULSEMIXER_TRACK))
typedef struct _GstPulseMixerTrack
{
GstMixerTrack parent;
GstPulseMixerCtrl *control;
} GstPulseMixerTrack;
typedef struct _GstPulseMixerTrackClass
{
GstMixerTrackClass parent;
} GstPulseMixerTrackClass;
GType gst_pulsemixer_track_get_type (void);
GstMixerTrack *gst_pulsemixer_track_new (GstPulseMixerCtrl * control);
G_END_DECLS
#endif
......@@ -23,7 +23,7 @@
/**
* SECTION:element-pulsesink
* @see_also: pulsesrc, pulsemixer
* @see_also: pulsesrc
*
* This element outputs audio to a
* <ulink href="http://www.pulseaudio.org">PulseAudio sound server</ulink>.
......
......@@ -21,7 +21,7 @@
/**
* SECTION:element-pulsesrc
* @see_also: pulsesink, pulsemixer
* @see_also: pulsesink
*
* This element captures audio from a
* <ulink href="http://www.pulseaudio.org">PulseAudio sound server</ulink>.
......@@ -47,7 +47,6 @@
#include "pulsesrc.h"
#include "pulseutil.h"
#include "pulsemixerctrl.h"
GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
#define GST_CAT_DEFAULT pulse_debug
......@@ -127,11 +126,8 @@ static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("src",
);
GST_IMPLEMENT_PULSEMIXER_CTRL_METHODS (GstPulseSrc, gst_pulsesrc);
#define gst_pulsesrc_parent_class parent_class</