diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2004-05-29 14:45:25 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2004-05-29 14:45:25 +0000 |
commit | a74413f06efef91496b3f5b9f749b328ede19ac8 (patch) | |
tree | 4077995d8ad8c0fc3784d9c7d91a40e1b15e731c /src/xine-engine/audio_out.c | |
parent | cd2b6b26d53a8d879250cd28f0dfbb1cf2b04355 (diff) | |
download | xine-lib-a74413f06efef91496b3f5b9f749b328ede19ac8.tar.gz xine-lib-a74413f06efef91496b3f5b9f749b328ede19ac8.tar.bz2 |
separate the two semantics of querying a port's status with a NULL stream;
before, NULL could mean two things: no stream at all or a stream that does not
want to be addressed; now the latter is represented by the new XINE_ANON_STREAM
resulting changes:
* the status() functions now behave differently for NULL and XINE_ANON_STREAM
(as the commentary always implied, but this was not the case, so post
plugin rewiring went wrong, because it relies on the status() function)
* the NULL_STREAM defines in audio_out and video_out are obsolete
* update the function comments in the headers
* update the post plugin rewire functions to use the status() functions to
check, if the old port was opened and handle the new one accordingly;
this makes open_count obsolete
* change all post plugins accordingly (mostly using XINE_ANON_STREAM instead
of NULL)
additional change:
* the status() function of audio port now returns the bits/rate/mode values
of the input and not the output; this is more likely to be what a post plugin
wants
* the reimplementation of status() in the upmix plugin is obsolete
CVS patchset: 6603
CVS date: 2004/05/29 14:45:25
Diffstat (limited to 'src/xine-engine/audio_out.c')
-rw-r--r-- | src/xine-engine/audio_out.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index ea0a1642a..adf87b658 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.177 2004/05/21 13:41:02 tmattern Exp $ + * $Id: audio_out.c,v 1.178 2004/05/29 14:45:25 mroi Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -100,8 +100,6 @@ #define ZERO_BUF_SIZE 5000 -#define NULL_STREAM (xine_stream_t *)-1 - /* By adding gap errors (difference between reported and expected * sound card clock) into metronom's vpts_offset we can use its * smoothing algorithms to correct sound card clock drifts. @@ -1092,7 +1090,7 @@ static void *ao_loop (void *this_gen) { pthread_mutex_lock(&this->streams_lock); for (stream = xine_list_first_content(this->streams); stream; stream = xine_list_next_content(this->streams)) { - if (stream == NULL_STREAM) continue; + if (stream == XINE_ANON_STREAM) continue; stream->metronom->set_option(stream->metronom, METRONOM_ADJ_VPTS_OFFSET, -gap/SYNC_GAP_RATE ); last_sync_time = cur_time; @@ -1190,7 +1188,7 @@ int xine_get_next_audio_frame (xine_audio_port_t *this_gen, in_buf = this->out_fifo->first; if (!in_buf) { pthread_mutex_unlock(&this->out_fifo->mutex); - if (stream != NULL_STREAM && stream->audio_fifo->fifo_size == 0 && + if (stream != XINE_ANON_STREAM && stream->audio_fifo->fifo_size == 0 && stream->demux_plugin->get_status(stream->demux_plugin) !=DEMUX_OK) /* no further data can be expected here */ return 0; @@ -1370,7 +1368,6 @@ static int ao_open(xine_audio_port_t *this_gen, xine_stream_t *stream, stream->metronom->set_audio_rate(stream->metronom, this->audio_step); } - if (stream == NULL) stream = NULL_STREAM; pthread_mutex_lock(&this->streams_lock); xine_list_append_content(this->streams, stream); pthread_mutex_unlock(&this->streams_lock); @@ -1403,6 +1400,9 @@ static void ao_put_buffer (xine_audio_port_t *this_gen, return; } + /* handle anonymous streams like NULL for easy checking */ + if (stream == XINE_ANON_STREAM) stream = NULL; + buf->stream = stream; pts = buf->vpts; @@ -1438,7 +1438,6 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "ao_close\n"); /* unregister stream */ - if (stream == NULL) stream = NULL_STREAM; pthread_mutex_lock(&this->streams_lock); for (cur = xine_list_first_content(this->streams); cur; cur = xine_list_next_content(this->streams)) @@ -1808,7 +1807,7 @@ static int ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, *bits = this->input.bits; *rate = this->input.rate; *mode = this->input.mode; - ret = 1; + ret = !!stream; /* return false for a NULL stream, true otherwise */ break; } pthread_mutex_unlock(&this->streams_lock); |