summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-03-16 21:40:27 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-03-16 21:40:27 +0000
commitadb29283e51b34c10e53dbc70e4ed063dc9737bd (patch)
tree2ed80d9312a9db692515f467565b80e2a0e99946
parent79e98f219ece342c1c66ace201683b0d6ab17e96 (diff)
downloadxine-lib-adb29283e51b34c10e53dbc70e4ed063dc9737bd.tar.gz
xine-lib-adb29283e51b34c10e53dbc70e4ed063dc9737bd.tar.bz2
add xine_engine_set/get_param() functions. For now, only verbosity is supported. Fix play_internal segfault, if stream->input_plugin is NULL
CVS patchset: 4432 CVS date: 2003/03/16 21:40:27
-rw-r--r--include/xine.h.in18
-rw-r--r--src/xine-engine/xine.c63
2 files changed, 49 insertions, 32 deletions
diff --git a/include/xine.h.in b/include/xine.h.in
index 4a92721b8..b11668626 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -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.h.in,v 1.65 2003/03/07 19:04:36 holstsn Exp $
+ * $Id: xine.h.in,v 1.66 2003/03/16 21:40:27 f1rmb Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -258,7 +258,15 @@ int xine_eject (xine_stream_t *stream);
void xine_dispose (xine_stream_t *stream);
/*
- * set/get xine engine parameters
+ * set/get engine parameters.
+ */
+void xine_engine_set_param(xine_t *self, int param, int value);
+int xine_engine_get_param(xine_t *self, int param);
+
+#define XINE_ENGINE_PARAM_VERBOSITY 1
+
+/*
+ * set/get xine stream parameters
* e.g. playback speed, constants see below
*/
void xine_set_param (xine_stream_t *stream, int param, int value);
@@ -329,9 +337,9 @@ int xine_get_param (xine_stream_t *stream, int param);
#define XINE_DEMUX_EXTENSION_STRATEGY 3
/* verbosity settings */
-#define XINE_VERBOSITY_NONE 0
-#define XINE_VERBOSITY_LOG 1
-#define XINE_VERBOSITY_DEBUG 2
+#define XINE_VERBOSITY_NONE 0
+#define XINE_VERBOSITY_LOG 1
+#define XINE_VERBOSITY_DEBUG 2
/*
* snapshot function
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 390c98314..158e7899f 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.236 2003/03/08 14:16:54 mroi Exp $
+ * $Id: xine.c,v 1.237 2003/03/16 21:40:27 f1rmb Exp $
*
* top-level xine functions
*
@@ -64,7 +64,6 @@
void xine_handle_stream_end (xine_stream_t *stream, int non_user) {
-
if (stream->status == XINE_STATUS_QUIT)
return;
stream->status = XINE_STATUS_STOP;
@@ -906,7 +905,8 @@ static int xine_play_internal (xine_stream_t *stream, int start_pos, int start_t
len = stream->current_extra_info->input_length;
pthread_mutex_unlock( &stream->current_extra_info_lock );
/* FIXME: do we need to protect concurrent access to input plugin here? */
- if (len == 0) len = stream->input_plugin->get_length (stream->input_plugin);
+ if ((len == 0) && stream->input_plugin)
+ len = stream->input_plugin->get_length (stream->input_plugin);
share = (double) start_pos / 65535;
pos = (off_t) (share * len) ;
} else
@@ -1066,8 +1066,6 @@ xine_t *xine_new (void) {
abort();
}
- this->verbosity = 0;
-
#ifdef ENABLE_NLS
/*
* i18n
@@ -1095,36 +1093,47 @@ xine_t *xine_new (void) {
pthread_mutex_init (&this->streams_lock, NULL);
- /*
- * verbose setting
- */
-
- this->verbosity = this->config->register_num (this->config,
- "misc.verbosity",
- XINE_VERBOSITY_NONE,
- "default verbosity setting",
- NULL, 40, NULL, NULL);
+ this->verbosity = XINE_VERBOSITY_NONE;
return this;
}
-void xine_init (xine_t *this) {
+void xine_engine_set_param(xine_t *this, int param, int value) {
- static char *demux_strategies[] = {"default", "reverse", "content",
- "extension", NULL};
+ if(this) {
+ switch(param) {
- /*
- * frontends don't have a chance to set xine parameters at this point
- * so read verbosity setting from config values
- */
- {
- cfg_entry_t *verbose_entry;
- verbose_entry = this->config->lookup_entry (this->config, "misc.verbosity");
- if (verbose_entry) {
- this->verbosity = verbose_entry->num_value;
+ case XINE_ENGINE_PARAM_VERBOSITY:
+ this->verbosity = value;
+ break;
+
+ default:
+ printf("Unknown parameter %d\n", param);
+ break;
}
}
-
+}
+
+int xine_engine_get_param(xine_t *this, int param) {
+
+ if(this) {
+ switch(param) {
+
+ case XINE_ENGINE_PARAM_VERBOSITY:
+ return this->verbosity;
+ break;
+
+ default:
+ printf("Unknown parameter %d\n", param);
+ break;
+ }
+ }
+ return -1;
+}
+
+void xine_init (xine_t *this) {
+ static char *demux_strategies[] = {"default", "reverse", "content",
+ "extension", NULL};
/* initialize color conversion tables and functions */
init_yuv_conversion();