mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
0037635bf2
newer pulseaudio. Fixes: #567794 * Hook pulsesink's volume property up with the stream volume -- not the sink volume in PA. * Read the device description directly from the sink instead of going via the mixer. * Properly implement _reset() methods for both sink and source to avoid deadlocks when shutting down a pipeline. * Replace all simple pa_threaded_mainloop_wait() by proper loops to guarantee that we wait for the right event in case multiple events are fired. While this is not strictly necessary in many cases it certainly is more correct and makes me sleep better at night. * Replace CHECK_DEAD_GOTO macros with proper functions * Extend the number of supported channels to 32 since that is the actual limit in PA. * Get rid of _dispose() methods since we don't need them. * Increase the volume property upper limit of the sink to 1000. * Reset function pointers after we disconnect a stream/context. Better fix for bug 556986. * Reset the state of the element properly if open/prepare fails * Cork the PA stream when the pipeline is paused. This allows the PA * daemon to close audio device on pause and thus save a bit of power. * Set PA stream properties based on GST tags such as GST_TAG_TITLE, GST_TAG_ARTIST, and so on. Signed-off-by: Lennart Poettering <lennart@poettering.net>
122 lines
6.1 KiB
C
122 lines
6.1 KiB
C
/*
|
|
* 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_PULSEPROBE_H__
|
|
#define __GST_PULSEPROBE_H__
|
|
|
|
#include <gst/gst.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#include <gst/interfaces/propertyprobe.h>
|
|
#include <pulse/pulseaudio.h>
|
|
#include <pulse/thread-mainloop.h>
|
|
|
|
typedef struct _GstPulseProbe GstPulseProbe;
|
|
|
|
struct _GstPulseProbe
|
|
{
|
|
GObject *object;
|
|
gchar *server;
|
|
GList *devices;
|
|
gboolean devices_valid;
|
|
|
|
pa_threaded_mainloop *mainloop;
|
|
pa_context *context;
|
|
|
|
GList *properties;
|
|
guint prop_id;
|
|
|
|
int enumerate_sinks, enumerate_sources;
|
|
int operation_success;
|
|
};
|
|
|
|
GstPulseProbe *gst_pulseprobe_new (GObject *object, GObjectClass * klass,
|
|
guint prop_id, const gchar * server, gboolean sinks, gboolean sources);
|
|
void gst_pulseprobe_free (GstPulseProbe * probe);
|
|
|
|
const GList *gst_pulseprobe_get_properties (GstPulseProbe * probe);
|
|
|
|
gboolean gst_pulseprobe_needs_probe (GstPulseProbe * probe, guint prop_id,
|
|
const GParamSpec * pspec);
|
|
void gst_pulseprobe_probe_property (GstPulseProbe * probe, guint prop_id,
|
|
const GParamSpec * pspec);
|
|
GValueArray *gst_pulseprobe_get_values (GstPulseProbe * probe, guint prop_id,
|
|
const GParamSpec * pspec);
|
|
|
|
void gst_pulseprobe_set_server (GstPulseProbe * c, const gchar * server);
|
|
|
|
#define GST_IMPLEMENT_PULSEPROBE_METHODS(Type, interface_as_function) \
|
|
static const GList* \
|
|
interface_as_function ## _get_properties(GstPropertyProbe * probe) \
|
|
{ \
|
|
Type *this = (Type*) probe; \
|
|
\
|
|
g_return_val_if_fail(this != NULL, NULL); \
|
|
g_return_val_if_fail(this->probe != NULL, NULL); \
|
|
\
|
|
return gst_pulseprobe_get_properties(this->probe); \
|
|
} \
|
|
static gboolean \
|
|
interface_as_function ## _needs_probe(GstPropertyProbe *probe, guint prop_id, \
|
|
const GParamSpec *pspec) \
|
|
{ \
|
|
Type *this = (Type*) probe; \
|
|
\
|
|
g_return_val_if_fail(this != NULL, FALSE); \
|
|
g_return_val_if_fail(this->probe != NULL, FALSE); \
|
|
\
|
|
return gst_pulseprobe_needs_probe(this->probe, prop_id, pspec); \
|
|
} \
|
|
static void \
|
|
interface_as_function ## _probe_property(GstPropertyProbe *probe, \
|
|
guint prop_id, const GParamSpec *pspec) \
|
|
{ \
|
|
Type *this = (Type*) probe; \
|
|
\
|
|
g_return_if_fail(this != NULL); \
|
|
g_return_if_fail(this->probe != NULL); \
|
|
\
|
|
gst_pulseprobe_probe_property(this->probe, prop_id, pspec); \
|
|
} \
|
|
static GValueArray* \
|
|
interface_as_function ## _get_values(GstPropertyProbe *probe, guint prop_id, \
|
|
const GParamSpec *pspec) \
|
|
{ \
|
|
Type *this = (Type*) probe; \
|
|
\
|
|
g_return_val_if_fail(this != NULL, NULL); \
|
|
g_return_val_if_fail(this->probe != NULL, NULL); \
|
|
\
|
|
return gst_pulseprobe_get_values(this->probe, prop_id, pspec); \
|
|
} \
|
|
static void \
|
|
interface_as_function ## _property_probe_interface_init(GstPropertyProbeInterface *iface)\
|
|
{ \
|
|
iface->get_properties = interface_as_function ## _get_properties; \
|
|
iface->needs_probe = interface_as_function ## _needs_probe; \
|
|
iface->probe_property = interface_as_function ## _probe_property; \
|
|
iface->get_values = interface_as_function ## _get_values; \
|
|
}
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|