summaryrefslogtreecommitdiffstats
path: root/src/polypmixerctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/polypmixerctrl.c')
-rw-r--r--src/polypmixerctrl.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/polypmixerctrl.c b/src/polypmixerctrl.c
index a219bd9..4786004 100644
--- a/src/polypmixerctrl.c
+++ b/src/polypmixerctrl.c
@@ -1,20 +1,20 @@
/* $Id$ */
/***
- This file is part of gst-polyp.
+ This file is part of gst-pulse.
- gst-polyp is free software; you can redistribute it and/or modify
+ 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-polyp is distributed in the hope that it will be useful, but
+ 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-polyp; if not, write to the Free Software
+ License along with gst-pulse; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
@@ -25,15 +25,15 @@
#include <gst/gst.h>
-#include "polypmixerctrl.h"
-#include "polypmixertrack.h"
-#include "polyputil.h"
+#include "pulsemixerctrl.h"
+#include "pulsemixertrack.h"
+#include "pulseutil.h"
-GST_DEBUG_CATEGORY_EXTERN(polyp_debug);
-#define GST_CAT_DEFAULT polyp_debug
+GST_DEBUG_CATEGORY_EXTERN(pulse_debug);
+#define GST_CAT_DEFAULT pulse_debug
-static void gst_polypmixer_ctrl_context_state_cb(pa_context *context, void *userdata) {
- GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata);
+static void gst_pulsemixer_ctrl_context_state_cb(pa_context *context, void *userdata) {
+ GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata);
/* Called from the background thread! */
@@ -52,7 +52,7 @@ static void gst_polypmixer_ctrl_context_state_cb(pa_context *context, void *user
}
}
-static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) {
+static void gst_pulsemixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_info *i, int eol, void *userdata) {
GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata;
/* Called from the background thread! */
@@ -74,7 +74,7 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
c->channel_map = i->channel_map;
c->volume = i->volume;
c->muted = i->mute;
- c->type = GST_POLYPMIXER_SINK;
+ c->type = GST_PULSEMIXER_SINK;
if (c->track)
@@ -84,7 +84,7 @@ static void gst_polypmixer_ctrl_sink_info_cb(pa_context *context, const pa_sink_
pa_threaded_mainloop_signal(c->mainloop, 0);
}
-static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) {
+static void gst_pulsemixer_ctrl_source_info_cb(pa_context *context, const pa_source_info *i, int eol, void *userdata) {
GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata;
/* Called from the background thread! */
@@ -106,7 +106,7 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou
c->channel_map = i->channel_map;
c->volume = i->volume;
c->muted = i->mute;
- c->type = GST_POLYPMIXER_SOURCE;
+ c->type = GST_PULSEMIXER_SOURCE;
if (c->track)
c->track->flags = (c->track->flags & ~GST_MIXER_TRACK_MUTE) | (c->muted ? GST_MIXER_TRACK_MUTE : 0);
@@ -115,8 +115,8 @@ static void gst_polypmixer_ctrl_source_info_cb(pa_context *context, const pa_sou
pa_threaded_mainloop_signal(c->mainloop, 0);
}
-static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
- GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata);
+static void gst_pulsemixer_ctrl_subscribe_cb(pa_context *context, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
+ GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata);
pa_operation *o = NULL;
/* Called from the background thread! */
@@ -127,10 +127,10 @@ static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_CHANGE)
return;
- if (c->type == GST_POLYPMIXER_SINK)
- o = pa_context_get_sink_info_by_index(c->context, c->index, gst_polypmixer_ctrl_sink_info_cb, c);
+ if (c->type == GST_PULSEMIXER_SINK)
+ o = pa_context_get_sink_info_by_index(c->context, c->index, gst_pulsemixer_ctrl_sink_info_cb, c);
else
- o = pa_context_get_source_info_by_index(c->context, c->index, gst_polypmixer_ctrl_source_info_cb, c);
+ o = pa_context_get_source_info_by_index(c->context, c->index, gst_pulsemixer_ctrl_source_info_cb, c);
if (!o) {
GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context)));
@@ -140,7 +140,7 @@ static void gst_polypmixer_ctrl_subscribe_cb(pa_context *context, pa_subscriptio
pa_operation_unref(o);
}
-static void gst_polypmixer_ctrl_success_cb(pa_context *context, int success, void *userdata) {
+static void gst_pulsemixer_ctrl_success_cb(pa_context *context, int success, void *userdata) {
GstPolypMixerCtrl *c = (GstPolypMixerCtrl*) userdata;
c->operation_success = success;
@@ -154,9 +154,9 @@ if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \
} \
} while(0);
-static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
+static gboolean gst_pulsemixer_ctrl_open(GstPolypMixerCtrl *c) {
int e;
- gchar *name = gst_polyp_client_name();
+ gchar *name = gst_pulse_client_name();
pa_operation *o = NULL;
g_assert(c);
@@ -174,8 +174,8 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
goto unlock_and_fail;
}
- pa_context_set_state_callback(c->context, gst_polypmixer_ctrl_context_state_cb, c);
- pa_context_set_subscribe_callback(c->context, gst_polypmixer_ctrl_subscribe_cb, c);
+ pa_context_set_state_callback(c->context, gst_pulsemixer_ctrl_context_state_cb, c);
+ pa_context_set_subscribe_callback(c->context, gst_pulsemixer_ctrl_subscribe_cb, c);
if (pa_context_connect(c->context, c->server, 0, NULL) < 0) {
GST_WARNING("Failed to connect context: %s", pa_strerror(pa_context_errno(c->context)));
@@ -192,7 +192,7 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
/* Subscribe to events */
- if (!(o = pa_context_subscribe(c->context, PA_SUBSCRIPTION_MASK_SINK|PA_SUBSCRIPTION_MASK_SOURCE, gst_polypmixer_ctrl_success_cb, c))) {
+ if (!(o = pa_context_subscribe(c->context, PA_SUBSCRIPTION_MASK_SINK|PA_SUBSCRIPTION_MASK_SOURCE, gst_pulsemixer_ctrl_success_cb, c))) {
GST_WARNING("Failed to subscribe to events: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
}
@@ -210,8 +210,8 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
/* Get sink info */
- if (c->type == GST_POLYPMIXER_UNKNOWN || c->type == GST_POLYPMIXER_SINK) {
- if (!(o = pa_context_get_sink_info_by_name(c->context, c->device, gst_polypmixer_ctrl_sink_info_cb, c))) {
+ if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SINK) {
+ if (!(o = pa_context_get_sink_info_by_name(c->context, c->device, gst_pulsemixer_ctrl_sink_info_cb, c))) {
GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
}
@@ -225,14 +225,14 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
pa_operation_unref(o);
o = NULL;
- if (!c->operation_success && (c->type == GST_POLYPMIXER_SINK || pa_context_errno(c->context) != PA_ERR_NOENTITY)) {
+ if (!c->operation_success && (c->type == GST_PULSEMIXER_SINK || pa_context_errno(c->context) != PA_ERR_NOENTITY)) {
GST_WARNING("Failed to get sink info: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
}
}
- if (c->type == GST_POLYPMIXER_UNKNOWN || c->type == GST_POLYPMIXER_SOURCE) {
- if (!(o = pa_context_get_source_info_by_name(c->context, c->device, gst_polypmixer_ctrl_source_info_cb, c))) {
+ if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SOURCE) {
+ if (!(o = pa_context_get_source_info_by_name(c->context, c->device, gst_pulsemixer_ctrl_source_info_cb, c))) {
GST_WARNING("Failed to get source info: %s", pa_strerror(pa_context_errno(c->context)));
goto unlock_and_fail;
}
@@ -252,9 +252,9 @@ static gboolean gst_polypmixer_ctrl_open(GstPolypMixerCtrl *c) {
}
}
- g_assert(c->type != GST_POLYPMIXER_UNKNOWN);
+ g_assert(c->type != GST_PULSEMIXER_UNKNOWN);
- c->track = gst_polypmixer_track_new(c);
+ c->track = gst_pulsemixer_track_new(c);
c->tracklist = g_list_append(c->tracklist, c->track);
pa_threaded_mainloop_unlock(c->mainloop);
@@ -275,7 +275,7 @@ unlock_and_fail:
return FALSE;
}
-static void gst_polypmixer_ctrl_close(GstPolypMixerCtrl *c) {
+static void gst_pulsemixer_ctrl_close(GstPolypMixerCtrl *c) {
g_assert(c);
if (c->mainloop)
@@ -299,13 +299,13 @@ static void gst_polypmixer_ctrl_close(GstPolypMixerCtrl *c) {
}
if (c->track) {
- GST_POLYPMIXER_TRACK(c->track)->control = NULL;
+ GST_PULSEMIXER_TRACK(c->track)->control = NULL;
g_object_unref(c->track);
c->track = NULL;
}
}
-GstPolypMixerCtrl* gst_polypmixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type) {
+GstPolypMixerCtrl* gst_pulsemixer_ctrl_new(const gchar *server, const gchar *device, GstPolypMixerType type) {
GstPolypMixerCtrl *c = NULL;
c = g_new(GstPolypMixerCtrl, 1);
@@ -326,18 +326,18 @@ GstPolypMixerCtrl* gst_polypmixer_ctrl_new(const gchar *server, const gchar *dev
c->time_event = NULL;
- if (!(gst_polypmixer_ctrl_open(c))) {
- gst_polypmixer_ctrl_free(c);
+ if (!(gst_pulsemixer_ctrl_open(c))) {
+ gst_pulsemixer_ctrl_free(c);
return NULL;
}
return c;
}
-void gst_polypmixer_ctrl_free(GstPolypMixerCtrl *c) {
+void gst_pulsemixer_ctrl_free(GstPolypMixerCtrl *c) {
g_assert(c);
- gst_polypmixer_ctrl_close(c);
+ gst_pulsemixer_ctrl_close(c);
g_free(c->server);
g_free(c->device);
@@ -346,17 +346,17 @@ void gst_polypmixer_ctrl_free(GstPolypMixerCtrl *c) {
g_free(c);
}
-const GList* gst_polypmixer_ctrl_list_tracks(GstPolypMixerCtrl *c) {
+const GList* gst_pulsemixer_ctrl_list_tracks(GstPolypMixerCtrl *c) {
g_assert(c);
return c->tracklist;
}
-static void gst_polypmixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv, void *userdata) {
+static void gst_pulsemixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event *e, const struct timeval *tv, void *userdata) {
pa_operation *o;
- GstPolypMixerCtrl *c = GST_POLYPMIXER_CTRL(userdata);
+ GstPolypMixerCtrl *c = GST_PULSEMIXER_CTRL(userdata);
- if (c->type == GST_POLYPMIXER_SINK)
+ if (c->type == GST_PULSEMIXER_SINK)
o = pa_context_set_sink_volume_by_index(c->context, c->index, &c->volume, NULL, NULL);
else
o = pa_context_set_source_volume_by_index(c->context, c->index, &c->volume, NULL, NULL);
@@ -371,7 +371,7 @@ static void gst_polypmixer_ctrl_timeout_event(pa_mainloop_api *a, pa_time_event
c->time_event = NULL;
}
-void gst_polypmixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
+void gst_pulsemixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
pa_cvolume v;
int i;
@@ -393,13 +393,13 @@ void gst_polypmixer_ctrl_set_volume(GstPolypMixerCtrl *c, GstMixerTrack *track,
* to update the volume only once every 100ms */
struct timeval tv;
pa_mainloop_api *api = pa_threaded_mainloop_get_api(c->mainloop);
- c->time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), gst_polypmixer_ctrl_timeout_event, c);
+ c->time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), gst_pulsemixer_ctrl_timeout_event, c);
}
pa_threaded_mainloop_unlock(c->mainloop);
}
-void gst_polypmixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
+void gst_pulsemixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track, gint *volumes) {
int i;
g_assert(c);
@@ -413,12 +413,12 @@ void gst_polypmixer_ctrl_get_volume(GstPolypMixerCtrl *c, GstMixerTrack *track,
pa_threaded_mainloop_unlock(c->mainloop);
}
-void gst_polypmixer_ctrl_set_record(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean record) {
+void gst_pulsemixer_ctrl_set_record(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean record) {
g_assert(c);
g_assert(track == c->track);
}
-void gst_polypmixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean mute) {
+void gst_pulsemixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gboolean mute) {
pa_operation *o = NULL;
g_assert(c);
@@ -426,7 +426,7 @@ void gst_polypmixer_ctrl_set_mute(GstPolypMixerCtrl *c, GstMixerTrack *track, gb
pa_threaded_mainloop_lock(c->mainloop);
- if (c->type == GST_POLYPMIXER_SINK)
+ if (c->type == GST_PULSEMIXER_SINK)
o = pa_context_set_sink_mute_by_index(c->context, c->index, !!mute, NULL, NULL);
else
o = pa_context_set_source_mute_by_index(c->context, c->index, !!mute, NULL, NULL);