summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-12-09 18:03:26 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-12-09 18:03:26 +0000
commitb3bf0f3eda9ebd70d75d3705d33bffa1491a7d3d (patch)
treec088af826b876314cf8fb67f2eeb47763bdeefef
parent67f3e9edd2441f934e4efef7fa009c32d3b5d617 (diff)
downloadxine-lib-b3bf0f3eda9ebd70d75d3705d33bffa1491a7d3d.tar.gz
xine-lib-b3bf0f3eda9ebd70d75d3705d33bffa1491a7d3d.tar.bz2
xine error reporting interface, very simple
CVS patchset: 1193 CVS date: 2001/12/09 18:03:26
-rw-r--r--include/xine.h.tmpl.in14
-rw-r--r--src/xine-engine/xine.c20
-rw-r--r--src/xine-engine/xine_internal.h17
3 files changed, 40 insertions, 11 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in
index e24bd384c..bcbdc02b5 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.62 2001/12/09 17:25:55 guenter Exp $
+ * $Id: xine.h.tmpl.in,v 1.63 2001/12/09 18:03:26 guenter Exp $
*
*/
@@ -725,14 +725,14 @@ void xine_exit (xine_t *self);
* \param MRL Media Resource Location to open
* \param start_pos position in input source (0..65535)
* \param start_time position measured in seconds from stream start
- * \return Nothing
+ * \return 1 => OK, 0=>err (use xine_get_error for details)
*
* Open a stream and play it. If both start position parameters
* are !=0 start_pos will be used
* for non-seekable streams both values will be ignored
*
*/
-void xine_play (xine_t *self, char *MRL, int start_pos, int start_time);
+int xine_play (xine_t *self, char *MRL, int start_pos, int start_time);
/**
* \fn void xine_set_speed (xine_t *self, int speed)
@@ -1686,7 +1686,15 @@ void xine_log (xine_t *self, int buf, const char *format, ...);
char **xine_get_log (xine_t *self, int buf);
+/*
+ * xine error reporting
+ */
+
+#define XINE_ERROR_NONE 0
+#define XINE_ERROR_NO_INPUT_PLUGIN 1
+#define XINE_ERROR_NO_DEMUXER_PLUGIN 2
+int xine_get_error (xine_t *self);
/** @} end of xine_api */
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 2be5b9dbc..717adb033 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.87 2001/12/09 17:24:39 guenter Exp $
+ * $Id: xine.c,v 1.88 2001/12/09 18:03:26 guenter Exp $
*
* top-level xine functions
*
@@ -237,7 +237,7 @@ static int find_demuxer(xine_t *this, const char *MRL) {
return 0;
}
-void xine_play (xine_t *this, char *mrl,
+int xine_play (xine_t *this, char *mrl,
int start_pos, int start_time) {
double share ;
@@ -295,8 +295,10 @@ void xine_play (xine_t *this, char *mrl,
if (!this->cur_input_plugin) {
printf ("xine: cannot find input plugin for this MRL\n");
this->cur_demuxer_plugin = NULL;
+ this->err = XINE_ERROR_NO_INPUT_PLUGIN;
pthread_mutex_unlock (&this->xine_lock);
- return;
+
+ return 0;
}
xine_log (this, XINE_LOG_MSG,
@@ -311,8 +313,9 @@ void xine_play (xine_t *this, char *mrl,
if (!find_demuxer(this, mrl)) {
printf ("xine: couldn't find demuxer for >%s<\n", mrl);
+ this->err = XINE_ERROR_NO_DEMUXER_PLUGIN;
pthread_mutex_unlock (&this->xine_lock);
- return;
+ return 0;
}
xine_log (this, XINE_LOG_MSG,
@@ -361,6 +364,8 @@ void xine_play (xine_t *this, char *mrl,
}
pthread_mutex_unlock (&this->xine_lock);
+
+ return 1;
}
int xine_eject (xine_t *this) {
@@ -413,7 +418,8 @@ xine_t *xine_init (vo_driver_t *vo,
printf("xine_init entered\n");
- this->config = config;
+ this->err = XINE_ERROR_NONE;
+ this->config = config;
/* probe for optimized memcpy or config setting */
xine_probe_fast_memcpy(config);
@@ -815,4 +821,6 @@ char **xine_get_log (xine_t *this, int buf) {
}
-
+int xine_get_error (xine_t *this) {
+ return this->err;
+}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 8921d385d..140db9a71 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.61 2001/12/09 17:24:39 guenter Exp $
+ * $Id: xine_internal.h,v 1.62 2001/12/09 18:03:26 guenter Exp $
*
*/
@@ -223,6 +223,8 @@ struct xine_s {
/* log output that may be presented to the user */
scratch_buffer_t *log_buffers[XINE_LOG_NUM];
+ int err;
+
};
/*
@@ -249,8 +251,9 @@ xine_t *xine_init (vo_driver_t *vo,
* if both parameters are !=0 start_pos will be used
* for non-seekable streams both values will be ignored
*
+ * returns 1 on succ, 0 on failure
*/
-void xine_play (xine_t *this, char *MRL, int start_pos, int start_time);
+int xine_play (xine_t *this, char *MRL, int start_pos, int start_time);
/*
@@ -588,6 +591,16 @@ void xine_log (xine_t *this, int buf, const char *format, ...);
char **xine_get_log (xine_t *this, int buf);
+/*
+ * xine error reporting
+ */
+
+#define XINE_ERROR_NONE 0
+#define XINE_ERROR_NO_INPUT_PLUGIN 1
+#define XINE_ERROR_NO_DEMUXER_PLUGIN 2
+
+int xine_get_error (xine_t *this);
+
#ifdef __cplusplus
}
#endif