summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-08-17 16:15:36 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-08-17 16:15:36 +0000
commit31f9517d0a924c20dae8b9c6d5cc839c48b0311a (patch)
treec145ac68c73ccf9c2b2ea212177aa10a4d05bd93
parente48313f4507bd8c37b31ac0ccd7fe74128c7b6ed (diff)
downloadxine-lib-31f9517d0a924c20dae8b9c6d5cc839c48b0311a.tar.gz
xine-lib-31f9517d0a924c20dae8b9c6d5cc839c48b0311a.tar.bz2
Add xine_seek() and friends.
CVS patchset: 446 CVS date: 2001/08/17 16:15:36
-rw-r--r--include/xine.h.tmpl.in23
-rw-r--r--src/demuxers/demux_mpeg_block.c13
-rw-r--r--src/input/input_dvd.c14
-rw-r--r--src/input/input_file.c14
-rw-r--r--src/input/input_net.c11
-rw-r--r--src/input/input_plugin.h10
-rw-r--r--src/input/input_rtp.c10
-rw-r--r--src/input/input_stdin_fifo.c12
-rw-r--r--src/input/input_vcd.c12
-rw-r--r--src/libspudec/spu_decoder_api.h1
-rw-r--r--src/xine-engine/xine.c48
-rw-r--r--src/xine-engine/xine_internal.h15
12 files changed, 152 insertions, 31 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in
index ef320a200..b91de236b 100644
--- a/include/xine.h.tmpl.in
+++ b/include/xine.h.tmpl.in
@@ -28,7 +28,7 @@
\endverbatim
*/
/*
- * $Id: xine.h.tmpl.in,v 1.35 2001/07/26 12:11:17 f1rmb Exp $
+ * $Id: xine.h.tmpl.in,v 1.36 2001/08/17 16:15:36 f1rmb Exp $
*
*/
@@ -111,7 +111,13 @@ extern "C" {
* Quit status.
* \sa xine_get_status()
*/
-#define XINE_QUIT 3
+#define XINE_SEEK 3
+/**
+ * \def XINE_QUIT
+ * Quit status.
+ * \sa xine_get_status()
+ */
+#define XINE_QUIT 4
/** @} end of status_group */
@@ -613,6 +619,19 @@ void xine_exit (xine_t *self);
void xine_play (xine_t *self, char *MRL, int pos);
/**
+ * \fn void xine_seek (xine_t *self, char *MRL, int pos)
+ * \brief Seek a stream to pos
+ * \param self Current xine engine configuration ( #see xine_init() )
+ * \param MRL Media Resource Location to open
+ * \param pos Start from position (0..65535)
+ * \return Nothing
+ *
+ * Seek (already opened) stream and play it.
+ *
+ */
+void xine_seek (xine_t *self, char *MRL, int pos);
+
+/**
* \fn void xine_pause (xine_t *self)
* \brief Pause toggle
* \param self Current xine engine configuration ( #see xine_init() )
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 8b1f022fa..69a2236ad 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.29 2001/08/12 15:12:54 guenter Exp $
+ * $Id: demux_mpeg_block.c,v 1.30 2001/08/17 16:15:36 f1rmb Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -412,7 +412,7 @@ static void *demux_mpeg_block_loop (void *this_gen) {
return NULL;
}
-static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
+static void demux_mpeg_block_close (demux_plugin_t *this_gen) {
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
buf_element_t *buf;
@@ -446,6 +446,11 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) {
}
+static void demux_mpeg_block_stop (demux_plugin_t *this) {
+
+ demux_mpeg_block_close(this);
+}
+
static int demux_mpeg_block_get_status (demux_plugin_t *this_gen) {
demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen;
@@ -638,10 +643,6 @@ static char *demux_mpeg_block_get_id(void) {
return "MPEG_BLOCK";
}
-static void demux_mpeg_block_close (demux_plugin_t *this) {
- /* nothing */
-}
-
demux_plugin_t *init_demuxer_plugin(int iface, config_values_t *config) {
demux_mpeg_block_t *this;
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index c8dbadc6f..bc31976c7 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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: input_dvd.c,v 1.18 2001/07/28 13:23:24 guenter Exp $
+ * $Id: input_dvd.c,v 1.19 2001/08/17 16:15:36 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -408,6 +408,13 @@ static void dvd_plugin_close (input_plugin_t *this_gen) {
/*
*
*/
+static void dvd_plugin_stop (input_plugin_t *this_gen) {
+ dvd_plugin_close(this_gen);
+}
+
+/*
+ *
+ */
static char *dvd_plugin_get_description (input_plugin_t *this_gen) {
return "dvd device input plugin as shipped with xine";
@@ -599,8 +606,8 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
- printf("vcd input plugin doesn't support plugin API version %d.\n"
+ if (iface != 3) {
+ printf("dvd input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
"plugin.\nInstalling current input plugins should help.\n",
@@ -627,6 +634,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.get_blocksize = dvd_plugin_get_blocksize;
this->input_plugin.eject_media = dvd_plugin_eject_media;
this->input_plugin.close = dvd_plugin_close;
+ this->input_plugin.stop = dvd_plugin_stop;
this->input_plugin.get_identifier = dvd_plugin_get_identifier;
this->input_plugin.get_description = dvd_plugin_get_description;
this->input_plugin.get_dir = dvd_plugin_get_dir;
diff --git a/src/input/input_file.c b/src/input/input_file.c
index be260f66e..434626367 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.17 2001/07/11 10:15:27 f1rmb Exp $
+ * $Id: input_file.c,v 1.18 2001/08/17 16:15:36 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -678,6 +678,15 @@ static void file_plugin_close (input_plugin_t *this_gen) {
/*
*
*/
+static void file_plugin_stop (input_plugin_t *this_gen) {
+
+ xprintf (VERBOSE|INPUT, "stopping input\n");
+ file_plugin_close(this_gen);
+}
+
+/*
+ *
+ */
static char *file_plugin_get_description (input_plugin_t *this_gen) {
return "plain file input plugin as shipped with xine";
}
@@ -706,7 +715,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
+ if (iface != 3) {
printf("file input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -730,6 +739,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.eject_media = file_plugin_eject_media;
this->input_plugin.get_mrl = file_plugin_get_mrl;
this->input_plugin.close = file_plugin_close;
+ this->input_plugin.stop = file_plugin_stop;
this->input_plugin.get_description = file_plugin_get_description;
this->input_plugin.get_identifier = file_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 3d0e6170b..e6cd76f14 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -255,6 +255,14 @@ static void net_plugin_close (input_plugin_t *this_gen) {
/*
*
*/
+static void net_plugin_stop (input_plugin_t *this_gen) {
+
+ net_plugin_close(this_gen);
+}
+
+/*
+ *
+ */
static char *net_plugin_get_description (input_plugin_t *this_gen) {
return "net input plugin as shipped with xine";
}
@@ -293,7 +301,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
+ if (iface != 3) {
printf("net input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -317,6 +325,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.eject_media = net_plugin_eject_media;
this->input_plugin.get_mrl = net_plugin_get_mrl;
this->input_plugin.close = net_plugin_close;
+ this->input_plugin.stop = net_plugin_stop;
this->input_plugin.get_description = net_plugin_get_description;
this->input_plugin.get_identifier = net_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h
index fa4e0a656..c6aa19131 100644
--- a/src/input/input_plugin.h
+++ b/src/input/input_plugin.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: input_plugin.h,v 1.11 2001/08/16 12:33:00 ehasenle Exp $
+ * $Id: input_plugin.h,v 1.12 2001/08/17 16:15:36 f1rmb Exp $
*/
#ifndef HAVE_INPUT_PLUGIN_H
@@ -33,7 +33,7 @@ extern "C" {
#include "buffer.h"
#include "configfile.h"
-#define INPUT_PLUGIN_IFACE_VERSION 2
+#define INPUT_PLUGIN_IFACE_VERSION 3
/*
* Return pointer of allocate/cleaned memory size *size*.
@@ -234,6 +234,12 @@ struct input_plugin_s
/*
+ * stop input source
+ */
+ void (*stop) (input_plugin_t *this);
+
+
+ /*
* close input source
*/
void (*close) (input_plugin_t *this);
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index b18082609..31dcf403d 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -401,6 +401,13 @@ static void rtp_plugin_close (input_plugin_t *this_gen) {
/*
*
*/
+static void rtp_plugin_stop (input_plugin_t *this_gen) {
+ rtp_plugin_stop(this_gen);
+}
+
+/*
+ *
+ */
static int rtp_plugin_eject_media (input_plugin_t *this_gen) {
return 1;
@@ -450,7 +457,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
+ if (iface != 3) {
printf("rtp input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -488,6 +495,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.get_blocksize = rtp_plugin_get_blocksize;
this->input_plugin.eject_media = rtp_plugin_eject_media;
this->input_plugin.close = rtp_plugin_close;
+ this->input_plugin.stop = rtp_plugin_stop;
this->input_plugin.get_identifier = rtp_plugin_get_identifier;
this->input_plugin.get_description = rtp_plugin_get_description;
this->input_plugin.get_dir = NULL;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index 98f0c7c34..5a47c870b 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.10 2001/07/27 22:00:27 f1rmb Exp $
+ * $Id: input_stdin_fifo.c,v 1.11 2001/08/17 16:15:36 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -220,6 +220,13 @@ static void stdin_plugin_close(input_plugin_t *this_gen) {
/*
*
*/
+static void stdin_plugin_stop(input_plugin_t *this_gen) {
+ stdin_plugin_close(this_gen);
+}
+
+/*
+ *
+ */
static char *stdin_plugin_get_description (input_plugin_t *this_gen) {
return "stdin/fifo input plugin as shipped with xine";
}
@@ -249,7 +256,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
+ if (iface != 3) {
printf("rtp input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -273,6 +280,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.eject_media = stdin_plugin_eject_media;
this->input_plugin.get_mrl = stdin_plugin_get_mrl;
this->input_plugin.close = stdin_plugin_close;
+ this->input_plugin.stop = stdin_plugin_stop;
this->input_plugin.get_description = stdin_plugin_get_description;
this->input_plugin.get_identifier = stdin_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 27142decc..657f013f7 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.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: input_vcd.c,v 1.18 2001/07/27 22:00:27 f1rmb Exp $
+ * $Id: input_vcd.c,v 1.19 2001/08/17 16:15:36 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -908,6 +908,13 @@ static void vcd_plugin_close (input_plugin_t *this_gen) {
/*
*
*/
+static void vcd_plugin_stop (input_plugin_t *this_gen) {
+ vcd_plugin_close(this_gen);
+}
+
+/*
+ *
+ */
static char *vcd_plugin_get_description (input_plugin_t *this_gen) {
return "plain file input plugin as shipped with xine";
}
@@ -1077,7 +1084,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
xine_debug = config->lookup_int (config, "xine_debug", 0);
- if (iface != 2) {
+ if (iface != 3) {
printf("vcd input plugin doesn't support plugin API version %d.\n"
"PLUGIN DISABLED.\n"
"This means there's a version mismatch between xine and this input"
@@ -1103,6 +1110,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
this->input_plugin.get_blocksize = vcd_plugin_get_blocksize;
this->input_plugin.eject_media = vcd_plugin_eject_media;
this->input_plugin.close = vcd_plugin_close;
+ this->input_plugin.stop = vcd_plugin_stop;
this->input_plugin.get_identifier = vcd_plugin_get_identifier;
this->input_plugin.get_description = vcd_plugin_get_description;
this->input_plugin.get_dir = vcd_plugin_get_dir;
diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h
index 174db342b..6a02cef3f 100644
--- a/src/libspudec/spu_decoder_api.h
+++ b/src/libspudec/spu_decoder_api.h
@@ -56,7 +56,6 @@ struct spu_decoder_s {
};
-
#define SPU_EVENT_BUTTON 0x100
typedef struct spu_button_s spu_button_t;
struct spu_button_s {
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 42c7713c0..f2f3b67cd 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.42 2001/08/16 19:58:37 ehasenle Exp $
+ * $Id: xine.c,v 1.43 2001/08/17 16:15:37 f1rmb Exp $
*
* top-level xine functions
*
@@ -82,14 +82,13 @@ void xine_stop (xine_t *this) {
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->close (this->cur_demuxer_plugin);
this->cur_demuxer_plugin = NULL;
}
-
+
printf ("xine_stop: closing input\n");
if(this->cur_input_plugin) {
@@ -101,7 +100,9 @@ void xine_stop (xine_t *this) {
* this->cur_input_plugin = NULL;
*/
}
-
+
+ this->status = XINE_STOP;
+
printf ("xine_stop: done\n");
pthread_mutex_unlock (&this->xine_lock);
@@ -263,15 +264,49 @@ void xine_play (xine_t *this, char *MRL, int spos) {
pthread_mutex_unlock (&this->xine_lock);
xine_pause(this);
return;
+ break;
+
case XINE_STOP:
xine_play_internal (this, MRL, spos, (off_t) 0);
break;
+
default:
printf ("xine_play: error, xine is not paused/stopped\n");
}
pthread_mutex_unlock (&this->xine_lock);
}
+void xine_seek (xine_t *this, char *MRL, int spos) {
+
+ pthread_mutex_lock (&this->xine_lock);
+
+ printf ("xine_seek\n");
+
+ switch (this->status) {
+ case XINE_PLAY:
+ case XINE_STOP:
+ case XINE_PAUSE:
+ this->status = XINE_SEEK;
+
+ if(this->cur_demuxer_plugin) {
+ this->cur_demuxer_plugin->stop (this->cur_demuxer_plugin);
+ }
+
+ if(this->cur_input_plugin) {
+ this->cur_input_plugin->stop(this->cur_input_plugin);
+ }
+
+ this->status = XINE_STOP;
+ xine_play_internal (this, MRL, spos, (off_t)0);
+ break;
+
+ default:
+ printf ("xine_play: error, unhandled status %d\n", this->status);
+ }
+
+ pthread_mutex_unlock (&this->xine_lock);
+}
+
int xine_eject (xine_t *this) {
if(this->cur_input_plugin == NULL)
@@ -345,7 +380,6 @@ void xine_pause (xine_t *this) {
this->cur_mrl, this->cur_input_pos);
this->status = XINE_STOP;
-
xine_play_internal (this, this->cur_mrl, 0, this->cur_input_pos);
/* this->mnPausePos = 0; */
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 0833438c5..13fc9803b 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.37 2001/08/13 12:52:33 ehasenle Exp $
+ * $Id: xine_internal.h,v 1.38 2001/08/17 16:15:37 f1rmb Exp $
*
*/
@@ -120,7 +120,8 @@ typedef void (*gui_stream_end_cb_t)(int nStatus);
#define XINE_STOP 0
#define XINE_PLAY 1
#define XINE_PAUSE 2
-#define XINE_QUIT 3
+#define XINE_SEEK 3
+#define XINE_QUIT 4
typedef struct xine_s xine_t;
@@ -218,6 +219,16 @@ void xine_play (xine_t *this, char *MRL, int pos);
/*
+ * seek the stream to pos, and play it
+ *
+ * name : mrl to open
+ * pos : start position 0..65535
+ *
+ */
+void xine_seek (xine_t *this, char *MRL, int pos);
+
+
+/*
* toggle pause mode
*/
void xine_pause (xine_t *this);