summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux.h11
-rw-r--r--src/demuxers/demux_avi.c38
-rw-r--r--src/demuxers/demux_elem.c52
-rw-r--r--src/demuxers/demux_mpeg.c36
-rw-r--r--src/demuxers/demux_mpeg_block.c72
-rw-r--r--src/demuxers/demux_mpgaudio.c37
-rw-r--r--src/xine-engine/audio_decoder.c17
-rw-r--r--src/xine-engine/video_decoder.c16
-rw-r--r--src/xine-engine/xine.c52
-rw-r--r--src/xine-engine/xine_internal.h19
10 files changed, 226 insertions, 124 deletions
diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h
index 8db15c542..247425ea7 100644
--- a/src/demuxers/demux.h
+++ b/src/demuxers/demux.h
@@ -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.h,v 1.4 2001/04/27 10:47:41 f1rmb Exp $
+ * $Id: demux.h,v 1.5 2001/06/16 18:03:22 guenter Exp $
*/
#ifndef HAVE_DEMUX_H
@@ -47,6 +47,12 @@
#define STAGE_BY_CONTENT 1
#define STAGE_BY_EXTENSION 2
+/* called when xine tries to branch seamlessly to the next mrl */
+typedef char* (*gui_get_next_mrl_cb_t) (void);
+
+/* called when xine branched successfully to the next mrl */
+typedef void (*gui_branched_cb_t) (void);
+
/*
* a demux plugin (no matter if it's staically built into xine
* or dynamically loaded at run-time) must implement these functions
@@ -80,7 +86,8 @@ struct demux_plugin_s
void (*start) (demux_plugin_t *this, fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo, fifo_buffer_t *spu_fifo,
- off_t pos) ;
+ off_t pos, gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb) ;
/*
* stop & kill demux thread, free resources associated with current
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 1c1bfe23d..30294f434 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.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_avi.c,v 1.18 2001/06/16 14:34:48 guenter Exp $
+ * $Id: demux_avi.c,v 1.19 2001/06/16 18:03:22 guenter Exp $
*
* demultiplexer for avi streams
*
@@ -117,6 +117,8 @@ typedef struct demux_avi_s {
uint32_t video_step;
uint32_t AVI_errno;
+
+ int send_end_buffers;
} demux_avi_t ;
#define AVI_ERR_SIZELIM 1 /* The write of the data would exceed
@@ -821,20 +823,26 @@ static void *demux_avi_loop (void *this_gen) {
buf_element_t *buf = NULL;
demux_avi_t *this = (demux_avi_t *) this_gen;
+ this->send_end_buffers = 1;
+
do {
if (!demux_avi_next(this))
this->status = DEMUX_FINISHED;
} while (this->status == DEMUX_OK) ;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- this->audio_fifo->put (this->audio_fifo, buf);
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
xprintf (VERBOSE|DEMUX, "demux_avi: demux loop finished.\n");
@@ -849,6 +857,7 @@ static void demux_avi_stop (demux_plugin_t *this_gen) {
demux_avi_t *this = (demux_avi_t *) this_gen;
buf_element_t *buf;
+ this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
pthread_join (this->thread, &p);
@@ -856,17 +865,18 @@ static void demux_avi_stop (demux_plugin_t *this_gen) {
AVI_close (this->avi);
this->avi = NULL;
-
this->video_fifo->clear(this->video_fifo);
this->audio_fifo->clear(this->audio_fifo);
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->video_fifo->put (this->video_fifo, buf);
if(this->audio_fifo) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->audio_fifo->put (this->audio_fifo, buf);
}
@@ -886,7 +896,9 @@ static void demux_avi_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
fifo_buffer_t *spu_fifo,
- off_t pos)
+ off_t pos,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb)
{
buf_element_t *buf;
demux_avi_t *this = (demux_avi_t *) this_gen;
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index e342b482c..5c2b58487 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.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_elem.c,v 1.9 2001/05/30 02:09:24 f1rmb Exp $
+ * $Id: demux_elem.c,v 1.10 2001/06/16 18:03:22 guenter Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -52,6 +52,8 @@ typedef struct {
int blocksize;
int status;
+
+ int send_end_buffers;
} demux_mpeg_elem_t ;
@@ -88,6 +90,8 @@ static void *demux_mpeg_elem_loop (void *this_gen) {
buf_element_t *buf = NULL;
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
+ this->send_end_buffers = 1;
+
do {
if (!demux_mpeg_elem_next(this))
@@ -99,14 +103,18 @@ static void *demux_mpeg_elem_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- this->audio_fifo->put (this->audio_fifo, buf);
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
pthread_exit(NULL);
@@ -116,12 +124,32 @@ static void *demux_mpeg_elem_loop (void *this_gen) {
*
*/
static void demux_mpeg_elem_stop (demux_plugin_t *this_gen) {
+
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
- void *p;
+ void *p;
+ buf_element_t *buf = NULL;
+
+ this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
pthread_join (this->thread, &p);
+
+ this->video_fifo->clear(this->video_fifo);
+ this->audio_fifo->clear(this->audio_fifo);
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
+
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
/*
@@ -140,7 +168,9 @@ static void demux_mpeg_elem_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
fifo_buffer_t *spu_fifo,
- off_t pos) {
+ off_t pos,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb) {
demux_mpeg_elem_t *this = (demux_mpeg_elem_t *) this_gen;
buf_element_t *buf;
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index ab2353431..b80c8f7ca 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.18 2001/06/16 14:34:48 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.19 2001/06/16 18:03:22 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -61,6 +61,8 @@ typedef struct demux_mpeg_s {
int status;
int preview_mode;
+
+ int send_end_buffers;
} demux_mpeg_t ;
static uint32_t read_bytes (demux_mpeg_t *this, int n) {
@@ -511,6 +513,7 @@ static void *demux_mpeg_loop (void *this_gen) {
uint32_t w;
this->status = DEMUX_OK;
+ this->send_end_buffers = 1;
do {
w = parse_pack (this);
@@ -520,16 +523,19 @@ static void *demux_mpeg_loop (void *this_gen) {
} while (this->status == DEMUX_OK) ;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- this->video_fifo->put (this->video_fifo, buf);
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- this->audio_fifo->put (this->audio_fifo, buf);
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
-
xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d, buf:%x)\n",
this->status, w);
printf ("demux loop finished (status: %d, buf:%x)\n",
@@ -545,6 +551,7 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
buf_element_t *buf;
+ this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
pthread_join (this->thread, &p);
@@ -553,15 +560,16 @@ static void demux_mpeg_stop (demux_plugin_t *this_gen) {
this->audio_fifo->clear(this->audio_fifo);
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->video_fifo->put (this->video_fifo, buf);
if(this->audio_fifo) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ 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) {
@@ -573,7 +581,9 @@ static void demux_mpeg_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
fifo_buffer_t *spu_fifo,
- off_t pos)
+ off_t pos,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb)
{
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
buf_element_t *buf;
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index b3e7e422f..b90949820 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.15 2001/06/16 14:34:48 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.16 2001/06/16 18:03:22 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -43,19 +43,24 @@
static uint32_t xine_debug;
typedef struct demux_mpeg_block_s {
- demux_plugin_t demux_plugin;
+ demux_plugin_t demux_plugin;
- fifo_buffer_t *audio_fifo;
- fifo_buffer_t *video_fifo;
- fifo_buffer_t *spu_fifo;
+ fifo_buffer_t *audio_fifo;
+ fifo_buffer_t *video_fifo;
+ fifo_buffer_t *spu_fifo;
- input_plugin_t *input;
+ input_plugin_t *input;
- pthread_t thread;
+ pthread_t thread;
- int status;
+ int status;
- int blocksize;
+ int blocksize;
+
+ int send_end_buffers;
+
+ gui_get_next_mrl_cb_t next_mrl_cb;
+ gui_branched_cb_t branched_cb;
} demux_mpeg_block_t ;
@@ -74,6 +79,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
buf = this->input->read_block (this->input, this->video_fifo, this->blocksize);
if (buf==NULL) {
+ printf ("demux_mpeg_block: read_block failed\n");
this->status = DEMUX_FINISHED;
return ;
}
@@ -333,25 +339,33 @@ static void *demux_mpeg_block_loop (void *this_gen) {
buf_element_t *buf = NULL;
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
+ printf ("demux_mpeg_block: demux loop starting...\n");
+
+ this->send_end_buffers = 1;
+
do {
demux_mpeg_block_parse_pack(this, 0);
} while (this->status == DEMUX_OK) ;
- xprintf (VERBOSE|DEMUX, "demux loop finished (status: %d)\n",
- this->status);
+ printf ("demux_mpeg_block: demux loop finished (status: %d)\n",
+ this->status);
this->status = DEMUX_FINISHED;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- this->audio_fifo->put (this->audio_fifo, buf);
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
pthread_exit(NULL);
@@ -365,6 +379,9 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
void *p;
buf_element_t *buf;
+ printf ("demux_mpeg_block: stop(...)\n");
+
+ this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
pthread_join (this->thread, &p);
@@ -373,12 +390,15 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
this->audio_fifo->clear(this->audio_fifo);
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
+
this->video_fifo->put (this->video_fifo, buf);
if(this->audio_fifo) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->audio_fifo->put (this->audio_fifo, buf);
}
@@ -394,7 +414,9 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
fifo_buffer_t *spu_fifo,
- off_t pos)
+ off_t pos,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb)
{
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
@@ -403,8 +425,8 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen,
this->video_fifo = video_fifo;
this->audio_fifo = audio_fifo;
this->spu_fifo = spu_fifo;
-
- this->status = DEMUX_OK;
+ this->next_mrl_cb = next_mrl_cb;
+ this->branched_cb = branched_cb;
pos /= (off_t) this->blocksize;
pos *= (off_t) this->blocksize;
@@ -444,6 +466,8 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen,
* now start demuxing
*/
+ this->status = DEMUX_OK ;
+
pthread_create (&this->thread, NULL, demux_mpeg_block_loop, this) ;
}
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index f99c77ffc..550ffee7d 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.11 2001/06/16 14:34:48 guenter Exp $
+ * $Id: demux_mpgaudio.c,v 1.12 2001/06/16 18:03:22 guenter Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -52,6 +52,8 @@ typedef struct {
pthread_t thread;
int status;
+
+ int send_end_buffers;
} demux_mpgaudio_t ;
static uint32_t xine_debug;
@@ -106,6 +108,8 @@ static void *demux_mpgaudio_loop (void *this_gen) {
buf_element_t *buf;
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
+ this->send_end_buffers = 1;
+
do {
if (!demux_mpgaudio_next(this))
@@ -117,14 +121,18 @@ static void *demux_mpgaudio_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
- this->video_fifo->put (this->video_fifo, buf);
-
- if(this->audio_fifo) {
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
- this->audio_fifo->put (this->audio_fifo, buf);
+ if (this->send_end_buffers) {
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->video_fifo->put (this->video_fifo, buf);
+
+ if(this->audio_fifo) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 0; /* stream finished */
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
pthread_exit(NULL);
@@ -135,6 +143,7 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) {
void *p;
buf_element_t *buf;
+ this->send_end_buffers = 0;
this->status = DEMUX_FINISHED;
pthread_join (this->thread, &p);
@@ -143,12 +152,14 @@ static void demux_mpgaudio_stop (demux_plugin_t *this_gen) {
this->audio_fifo->clear(this->audio_fifo);
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->video_fifo->put (this->video_fifo, buf);
if(this->audio_fifo) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_CONTROL_END;
+ buf->type = BUF_CONTROL_END;
+ buf->decoder_info[0] = 1; /* forced */
this->audio_fifo->put (this->audio_fifo, buf);
}
}
@@ -163,7 +174,9 @@ static void demux_mpgaudio_start (demux_plugin_t *this_gen,
fifo_buffer_t *video_fifo,
fifo_buffer_t *audio_fifo,
fifo_buffer_t *spu_fifo,
- off_t pos) {
+ off_t pos,
+ gui_get_next_mrl_cb_t next_mrl_cb,
+ gui_branched_cb_t branched_cb) {
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
buf_element_t *buf;
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 9effea450..1dd4a021f 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.19 2001/06/16 14:34:49 guenter Exp $
+ * $Id: audio_decoder.c,v 1.20 2001/06/16 18:03:22 guenter Exp $
*
*
* functions that implement audio decoding
@@ -81,15 +81,18 @@ void *audio_decoder_loop (void *this_gen) {
}
pthread_mutex_lock (&this->xine_lock);
+
+ if (!this->audio_finished && (buf->decoder_info[0]==0)) {
+ this->audio_finished = 1;
- this->audio_finished = 1;
-
- if (this->video_finished) {
- pthread_mutex_unlock (&this->xine_lock);
- xine_notify_stream_finished (this);
+ if (this->video_finished) {
+ pthread_mutex_unlock (&this->xine_lock);
+ xine_notify_stream_finished (this);
+ } else
+ pthread_mutex_unlock (&this->xine_lock);
} else
pthread_mutex_unlock (&this->xine_lock);
-
+
break;
case BUF_CONTROL_QUIT:
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index adb5876e5..53780cf19 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.23 2001/06/16 14:34:49 guenter Exp $
+ * $Id: video_decoder.c,v 1.24 2001/06/16 18:03:22 guenter Exp $
*
*/
@@ -107,12 +107,16 @@ void *video_decoder_loop (void *this_gen) {
}
pthread_mutex_lock (&this->xine_lock);
-
- this->video_finished = 1;
- if (this->audio_finished) {
- pthread_mutex_unlock (&this->xine_lock);
- xine_notify_stream_finished (this);
+ if (!this->video_finished && (buf->decoder_info[0]==0)) {
+
+ this->video_finished = 1;
+
+ if (this->audio_finished) {
+ pthread_mutex_unlock (&this->xine_lock);
+ xine_notify_stream_finished (this);
+ } else
+ pthread_mutex_unlock (&this->xine_lock);
} else
pthread_mutex_unlock (&this->xine_lock);
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 46e00783b..ab506fbdb 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.24 2001/06/16 14:34:49 guenter Exp $
+ * $Id: xine.c,v 1.25 2001/06/16 18:03:22 guenter Exp $
*
* top-level xine functions
*
@@ -63,17 +63,20 @@ void xine_notify_stream_finished (xine_t *this) {
xine_stop (this);
- this->status_callback (this->status);
+ if (this->stream_end_cb)
+ this->stream_end_cb (this->status);
}
void xine_stop (xine_t *this) {
- if (!this->cur_input_plugin)
+ pthread_mutex_lock (&this->xine_lock);
+
+ if (this->status == XINE_STOP) {
+ pthread_mutex_unlock (&this->xine_lock);
return;
+ }
- pthread_mutex_lock (&this->xine_lock);
-
this->status = XINE_STOP;
if(this->cur_demuxer_plugin) {
@@ -183,8 +186,6 @@ static void xine_play_internal (xine_t *this, char *MRL,
* find input plugin
*/
- printf ("xine: looking for an input plugin...\n");
-
this->cur_input_plugin = NULL;
for (i = 0; i < this->num_input_plugins; i++) {
@@ -207,10 +208,8 @@ static void xine_play_internal (xine_t *this, char *MRL,
* find demuxer plugin
*/
- printf ("xine: looking for a demuxer plugin...\n");
-
if(!find_demuxer(this, MRL)) {
- printf ("error: couldn't find demuxer for >%s<\n", MRL);
+ printf ("xine: couldn't find demuxer for >%s<\n", MRL);
return;
}
@@ -238,8 +237,6 @@ static void xine_play_internal (xine_t *this, char *MRL,
* start demuxer
*/
- printf ("xine: starting demuxer ...\n");
-
if (spos) {
len = this->cur_input_plugin->get_length (this->cur_input_plugin);
share = (double) spos / 65535;
@@ -249,7 +246,9 @@ static void xine_play_internal (xine_t *this, char *MRL,
this->cur_demuxer_plugin->start (this->cur_demuxer_plugin,
this->video_fifo,
this->audio_fifo,
- this->spu_fifo, pos);
+ this->spu_fifo, pos,
+ this->get_next_mrl_cb,
+ this->branched_cb);
this->status = XINE_PLAY;
this->cur_input_pos = pos;
@@ -258,10 +257,7 @@ static void xine_play_internal (xine_t *this, char *MRL,
* start clock
*/
- printf ("xine: starting clock ...\n");
this->metronom->start_clock (this->metronom, 0);
-
- printf ("xine: play_internal done.\n");
}
void xine_play (xine_t *this, char *MRL, int spos) {
@@ -299,16 +295,16 @@ void xine_exit (xine_t *this) {
* stop decoder threads
*/
- printf ("xine_exit: stopping demuxer\n");
-
if(this->cur_demuxer_plugin) {
+ printf ("xine_exit: stopping demuxer\n");
+
this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin);
this->cur_demuxer_plugin = NULL;
}
- printf ("xine_exit: closing input plugin\n");
-
if(this->cur_input_plugin) {
+ printf ("xine_exit: closing input plugin\n");
+
this->cur_input_plugin->close(this->cur_input_plugin);
this->cur_input_plugin = NULL;
}
@@ -367,12 +363,16 @@ void xine_pause (xine_t *this) {
xine_t *xine_init (vo_driver_t *vo,
ao_functions_t *ao,
- gui_status_callback_func_t gui_status_callback,
- config_values_t *config) {
+ config_values_t *config,
+ gui_stream_end_cb_t stream_end_cb,
+ gui_get_next_mrl_cb_t get_next_mrl_cb,
+ gui_branched_cb_t branched_cb) {
xine_t *this = xmalloc (sizeof (xine_t));
- this->status_callback = gui_status_callback;
+ this->stream_end_cb = stream_end_cb;
+ this->get_next_mrl_cb = get_next_mrl_cb;
+ this->branched_cb = branched_cb;
this->config = config;
xine_debug = config->lookup_int (config, "xine_debug", 0);
@@ -381,14 +381,12 @@ xine_t *xine_init (vo_driver_t *vo,
*/
pthread_mutex_init (&this->xine_lock, NULL);
- printf ("xine_init: lock created\n");
/*
* create a metronom
*/
this->metronom = metronom_init ();
- printf ("xine_init: metronom created\n");
/*
* load input and demuxer plugins
@@ -396,8 +394,6 @@ xine_t *xine_init (vo_driver_t *vo,
load_input_plugins (this, config, INPUT_PLUGIN_IFACE_VERSION);
- printf ("xine_init: input plugins loaded\n");
-
this->demux_strategy = config->lookup_int (config, "demux_strategy", 0);
load_demux_plugins(this, config, DEMUXER_PLUGIN_IFACE_VERSION);
@@ -406,8 +402,6 @@ xine_t *xine_init (vo_driver_t *vo,
this->spu_channel = -1;
this->cur_input_pos = 0;
- printf ("xine_init: demuxer plugins loaded\n");
-
/*
* init and start decoder threads
*/
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index c3277499a..22a5a5128 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -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_internal.h,v 1.22 2001/06/16 14:34:49 guenter Exp $
+ * $Id: xine_internal.h,v 1.23 2001/06/16 18:03:22 guenter Exp $
*
*/
@@ -91,11 +91,12 @@ struct audio_decoder_s {
};
/*
- * gui callback function - called by xine engine on stream end
+ * gui callback functions
*
- * nStatus : current xine status
*/
-typedef void (*gui_status_callback_func_t)(int nStatus);
+
+/* called when xine has finished a stream (_not_ if xine was stopped/paused) */
+typedef void (*gui_stream_end_cb_t)(int nStatus);
/*
* player status constants:
@@ -149,7 +150,9 @@ typedef struct xine_s {
int audio_track_map_entries;
int audio_finished;
- gui_status_callback_func_t status_callback;
+ gui_stream_end_cb_t stream_end_cb;
+ gui_get_next_mrl_cb_t get_next_mrl_cb;
+ gui_branched_cb_t branched_cb;
/* Lock for xine player functions */
pthread_mutex_t xine_lock;
@@ -169,8 +172,10 @@ config_values_t *config_file_init (char *filename);
xine_t *xine_init (vo_driver_t *vo,
ao_functions_t *ao,
- gui_status_callback_func_t gui_status_callback,
- config_values_t *config);
+ config_values_t *config,
+ gui_stream_end_cb_t stream_end_cb,
+ gui_get_next_mrl_cb_t get_next_mrl_cb,
+ gui_branched_cb_t branched_cb);
/*
* open a stream and play it