summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_mpeg.c20
-rw-r--r--src/demuxers/demux_mpeg_block.c9
-rw-r--r--src/xine-engine/buffer.c30
-rw-r--r--src/xine-engine/metronom.c45
-rw-r--r--src/xine-engine/xine.c8
5 files changed, 93 insertions, 19 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 61aac2ca9..2061d8843 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg.c,v 1.22 2001/06/17 23:37:59 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.23 2001/07/03 21:25:03 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -63,6 +63,7 @@ typedef struct demux_mpeg_s {
int preview_mode;
int send_end_buffers;
+
} demux_mpeg_t ;
static uint32_t read_bytes (demux_mpeg_t *this, int n) {
@@ -77,7 +78,9 @@ static uint32_t read_bytes (demux_mpeg_t *this, int n) {
i = this->input->read (this->input, buf, n);
if (i != n) {
+
this->status = DEMUX_FINISHED;
+
xprintf (VERBOSE|DEMUX, "Unexpected end of stream\n");
}
@@ -512,9 +515,6 @@ static void *demux_mpeg_loop (void *this_gen) {
buf_element_t *buf;
uint32_t w;
- this->status = DEMUX_OK;
- this->send_end_buffers = 1;
-
do {
w = parse_pack (this);
@@ -551,6 +551,13 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
buf_element_t *buf;
+ printf ("demux_mpeg: stop...\n");
+
+ if (this->status != DEMUX_OK) {
+ printf ("demux_mpeg: stop...ignored\n");
+ return;
+ }
+
this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
@@ -571,6 +578,7 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
buf->decoder_info[0] = 1; /* forced */
this->audio_fifo->put (this->audio_fifo, buf);
}
+
}
static int demux_mpeg_get_status (demux_plugin_t *this_gen) {
@@ -629,6 +637,8 @@ static void demux_mpeg_start (demux_plugin_t *this_gen,
read_bytes(this, 4);
this->preview_mode = 0;
+ this->send_end_buffers = 1;
+ this->status = DEMUX_OK ;
pthread_create (&this->thread, NULL, demux_mpeg_loop, this) ;
}
@@ -764,7 +774,7 @@ demux_plugin_t *init_demuxer_plugin(int iface, config_values_t *config) {
this->demux_plugin.close = demux_mpeg_close;
this->demux_plugin.get_status = demux_mpeg_get_status;
this->demux_plugin.get_identifier = demux_mpeg_get_id;
-
+
return (demux_plugin_t *) this;
break;
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index a9e8e7dba..be362d0f0 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg_block.c,v 1.22 2001/07/01 23:50:19 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.23 2001/07/03 21:25:04 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -384,8 +384,11 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
void *p;
buf_element_t *buf;
- printf ("demux_mpeg_block: stop(...)\n");
-
+ if (this->status != DEMUX_OK) {
+ printf ("demux_mpeg_block: stop...ignored\n");
+ return;
+ }
+
this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c
index 6ad5d9f4d..a05660fb2 100644
--- a/src/xine-engine/buffer.c
+++ b/src/xine-engine/buffer.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.c,v 1.4 2001/05/24 15:31:31 guenter Exp $
+ * $Id: buffer.c,v 1.5 2001/07/03 21:25:04 guenter Exp $
*
*
* contents:
@@ -130,10 +130,35 @@ static buf_element_t *fifo_buffer_get (fifo_buffer_t *fifo) {
*/
static void fifo_buffer_clear (fifo_buffer_t *fifo) {
- buf_element_t *buf;
+ buf_element_t *buf, *next, *prev;
pthread_mutex_lock (&fifo->mutex);
+ buf = fifo->first;
+ prev = NULL;
+
+ while (buf != NULL) {
+
+ next = buf->next;
+
+ if ((buf->type & BUF_MAJOR_MASK) != BUF_CONTROL_BASE) {
+ /* remove this buffer */
+
+ if (prev)
+ prev->next = next;
+ else
+ fifo->first = next;
+
+ if (!next)
+ fifo->last = prev;
+
+ buf->free_buffer(buf);
+ } else
+ prev = buf;
+
+ buf = next;
+ }
+ /*
while (fifo->first != NULL) {
buf = fifo->first;
@@ -144,6 +169,7 @@ static void fifo_buffer_clear (fifo_buffer_t *fifo) {
buf->free_buffer(buf);
}
+ */
pthread_mutex_unlock (&fifo->mutex);
}
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index a1c8136d4..de24dad76 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: metronom.c,v 1.12 2001/06/30 22:53:50 guenter Exp $
+ * $Id: metronom.c,v 1.13 2001/07/03 21:25:04 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -132,7 +132,13 @@ static void metronom_video_stream_start (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("video stream start...\n");
+ printf ("metronom: video stream start...\n");
+
+ if (this->video_stream_running) {
+ printf ("metronom: video stream start ignored\n");
+ pthread_mutex_unlock (&this->lock);
+ return;
+ }
this->pts_per_frame = 3000;
@@ -151,7 +157,7 @@ static void metronom_video_stream_start (metronom_t *this) {
if (this->have_audio) {
while (!this->audio_stream_running) {
- printf ("waiting for audio to start...\n");
+ printf ("metronom: waiting for audio to start...\n");
pthread_cond_wait (&this->audio_started, &this->lock);
}
}
@@ -159,7 +165,7 @@ static void metronom_video_stream_start (metronom_t *this) {
pthread_mutex_unlock (&this->lock);
- printf ("video stream start...done\n");
+ printf ("metronom: video stream start...done\n");
metronom_start_clock (this, 0);
}
@@ -168,11 +174,20 @@ static void metronom_video_stream_start (metronom_t *this) {
static void metronom_video_stream_end (metronom_t *this) {
pthread_mutex_lock (&this->lock);
+
+ printf ("metronom: video stream end\n");
+
+ if (!this->video_stream_running) {
+ printf ("metronom: video stream end ignored\n");
+ pthread_mutex_unlock (&this->lock);
+ return;
+ }
+
this->video_stream_running = 0;
if (this->have_audio) {
while (this->audio_stream_running) {
- printf ("waiting for audio to end...\n");
+ printf ("metronom: waiting for audio to end...\n");
pthread_cond_wait (&this->audio_ended, &this->lock);
}
}
@@ -186,7 +201,13 @@ static void metronom_audio_stream_start (metronom_t *this) {
pthread_mutex_lock (&this->lock);
- printf ("audio stream start...\n");
+ printf ("metronom: audio stream start...\n");
+
+ if (this->audio_stream_running) {
+ printf ("metronom: audio stream start ignored\n");
+ pthread_mutex_unlock (&this->lock);
+ return;
+ }
this->audio_vpts = 0;
@@ -202,7 +223,7 @@ static void metronom_audio_stream_start (metronom_t *this) {
this->audio_stream_starting = 1;
while (!this->video_stream_running) {
- printf ("waiting for video to start...\n");
+ printf ("metronom: waiting for video to start...\n");
pthread_cond_wait (&this->video_started, &this->lock);
}
@@ -210,7 +231,7 @@ static void metronom_audio_stream_start (metronom_t *this) {
pthread_mutex_unlock (&this->lock);
- printf ("audio stream start...done\n");
+ printf ("metronom: audio stream start...done\n");
metronom_start_clock (this, 0);
}
@@ -218,6 +239,14 @@ static void metronom_audio_stream_start (metronom_t *this) {
static void metronom_audio_stream_end (metronom_t *this) {
pthread_mutex_lock (&this->lock);
+
+ printf ("metronom: audio stream end\n");
+ if (!this->audio_stream_running) {
+ printf ("metronom: audio stream end ignored\n");
+ pthread_mutex_unlock (&this->lock);
+ return;
+ }
+
this->audio_stream_running = 0;
while (this->video_stream_running) {
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 542958083..000401caa 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.30 2001/06/23 19:45:47 guenter Exp $
+ * $Id: xine.c,v 1.31 2001/07/03 21:25:04 guenter Exp $
*
* top-level xine functions
*
@@ -75,17 +75,21 @@ void xine_stop (xine_t *this) {
printf ("xine_stop\n");
if (this->status == XINE_STOP) {
+ printf ("xine_stop ignored\n");
pthread_mutex_unlock (&this->xine_lock);
return;
}
this->status = XINE_STOP;
+ printf ("xine_stop: stopping demuxer\n");
if(this->cur_demuxer_plugin) {
this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin);
this->cur_demuxer_plugin = NULL;
}
+ printf ("xine_stop: closing input\n");
+
if(this->cur_input_plugin) {
this->cur_input_plugin->close(this->cur_input_plugin);
this->cur_input_plugin = NULL;
@@ -93,6 +97,8 @@ void xine_stop (xine_t *this) {
this->spu_fifo->clear(this->spu_fifo);
+ printf ("xine_stop: done\n");
+
pthread_mutex_unlock (&this->xine_lock);
}