[Toxine-cvs] CVS: toxine/src commands.c,1.59,1.60 common.h,1.25,1.26 loader.c,1.13,1.14 utils.c,1.24
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-04-11 13:43:18
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14067 Modified Files: commands.c common.h loader.c utils.c xine_commands.c Log Message: return of echo command. add 'display events <bool>' Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- commands.c 8 Apr 2004 15:35:36 -0000 1.59 +++ commands.c 11 Apr 2004 13:29:38 -0000 1.60 @@ -192,6 +192,7 @@ { "display", REQUIRE_ARGS, do_display, "Display some status", "display current <[position | time]>\n" + "display events <[yes | no | 1 | 0 | true | false] | [status]>\n" "display settings" }, { "down", NO_ARGS, do_events, @@ -516,16 +517,18 @@ break; } - pinfo("Get xine event:\n"); - poutalign(); - for(i = 0; event_struct[i].name != NULL; i++) { - if(event_struct[i].event == tox->event.last.type) { - event_name = event_struct[i].name; - break; + if(tox->display_events) { + pinfo("Get xine event:\n"); + poutalign(); + for(i = 0; event_struct[i].name != NULL; i++) { + if(event_struct[i].event == tox->event.last.type) { + event_name = event_struct[i].name; + break; + } } + pout("%s", (event_name) ? event_name : "UNKNOWN EVENT"); + pinfo("\n"); } - pout("%s", (event_name) ? event_name : "UNKNOWN EVENT"); - pinfo("\n"); if(tox->video.cur_plugin && tox->video.cur_plugin->receive_xine_event) tox->video.cur_plugin->receive_xine_event(tox, event); @@ -1764,6 +1767,7 @@ pinfo("\n"); pinfo(" Xine engine:\n"); pinfo(" initialized: '%s'\n", (tox->xine) ? "YES" : "NO"); + pinfo(" display events: '%s'\n", (tox->display_events) ? "YES" : "NO"); pinfo("\n"); pinfo(" Video:\n"); pinfo(" number of toxine plugins: '%d'\n", tox->video.plugins_num); @@ -1816,6 +1820,15 @@ } } + else if(toxine_is_arg_contain(tox, 1, "events")) { + const char *arg = toxine_get_arg(tox, 2); + + if(toxine_is_arg_contain(tox, 2, "status")) { + pinfo("Display events: %s\n", (tox->display_events) ? "YES" : "NO"); + } + else + tox->display_events = toxine_get_bool_value(arg); + } } } @@ -2242,15 +2255,13 @@ static char *get_var(toxine_t *tox, const char *var) { -#warning FIXME -#if 0 if(tox && var) { char *variable; variable = strchr(var, '$'); if(variable && (*variable == '$') && (*(variable + 1) != '$')) { - static char buffer[_PATH_MAX + _NAME_MAX + 1]; + static char buffer[32768]; char varname[1024]; int found = 0; @@ -2270,23 +2281,33 @@ found = 0; if(!strncasecmp(varname, "result", 6)) { - sprintf(buffer, "%d", toxine_get_last_int_result(tox)); + snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); found = 1; } else if(!strncasecmp(varname, "cresult", 7)) { - sprintf(buffer, "%s", toxine_get_last_char_result(tox)); + snprintf(buffer, sizeof(buffer), "%s", toxine_get_last_char_result(tox)); + found = 1; + } + else if(!strncasecmp(varname, "cxresult", 7)) { + char *p = toxine_get_last_char_result(tox); + if(p) { + int val = strtol(p, &p, 10); + snprintf(buffer, sizeof(buffer), "0x%x", val); + } + else + snprintf(buffer, sizeof(buffer), "Nothing available"); found = 1; } else if(!strncasecmp(varname, "iresult", 7)) { - sprintf(buffer, "%d", toxine_get_last_int_result(tox)); + snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); found = 1; } else if(!strncasecmp(varname, "xresult", 7)) { - sprintf(buffer, "0x%x", toxine_get_last_int_result(tox)); + snprintf(buffer, sizeof(buffer), "0x%x", toxine_get_last_int_result(tox)); found = 1; } else if(!strncasecmp(varname, "version", 7)) { - sprintf(buffer, "%s", VERSION); + snprintf(buffer, sizeof(buffer), "%s", VERSION); found = 1; } else if(!strncasecmp(varname, "date", 4)) { @@ -2295,9 +2316,9 @@ time(&curtime); lt = localtime(&curtime); - sprintf(buffer, "%-3.3s %-3.3s %d %d", - day_names + 3 * lt->tm_wday, month_names + 3 * lt->tm_mon, - lt->tm_mday, (lt->tm_year + 1900)); + snprintf(buffer, sizeof(buffer), "%-3.3s %-3.3s %d %d", + day_names + 3 * lt->tm_wday, month_names + 3 * lt->tm_mon, + lt->tm_mday, (lt->tm_year + 1900)); found = 1; } else if(!strncasecmp(varname, "time", 4)) { @@ -2306,27 +2327,27 @@ time(&curtime); lt = localtime(&curtime); - sprintf(buffer, "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); + snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); found = 1; } else if(!strncasecmp(varname, "config_file", 11)) { - sprintf(buffer, "%s", (tox->configfile) ? tox->configfile : "UNSET"); + snprintf(buffer, sizeof(buffer), "%s", (tox->configfile) ? tox->configfile : "UNSET"); found = 1; } else if(!strncasecmp(varname, "video_driver", 12)) { - sprintf(buffer, "%s", (tox->video.name) ? tox->video.name : "UNSET"); + snprintf(buffer, sizeof(buffer), "%s", (tox->video.name) ? tox->video.name : "UNSET"); found = 1; } else if(!strncasecmp(varname, "audio_driver", 12)) { - sprintf(buffer, "%s", (tox->audio.name) ? tox->audio.name : "UNSET"); + snprintf(buffer, sizeof(buffer), "%s", (tox->audio.name) ? tox->audio.name : "UNSET"); found = 1; } else if(!strncasecmp(varname, "mrl", 3)) { - sprintf(buffer, "%s", (tox->current_mrl) ? tox->current_mrl : "UNSET"); + snprintf(buffer, sizeof(buffer), "%s", (tox->current_mrl) ? tox->current_mrl : "UNSET"); found = 1; } else if(!strncasecmp(varname, "script_file", 11)) { - sprintf(buffer, "%s", (tox->script.filename) ? tox->script.filename : "UNSET"); + snprintf(buffer, sizeof(buffer), "%s", (tox->script.filename) ? tox->script.filename : "UNSET"); found = 1; } @@ -2336,7 +2357,7 @@ } } } -#endif + return NULL; } Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- common.h 7 Apr 2004 18:21:07 -0000 1.25 +++ common.h 11 Apr 2004 13:29:38 -0000 1.26 @@ -175,8 +175,9 @@ xine_event_queue_t *event_queue; int autoinit; int running; + int display_events; - // char *last_result; + char *last_result; char *configfile; uint32_t xine_state; /* bitfield, see XINE_* */ Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- loader.c 8 Apr 2004 15:36:30 -0000 1.13 +++ loader.c 11 Apr 2004 13:29:38 -0000 1.14 @@ -35,7 +35,7 @@ extern int errno; -/* #define LOCAL_BUILD 1 */ +#define LOCAL_BUILD 1 #ifdef LOCAL_BUILD #undef TOXINE_PLUGINDIR #define TOXINE_PLUGINDIR "plugins/.libs" Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- utils.c 7 Apr 2004 18:21:07 -0000 1.24 +++ utils.c 11 Apr 2004 13:29:38 -0000 1.25 @@ -435,44 +435,55 @@ return 1; } -#if 0 /* * */ void toxine_set_last_char_result(toxine_t *tox, const char *result) { - if(tox && result) { - if(tox->last_result) - tox->last_result = (char *) realloc(tox->last_result, sizeof(char *) * (strlen(result) + 1)); - else - tox->last_result = (char *) xine_xmalloc(sizeof(char *) * (strlen(result) + 1)); - - memset(tox->last_result, 0, sizeof(tox->last_result)); - sprintf(tox->last_result, "%s", result); + if(tox) { + if(result) { + if(tox->last_result) + tox->last_result = (char *) realloc(tox->last_result, (strlen(result) + 1)); + else + tox->last_result = (char *) xine_xmalloc(strlen(result) + 1); + + memset(tox->last_result, 0, sizeof(tox->last_result)); + sprintf(tox->last_result, "%s", result); + } + else { + free(tox->last_result); + tox->last_result = NULL; + } } } void toxine_set_last_achar_result(toxine_t *tox, const char *const *result) { - if(tox && result) { - int i = 0; - int len = 0; - - while(result[i] != NULL) - len += strlen(result[i++]); - - len += ((2 * (i - 1)) + 1); - - if(tox->last_result) - tox->last_result = (char *) realloc(tox->last_result, sizeof(char *) * (len + 1)); - else - tox->last_result = (char *) xine_xmalloc(sizeof(char *) * (len + 1)); - - memset(tox->last_result, 0, sizeof(tox->last_result)); - - i = 0; - while(result[i] != NULL) { - if(i > 0) - strcat(tox->last_result, ", "); - strcat(tox->last_result, result[i++]); + if(tox) { + if(result) { + int i = 0; + int len = 0; + + while(result[i] != NULL) + len += strlen(result[i++]); + + len += ((2 * (i - 1)) + 1); + + if(tox->last_result) + tox->last_result = (char *) realloc(tox->last_result, (len + 1)); + else + tox->last_result = (char *) xine_xmalloc(len + 1); + + memset(tox->last_result, 0, sizeof(tox->last_result)); + + i = 0; + while(result[i] != NULL) { + if(i > 0) + strcat(tox->last_result, ", "); + strcat(tox->last_result, result[i++]); + } + } + else { + free(tox->last_result); + tox->last_result = NULL; } } } @@ -495,17 +506,26 @@ } int toxine_get_last_int_result(toxine_t *tox) { - if(tox && (tox->last_result)) - return (atoi(tox->last_result)); + int retval = 0; + + if(tox && (tox->last_result)) { + char *p = tox->last_result; + + retval = strtol(p, &p, 10); + } return 0; } void toxine_unset_last_result(toxine_t *tox) { - if(tox) - toxine_set_last_int_result(tox, -1); + if(tox) { + if(tox->last_result) { + free(tox->last_result); + tox->last_result = NULL; + } + } } -#endif + static void _config_update(toxine_t *tox, _cfg_entry_t *entry, int type, int min, int max, int value, char *string) { Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- xine_commands.c 8 Apr 2004 16:28:03 -0000 1.43 +++ xine_commands.c 11 Apr 2004 13:29:38 -0000 1.44 @@ -434,6 +434,7 @@ */ void _xine_new(commands_t *command, toxine_t *tox, void *data) { + toxine_unset_last_result(tox); if(tox->xine) { pinfo("Exiting old xine instance\n"); _xine_exit(NULL, tox, NULL); @@ -442,9 +443,9 @@ pinfo("xine_new():\n"); tox->xine = xine_new(); pinfo(".\n"); - + tox->xine_state |= XINE_NEW; - // toxine_set_last_int_result(tox, (int)tox->xine); + toxine_set_last_int_result(tox, (int)tox->xine); _xine_config_load(NULL, tox, NULL); } @@ -466,8 +467,10 @@ tox->stream = xine_stream_new(tox->xine, tox->audio.port, tox->video.port); pinfo(".\n"); - if(tox->stream) + if(tox->stream) { tox->xine_state |= XINE_STREAM; + toxine_set_last_int_result(tox, (int)tox->stream); + } else perr("Wow, xine_stream_new() failed.\n"); @@ -480,7 +483,7 @@ */ void _xine_init(commands_t *command, toxine_t *tox, void *data) { - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); if(tox->xine_state & XINE_INIT) { perr("xine engine already initialized.\n"); @@ -507,6 +510,8 @@ _xine_exit(NULL, tox, NULL); return; } + + toxine_set_last_int_result(tox, (int)tox->xine); } /* @@ -521,10 +526,12 @@ if(mrl) { int result; + toxine_unset_last_result(tox); toxine_set_current_mrl(tox, mrl); pinfo("xine_open(%s):\n", tox->current_mrl); result = xine_open(tox->stream, tox->current_mrl); + toxine_set_last_int_result(tox, result); pinfo("-- returned %d\n", result); tox->xine_state |= XINE_OPEN; pinfo(".\n"); @@ -541,8 +548,9 @@ int ignore_args = 0; int nargs; int need_open = 1; - - // toxine_unset_last_result(tox); + int result; + + toxine_unset_last_result(tox); return_if_no_stream(tox); /* Don't take care about arguments */ @@ -681,19 +689,23 @@ time *= 1000; if(need_open) { + pinfo("xine_open(%s) && xine_play(%d, %d):\n", mrl, start, time); - if((!xine_open(tox->stream, mrl)) || (!xine_play(tox->stream, start, time))) + if((!(result = xine_open(tox->stream, mrl))) || (!(result = xine_play(tox->stream, start, time)))) toxine_handle_xine_errors(tox); else tox->xine_state |= XINE_OPEN; + } else { pinfo("xine_play(%d, %d):\n", start, time); - if(!xine_play(tox->stream, start, time)) + if(!(result = xine_play(tox->stream, start, time))) toxine_handle_xine_errors(tox); } pinfo(".\n"); + toxine_set_last_int_result(tox, result); + if(expanded_mrl) free(expanded_mrl); } @@ -704,6 +716,7 @@ void _xine_trick_mode(commands_t *command, toxine_t *tox, void *data) { int nargs; + toxine_unset_last_result(tox); return_if_no_stream(tox); if((nargs = toxine_is_args(tox)) == 2) { @@ -723,7 +736,8 @@ value = atoi(((char *)toxine_get_arg(tox, 2))); pinfo("xine_trick_mode(%s, %d):\n", xine_tricks[i].name, value); result = xine_trick_mode(tox->stream, trick_mode, value); - pinfo("returned %d\n", result); + toxine_set_last_int_result(tox, result); + pinfo("--returned %d\n", result); } else perr("invalid trick mode: %s.\n", trick); @@ -737,7 +751,8 @@ */ void _xine_get_stream_info(commands_t *command, toxine_t *tox, void *data) { int nargs; - + + toxine_unset_last_result(tox); return_if_no_stream(tox); nargs = toxine_is_args(tox); @@ -756,6 +771,7 @@ pinfo("xine_get_stream_info(%s):\n", stream_infos[i].name); stream_info = xine_get_stream_info(tox->stream, stream_infos[i].type); + toxine_set_last_int_result(tox, stream_info); toxine_show_stream_info(stream_infos[i].type, stream_info); pinfo(".\n"); } @@ -764,7 +780,8 @@ void _xine_get_meta_info(commands_t *command, toxine_t *tox, void *data) { int nargs; - + + toxine_unset_last_result(tox); return_if_no_stream(tox); nargs = toxine_is_args(tox); @@ -783,6 +800,8 @@ pinfo("xine_get_meta_info(%s):\n", meta_infos[i].name); meta_info = xine_get_meta_info(tox->stream, stream_infos[i].type); + toxine_set_last_char_result(tox, meta_info); + switch(meta_infos[i].type) { case XINE_META_INFO_TITLE: case XINE_META_INFO_COMMENT: @@ -805,7 +824,7 @@ * */ void _xine_stop(commands_t *command, toxine_t *tox, void *data) { - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_stream(tox); tox->ignore_finished = 1; pinfo("xine_stop():\n"); @@ -819,12 +838,12 @@ void _xine_eject(commands_t *command, toxine_t *tox, void *data) { int retval; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_stream(tox); pinfo("xine_eject():\n"); retval = xine_eject(tox->stream); - // toxine_set_last_int_result(tox, retval); + toxine_set_last_int_result(tox, retval); pinfo("returned %d.\n", retval); pinfo(".\n"); } @@ -833,8 +852,8 @@ * */ void _xine_exit(commands_t *command, toxine_t *tox, void *data) { - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_new(tox); toxine_config_save(tox); @@ -882,10 +901,12 @@ int xine_errno; char buffer[2048]; + toxine_unset_last_result(tox); return_if_no_stream(tox); pinfo("xine_get_error():\n"); xine_errno = xine_get_error(tox->stream); + toxine_set_last_int_result(tox, xine_errno); sprintf(buffer, "returned %d (", xine_errno); @@ -916,12 +937,12 @@ void _xine_get_status(commands_t *command, toxine_t *tox, void *data) { int i, found = 0, status; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_stream(tox); pinfo("xine_get_status():\n"); status = xine_get_status(tox->stream); - // toxine_set_last_int_result(tox, status); + toxine_set_last_int_result(tox, status); for(i = 0; xine_status[i].name != NULL; i++) { if(status == xine_status[i].status) { @@ -938,7 +959,8 @@ * */ void _xine_set_param(commands_t *command, toxine_t *tox, void *data) { - + + toxine_unset_last_result(tox); return_if_no_stream(tox); if((toxine_is_args(tox)) >= 2) { @@ -1038,6 +1060,7 @@ const char *param; int i, found = -1; + toxine_unset_last_result(tox); return_if_no_stream(tox); param = toxine_get_arg(tox, 1); @@ -1053,6 +1076,7 @@ pinfo("xine_get_param(%s):\n", xine_params[i].name); result = xine_get_param(tox->stream, xine_params[i].param); + toxine_set_last_int_result(tox, result); pinfo("returned [%d]:\n", result); switch(xine_params[i].param) { @@ -1170,7 +1194,8 @@ char lang[20]; int channel; int ret; - + + toxine_unset_last_result(tox); return_if_no_stream(tox); if(toxine_is_args(tox)) @@ -1180,7 +1205,7 @@ pinfo("xine_get_audio_lang(%d):\n", channel); ret = xine_get_audio_lang(tox->stream, channel, &lang[0]); - // toxine_set_last_char_result(tox, buffer); + toxine_set_last_int_result(tox, ret); poutalign(); pout("'%s'\n", lang); pinfo(".\n"); @@ -1194,6 +1219,7 @@ int channel; int ret; + toxine_unset_last_result(tox); return_if_no_stream(tox); if(toxine_is_args(tox)) @@ -1203,8 +1229,8 @@ pinfo("xine_get_spu_lang(%d):\n", channel); - ret= xine_get_spu_lang(tox->stream, channel, &lang[0]); - // toxine_set_last_char_result(tox, buffer); + ret = xine_get_spu_lang(tox->stream, channel, &lang[0]); + toxine_set_last_int_result(tox, ret); poutalign(); pout("'%s'\n", lang); pinfo(".\n"); @@ -1217,10 +1243,12 @@ int result, stream, time, length; int stime, slength; + toxine_unset_last_result(tox); return_if_no_stream(tox); pinfo("xine_get_pos_length():\n"); result = xine_get_pos_length (tox->stream, &stream, &time, &length); + toxine_set_last_int_result(tox, result); stime = time / 1000; slength = length / 1000; toxine_draw_bar("", 0, length, time); @@ -1242,11 +1270,14 @@ const char *log = NULL, *bufname; const char *const *log_names; + toxine_unset_last_result(tox); return_if_no_init(tox); bufname = toxine_get_arg(tox, 1); log_names = xine_get_log_names(tox->xine); + toxine_set_last_achar_result(tox, log_names); + if(log_names) { int i; @@ -1270,6 +1301,7 @@ pinfo("xine_get_log(%s):\n", log); logs = xine_get_log(tox->xine, buftype); + toxine_set_last_achar_result(tox, logs); if(logs) { char buffer[2048]; @@ -1293,12 +1325,14 @@ const char *log; char buffer[2048]; + toxine_unset_last_result(tox); return_if_no_init(tox); memset(&buffer, 0, sizeof(buffer)); pinfo("xine_get_log_names():\n"); log_names = xine_get_log_names(tox->xine); + toxine_set_last_achar_result(tox, log_names); if(log_names) { for(log = *log_names++; log; log = *log_names++) { if(strlen(buffer)) @@ -1318,9 +1352,11 @@ void _xine_get_log_section_count(commands_t *command, toxine_t *tox, void *data) { int count; + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_get_log_section_count():\n"); count = xine_get_log_section_count(tox->xine); + toxine_set_last_int_result(tox, count); pinfo("returned %d\n", count); pinfo(".\n"); @@ -1334,6 +1370,7 @@ const char *msg, *log = NULL, *bufname; const char *const *log_names; + toxine_unset_last_result(tox); return_if_no_init(tox); bufname = toxine_get_arg(tox, 1); @@ -1372,16 +1409,16 @@ void _xine_get_browsable_input_plugin_ids(commands_t *command, toxine_t *tox, void *data) { const char *const *inpp; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_get_browsable_input_plugin_ids():\n"); inpp = xine_get_browsable_input_plugin_ids(tox->xine); + toxine_set_last_achar_result(tox, inpp); if(inpp) { char buffer[4096]; const char *ipid; - // toxine_set_last_achar_result(tox, inpp); memset(&buffer, 0, sizeof(buffer)); pinfo("Available identifier of browsable input plugins are:\n"); @@ -1406,7 +1443,7 @@ void _xine_get_browse_mrls(commands_t *command, toxine_t *tox, void *data) { int nargs; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); if((nargs = toxine_is_args(tox))) { @@ -1425,6 +1462,16 @@ pinfo("xine_get_browse_mrls(%s,%s):\n", pname, smrl); bmrls = xine_get_browse_mrls(tox->xine, pname, smrl, &mrls); + { + char *p[mrls + 1]; + + for(i = 0; i < mrls; i++) { + p[i] = bmrls[i]->mrl; + } + p[i] = NULL; + toxine_set_last_achar_result(tox, (const char *const *)p); + } + if(bmrls) { for(i = 0; i < mrls; i++) { const xine_mrl_t *mrl = bmrls[i]; @@ -1489,17 +1536,17 @@ void _xine_get_autoplay_input_plugin_ids(commands_t *command, toxine_t *tox, void *data) { const char *const *inpp; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_get_autoplay_input_plugin_ids():\n"); inpp = xine_get_autoplay_input_plugin_ids(tox->xine); + toxine_set_last_achar_result(tox, inpp); if(inpp) { char buffer[4096]; const char *ipid; - // toxine_set_last_achar_result(tox, inpp); memset(&buffer, 0, sizeof(buffer)); pinfo("Available identifier of autoplay featured input plugins are:\n"); @@ -1525,7 +1572,7 @@ */ void _xine_get_autoplay_mrls(commands_t *command, toxine_t *tox, void *data) { - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); if(toxine_is_args(tox)) { @@ -1536,11 +1583,9 @@ pname = toxine_get_arg(tox, 1); pinfo("xine_get_autoplay_mrls(%s):\n", pname); ap = xine_get_autoplay_mrls(tox->xine, pname, &mrls); + toxine_set_last_achar_result(tox, (const char *const *)ap); if(ap) { - - // toxine_set_last_achar_result(tox, ap); - for(i = 0; i < mrls; i++) pinfo("%s\n", ap[i]); @@ -1556,7 +1601,7 @@ */ void _xine_get_input_plugin_description(commands_t *command, toxine_t *tox, void *data) { - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); if(toxine_is_args(tox)) { @@ -1566,7 +1611,7 @@ pname = toxine_get_arg(tox, 1); pinfo("xine_get_input_plugin_description(%s):\n", pname); ipd = xine_get_input_plugin_description(tox->xine, pname); - // toxine_set_last_char_result(tox, ipd); + toxine_set_last_char_result(tox, ipd); if(ipd) { pinfo("description of '%s' plugin id is:\n", pname); pinfo("%s\n", ipd); @@ -1585,15 +1630,16 @@ const char *const *aop; char buffer[4096]; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_list_audio_output_plugins():\n"); aop = xine_list_audio_output_plugins(tox->xine); + toxine_set_last_achar_result(tox, aop); + if(aop) { const char *aopn; - - // toxine_set_last_achar_result(tox, aop); + pinfo("Available audio output plugins are:\n"); memset(&buffer, 0, sizeof(buffer)); for(aopn = *aop++; aopn; aopn = *aop++) { @@ -1621,14 +1667,15 @@ const char *const *vop; char buffer[4096]; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_list_video_output_plugins():\n"); vop = xine_list_video_output_plugins(tox->xine); + toxine_set_last_achar_result(tox, vop); + if(vop) { const char *vopn; - // toxine_set_last_achar_result(tox, vop); pinfo("Available video output plugins are:\n"); memset(&buffer, 0, sizeof(buffer)); for(vopn = *vop++; vopn; vopn = *vop++) { @@ -1655,7 +1702,7 @@ void _xine_event_send(commands_t *command, toxine_t *tox, void *data) { int alias_event = (int) data; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); return_if_no_stream(tox); if((toxine_is_args(tox)) || (alias_event > 0)) { @@ -1703,6 +1750,7 @@ void _xine_config_get_first_entry(commands_t *command, toxine_t *tox, void *data) { _cfg_entry_t cfg_entry; + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_config_get_first_entry():\n"); @@ -1716,6 +1764,7 @@ void _xine_config_get_next_entry(commands_t *command, toxine_t *tox, void *data) { _cfg_entry_t cfg_entry; + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_config_get_next_entry():\n"); @@ -1730,6 +1779,7 @@ const char *key; _cfg_entry_t cfg_entry; + toxine_unset_last_result(tox); return_if_no_init(tox); key = toxine_get_arg(tox, 1); @@ -1746,6 +1796,7 @@ int value; _cfg_entry_t cfg_entry; + toxine_unset_last_result(tox); return_if_no_init(tox); if(toxine_is_args(tox) >= 2) { @@ -1819,6 +1870,7 @@ void _xine_config_save(commands_t *command, toxine_t *tox, void *data) { const char *filename = NULL; + toxine_unset_last_result(tox); return_if_no_init(tox); if(toxine_is_args(tox)) @@ -1830,6 +1882,8 @@ } void _xine_config_reset(commands_t *command, toxine_t *tox, void *data) { + + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_config_reset():\n"); @@ -1845,10 +1899,14 @@ */ void _xine_get_version(commands_t *command, toxine_t *tox, void *data) { int major, minor, sub; + char buffer[32]; + toxine_unset_last_result(tox); pinfo("xine_get_version():\n"); xine_get_version(&major, &minor, &sub); - // toxine_set_last_int_result(tox, version); + sprintf(buffer, "%d.%d.%d", major, minor, sub); + toxine_set_last_char_result(tox, buffer); + poutalign(); pout("'%d.%d.%d'\n", major, minor, sub); pinfo(".\n"); @@ -1860,9 +1918,10 @@ void _xine_get_version_string(commands_t *command, toxine_t *tox, void *data) { const char *result; + toxine_unset_last_result(tox); pinfo("xine_get_version_string():\n"); result = xine_get_version_string(); - // toxine_set_last_char_result(tox, result); + toxine_set_last_char_result(tox, result); poutalign(); pout("'%s'\n", result); pinfo(".\n"); @@ -1874,13 +1933,13 @@ void _xine_check_version(commands_t *command, toxine_t *tox, void *data) { int major, minor, sub, retval; - // toxine_unset_last_result(tox); + toxine_unset_last_result(tox); if(toxine_is_args(tox) >= 1) { if((sscanf((toxine_get_arg(tox, 1)), "%d.%d.%d", &major, &minor, &sub)) == 3) { pinfo("xine_check_version(%d,%d,%d):\n", major, minor, sub); retval = xine_check_version(major, minor, sub); - // toxine_set_last_int_result(tox, retval); + toxine_set_last_int_result(tox, retval); pinfo("returned %d.\n", retval); pinfo(".\n"); } @@ -1888,6 +1947,7 @@ } void _xine_close(commands_t *command, toxine_t *tox, void *data) { + toxine_unset_last_result(tox); return_if_no_stream(tox); pinfo("xine_close():\n"); @@ -1897,6 +1957,7 @@ } void _xine_dispose(commands_t *command, toxine_t *tox, void *data) { + toxine_unset_last_result(tox); return_if_no_stream(tox); if(tox->event_queue) { @@ -1916,9 +1977,11 @@ void _xine_get_file_extensions(commands_t *command, toxine_t *tox, void *data) { char *exts; + toxine_unset_last_result(tox); return_if_no_init(tox); pinfo("xine_get_file_extensions():\n"); exts = xine_get_file_extensions(tox->xine); + toxine_set_last_char_result(tox, exts); pinfo("returned: '%s'\n", (exts) ? exts : "NONE"); pinfo(".\n"); toxine_free(exts); @@ -1927,9 +1990,12 @@ void _xine_get_mime_types(commands_t *command, toxine_t *tox, void *data) { char *mimes; + toxine_unset_last_result(tox); return_if_no_init(tox); + pinfo("xine_get_mime_types():\n"); mimes = xine_get_mime_types(tox->xine); + toxine_set_last_char_result(tox, mimes); pinfo("returned: '%s'\n", (mimes) ? mimes : "NONE"); pinfo(".\n"); toxine_free(mimes); @@ -1944,7 +2010,9 @@ int ratio_code; int format; uint8_t *frame = NULL; + int result; + toxine_unset_last_result(tox); return_if_no_stream(tox); if(toxine_is_args(tox)) @@ -1965,8 +2033,8 @@ frame = (uint8_t *) xine_xmalloc(sizeof(uint8_t) * size); pinfo("xine_get_current_frame():\n"); - if(xine_get_current_frame(tox->stream, &width, &height, &ratio_code, &format, frame)) { - + if((result = xine_get_current_frame(tox->stream, &width, &height, &ratio_code, &format, frame))) { + toxine_set_last_int_result(tox, result); pinfo("get frame: %dx%d, ratio %d, format %d\n", width, height, ratio_code, format); if((fd = fopen(filename, "w+b")) != NULL) { @@ -1994,6 +2062,7 @@ void _xine_usec_sleep(commands_t *command, toxine_t *tox, void *data) { unsigned usecs; + toxine_unset_last_result(tox); usecs = (unsigned) atoi((toxine_get_arg(tox, 1))); pinfo("xine_usec_sleep(%u):\n", usecs); xine_usec_sleep(usecs); @@ -2005,18 +2074,21 @@ uint32_t iinfo; int i; + toxine_unset_last_result(tox); return_if_no_stream(tox); return_if_no_open(tox); pinfo("Meta info:\n"); for(i = 0; meta_infos[i].name != NULL; i++) { minfo = xine_get_meta_info(tox->stream, meta_infos[i].type); + toxine_set_last_char_result(tox, minfo); pinfo("%s: %s\n", meta_infos[i].name, (minfo) ? (char *) minfo : "Unavailable"); } pinfo("\n"); pinfo("Stream info:\n"); for(i = 0; stream_infos[i].name != NULL; i++) { iinfo = xine_get_stream_info(tox->stream, stream_infos[i].type); + toxine_set_last_int_result(tox, iinfo); pinfo("%s: ", stream_infos[i].name); toxine_show_stream_info(stream_infos[i].type, iinfo); } |