summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-06-22 15:14:47 +0200
committerLennart Poettering <lennart@poettering.net>2008-06-22 15:14:47 +0200
commit5f7a8dcc234492da883ab5226e9de2711a2e6cd4 (patch)
tree1f25a7ba213cdea5f46d63b4c7aeb2cba60cf999
parenta71fee173be8f2f6f4dea5b95697457a66bb27f2 (diff)
remove trailing whitespaceHEADmaster
-rw-r--r--src/plugin.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/src/plugin.c b/src/plugin.c
index c54163a..a076213 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -2,17 +2,17 @@
/***
This file is part of xmms-pulse.
-
+
xmms-pulse is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
xmms-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
General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with xmms-pulse; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -93,7 +93,7 @@ static const char* get_song_name(void) {
snprintf(t, sizeof(t), "%s", u = pa_locale_to_utf8(str));
pa_xfree(u);
-
+
return t;
}
@@ -109,7 +109,7 @@ static void info_cb(struct pa_context *c, const struct pa_sink_input_info *i, in
static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) {
pa_operation *o;
-
+
assert(c);
if (!stream ||
@@ -122,7 +122,7 @@ static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t
g_warning("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(c)));
return;
}
-
+
pa_operation_unref(o);
}
@@ -166,7 +166,7 @@ static void stream_success_cb(pa_stream *s, int success, void *userdata) {
if (userdata)
*(int*) userdata = success;
-
+
pa_threaded_mainloop_signal(mainloop, 0);
}
@@ -175,7 +175,7 @@ static void context_success_cb(pa_context *c, int success, void *userdata) {
if (userdata)
*(int*) userdata = success;
-
+
pa_threaded_mainloop_signal(mainloop, 0);
}
@@ -202,7 +202,7 @@ static void pulse_get_volume(int *l, int *r) {
if (connected) {
pa_threaded_mainloop_lock(mainloop);
CHECK_DEAD_GOTO(fail, 1);
-
+
v = volume;
b = volume_valid;
@@ -212,7 +212,7 @@ static void pulse_get_volume(int *l, int *r) {
v = volume;
b = volume_valid;
}
-
+
if (b) {
if (v.channels == 2) {
*l = (int) ((v.values[0]*100)/PA_VOLUME_NORM);
@@ -224,8 +224,8 @@ static void pulse_get_volume(int *l, int *r) {
static void volume_time_cb(pa_mainloop_api *api, pa_time_event *e, const struct timeval *tv, void *userdata) {
pa_operation *o;
-
- if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL)))
+
+ if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL)))
g_warning("pa_context_set_sink_input_volume() failed: %s", pa_strerror(pa_context_errno(context)));
else
pa_operation_unref(o);
@@ -282,7 +282,7 @@ static void pulse_pause(short b) {
g_warning("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
}
-
+
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
@@ -290,12 +290,12 @@ static void pulse_pause(short b) {
if (!success)
g_warning("pa_stream_cork() failed: %s", pa_strerror(pa_context_errno(context)));
-
+
fail:
if (o)
pa_operation_unref(o);
-
+
pa_threaded_mainloop_unlock(mainloop);
}
@@ -320,25 +320,25 @@ static int pulse_free(void) {
* between this means we should trigger the playback */
if (do_trigger) {
int success = 0;
-
+
if (!(o = pa_stream_trigger(stream, stream_success_cb, &success))) {
g_warning("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
}
-
+
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
}
-
+
if (!success)
g_warning("pa_stream_trigger() failed: %s", pa_strerror(pa_context_errno(context)));
}
-
+
fail:
if (o)
pa_operation_unref(o);
-
+
pa_threaded_mainloop_unlock(mainloop);
do_trigger = !!l;
@@ -347,14 +347,14 @@ fail:
static int pulse_get_written_time(void) {
int r = 0;
-
+
/* g_message("get_written_time"); */
CHECK_CONNECTED(0);
pa_threaded_mainloop_lock(mainloop);
CHECK_DEAD_GOTO(fail, 1);
-
+
r = (int) (((double) written*1000) / pa_bytes_per_second(pa_stream_get_sample_spec(stream)));
/* g_message("written_time = %i", r); */
@@ -368,7 +368,7 @@ fail:
static int pulse_get_output_time(void) {
int r = 0;
pa_usec_t t;
-
+
/* g_message("get_output_time"); */
CHECK_CONNECTED(0);
@@ -377,7 +377,7 @@ static int pulse_get_output_time(void) {
for (;;) {
CHECK_DEAD_GOTO(fail, 1);
-
+
if (pa_stream_get_time(stream, &t) >= 0)
break;
@@ -394,15 +394,15 @@ static int pulse_get_output_time(void) {
if (just_flushed) {
time_offset_msec -= r;
just_flushed = 0;
- }
+ }
r += time_offset_msec;
/* g_message("output_time = %i", r); */
-
+
fail:
pa_threaded_mainloop_unlock(mainloop);
-
+
return r;
}
@@ -411,7 +411,7 @@ static int pulse_playing(void) {
const pa_timing_info *i;
CHECK_CONNECTED(0);
-
+
/* g_message("playing"); */
pa_threaded_mainloop_lock(mainloop);
@@ -421,7 +421,7 @@ static int pulse_playing(void) {
if ((i = pa_stream_get_timing_info(stream)))
break;
-
+
if (pa_context_errno(context) != PA_ERR_NODATA) {
g_warning("pa_stream_get_timing_info() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
@@ -453,7 +453,7 @@ static void pulse_flush(int time) {
g_warning("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
}
-
+
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
@@ -461,22 +461,22 @@ static void pulse_flush(int time) {
if (!success)
g_warning("pa_stream_flush() failed: %s", pa_strerror(pa_context_errno(context)));
-
+
written = (uint64_t) (((double) time * pa_bytes_per_second(pa_stream_get_sample_spec(stream))) / 1000);
just_flushed = 1;
time_offset_msec = time;
-
+
fail:
if (o)
pa_operation_unref(o);
-
+
pa_threaded_mainloop_unlock(mainloop);
}
static void pulse_write(void* ptr, int length) {
/* g_message("write"); */
-
+
CHECK_CONNECTED();
pa_threaded_mainloop_lock(mainloop);
@@ -486,12 +486,12 @@ static void pulse_write(void* ptr, int length) {
g_warning("pa_stream_write() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
}
-
+
do_trigger = 0;
written += length;
fail:
-
+
pa_threaded_mainloop_unlock(mainloop);
}
@@ -508,7 +508,7 @@ static void drain(void) {
g_warning("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));
goto fail;
}
-
+
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
@@ -516,18 +516,18 @@ static void drain(void) {
if (!success)
g_warning("pa_stream_drain() failed: %s", pa_strerror(pa_context_errno(context)));
-
+
fail:
if (o)
pa_operation_unref(o);
-
+
pa_threaded_mainloop_unlock(mainloop);
}
static void pulse_close(void) {
/* g_message("close"); */
-
+
drain();
connected = 0;
@@ -546,7 +546,7 @@ static void pulse_close(void) {
pa_context_unref(context);
context = NULL;
}
-
+
if (mainloop) {
pa_threaded_mainloop_free(mainloop);
mainloop = NULL;
@@ -566,7 +566,7 @@ static int pulse_open(AFormat fmt, int rate, int nch) {
g_assert(!context);
g_assert(!stream);
g_assert(!connected);
-
+
if (fmt == FMT_U8)
ss.format = PA_SAMPLE_U8;
else if (fmt == FMT_S16_LE)
@@ -597,7 +597,7 @@ static int pulse_open(AFormat fmt, int rate, int nch) {
pa_threaded_mainloop_lock(mainloop);
-#ifdef HAVE_XMMS
+#ifdef HAVE_XMMS
if (!(context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "XMMS"))) {
#endif
@@ -656,7 +656,7 @@ static int pulse_open(AFormat fmt, int rate, int nch) {
g_warning("pa_context_subscribe() failed: %s", pa_strerror(pa_context_errno(context)));
goto unlock_and_fail;
}
-
+
success = 0;
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
@@ -675,7 +675,7 @@ static int pulse_open(AFormat fmt, int rate, int nch) {
g_warning("pa_context_get_sink_input_info() failed: %s", pa_strerror(pa_context_errno(context)));
goto unlock_and_fail;
}
-
+
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail, 1);
pa_threaded_mainloop_wait(mainloop);
@@ -692,22 +692,22 @@ static int pulse_open(AFormat fmt, int rate, int nch) {
just_flushed = 0;
connected = 1;
volume_time_event = NULL;
-
+
pa_threaded_mainloop_unlock(mainloop);
-
+
return TRUE;
unlock_and_fail:
if (o)
pa_operation_unref(o);
-
+
pa_threaded_mainloop_unlock(mainloop);
-
+
fail:
pulse_close();
-
+
return FALSE;
}
@@ -716,10 +716,10 @@ static void pulse_init(void) {
static void pulse_about(void) {
static GtkWidget *dialog;
-
+
if (dialog != NULL)
return;
-
+
#ifdef HAVE_XMMS
dialog = xmms_show_message(
"About XMMS PulseAudio Output Plugin",
@@ -767,7 +767,7 @@ static void pulse_about(void) {
NULL,
NULL);
#endif
-
+
gtk_signal_connect(
GTK_OBJECT(dialog),
"destroy",
@@ -781,20 +781,20 @@ OutputPlugin *get_oplugin_info(void) {
NULL,
NULL,
"PulseAudio Output Plugin",
- pulse_init,
+ pulse_init,
pulse_about,
NULL, /* pulse_configure, */
pulse_get_volume,
pulse_set_volume,
- pulse_open,
- pulse_write,
- pulse_close,
- pulse_flush,
- pulse_pause,
- pulse_free,
- pulse_playing,
- pulse_get_output_time,
- pulse_get_written_time,
+ pulse_open,
+ pulse_write,
+ pulse_close,
+ pulse_flush,
+ pulse_pause,
+ pulse_free,
+ pulse_playing,
+ pulse_get_output_time,
+ pulse_get_written_time,
};
return &pulse_plugin;