[Toxine-cvs] CVS: toxine/src xine_commands.c,1.50,1.51 xine_commands.h,1.29,1.30
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-06-12 11:39:29
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21200 Modified Files: xine_commands.c xine_commands.h Log Message: add xine_engine_get/set_param Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- xine_commands.c 1 Jun 2004 21:49:51 -0000 1.50 +++ xine_commands.c 12 Jun 2004 11:39:20 -0000 1.51 @@ -248,6 +248,14 @@ { NULL , 0 } }; +static struct xine_engine_params_s { + char *name; + int param; +} xine_engine_params[] = { + { "XINE_ENGINE_PARAM_VERBOSITY" , XINE_ENGINE_PARAM_VERBOSITY }, + { NULL , 0} +}; + static struct xine_speeds_s { char *name; int speed; @@ -1379,6 +1387,117 @@ /* * */ +void _xine_engine_set_param(commands_t *command, toxine_t *tox, void *data) { + + toxine_unset_last_result(tox); + return_if_no_stream(tox); + error_code_clear(tox); + + if((toxine_is_args(tox)) >= 2) { + const char *param; + const char *svalue; + int value; + int i, found = -1; + char buffer[2048]; + int value_found = -1; + + param = toxine_get_arg(tox, 1); + svalue = toxine_get_arg(tox, 2); + value = atoi(((char *)svalue)); + + memset(&buffer, 0, sizeof(buffer)); + + for(i = 0; xine_engine_params[i].name != NULL; i++) { + if(!strncasecmp(param, xine_engine_params[i].name, strlen(param))) { + found = i; + break; + } + } + + if(found >= 0) { + + sprintf(buffer, "xine_engine_set_param(%s", xine_engine_params[found].name); + + switch(xine_engine_params[i].param) { + + case XINE_ENGINE_PARAM_VERBOSITY: + sprintf(buffer, "%s, %d)\n", buffer, value); + value_found = 1; + break; + + } + + if(value_found == -1) { + sprintf(buffer, "%s, UNKNOWN[%d])\n", buffer, value); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } + + pinfo(buffer); + start_watchdog(tox, "xine_engine_set_param"); + xine_engine_set_param(tox->stream, xine_engine_params[found].param, value); + stop_watchdog(tox); + pinfo(".\n"); + } + else { + perr("Unknown xine engine parameter: '%s'\n", param); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } + + } + else { + perr("Argument(s) missing.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } +} + +/* + * + */ +void _xine_engine_get_param(commands_t *command, toxine_t *tox, void *data) { + const char *param; + int i, found = -1; + + toxine_unset_last_result(tox); + return_if_no_stream(tox); + error_code_clear(tox); + + param = toxine_get_arg(tox, 1); + for(i = 0; xine_engine_params[i].name != NULL; i++) { + if(!strncasecmp(param, xine_engine_params[i].name, strlen(param))) { + found = i; + break; + } + } + + if(found >= 0) { + int result; + + pinfo("xine_engine_get_param(%s):\n", xine_engine_params[i].name); + start_watchdog(tox, "xine_engine_get_param"); + result = xine_engine_get_param(tox->stream, xine_engine_params[i].param); + stop_watchdog(tox); + toxine_set_last_int_result(tox, result); + pinfo("returned [%d]:\n", result); + + switch(xine_engine_params[i].param) { + + case XINE_ENGINE_PARAM_VERBOSITY: + pinfo("verbosity: %d\n", result); + break; + + } + } + else { + perr("Unknown xine engine parameter: '%s'\n", param); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } + + pinfo(".\n"); +} + +/* + * + */ void _xine_get_audio_lang(commands_t *command, toxine_t *tox, void *data) { char lang[20]; int channel; Index: xine_commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- xine_commands.h 1 Jun 2004 21:49:51 -0000 1.29 +++ xine_commands.h 12 Jun 2004 11:39:20 -0000 1.30 @@ -38,6 +38,8 @@ void _xine_get_status(commands_t *, toxine_t *, void *); void _xine_set_param(commands_t *, toxine_t *, void *); void _xine_get_param(commands_t *, toxine_t *, void *); +void _xine_engine_set_param(commands_t *, toxine_t *, void *); +void _xine_engine_get_param(commands_t *, toxine_t *, void *); void _xine_get_audio_lang(commands_t *, toxine_t *, void *); void _xine_get_spu_lang(commands_t *, toxine_t *, void *); void _xine_get_pos_length(commands_t *, toxine_t *, void *); @@ -290,11 +292,23 @@ " XINE_VO_ASPECT_DONT_TOUCH]\n" \ " or any numeric value for any parameter." \ }, \ + { "xine_engine_set_param", REQUIRE_ARGS, _xine_engine_set_param, \ + "Set engine parameter", \ + "xine_engine_set_param <parameter> <value>\n" \ + " - parameter can be:\n" \ + " XINE_ENGINE_PARAM_VERBOSITY" \ + }, \ + { "xine_engine_get_param", REQUIRE_ARGS, _xine_engine_get_param, \ + "Get engine parameter value.", \ + "xine_engine_get_param <parameter>\n" \ + " - parameter can be:\n" \ + " XINE_ENGINE_PARAM_VERBOSITY" \ + }, \ { "xine_get_audio_lang", OPTIONAL_ARGS, _xine_get_audio_lang, \ "Get current audio channel language", \ "xine_get_audio_lang" \ }, \ - { "xine_get_spu_lang", OPTIONAL_ARGS, _xine_get_spu_lang, \ + { "xine_get_spu_lang", OPTIONAL_ARGS, _xine_get_spu_lang, \ "Get current spu channel language", \ "xine_get_spu_lang" \ }, \ |