summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-04 19:20:46 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-04-04 19:20:46 +0000
commitfdf8666254e5a0feee085d87e6703bf3ddbecdb8 (patch)
treea5b9bc2bbaa6f148e62c571f3f2489db1cf9e3a8 /src
parent3b564751a145788cfe48a1be3b4ceafdb9150df6 (diff)
downloadxine-lib-fdf8666254e5a0feee085d87e6703bf3ddbecdb8.tar.gz
xine-lib-fdf8666254e5a0feee085d87e6703bf3ddbecdb8.tar.bz2
add initial async error/general message reporting to frontend
obs: more messages should be added CVS patchset: 4539 CVS date: 2003/04/04 19:20:46
Diffstat (limited to 'src')
-rw-r--r--src/input/input_dvd.c8
-rw-r--r--src/input/input_file.c7
-rw-r--r--src/libreal/audio_decoder.c4
-rw-r--r--src/libreal/xine_decoder.c4
-rw-r--r--src/libw32dll/qt_decoder.c6
-rw-r--r--src/libw32dll/w32codec.c4
-rw-r--r--src/xine-engine/xine_interface.c76
-rw-r--r--src/xine-engine/xine_internal.h6
8 files changed, 106 insertions, 9 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index 7c6134240..f945f0fe2 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -18,7 +18,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.140 2003/04/03 13:04:52 mroi Exp $
+ * $Id: input_dvd.c,v 1.141 2003/04/04 19:20:48 miguelfreitas Exp $
*
*/
@@ -489,6 +489,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
if(result == DVDNAV_STATUS_ERR) {
printf("input_dvd: Error getting next block from DVD (%s)\n",
dvdnav_err_to_string(this->dvdnav));
+ xine_message(this->stream, XINE_MSG_READ_ERROR,
+ dvdnav_err_to_string(this->dvdnav), NULL);
if (block != buf->mem) dvdnav_free_cache_block(this->dvdnav, block);
buf->free_buffer(buf);
return NULL;
@@ -1625,6 +1627,10 @@ static void *init_class (xine_t *xine, void *data) {
/*
* $Log: input_dvd.c,v $
+ * Revision 1.141 2003/04/04 19:20:48 miguelfreitas
+ * add initial async error/general message reporting to frontend
+ * obs: more messages should be added
+ *
* Revision 1.140 2003/04/03 13:04:52 mroi
* not so much noise in cvs
*
diff --git a/src/input/input_file.c b/src/input/input_file.c
index a6991c74e..4ec7328db 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.77 2003/03/24 14:23:56 f1rmb Exp $
+ * $Id: input_file.c,v 1.78 2003/04/04 19:20:49 miguelfreitas Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -105,9 +105,12 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf
while (total_bytes < todo) {
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes <= 0) {
- if (num_bytes < 0)
+ if (num_bytes < 0) {
xine_log (this->stream->xine, XINE_LOG_MSG,
_("input_file: read error (%s)\n"), strerror(errno));
+ xine_message(this->stream, XINE_MSG_READ_ERROR,
+ this->mrl, NULL);
+ }
buf->free_buffer (buf);
buf = NULL;
break;
diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c
index e9d01ffc6..f4e3ee0e1 100644
--- a/src/libreal/audio_decoder.c
+++ b/src/libreal/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.21 2003/02/14 22:28:45 f1rmb Exp $
+ * $Id: audio_decoder.c,v 1.22 2003/04/04 19:20:50 miguelfreitas Exp $
*
* thin layer to use real binary-only codecs in xine
*
@@ -157,6 +157,8 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
if (!this->ra_handle) {
printf ("libareal: error: %s\n", dlerror());
+ xine_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR,
+ codec_name, NULL);
return 0;
}
diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c
index 8152a4dd6..b6d5756ce 100644
--- a/src/libreal/xine_decoder.c
+++ b/src/libreal/xine_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: xine_decoder.c,v 1.32 2003/03/28 23:40:23 guenter Exp $
+ * $Id: xine_decoder.c,v 1.33 2003/04/04 19:20:50 miguelfreitas Exp $
*
* thin layer to use real binary-only codecs in xine
*
@@ -156,6 +156,8 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) {
if (!this->rv_handle) {
printf ("libreal: error: %s\n", dlerror());
+ xine_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR,
+ codec_name, NULL);
return 0;
}
diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c
index 8aa088866..3d505d923 100644
--- a/src/libw32dll/qt_decoder.c
+++ b/src/libw32dll/qt_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: qt_decoder.c,v 1.17 2003/03/09 12:19:13 mroi Exp $
+ * $Id: qt_decoder.c,v 1.18 2003/04/04 19:20:51 miguelfreitas Exp $
*
* quicktime video/audio decoder plugin, using win32 dlls
* most of this code comes directly from MPlayer
@@ -242,6 +242,8 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) {
if (this->qtml_dll == NULL ) {
printf ("qt_audio: failed to load dll\n" );
pthread_mutex_unlock(&win32_codec_mutex);
+ xine_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR,
+ "qtmlClient.dll", NULL);
return;
}
@@ -815,6 +817,8 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) {
if (this->qtml_dll == NULL ) {
printf ("qt_video: failed to load dll\n" );
pthread_mutex_unlock(&win32_codec_mutex);
+ xine_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR,
+ "qtmlClient.dll", NULL);
return;
}
diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c
index b49820e71..8ae300c50 100644
--- a/src/libw32dll/w32codec.c
+++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.120 2003/03/18 20:40:59 jstembridge Exp $
+ * $Id: w32codec.c,v 1.121 2003/04/04 19:20:52 miguelfreitas Exp $
*
* routines for using w32 codecs
* DirectShow support by Miguel Freitas (Nov/2001)
@@ -729,6 +729,8 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
"w32codec: decoder failed to start. Is '%s' installed?\n",
win32_codec_name );
this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HANDLED] = 0;
+ xine_message(this->stream, XINE_MSG_LIBRARY_LOAD_ERROR,
+ win32_codec_name, NULL);
}
pthread_mutex_unlock(&win32_codec_mutex);
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 55204e591..d9b6ee0c2 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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_interface.c,v 1.47 2003/03/27 18:57:12 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.48 2003/04/04 19:20:53 miguelfreitas Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -700,3 +700,77 @@ xine_post_out_t * xine_get_audio_source(xine_stream_t *stream) {
return &stream->audio_source;
}
+/* report error/message to UI. may be provided with several
+ * string parameters. last parameter must be NULL.
+ */
+int xine_message(xine_stream_t *stream, int type, ...) {
+ xine_ui_message_data_t *data;
+ xine_event_t event;
+ char *explanation;
+ int size;
+ int n;
+ va_list ap;
+ char *s, *params;
+
+ static char *std_explanation[] = {
+ "",
+ "Warning",
+ "Unknown host:",
+ "Unknown device:",
+ "Network unreachable",
+ "Connection refused:",
+ "File not found:",
+ "Read error from:",
+ "Error loading library:"
+ };
+
+ if( type >= 0 && type <= sizeof(std_explanation)/
+ sizeof(std_explanation[0]) ) {
+ explanation = std_explanation[type];
+ size = strlen(explanation)+1;
+ } else {
+ explanation = NULL;
+ size = 0;
+ }
+
+ n = 0;
+ va_start(ap, type);
+ while( (s = va_arg(ap, char *)) != NULL ) {
+ size += strlen(s) + 1;
+ n++;
+ }
+ va_end(ap);
+
+ size += sizeof(xine_ui_message_data_t);
+ data = xine_xmalloc( size );
+ strcpy(data->compatibility.str,
+ "Upgrade your frontend to see the error messages");
+ data->type = type;
+ data->num_parameters = n;
+
+ if( explanation ) {
+ strcpy(data->internal_data, explanation);
+ data->explanation = data->internal_data;
+ params = data->parameters = data->internal_data + strlen(explanation) + 1;
+ } else {
+ data->explanation = NULL;
+ params = data->parameters = data->internal_data;
+ }
+
+ params[0] = '\0';
+ va_start(ap, type);
+ while( (s = va_arg(ap, char *)) != NULL ) {
+ strcpy(params, s);
+ params += strlen(s) + 1;
+ }
+ va_end(ap);
+
+ event.type = XINE_EVENT_UI_MESSAGE;
+ event.stream = stream;
+ event.data_length = size;
+ event.data = data;
+ xine_event_send(stream, &event);
+ free(data);
+
+ return 1;
+}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index c8921a181..c59f04741 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.131 2003/03/27 18:57:15 miguelfreitas Exp $
+ * $Id: xine_internal.h,v 1.132 2003/04/04 19:20:54 miguelfreitas Exp $
*
*/
@@ -269,6 +269,10 @@ struct xine_stream_s {
void xine_handle_stream_end (xine_stream_t *stream, int non_user);
+/* report message to UI. usually these are async errors */
+
+int xine_message(xine_stream_t *stream, int type, ...);
+
/* find and instantiate input and demux plugins */
input_plugin_t *find_input_plugin (xine_stream_t *stream, const char *mrl);