Update of /cvsroot/toxine/toxine/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5303/src
Modified Files:
commands.c utils.c utils.h xine_commands.c
Log Message:
Add sleep command. Update audio volume/mute on stream opening.
Index: commands.c
===================================================================
RCS file: /cvsroot/toxine/toxine/src/commands.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- commands.c 19 Jul 2004 20:45:33 -0000 1.81
+++ commands.c 23 Jul 2004 09:25:42 -0000 1.82
@@ -195,6 +195,7 @@
static void do_dumpstream(commands_t *, toxine_t *, void *);
static void do_gettime(commands_t *, toxine_t *, void *);
static void do_repeat(commands_t *, toxine_t *, void *);
+static void do_sleep(commands_t *, toxine_t *, void *);
static commands_t commands[] = {
@@ -406,6 +407,10 @@
"Execute a shell, or a command if an argument to this command is given.",
"shell [command]"
},
+ { "sleep", REQUIRE_ARGS, do_sleep,
+ "Sleep for x seconds",
+ "sleep <secs>"
+ },
{ "stop", NO_ARGS, do_stop,
"Stop playback",
"stop"
@@ -485,6 +490,7 @@
if(result) {
tox->xine_state |= XINE_OPEN;
+ toxine_update_infos(tox);
_xine_play(NULL, tox, (void *)NO_ARGS);
}
else
@@ -1331,6 +1337,7 @@
pinfo("-- returned %d\n", result);
if(result) {
tox->xine_state |= XINE_OPEN;
+ toxine_update_infos(tox);
_xine_play(command, tox, (void *)NO_ARGS);
}
else
@@ -2623,3 +2630,21 @@
}
}
}
+
+static void do_sleep(commands_t *command, toxine_t *tox, void *data) {
+ char *csecs;
+ unsigned int secs;
+
+ csecs = (char *) toxine_get_arg(tox, 1);
+ secs = (unsigned int) strtol(csecs, &csecs, 10);
+ if(secs) {
+ int i;
+
+ pinfo("sleeping %d secs: ", secs);
+ for(i = 0; i < secs; i++) {
+ pout(".");
+ sleep(1);
+ }
+ pinfo("\n.\n");
+ }
+}
Index: utils.c
===================================================================
RCS file: /cvsroot/toxine/toxine/src/utils.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- utils.c 18 Jul 2004 20:31:40 -0000 1.33
+++ utils.c 23 Jul 2004 09:25:42 -0000 1.34
@@ -633,6 +633,13 @@
}
}
+void toxine_update_infos(toxine_t *tox) {
+ if(tox->xine_state & XINE_OPEN) {
+ tox->audio.mixer.volume_level = xine_get_param(tox->stream, XINE_PARAM_AUDIO_VOLUME);
+ tox->audio.mixer.mute = xine_get_param(tox->stream, XINE_PARAM_AUDIO_MUTE);
+ }
+}
+
void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo) {
error_code_clear(tox);
Index: utils.h
===================================================================
RCS file: /cvsroot/toxine/toxine/src/utils.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- utils.h 18 Jul 2004 20:31:40 -0000 1.17
+++ utils.h 23 Jul 2004 09:25:42 -0000 1.18
@@ -52,6 +52,7 @@
void toxine_config_load(toxine_t *tox);
void toxine_config_save(toxine_t *tox);
+void toxine_update_infos(toxine_t *tox);
void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo);
char *toxine_get_var(toxine_t *tox, const char *var);
Index: xine_commands.c
===================================================================
RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- xine_commands.c 19 Jul 2004 20:45:33 -0000 1.54
+++ xine_commands.c 23 Jul 2004 09:25:42 -0000 1.55
@@ -590,10 +590,13 @@
if(!result)
error_code_set(tox, TOX_ERR_XINE_OPEN);
+ else {
+ tox->xine_state |= XINE_OPEN;
+ toxine_update_infos(tox);
+ }
toxine_set_last_int_result(tox, result);
pinfo("-- returned %d\n", result);
- tox->xine_state |= XINE_OPEN;
pinfo(".\n");
}
}
@@ -767,9 +770,11 @@
open_result = xine_open(tox->stream, mrl);
stop_watchdog(tox);
- start_watchdog(tox, "xine_play");
- result = xine_play(tox->stream, start, time);
- stop_watchdog(tox);
+ if(open_result) {
+ start_watchdog(tox, "xine_play");
+ result = xine_play(tox->stream, start, time);
+ stop_watchdog(tox);
+ }
if(!open_result || !result) {
if(!open_result) {
|