[pulseaudio-commits] r1162 - in /trunk/src/pulsecore: sink-input.c sink-input.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Jul 28 16:27:18 PDT 2006
Author: lennart
Date: Sat Jul 29 01:27:16 2006
New Revision: 1162
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1162&root=pulseaudio&view=rev
Log:
fold the seperate variable pa_sink_input::playing into pa_sink_input::state as state PA_SINK_INPUT_DRAINED. The following mappings hold:
old PA_SINK_RUNNING + playing set = new PA_SINK_RUNNING
old PA_SINK_RUNNING + playing not set = new PA_SINK_DRAINED
Modified:
trunk/src/pulsecore/sink-input.c
trunk/src/pulsecore/sink-input.h
Modified: trunk/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink-input.c?rev=1162&root=pulseaudio&r1=1161&r2=1162&view=diff
==============================================================================
--- trunk/src/pulsecore/sink-input.c (original)
+++ trunk/src/pulsecore/sink-input.c Sat Jul 29 01:27:16 2006
@@ -94,7 +94,7 @@
i = pa_xnew(pa_sink_input, 1);
i->ref = 1;
- i->state = PA_SINK_INPUT_RUNNING;
+ i->state = PA_SINK_INPUT_DRAINED;
i->name = pa_xstrdup(name);
i->driver = pa_xstrdup(driver);
i->owner = NULL;
@@ -112,8 +112,6 @@
i->underrun = NULL;
i->userdata = NULL;
- i->playing = 0;
-
pa_memchunk_reset(&i->resampled_chunk);
i->resampler = resampler;
@@ -149,7 +147,6 @@
i->get_latency = NULL;
i->underrun = NULL;
- i->playing = 0;
i->state = PA_SINK_INPUT_DISCONNECTED;
}
@@ -225,6 +222,8 @@
if (!i->peek || !i->drop || i->state == PA_SINK_INPUT_CORKED)
goto finish;
+ assert(i->state == PA_SINK_INPUT_RUNNING || i->state == PA_SINK_INPUT_DRAINED);
+
if (!i->resampler) {
do_volume_adj_here = 0;
ret = i->peek(i, chunk);
@@ -270,10 +269,13 @@
finish:
- if (ret < 0 && i->playing && i->underrun)
+ if (ret < 0 && i->state == PA_SINK_INPUT_RUNNING && i->underrun)
i->underrun(i);
- i->playing = ret >= 0;
+ if (ret >= 0)
+ i->state = PA_SINK_INPUT_RUNNING;
+ else if (ret < 0 && i->state == PA_SINK_INPUT_RUNNING)
+ i->state = PA_SINK_INPUT_DRAINED;
if (ret >= 0) {
/* Let's see if we had to apply the volume adjustment
@@ -342,12 +344,14 @@
assert(i);
assert(i->ref >= 1);
- if (i->state == PA_SINK_INPUT_DISCONNECTED)
- return;
+ assert(i->state != PA_SINK_INPUT_DISCONNECTED);
n = i->state == PA_SINK_INPUT_CORKED && !b;
-
- i->state = b ? PA_SINK_INPUT_CORKED : PA_SINK_INPUT_RUNNING;
+
+ if (b)
+ i->state = PA_SINK_INPUT_CORKED;
+ else if (i->state == PA_SINK_INPUT_CORKED)
+ i->state = PA_SINK_INPUT_DRAINED;
if (n)
pa_sink_notify(i->sink);
Modified: trunk/src/pulsecore/sink-input.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink-input.h?rev=1162&root=pulseaudio&r1=1161&r2=1162&view=diff
==============================================================================
--- trunk/src/pulsecore/sink-input.h (original)
+++ trunk/src/pulsecore/sink-input.h Sat Jul 29 01:27:16 2006
@@ -34,9 +34,10 @@
#include <pulsecore/client.h>
typedef enum pa_sink_input_state {
- PA_SINK_INPUT_RUNNING,
- PA_SINK_INPUT_CORKED,
- PA_SINK_INPUT_DISCONNECTED
+ PA_SINK_INPUT_RUNNING, /*< The stream is alive and kicking */
+ PA_SINK_INPUT_DRAINED, /*< The stream stopped playing because there was no data to play */
+ PA_SINK_INPUT_CORKED, /*< The stream was corked on user request */
+ PA_SINK_INPUT_DISCONNECTED /*< The stream is dead */
} pa_sink_input_state_t;
struct pa_sink_input {
@@ -62,8 +63,6 @@
void (*underrun) (pa_sink_input *i);
void *userdata;
-
- int playing;
pa_memchunk resampled_chunk;
pa_resampler *resampler;
More information about the pulseaudio-commits
mailing list