toxine-cvs Mailing List for toxine (Page 3)
Brought to you by:
f1rmb
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(19) |
Jul
(81) |
Aug
(18) |
Sep
(38) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(24) |
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
(23) |
May
(36) |
Jun
(7) |
Jul
(29) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-27 00:43:05
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv837 Added Files: errors.c errors.h Log Message: oops, forgotten files --- NEW FILE: errors.c --- /* ** Copyright (C) 2002-2004 Daniel Caujolle-Bert <seg...@cl...> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdio.h> #include <stdlib.h> #include "common.h" static struct error_codes_s { char *descr; toxine_error_code_t code; } error_codes[] = { #warning Write real description { "TOX_ERR_SUCCESS", TOX_ERR_SUCCESS }, { "TOX_ERR_DEADLOCK", TOX_ERR_DEADLOCK }, { "TOX_ERR_SEGFAULT", TOX_ERR_SEGFAULT }, { "TOX_ERR_SIGINT", TOX_ERR_SIGINT }, { "TOX_ERR_SIGTERM", TOX_ERR_SIGTERM }, { "TOX_ERR_SIGQUIT", TOX_ERR_SIGQUIT }, { "TOX_ERR_INTERNAL", TOX_ERR_INTERNAL }, { "TOX_ERR_BAD_CMDLINE", TOX_ERR_BAD_CMDLINE }, { "TOX_ERR_UNKNOWN_CMD", TOX_ERR_UNKNOWN_CMD }, { "TOX_ERR_WRONG_SYNTAX", TOX_ERR_WRONG_SYNTAX }, { "TOX_ERR_MISSING_STEP", TOX_ERR_MISSING_STEP }, { "TOX_ERR_SURNUM_STEP", TOX_ERR_SURNUM_STEP }, { "TOX_ERR_NO_VOP", TOX_ERR_NO_VOP }, { "TOX_ERR_VOP_FAILURE", TOX_ERR_VOP_FAILURE }, { "TOX_ERR_AOP_FAILURE", TOX_ERR_AOP_FAILURE }, { "TOX_ERR_WRONG_VERSION", TOX_ERR_WRONG_VERSION }, { "TOX_ERR_XINE_GET_ERROR", TOX_ERR_XINE_GET_ERROR }, /* xine API */ { "TOX_ERR_XINE_OPEN_VIDEO_DRIVER", TOX_ERR_XINE_OPEN_VIDEO_DRIVER }, { "TOX_ERR_XINE_OPEN_AUDIO_DRIVER", TOX_ERR_XINE_OPEN_AUDIO_DRIVER }, { "TOX_ERR_XINE_STREAM_NEW", TOX_ERR_XINE_STREAM_NEW }, { "TOX_ERR_XINE_OPEN", TOX_ERR_XINE_OPEN }, { "TOX_ERR_XINE_PLAY", TOX_ERR_XINE_PLAY }, { "TOX_ERR_XINE_TRICK_MODE", TOX_ERR_XINE_TRICK_MODE }, { "TOX_ERR_XINE_GET_AUDIO_LANG", TOX_ERR_XINE_GET_AUDIO_LANG }, { "TOX_ERR_XINE_GET_SPU_LANG", TOX_ERR_XINE_GET_SPU_LANG }, { "TOX_ERR_XINE_GET_POS_LENGTH", TOX_ERR_XINE_GET_POS_LENGTH }, { "TOX_ERR_XINE_GET_LOG_NAMES", TOX_ERR_XINE_GET_LOG_NAMES }, { "TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY", TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY }, { "TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY", TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY }, { "TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY", TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY }, { "TOX_ERR_XINE_GET_VERSION_STRING", TOX_ERR_XINE_GET_VERSION_STRING }, { "TOX_ERR_XINE_CHECK_VERSION", TOX_ERR_XINE_CHECK_VERSION }, { "TOX_ERR_XINE_GET_CURRENT_FRAME", TOX_ERR_XINE_GET_CURRENT_FRAME }, { NULL, 0 } }; void toxine_print_error_codes(toxine_t *tox) { int i; pout("Return codes are:\n"); for(i = 0; error_codes[i].descr; i++) pout("%3d => \t%s\n", error_codes[i].code, error_codes[i].descr); pout("--\n"); } const char *toxine_get_error_description(toxine_t *tox, toxine_error_code_t err) { int i; for(i = 0; error_codes[i].descr; i++) { if(error_codes[i].code == err) { return error_codes[i].descr; } } return NULL; } --- NEW FILE: errors.h --- /* ** Copyright (C) 2002-2004 Daniel Caujolle-Bert <seg...@cl...> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ #ifndef __TOXINE_ERRORS_H__ #define __TOXINE_ERRORS_H_ #include "common.h" typedef enum { TOX_ERR_SUCCESS, /* Everything was fine */ TOX_ERR_DEADLOCK, /* Deadlock happened */ TOX_ERR_SEGFAULT, /* SEGFAULT received */ TOX_ERR_SIGINT, /* SIGINT received */ TOX_ERR_SIGTERM, /* SIGTERM received */ TOX_ERR_SIGQUIT, /* SIGQUIT received */ TOX_ERR_INTERNAL, /* Toxine internal error */ TOX_ERR_BAD_CMDLINE, /* Wrong command line option passed */ TOX_ERR_UNKNOWN_CMD, /* Unknown command */ TOX_ERR_WRONG_SYNTAX, /* Wrong syntax */ TOX_ERR_MISSING_STEP, /* One step is missing in commands execution */ TOX_ERR_SURNUM_STEP, /* One step is already done, and can't be twice */ TOX_ERR_NO_VOP, /* No output plugins found */ TOX_ERR_VOP_FAILURE, /* Video Ouput Plugin failed to initialize */ TOX_ERR_AOP_FAILURE, /* Audio Output Plugin failed to initialize */ TOX_ERR_WRONG_VERSION, /* Wrong version of xine-lib */ TOX_ERR_XINE_GET_ERROR = 100, /* xine_get_error returned != XINE_ERROR_NONE */ /* xine's fonctions error code, self explanatory */ TOX_ERR_XINE_OPEN_VIDEO_DRIVER, TOX_ERR_XINE_OPEN_AUDIO_DRIVER, TOX_ERR_XINE_STREAM_NEW, TOX_ERR_XINE_OPEN, TOX_ERR_XINE_PLAY, TOX_ERR_XINE_TRICK_MODE, TOX_ERR_XINE_GET_AUDIO_LANG, TOX_ERR_XINE_GET_SPU_LANG, TOX_ERR_XINE_GET_POS_LENGTH, TOX_ERR_XINE_GET_LOG_NAMES, TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY, TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY, TOX_ERR_XINE_GET_VERSION_STRING, TOX_ERR_XINE_CHECK_VERSION, TOX_ERR_XINE_GET_CURRENT_FRAME, } toxine_error_code_t; void toxine_print_error_codes(toxine_t *tox); const char *toxine_get_error_description(toxine_t *tox, toxine_error_code_t err); #endif |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-27 00:27:57
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30316 Modified Files: Makefile.am commands.c common.h loader.c main.c playlist.c script.c utils.c utils.h xine_commands.c Log Message: preliminary implementation of return code. (now in script or stdin mode, any error is fatal). Index: Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/src/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 17 May 2004 20:15:52 -0000 1.10 +++ Makefile.am 27 May 2004 00:27:39 -0000 1.11 @@ -15,7 +15,7 @@ GETOPT_H = getopt.h endif -COMMON_sources = utils.c parse.c xine_commands.c loader.c script.c playlist.c +COMMON_sources = utils.c parse.c xine_commands.c loader.c script.c playlist.c errors.c toxine_SOURCES = $(GETOPT_C) main.c commands.c $(COMMON_sources) toxine_DEPENDENTIES = @@ -27,7 +27,7 @@ sortcmds_SOURCES = $(GETOPT_C) sortcmds.c $(COMMON_sources) sortcmds_LDADD = @XINE_LIBS@ $(DYNAMIC_LD_LIBS) $(READLINE_LIBS) $(NCURSES_LIB) -lm -noinst_HEADERS = common.h utils.h commands.h parse.h xine_commands.h loader.h script.h playlist.h +noinst_HEADERS = common.h utils.h commands.h parse.h xine_commands.h loader.h script.h playlist.h errors.h debug: @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) @XINE_CFLAGS@ `if test -f .local; then echo -DLOCAL_BUILD; fi`" Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- commands.c 19 May 2004 23:16:42 -0000 1.71 +++ commands.c 27 May 2004 00:27:39 -0000 1.72 @@ -442,10 +442,13 @@ __playmrloop: toxine_set_current_mrl_from_cur(tox); + error_code_clear(tox); if(xine_open(tox->stream, tox->current_mrl)) { tox->xine_state |= XINE_OPEN; _xine_play(NULL, tox, (void *)NO_ARGS); } + else + error_code_set(tox, TOX_ERR_XINE_OPEN); } else { if(tox->playlist.loop && tox->playlist.num) { @@ -479,10 +482,14 @@ if((tox->xine_state & (XINE_NEW | XINE_OPEN))) { int secs; - - secs = xine_get_pos_length(tox->stream, NULL, &secs, NULL); - secs /= 1000; - + int err; + + error_code_clear(tox); + if((err = xine_get_pos_length(tox->stream, NULL, &secs, NULL))) + secs /= 1000; + else + error_code_set(tox, TOX_ERR_XINE_GET_POS_LENGTH); + if(cur == tox->playlist.cur) { if(secs >= tox->playlist.mmk[cur]->end) { @@ -553,13 +560,17 @@ pthread_attr_t pth_attrs; struct sched_param pth_params; + error_code_clear(tox); + if(!tox->video.name) { perr("you should specify a video driver name first.\n"); + error_code_set(tox, TOX_ERR_MISSING_STEP); return 0; } if(!tox->video.plugins_num) { perr("no video plugin found.\n"); + error_code_set(tox, TOX_ERR_NO_VOP); return 0; } @@ -584,6 +595,7 @@ if(!tox->video.cur_plugin) { perr("No video driver name match with '%s'\n", tox->video.name); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return 0; } @@ -626,6 +638,8 @@ */ int toxine_audio_out_init(toxine_t *tox) { + error_code_clear(tox); + if(!tox->audio.name) { perr("no audio driver sets, no audio output.\n"); return 1; @@ -639,6 +653,7 @@ tox->audio.port = xine_open_audio_driver(tox->xine, (const char*)tox->audio.name, NULL); if(tox->audio.port == NULL) { perr("xine_load_audio_output_plugin() failed to load '%s' driver.\n", tox->audio.name); + error_code_set(tox, TOX_ERR_XINE_OPEN_AUDIO_DRIVER); return 0; } tox->audio.mixer.enable = 1; @@ -697,22 +712,34 @@ if((commands[i].argtype == REQUIRE_ARGS) && (tox->command.num_args <= 0)) { perr("Command '%s' require argument(s).\n", commands[i].command); + if(tox->script.in_use || tox->stdin) + exit(TOX_ERR_WRONG_SYNTAX); found++; } else if((commands[i].argtype == NO_ARGS) && (tox->command.num_args > 0)) { perr("Command '%s' doesn't require argument.\n", commands[i].command); + if(tox->script.in_use || tox->stdin) + exit(TOX_ERR_WRONG_SYNTAX); found++; } else { commands[i].function(&commands[i], tox, NULL); + if(tox->script.in_use || tox->stdin) { + if(tox->last_error != TOX_ERR_SUCCESS) + exit(tox->last_error); + } found++; } } i++; } - if(!found) + if(!found) { perr("unhandled command '%s'.\n", tox->command.command); + if(tox->script.in_use || tox->stdin) + exit(TOX_ERR_UNKNOWN_CMD); + + } } @@ -759,6 +786,7 @@ */ void toxine_stop(toxine_t *tox) { + error_code_clear(tox); if(tox->xine) { toxine_set_command_line(tox, "xine_stop"); toxine_handle_command(tox, NULL); @@ -914,8 +942,9 @@ __re_readline: if((grabbed_line = readline(tox->prompt)) == NULL) { - fprintf(stderr, "%s(%d): readline() failed: %s\n", - __tox_func__, __LINE__, strerror(errno)); +#ifdef DEBUG + perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, strerror(errno)); +#endif goto __re_readline; } @@ -974,6 +1003,8 @@ static void do_get(commands_t *command, toxine_t *tox, void *data) { int nargs; + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs) { if(toxine_is_arg_contain(tox, 1, "audio")) { @@ -1030,7 +1061,6 @@ } - } else if(nargs >= 3) { @@ -1066,6 +1096,8 @@ static void do_set(commands_t *command, toxine_t *tox, void *data) { int nargs; + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs) { if(nargs >= 2) { @@ -1087,8 +1119,10 @@ tox->loop_mode = mode; pinfo("Loop mode is set to: '%s' [%d]\n", loop_modes[i].name, loop_modes[i].mode); } - else + else { perr("Loop mode '%s' isn't valid\n", lmode); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } else if(toxine_is_arg_contain(tox, 1, "interactive")) { @@ -1229,6 +1263,7 @@ return_if_no_init(tox); return_if_no_stream(tox); + error_code_clear(tox); if(tox->command.num_args) toxine_set_current_mrl(tox, (toxine_get_arg(tox, 1))); @@ -1244,6 +1279,8 @@ tox->xine_state |= XINE_OPEN; _xine_play(command, tox, (void *)NO_ARGS); } + else + error_code_set(tox, TOX_ERR_XINE_OPEN); } @@ -1253,6 +1290,7 @@ static void do_stop(commands_t *command, toxine_t *tox, void *data) { return_if_no_init(tox); + error_code_clear(tox); _xine_stop(command, tox, NULL); } @@ -1263,6 +1301,7 @@ static void do_pause(commands_t *command, toxine_t *tox, void *data) { return_if_no_init(tox); + error_code_clear(tox); if((xine_get_param(tox->stream, XINE_PARAM_SPEED)) != XINE_SPEED_PAUSE) xine_set_param(tox->stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE); @@ -1278,19 +1317,25 @@ int pos; return_if_no_init(tox); + error_code_clear(tox); - if((xine_get_stream_info(tox->stream, XINE_STREAM_INFO_SEEKABLE)) == 0) + if((xine_get_stream_info(tox->stream, XINE_STREAM_INFO_SEEKABLE)) == 0) { + pinfo("Stream is not seekable\n"); return; + } if(!tox->current_mrl) { perr("You should set/specify an MRL.\n"); + error_code_set(tox, TOX_ERR_MISSING_STEP); return; } pos = atoi((toxine_get_arg(tox, 1))); - if(!xine_play(tox->stream, pos, 0)) - fprintf(stderr, "xine_play() failed.\n"); + if(!xine_play(tox->stream, pos, 0)) { + perr("xine_play() failed.\n"); + error_code_set(tox, TOX_ERR_XINE_PLAY); + } } @@ -1301,12 +1346,16 @@ int msec; return_if_no_init(tox); + error_code_clear(tox); - if((xine_get_stream_info(tox->stream, XINE_STREAM_INFO_SEEKABLE)) == 0) + if((xine_get_stream_info(tox->stream, XINE_STREAM_INFO_SEEKABLE)) == 0) { + pinfo("Stream is not seekable\n"); return; + } if(!tox->current_mrl) { perr("You should set/specify an MRL.\n"); + error_code_set(tox, TOX_ERR_MISSING_STEP); return; } @@ -1315,8 +1364,10 @@ if(msec < 0) msec = 0; - if(!xine_play(tox->stream, 0, msec)) - fprintf(stderr, "xine_play() failed.\n"); + if(!xine_play(tox->stream, 0, msec)) { + perr("xine_play() failed.\n"); + error_code_set(tox, TOX_ERR_XINE_PLAY); + } } /* @@ -1326,18 +1377,20 @@ char buffer[2048] = ""; int retval; - if(tox->command.num_args) { - int i; + if(!tox->script.in_use) { + if(tox->command.num_args) { + int i; + + for(i = 0; i < tox->command.num_args; i++) + sprintf(buffer, "%s %s", buffer, (toxine_get_arg(tox, (i+1)))); + } + else + sprintf(buffer, "%s", "/bin/sh --login"); - for(i = 0; i < tox->command.num_args; i++) - sprintf(buffer, "%s %s", buffer, (toxine_get_arg(tox, (i+1)))); + retval = toxine_system(0, buffer); + pinfo("shell returned %d.\n", retval); + pinfo(".\n"); } - else - sprintf(buffer, "%s", "/bin/sh --login"); - - retval = toxine_system(0, buffer); - pinfo("shell returned %d.\n", retval); - pinfo(".\n"); } /* @@ -1346,6 +1399,8 @@ static void do_version(commands_t *command, toxine_t *tox, void *data) { int major, minor, sub; + error_code_clear(tox); + pinfo("Toxine version %s\n", VERSION); pinfo("Copyright 2002-2004, Daniel Caujolle-Bert <f1...@us...>.\n"); pinfo("Built with xine library %d.%d.%d (%s).\n", @@ -1363,6 +1418,8 @@ static void do_syntax(commands_t *command, toxine_t *tox, void *data) { int i; + error_code_clear(tox); + for(i = 0; commands[i].command != NULL; i++) { if(!strcasecmp((toxine_get_arg(tox, 1)), commands[i].command)) { toxine_command_syntax(&commands[i], tox); @@ -1371,6 +1428,7 @@ } perr("Unknown command '%s'\n", (toxine_get_arg(tox, 1))); + error_code_set(tox, TOX_ERR_UNKNOWN_CMD); } /* @@ -1378,6 +1436,8 @@ */ static void do_help(commands_t *command, toxine_t *tox, void *data) { + error_code_clear(tox); + if(!tox->command.num_args) { int i = 0, j; int maxlen = 0; @@ -1432,6 +1492,7 @@ } perr("Unknown command '%s'\n", (toxine_get_arg(tox, 1))); + error_code_set(tox, TOX_ERR_UNKNOWN_CMD); } } @@ -1483,6 +1544,7 @@ int speed, speed_status; return_if_no_init(tox); + error_code_clear(tox); if(toxine_get_event_value((toxine_get_arg(tox, 1)), &event_value)) { @@ -1545,15 +1607,19 @@ } } - else + else { perr("Invalid status name '%s'\n", (toxine_get_arg(tox, 2))); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } - else + else { perr("Wait for event '%s' is invalid.\n", (toxine_get_arg(tox, 1))); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } static void do_events(commands_t *command, toxine_t *tox, void *data) { - int i; + int i, found = 0; static struct event_aliases_s { char *alias; int event; @@ -1576,18 +1642,28 @@ { "select", XINE_EVENT_INPUT_SELECT }, { NULL, 0 } }; - + + error_code_clear(tox); + for(i = 0; event_aliases[i].alias != NULL; i++) { if(!strncmp(command->command, event_aliases[i].alias, strlen(command->command))) { _xine_event_send(command, tox, (void *) event_aliases[i].event); + found = 1; break; } } + + if(!found) { + perr("Event %s unknown\n", command->command); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } static void do_playlist(commands_t *command, toxine_t *tox, void *data) { int nargs; + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs == 1) { @@ -1798,6 +1874,7 @@ int nargs; nargs = toxine_is_args(tox); + error_code_clear(tox); if(nargs == 1) { if(toxine_is_arg_contain(tox, 1, "settings")) { @@ -1841,22 +1918,27 @@ else if(nargs >= 2) { if(toxine_is_arg_contain(tox, 1, "current")) { if(toxine_is_arg_contain(tox, 2, "position")) { - int pos; - + int ret, pos; +#warning Set last result return_if_no_init(tox); - - xine_get_pos_length(tox->stream, &pos, NULL, NULL); - toxine_draw_bar(tox, "Current position", 0, 65535, pos); + + if(!(ret = xine_get_pos_length(tox->stream, &pos, NULL, NULL))) + error_code_set(tox, TOX_ERR_XINE_GET_POS_LENGTH); + else + toxine_draw_bar(tox, "Current position", 0, 65535, pos); } else if(toxine_is_arg_contain(tox, 2, "time")) { - int seconds; + int err, seconds; return_if_no_init(tox); - xine_get_pos_length(tox->stream, NULL, &seconds, NULL); - seconds /= 1000; - pinfo("Current time: %02d:%02d:%02d\n", - seconds / (60 * 60), (seconds / 60) % 60, seconds % 60); + if(!(err = xine_get_pos_length(tox->stream, NULL, &seconds, NULL))) + error_code_set(tox, TOX_ERR_XINE_GET_POS_LENGTH); + else { + seconds /= 1000; + pinfo("Current time: %02d:%02d:%02d\n", + seconds / (60 * 60), (seconds / 60) % 60, seconds % 60); + } } } @@ -1875,6 +1957,8 @@ static void do_mediamk(commands_t *command, toxine_t *tox, void *data) { int nargs; + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs >= 1 && (toxine_is_arg_contain(tox, 1, "add"))) { @@ -1896,8 +1980,9 @@ __re_readline_1: if((line = readline(questions[question_counter])) == NULL) { - perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, - strerror(errno)); +#ifdef DEBUG + perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, strerror(errno)); +#endif goto __re_readline_1; } @@ -1913,6 +1998,7 @@ else { perr("Mrl should be specified, at least.\n"); perr("Action canceled.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } break; @@ -2008,6 +2094,7 @@ if((mmk.end != -1) && ((mmk.start >= mmk.end) || (mmk.end <= mmk.start))) { perr("start and end time are wrong:start @ %d, end @ %d\n", mmk.start, mmk.end); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); pinfo("Set start/end times to default\n"); mmk.start = 0; mmk.end = -1; @@ -2033,8 +2120,10 @@ pout("Canceled.\n"); } } - else + else { perr("MRL wasn't specified\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } else { @@ -2048,6 +2137,7 @@ i++; } pout("\b'\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); } } @@ -2187,8 +2277,9 @@ __re_readline_2: if((line = readline(questions[question_counter])) == NULL) { - perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, - strerror(errno)); +#ifdef DEBUG + perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, strerror(errno)); +#endif goto __re_readline_2; } @@ -2255,8 +2346,10 @@ pinfo("Nothing has been changed for this mediamark.\n"); } - else + else { perr("Entry %d is out of bounds\n", entry); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } else if(toxine_is_arg_contain(tox, 1, "select")) { @@ -2299,6 +2392,8 @@ int len = 0; const char *var, *arg; + error_code_clear(tox); + i = 1; while(i <= nargs) { arg = toxine_get_arg(tox, i++); @@ -2342,6 +2437,7 @@ _cfg_entry_t cfg_entry; return_if_no_new(tox); + error_code_clear(tox); pinfo("Dumping all config object:\n"); if((xine_config_get_first_entry(tox->xine, &cfg_entry))) { @@ -2349,6 +2445,8 @@ toxine_dump_config_entry(tox, &cfg_entry); } while((xine_config_get_next_entry(tox->xine, &cfg_entry))); } + else + error_code_set(tox, TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY); pinfo(".\n"); pinfo("\n"); @@ -2362,6 +2460,8 @@ struct tm *ptm; struct timeval tv; + error_code_clear(tox); + gettimeofday(&tv, NULL); if((ptm = localtime(&tv.tv_sec))) pinfo("%02d:%02d:%02d.%03d\n", ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)(tv.tv_usec / 1000)); @@ -2371,7 +2471,9 @@ static void do_repeat(commands_t *command, toxine_t *tox, void *data) { int nargs; - + + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs >= 2) { char *c_repeat; @@ -2422,4 +2524,3 @@ } } } - Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- common.h 19 May 2004 22:46:21 -0000 1.30 +++ common.h 27 May 2004 00:27:39 -0000 1.31 @@ -34,6 +34,7 @@ #include "utils.h" #include "vo_plugin.h" +#include "errors.h" #ifndef __GNUC__ #define __tox_func__ __func__ @@ -130,33 +131,62 @@ if(((x)->xine == NULL) || !((x)->xine_state & XINE_INIT)) { \ perr("%s(): xine engine uninitialized. Do it first.\n", \ __tox_func__); \ - return; \ + if(((x)->script.in_use || (x)->stdin)) { \ + perr("%s\n", toxine_get_error_description((x), (TOX_ERR_MISSING_STEP))); \ + exit((TOX_ERR_MISSING_STEP)); \ + } \ + return; \ } \ - } while(0) + } while(0) #define return_if_no_new(x) do { \ if(((x)->xine == NULL) || !((x)->xine_state & XINE_NEW)) { \ perr("%s(): xine instance not created. Do it first.\n", \ __tox_func__); \ + if(((x)->script.in_use || (x)->stdin)) { \ + perr("%s\n", toxine_get_error_description((x), (TOX_ERR_MISSING_STEP))); \ + exit((TOX_ERR_MISSING_STEP)); \ + } \ return; \ } \ - } while(0) + } while(0) #define return_if_no_open(x) do { \ - if(((x)->xine == NULL) || !((x)->xine_state & XINE_OPEN)) { \ - perr("%s(): mrl not opened. Do it first.\n", \ - __tox_func__); \ - return; \ - } \ - } while(0) + if(((x)->xine == NULL) || !((x)->xine_state & XINE_OPEN)) { \ + perr("%s(): mrl not opened. Do it first.\n", \ + __tox_func__); \ + if(((x)->script.in_use || (x)->stdin)) { \ + perr("%s\n", toxine_get_error_description((x), (TOX_ERR_MISSING_STEP))); \ + exit((TOX_ERR_MISSING_STEP)); \ + } \ + return; \ + } \ + } while(0) #define return_if_no_stream(x) do { \ - if(((x)->xine == NULL) || !((x)->xine_state & XINE_STREAM)) { \ - perr("%s(): no stream created. Do it first.\n", \ - __tox_func__); \ - return; \ - } \ - } while(0) + if(((x)->xine == NULL) || !((x)->xine_state & XINE_STREAM)) { \ + perr("%s(): no stream created. Do it first.\n", \ + __tox_func__); \ + if(((x)->script.in_use || (x)->stdin)) { \ + perr("%s\n", toxine_get_error_description((x), (TOX_ERR_MISSING_STEP))); \ + exit((TOX_ERR_MISSING_STEP)); \ + } \ + return; \ + } \ + } while(0) + +#define error_code_clear(x) do { \ + (x)->last_error = TOX_ERR_SUCCESS; \ + } while(0) + +#define error_code_set(x, E) do { \ + (x)->last_error = (E); \ + if(((x)->script.in_use || (x)->stdin) && ((E) != TOX_ERR_SUCCESS)) { \ + perr("%s\n", toxine_get_error_description((x), (E))); \ + exit((E)); \ + } \ + } while(0) + #ifndef NAME_MAX #define _NAME_MAX 256 @@ -273,6 +303,8 @@ } script; int stdin; + + toxine_error_code_t last_error; }; typedef struct commands_s commands_t; Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- loader.c 17 May 2004 20:31:43 -0000 1.19 +++ loader.c 27 May 2004 00:27:39 -0000 1.20 @@ -45,9 +45,8 @@ DIR *dir; if(tox == NULL) { - fprintf(stderr, "%s(%s@%d): toxine_t * parameter should be non null, exiting\n", - __FILE__, __tox_func__, __LINE__); - exit(1); + perr("%s(%s@%d): toxine_t * parameter should be non null, exiting\n", __FILE__, __tox_func__, __LINE__); + exit(TOX_ERR_INTERNAL); } tox->video.plugins_num = 0; @@ -68,8 +67,8 @@ sprintf(str, "%s/%s", TOXINE_PLUGINDIR, pf->d_name); if(!(plugin = dlopen(str, RTLD_LAZY))) { - fprintf(stderr, "%s(%s@%d): cannot open demux plugin %s:\n%s\n", - __FILE__, __tox_func__, __LINE__, str, dlerror()); + perr("%s(%s@%d): cannot open video output plugin %s:\n%s\n", __FILE__, __tox_func__, __LINE__, str, dlerror()); + error_code_set(tox, TOX_ERR_INTERNAL); } else { void *(*initplug) (toxine_t *); @@ -106,9 +105,8 @@ } if(tox->video.plugins_num > TOXINE_VO_PLUGINS_MAX) { - fprintf(stderr, "%s(%s@%d): too many video out plugins installed, exiting.\n", - __FILE__, __tox_func__, __LINE__); - exit(1); + perr("%s(%s@%d): too many video out plugins installed, exiting.\n", __FILE__, __tox_func__, __LINE__); + exit(TOX_ERR_INTERNAL); } } } @@ -116,8 +114,8 @@ closedir(dir); } else { - fprintf(stderr, "Can't open plugin directory: '%s'\nGiving up.\n", TOXINE_PLUGINDIR); - exit(1); + perr("Can't open plugin directory: '%s'\nGiving up.\n", TOXINE_PLUGINDIR); + exit(TOX_ERR_NO_VOP); } tox->video.cur_plugin = NULL; Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- main.c 17 May 2004 21:23:35 -0000 1.33 +++ main.c 27 May 2004 00:27:39 -0000 1.34 @@ -54,20 +54,22 @@ static toxine_t *tox; +#define ERROR_CODES 1000 /* options args */ static const char *short_options = "?hs:e:o::vV:A:iIS"; static struct option long_options[] = { - { "help" , no_argument , 0, 'h' }, - { "script" , required_argument, 0, 's' }, - { "execute" , required_argument, 0, 'e' }, - { "output" , optional_argument, 0, 'o' }, - { "video" , required_argument, 0, 'V' }, - { "audio" , required_argument, 0, 'A' }, - { "interactive" , required_argument, 0, 'i' }, - { "autoinit" , no_argument , 0, 'I' }, - { "stdin" , no_argument , 0, 'S' }, - { "version" , no_argument , 0, 'v' }, - { 0 , no_argument , 0, 0 } + { "help" , no_argument , 0, 'h' }, + { "script" , required_argument, 0, 's' }, + { "execute" , required_argument, 0, 'e' }, + { "output" , optional_argument, 0, 'o' }, + { "video" , required_argument, 0, 'V' }, + { "audio" , required_argument, 0, 'A' }, + { "interactive" , required_argument, 0, 'i' }, + { "autoinit" , no_argument , 0, 'I' }, + { "stdin" , no_argument , 0, 'S' }, + { "version" , no_argument , 0, 'v' }, + { "error-codes" , optional_argument, 0, ERROR_CODES }, + { 0 , no_argument , 0, 0 } }; /* @@ -77,7 +79,7 @@ pid_t pid = getppid(); if(pid == tox->pid) { - + switch(sig) { /* Kill the line on C-c */ case SIGINT: @@ -89,7 +91,12 @@ } else { tox->video.running = tox->running = 0; - exit(1); + if(sig == SIGINT) + exit(TOX_ERR_SIGINT); + else if(sig == SIGTERM) + exit(TOX_ERR_SIGTERM); + else if(sig == SIGQUIT) + exit(TOX_ERR_SIGQUIT); } break; @@ -134,6 +141,8 @@ printf(" *(video/audio driver names should be sets).\n"); printf(" -v, --version Display version.\n"); printf(" -h, --help Display this help text.\n"); + printf(" --error-codes[=num] Display error codes descriptions.\n"); + printf(" if 'num' is specified, the error description will be printed.\n"); printf("\n"); } @@ -202,10 +211,11 @@ * ... */ int main(int argc, char **argv) { - int c = '?'; - int option_index = 0; - int interactive = 1; - int i; + int c = '?'; + int option_index = 0; + int interactive = 1; + int i; + toxine_error_code_t last_error; /* Check xine library version */ if(!xine_check_version(1, 0, 0)) { @@ -213,7 +223,7 @@ xine_get_version(&major, &minor, &sub); fprintf(stderr, "Require xine library version 1.0.0, found %d.%d.%d.\n", major, minor, sub); - exit(1); + exit(TOX_ERR_WRONG_VERSION); } tox = (toxine_t *) xine_xmalloc(sizeof(toxine_t)); @@ -245,12 +255,12 @@ tox->script.in_use = 1; } else - fprintf(stderr, "script filename already set: '%s'\n", tox->script.filename); + perr("Script filename already set: '%s'\n", tox->script.filename); } else { - fprintf(stderr, "script filename is required to -S/--script option\n"); - exit(1); + perr("Script filename is required to -S/--script option\n"); + exit(TOX_ERR_BAD_CMDLINE); } break; @@ -266,8 +276,8 @@ char *ofile = (optarg) ? optarg : "toxine.out"; if((tox->msg_fd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, 0644)) < 0) { - fprintf(stderr, "Cannot open %s: %s\n", ofile, strerror(errno)); - exit(1); + perr("Cannot open %s: %s\n", ofile, strerror(errno)); + exit(TOX_ERR_INTERNAL); } } @@ -297,33 +307,43 @@ case 'v': /* Display version and exit*/ toxine_show_version(tox); - exit(1); + exit(TOX_ERR_SUCCESS); break; + case ERROR_CODES: + if(optarg) { + toxine_error_code_t err = (toxine_error_code_t) atoi(optarg); + pout("%s\n", toxine_get_error_description(tox, err)); + } + else + toxine_print_error_codes(tox); + exit(TOX_ERR_SUCCESS); + break; + case 'h': /* Display usage */ case '?': toxine_print_usage(); - exit(1); + exit(TOX_ERR_SUCCESS); break; default: toxine_print_usage(); - fprintf(stderr, "invalid argument %d => exit\n",c); - exit(1); + perr("Invalid argument %d => exit\n",c); + exit(TOX_ERR_BAD_CMDLINE); } } if(tox->msg_fd >= 0) { if((!tox->script.in_use) && (!tox->command.execute)) { - fprintf(stderr, "You can't use message redirection in prompt mode.\n"); + perr("You can't use message redirection in prompt mode.\n"); toxine_release(tox); - exit(1); + exit(TOX_ERR_BAD_CMDLINE); } if(dup2(tox->msg_fd, STDOUT_FILENO) < 0) - fprintf(stderr, "Cannot dup2 stdout: %s\n", strerror(errno)); + perr("Cannot dup2 stdout: %s\n", strerror(errno)); if(dup2(tox->msg_fd, STDERR_FILENO) < 0) - fprintf(stderr, "Cannot dup2 stderr: %s\n", strerror(errno)); + perr("Cannot dup2 stderr: %s\n", strerror(errno)); } toxine_show_version(tox); @@ -358,7 +378,8 @@ tox->interactive = 0; toxine_run(tox, argc - optind, &argv[optind]); + last_error = tox->last_error; toxine_release(tox); - return 1; + return last_error; } Index: playlist.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/playlist.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- playlist.c 17 May 2004 20:31:43 -0000 1.13 +++ playlist.c 27 May 2004 00:27:39 -0000 1.14 @@ -692,7 +692,7 @@ if(fn) { *fn = '\0'; fn++; - status = toxine_mkdir_safe(pn); + status = toxine_mkdir_safe(tox, pn); } else fn = pn; Index: script.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/script.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- script.c 19 May 2004 22:46:21 -0000 1.5 +++ script.c 27 May 2004 00:27:39 -0000 1.6 @@ -113,7 +113,7 @@ if((br = read(fd, buf, st.st_size)) != st.st_size) { close(fd); toxine_free(buf); - fprintf(stderr, "read() returned wrong size (expected %lld, readed %lld)\n", st.st_size, br); + perr("read() returned wrong size (expected %lld, readed %lld)\n", st.st_size, br); return; } @@ -139,15 +139,21 @@ } } - else - fprintf(stderr, "failed to open '%s': %s\n", tox->script.filename, strerror(errno)); + else { + perr("Failed to open '%s': %s\n", tox->script.filename, strerror(errno)); + error_code_set(tox, TOX_ERR_INTERNAL); + } } - else - fprintf(stderr, "file is empty; '%s'\n", tox->script.filename); - + else { + perr("File is empty; '%s'\n", tox->script.filename); + error_code_set(tox, TOX_ERR_INTERNAL); + } + + } + else { + perr("Unable to stat() '%s': %s\n", tox->script.filename, strerror(errno)); + error_code_set(tox, TOX_ERR_INTERNAL); } - else - fprintf(stderr, "unable to stat() '%s': %s\n", tox->script.filename, strerror(errno)); } Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- utils.c 19 May 2004 21:23:38 -0000 1.29 +++ utils.c 27 May 2004 00:27:39 -0000 1.30 @@ -126,10 +126,13 @@ char prompt[strlen(HELP_PREFIX) + strlen(message) + 1]; sprintf(prompt, "%s%s", HELP_PREFIX, message); + + __re_readline: if((line = readline(prompt)) == NULL) { - perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, - strerror(errno)); - exit(1); +#ifdef DEBUG + perr("%s(%d): readline() failed: %s\n", __tox_func__, __LINE__, strerror(errno)); +#endif + goto __re_readline; } if (*line) { @@ -410,7 +413,7 @@ /* * */ -static int _mkdir_safe(char *path) { +static int _mkdir_safe(toxine_t *tox, char *path) { struct stat pstat; if(path == NULL) @@ -419,14 +422,16 @@ if((lstat(path, &pstat)) < 0) { /* file or directory no exist, create it */ if(mkdir(path, 0755) < 0) { - fprintf(stderr, "mkdir(%s) failed: %s\n", path, strerror(errno)); + perr("mkdir(%s) failed: %s\n", path, strerror(errno)); + error_code_set(tox, TOX_ERR_INTERNAL); return 0; } } else { /* Check of found file is a directory file */ if(!S_ISDIR(pstat.st_mode)) { - fprintf(stderr, "%s is not a directory.\n", path); + perr("%s is not a directory.\n", path); + error_code_set(tox, TOX_ERR_INTERNAL); return 0; } } @@ -437,14 +442,16 @@ /* * */ -int toxine_mkdir_safe(char *path) { +int toxine_mkdir_safe(toxine_t *tox, char *path) { char *p, *pp; char buf[_PATH_MAX + _NAME_MAX + 1]; char buf2[_PATH_MAX + _NAME_MAX + 1]; if(path == NULL) return 0; - + + error_code_clear(tox); + memset(&buf, 0, sizeof(buf)); memset(&buf2, 0, sizeof(buf2)); @@ -453,7 +460,7 @@ while((p = xine_strsep(&pp, "/")) != NULL) { if(p && strlen(p)) { sprintf(buf2, "%s/%s", buf2, p); - if(!_mkdir_safe(buf2)) + if(!_mkdir_safe(tox, buf2)) return 0; } } @@ -571,7 +578,8 @@ break; default: - fprintf(stderr, "Unknown config type %d\n", type); + perr("Unknown config type %d\n", type); + error_code_set(tox, TOX_ERR_INTERNAL); return; break; } @@ -582,64 +590,80 @@ void toxine_config_update_range(toxine_t *tox, char *key, int min, int max) { _cfg_entry_t entry; + error_code_clear(tox); memset(&entry, 0, sizeof(_cfg_entry_t)); if(xine_config_lookup_entry(tox->xine, key, &entry)) _config_update(tox, &entry, XINE_CONFIG_TYPE_RANGE, min, max, 0, NULL); - else - fprintf(stderr, "WOW, range key %s isn't registered\n", key); + else { + perr("WOW, range key %s isn't registered\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } } void toxine_config_update_string(toxine_t *tox, char *key, char *string) { _cfg_entry_t entry; + error_code_clear(tox); memset(&entry, 0, sizeof(_cfg_entry_t)); - if((xine_config_lookup_entry(tox->xine, key, &entry)) && string) _config_update(tox, &entry, XINE_CONFIG_TYPE_STRING, 0, 0, 0, string); else { if(string == NULL) - fprintf(stderr, "string is NULL\n"); + perr("String is NULL\n"); else - fprintf(stderr, "WOW, string key %s isn't registered\n", key); + perr("WOW, string key %s isn't registered\n", key); + + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); } } void toxine_config_update_enum(toxine_t *tox, char *key, int value) { _cfg_entry_t entry; + error_code_clear(tox); memset(&entry, 0, sizeof(_cfg_entry_t)); if(xine_config_lookup_entry(tox->xine, key, &entry)) _config_update(tox, &entry, XINE_CONFIG_TYPE_ENUM, 0, 0, value, NULL); - else - fprintf(stderr, "WOW, enum key %s isn't registered\n", key); + else { + perr("WOW, enum key %s isn't registered\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } } void toxine_config_update_bool(toxine_t *tox, char *key, int value) { _cfg_entry_t entry; + error_code_clear(tox); memset(&entry, 0, sizeof(_cfg_entry_t)); if(xine_config_lookup_entry(tox->xine, key, &entry)) _config_update(tox, &entry, XINE_CONFIG_TYPE_BOOL, 0, 0, ((value > 0) ? 1 : 0), NULL); - else - fprintf(stderr, "WOW, bool key %s isn't registered\n", key); + else { + perr("WOW, bool key %s isn't registered\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } } void toxine_config_update_num(toxine_t *tox, char *key, int value) { _cfg_entry_t entry; + error_code_clear(tox); memset(&entry, 0, sizeof(_cfg_entry_t)); if(xine_config_lookup_entry(tox->xine, key, &entry)) _config_update(tox, &entry, XINE_CONFIG_TYPE_NUM, 0, 0, value, NULL); - else - fprintf(stderr, "WOW, num key %s isn't registered\n", key); + else { + perr("WOW, num key %s isn't registered\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } } void toxine_config_load(toxine_t *tox) { + error_code_clear(tox); if(tox) xine_config_load(tox->xine, tox->configfile); } void toxine_config_save(toxine_t *tox) { + error_code_clear(tox); if(tox) { return_if_no_new(tox); xine_config_save(tox->xine, tox->configfile); @@ -647,6 +671,8 @@ } void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo) { + error_code_clear(tox); + switch(info_type) { case XINE_STREAM_INFO_BITRATE: case XINE_STREAM_INFO_SEEKABLE: @@ -685,11 +711,13 @@ default: perr("Unknown stream info type %d\n", iinfo); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); break; } } char *toxine_get_var(toxine_t *tox, const char *var) { + error_code_clear(tox); if(tox && var) { char *variable; @@ -827,5 +855,6 @@ } } + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return NULL; } Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- utils.h 19 May 2004 21:23:38 -0000 1.15 +++ utils.h 27 May 2004 00:27:39 -0000 1.16 @@ -39,7 +39,7 @@ int toxine_is_last_arg_contain(toxine_t *tox, const char *arg); int toxine_is_last_arg_match(toxine_t *tox, const char *arg); -int toxine_mkdir_safe(char *path); +int toxine_mkdir_safe(toxine_t *tox, char *path); void toxine_draw_bar(toxine_t *tox, char *title, int min, int max, int val); void toxine_set_last_char_result(toxine_t *tox, const char *result); Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- xine_commands.c 17 May 2004 19:53:25 -0000 1.45 +++ xine_commands.c 27 May 2004 00:27:39 -0000 1.46 @@ -308,7 +308,7 @@ return_if_no_stream(tox); err = xine_get_error(tox->stream); - + switch(err) { case XINE_ERROR_NONE: /* noop */ @@ -436,6 +436,8 @@ void _xine_new(commands_t *command, toxine_t *tox, void *data) { toxine_unset_last_result(tox); + error_code_clear(tox); + if(tox->xine) { pinfo("Exiting old xine instance\n"); _xine_exit(NULL, tox, NULL); @@ -453,27 +455,32 @@ void _xine_stream_new(commands_t *command, toxine_t *tox, void *data) { return_if_no_init(tox); + error_code_clear(tox); if(tox->video.port == NULL) { perr("Choose and initialise a video driver first\n"); + error_code_set(tox, TOX_ERR_MISSING_STEP); return; } if(tox->xine_state & XINE_STREAM) { perr("Stream is already created, use xine_dispose() in order to create a new one\n"); + error_code_set(tox, TOX_ERR_SURNUM_STEP); return; } pinfo("xine_stream_new():\n"); tox->stream = xine_stream_new(tox->xine, tox->audio.port, tox->video.port); pinfo(".\n"); - + if(tox->stream) { tox->xine_state |= XINE_STREAM; toxine_set_last_int_result(tox, (int)tox->stream); } - else + else { perr("Wow, xine_stream_new() failed.\n"); + error_code_set(tox, TOX_ERR_XINE_STREAM_NEW); + } tox->event_queue = xine_event_new_queue(tox->stream); xine_event_create_listener_thread(tox->event_queue, toxine_event_listener, (void *) tox); @@ -485,9 +492,11 @@ void _xine_init(commands_t *command, toxine_t *tox, void *data) { toxine_unset_last_result(tox); - + error_code_clear(tox); + if(tox->xine_state & XINE_INIT) { perr("xine engine already initialized.\n"); + error_code_set(tox, TOX_ERR_SURNUM_STEP); return; } @@ -503,12 +512,14 @@ if(!toxine_video_out_init(tox)) { perr("unable to initialize video out plugin.\n"); _xine_exit(NULL, tox, NULL); + error_code_set(tox, TOX_ERR_VOP_FAILURE); return; } if(!toxine_audio_out_init(tox)) { perr("unable to initialize audio driver, audio output disabled.\n"); _xine_exit(NULL, tox, NULL); + error_code_set(tox, TOX_ERR_AOP_FAILURE); return; } @@ -522,7 +533,8 @@ const char *mrl; return_if_no_stream(tox); - + error_code_clear(tox); + mrl = toxine_get_arg(tox, 1); if(mrl) { int result; @@ -531,7 +543,9 @@ toxine_set_current_mrl(tox, mrl); pinfo("xine_open(%s):\n", tox->current_mrl); - result = xine_open(tox->stream, tox->current_mrl); + if(!(result = xine_open(tox->stream, tox->current_mrl))) + error_code_set(tox, TOX_ERR_XINE_OPEN); + toxine_set_last_int_result(tox, result); pinfo("-- returned %d\n", result); tox->xine_state |= XINE_OPEN; @@ -549,10 +563,13 @@ int ignore_args = 0; int nargs; int need_open = 1; - int result; + int open_result, result; toxine_unset_last_result(tox); + return_if_no_stream(tox); + + error_code_clear(tox); /* Don't take care about arguments */ if(data) @@ -566,6 +583,7 @@ if((!nargs) || (ignore_args == NO_ARGS)) { if(!tox->current_mrl) { perr("You should set/specify an MRL.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } else { @@ -625,6 +643,7 @@ time = atoi((toxine_get_arg(tox, 2))); else { perr("Unhandled argument '%s'\n", (toxine_get_arg(tox, 1))); + error_code_set(tox, TOX_ERR_UNKNOWN_CMD); return; } @@ -633,6 +652,7 @@ mrl = (const char *)tox->current_mrl; else { perr("You should set/specify an MRL.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } } @@ -666,18 +686,21 @@ time = atoi((toxine_get_arg(tox, 4))); else { perr("Unhandled argument '%s'\n", toxine_get_arg(tox, 3)); + error_code_set(tox, TOX_ERR_UNKNOWN_CMD); return; } } else { perr("Unhandled argument '%s'\n", toxine_get_arg(tox, 1)); + error_code_set(tox, TOX_ERR_UNKNOWN_CMD); return; } } else { - perr("wrong command syntax, try 'syntax xine_play'\n"); + perr("Wrong command syntax, try 'syntax xine_play'\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } @@ -692,16 +715,25 @@ if(need_open) { pinfo("xine_open(%s) && xine_play(%d, %d):\n", mrl, start, time); - if((!(result = xine_open(tox->stream, mrl))) || (!(result = xine_play(tox->stream, start, time)))) + if((!(open_result = xine_open(tox->stream, mrl))) || (!(result = xine_play(tox->stream, start, time)))) { + if(!open_result) { + error_code_set(tox, TOX_ERR_XINE_OPEN); + result = open_result; + } + else + error_code_set(tox, TOX_ERR_XINE_PLAY); toxine_handle_xine_errors(tox); + } else tox->xine_state |= XINE_OPEN; } else { pinfo("xine_play(%d, %d):\n", start, time); - if(!(result = xine_play(tox->stream, start, time))) + if(!(result = xine_play(tox->stream, start, time))) { + error_code_set(tox, TOX_ERR_XINE_PLAY); toxine_handle_xine_errors(tox); + } } pinfo(".\n"); @@ -719,12 +751,12 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if((nargs = toxine_is_args(tox)) == 2) { int i, trick_mode = -1; const char *trick = toxine_get_arg(tox, 1); - for(i = 0; xine_tricks[i].name != NULL; i++) { if(!strncasecmp(trick, xine_tricks[i].name, strlen(trick))) { trick_mode = xine_tricks[i].mode; @@ -737,11 +769,15 @@ 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); + if(!result) + error_code_set(tox, TOX_ERR_XINE_TRICK_MODE); toxine_set_last_int_result(tox, result); pinfo("--returned %d\n", result); } - else + else { perr("invalid trick mode: %s.\n", trick); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } pinfo(".\n"); } @@ -755,7 +791,8 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); - + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs) { char *info_name = (char *)toxine_get_arg(tox, 1); @@ -784,7 +821,8 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); - + error_code_clear(tox); + nargs = toxine_is_args(tox); if(nargs) { char *info_name = (char *)toxine_get_arg(tox, 1); @@ -819,6 +857,8 @@ } pinfo(".\n"); } + else + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); } } /* @@ -827,6 +867,7 @@ void _xine_stop(commands_t *command, toxine_t *tox, void *data) { toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); tox->ignore_finished = 1; pinfo("xine_stop():\n"); xine_stop(tox->stream); @@ -856,6 +897,7 @@ toxine_unset_last_result(tox); return_if_no_new(tox); + error_code_clear(tox); toxine_config_save(tox); @@ -904,6 +946,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); pinfo("xine_get_error():\n"); xine_errno = xine_get_error(tox->stream); @@ -940,7 +983,8 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); - + error_code_clear(tox); + pinfo("xine_get_status():\n"); status = xine_get_status(tox->stream); toxine_set_last_int_result(tox, status); @@ -963,6 +1007,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if((toxine_is_args(tox)) >= 2) { const char *param; @@ -1039,19 +1084,25 @@ } - if(value_found == -1) + if(value_found == -1) { sprintf(buffer, "%s, UNKNOWN[%d])\n", buffer, value); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } pinfo(buffer); xine_set_param(tox->stream, xine_params[found].param, value); pinfo(".\n"); } - else + else { perr("Unknown xine parameter: '%s'\n", param); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } - else + else { perr("Argument(s) missing.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } /* @@ -1063,6 +1114,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); param = toxine_get_arg(tox, 1); for(i = 0; xine_params[i].name != NULL; i++) { @@ -1182,8 +1234,10 @@ } } - else + else { perr("Unknown xine parameter: '%s'\n", param); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } pinfo(".\n"); } @@ -1198,7 +1252,8 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); - + error_code_clear(tox); + if(toxine_is_args(tox)) channel = atoi(((char *)toxine_get_arg(tox, 1))); else @@ -1206,6 +1261,8 @@ pinfo("xine_get_audio_lang(%d):\n", channel); ret = xine_get_audio_lang(tox->stream, channel, &lang[0]); + if(!ret) + error_code_set(tox, TOX_ERR_XINE_GET_AUDIO_LANG); toxine_set_last_int_result(tox, ret); poutalign(); pout("'%s'\n", lang); @@ -1222,6 +1279,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if(toxine_is_args(tox)) channel = atoi(((char *)toxine_get_arg(tox, 1))); @@ -1231,6 +1289,8 @@ pinfo("xine_get_spu_lang(%d):\n", channel); ret = xine_get_spu_lang(tox->stream, channel, &lang[0]); + if(!ret) + error_code_set(tox, TOX_ERR_XINE_GET_SPU_LANG); toxine_set_last_int_result(tox, ret); poutalign(); pout("'%s'\n", lang); @@ -1246,9 +1306,12 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); pinfo("xine_get_pos_length():\n"); result = xine_get_pos_length (tox->stream, &stream, &time, &length); + if(!result) + error_code_set(tox, TOX_ERR_XINE_GET_POS_LENGTH); toxine_set_last_int_result(tox, result); stime = time / 1000; slength = length / 1000; @@ -1273,10 +1336,13 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); bufname = toxine_get_arg(tox, 1); - + log_names = xine_get_log_names(tox->xine); + if(!log_names) + error_code_set(tox, TOX_ERR_XINE_GET_LOG_NAMES); toxine_set_last_achar_result(tox, log_names); if(log_names) { @@ -1294,6 +1360,7 @@ buftype = atoi(((char *)bufname)); if(buftype >= xine_get_log_section_count(tox->xine)) { perr("buffer number %d is out of bounds\n", buftype); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } pinfo("xine_get_log(%d):\n", buftype); @@ -1328,11 +1395,14 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); memset(&buffer, 0, sizeof(buffer)); pinfo("xine_get_log_names():\n"); log_names = xine_get_log_names(tox->xine); + if(!log_names) + error_code_set(tox, TOX_ERR_XINE_GET_LOG_NAMES); toxine_set_last_achar_result(tox, log_names); if(log_names) { for(log = *log_names++; log; log = *log_names++) { @@ -1355,6 +1425,8 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); + pinfo("xine_get_log_section_count():\n"); count = xine_get_log_section_count(tox->xine); toxine_set_last_int_result(tox, count); @@ -1373,10 +1445,13 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); bufname = toxine_get_arg(tox, 1); log_names = xine_get_log_names(tox->xine); - if(log_names) { + if(!log_names) + error_code_set(tox, TOX_ERR_XINE_GET_LOG_NAMES); + else { int i; for(i = 0, log = *log_names++; log; log = *log_names++, i++) { @@ -1393,6 +1468,7 @@ buftype = atoi(((char *)bufname)); if(buftype >= xine_get_log_section_count(tox->xine)) { perr("buffer number %d is out of bounds\n", buftype); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); return; } pinfo("xine_log(%d, '%s')\n", buftype, msg); @@ -1412,6 +1488,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_get_browsable_input_plugin_ids():\n"); inpp = xine_get_browsable_input_plugin_ids(tox->xine); @@ -1446,6 +1523,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); if((nargs = toxine_is_args(tox))) { xine_mrl_t **bmrls; @@ -1539,6 +1617,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_get_autoplay_input_plugin_ids():\n"); inpp = xine_get_autoplay_input_plugin_ids(tox->xine); @@ -1575,6 +1654,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); if(toxine_is_args(tox)) { const char *pname; @@ -1604,6 +1684,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); if(toxine_is_args(tox)) { const char *ipd; @@ -1633,6 +1714,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_list_audio_output_plugins():\n"); aop = xine_list_audio_output_plugins(tox->xine); @@ -1670,6 +1752,8 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); + pinfo("xine_list_video_output_plugins():\n"); vop = xine_list_video_output_plugins(tox->xine); toxine_set_last_achar_result(tox, vop); @@ -1705,6 +1789,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if((toxine_is_args(tox)) || (alias_event > 0)) { const char *event_name = NULL; @@ -1741,6 +1826,8 @@ else pinfo("there is no event type # %d.\n", alias_event); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } } @@ -1753,12 +1840,15 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_config_get_first_entry():\n"); if((xine_config_get_first_entry(tox->xine, &cfg_entry))) toxine_dump_config_entry(tox, &cfg_entry); - else + else { perr("xine_config_get_first_entry() returned NULL\n"); + error_code_set(tox, TOX_ERR_XINE_CONFIG_GET_FIRST_ENTRY); + } pinfo(".\n"); } @@ -1767,12 +1857,15 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_config_get_next_entry():\n"); if((xine_config_get_next_entry(tox->xine, &cfg_entry))) toxine_dump_config_entry(tox, &cfg_entry); - else + else { perr("xine_config_get_next_entry() returned NULL\n"); + error_code_set(tox, TOX_ERR_XINE_CONFIG_GET_NEXT_ENTRY); + } pinfo(".\n"); } @@ -1782,13 +1875,16 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); key = toxine_get_arg(tox, 1); pinfo("xine_config_lookup_entry(%s):\n", key); if((xine_config_lookup_entry(tox->xine, key, &cfg_entry))) toxine_dump_config_entry(tox, &cfg_entry); - else + else { perr("Entry '%s' doesn't exist.\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } pinfo(".\n"); } @@ -1799,6 +1895,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); if(toxine_is_args(tox) >= 2) { const char *svalue; @@ -1841,20 +1938,25 @@ pinfo(".\n"); } } - else + else { perr("Entry '%s' doesn't exist.\n", key); + error_code_set(tox, TOX_ERR_XINE_CONFIG_LOOKUP_ENTRY); + } pinfo(".\n"); } - else + else { perr("Argument(s) missing.\n"); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } } void _xine_config_load(commands_t *command, toxine_t *tox, void *data) { const char *filename = NULL; return_if_no_new(tox); + error_code_clear(tox); if(toxine_is_args(tox)) { filename = toxine_get_arg(tox, 1); @@ -1873,6 +1975,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); if(toxine_is_args(tox)) filename = toxine_get_arg(tox, 1); @@ -1886,6 +1989,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_config_reset():\n"); xine_config_reset(tox->xine); @@ -1903,6 +2007,8 @@ char buffer[32]; toxine_unset_last_result(tox); + error_code_clear(tox); + pinfo("xine_get_version():\n"); xine_get_version(&major, &minor, &sub); sprintf(buffer, "%d.%d.%d", major, minor, sub); @@ -1920,8 +2026,12 @@ const char *result; toxine_unset_last_result(tox); + error_code_clear(tox); + pinfo("xine_get_version_string():\n"); result = xine_get_version_string(); + if(!result) + error_code_set(tox, TOX_ERR_XINE_GET_VERSION_STRING); toxine_set_last_char_result(tox, result); poutalign(); pout("'%s'\n", result); @@ -1935,11 +2045,14 @@ int major, minor, sub, retval; toxine_unset_last_result(tox); + error_code_clear(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); + if(!retval) + error_code_set(tox, TOX_ERR_XINE_CHECK_VERSION); toxine_set_last_int_result(tox, retval); pinfo("returned %d.\n", retval); pinfo(".\n"); @@ -1950,6 +2063,7 @@ void _xine_close(commands_t *command, toxine_t *tox, void *data) { toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); pinfo("xine_close():\n"); xine_close(tox->stream); @@ -1960,6 +2074,7 @@ void _xine_dispose(commands_t *command, toxine_t *tox, void *data) { toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if(tox->event_queue) { pinfo("xine_event_dispose_queue():\n"); @@ -1980,6 +2095,8 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); + pinfo("xine_get_file_extensions():\n"); exts = xine_get_file_extensions(tox->xine); toxine_set_last_char_result(tox, exts); @@ -1993,6 +2110,7 @@ toxine_unset_last_result(tox); return_if_no_init(tox); + error_code_clear(tox); pinfo("xine_get_mime_types():\n"); mimes = xine_get_mime_types(tox->xine); @@ -2015,6 +2133,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); + error_code_clear(tox); if(toxine_is_args(tox)) filename = (char *) toxine_get_arg(tox, 1); @@ -2026,8 +2145,10 @@ width = xine_get_stream_info(tox->stream,XINE_STREAM_INFO_VIDEO_WIDTH); height = xine_get_stream_info(tox->stream,XINE_STREAM_INFO_VIDEO_HEIGHT); - if((!width) || (!height)) + if((!width) || (!height)) { perr("Wrong frame size: %dx%d\n", width, height); + error_code_set(tox, TOX_ERR_WRONG_SYNTAX); + } else { int size = (width * height) * 2; @@ -2044,12 +2165,16 @@ fclose(fd); pinfo("File '%s' saved\n", filename); } - else + else { perr("Unable to open file '%s' in write mode\n", filename); + error_code_set(tox, TOX_ERR_INTERNAL); + } } - else + else { perr("unable to get current frame\n"); + error_code_set(tox, TOX_ERR_XINE_GET_CURRENT_FRAME); + } pinfo(".\n"); toxine_free(frame); @@ -2064,6 +2189,8 @@ unsigned usecs; toxine_unset_last_result(tox); + error_code_clear(tox); + usecs = (unsigned) atoi((toxine_get_arg(tox, 1))); pinfo("xine_usec_sleep(%u):\n", usecs); xine_usec_sleep(usecs); @@ -2078,6 +2205,7 @@ toxine_unset_last_result(tox); return_if_no_stream(tox); return_if_no_open(tox); + error_code_clear(tox); pinfo("Meta info:\n"); for(i = 0; meta_infos[i].name != NULL; i++) { |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-27 00:27:51
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30316/plugins Modified Files: vo_aa.c vo_caca.c vo_dxr3.c vo_none.c vo_x11.c Log Message: preliminary implementation of return code. (now in script or stdin mode, any error is fatal). Index: vo_aa.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_aa.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- vo_aa.c 6 May 2004 19:18:34 -0000 1.16 +++ vo_aa.c 27 May 2004 00:27:40 -0000 1.17 @@ -46,13 +46,13 @@ private->context = aa_autoinit(&aa_defparams); if(private->context == NULL) { - fprintf(stderr,"Cannot initialize AA-lib. Sorry\n"); - exit(1); + perr("Cannot initialize AA-lib. Sorry\n"); + exit(TOX_ERR_VOP_FAILURE); } if(aa_autoinitkbd(private->context, 0) < 1) { - fprintf(stderr, "aa_autoinitkdb() failed.\n"); - exit(1); + perr("aa_autoinitkdb() failed.\n"); + exit(TOX_ERR_VOP_FAILURE); } aa_hidecursor(private->context); @@ -63,9 +63,8 @@ (void *) private->context); if(tox->video.port == NULL) { - fprintf(stderr, "xine_open_video_driver() failed to load '%s' driver.\n", - tox->video.name); - exit(1); + perr("xine_open_video_driver() failed to load '%s' driver.\n", tox->video.name); + exit(TOX_ERR_XINE_OPEN_VIDEO_DRIVER); } else pinfo("video driver '%s' successfully loaded.\n", tox->video.name); Index: vo_caca.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_caca.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vo_caca.c 6 May 2004 19:18:34 -0000 1.2 +++ vo_caca.c 27 May 2004 00:27:40 -0000 1.3 @@ -78,9 +78,8 @@ tox->video.port = xine_open_video_driver(tox->xine, tox->video.name, XINE_VISUAL_TYPE_CACA, NULL); if(tox->video.port == NULL) { - fprintf(stderr, "xine_open_video_driver() failed to load '%s' driver.\n", - tox->video.name); - exit(1); + perr("xine_open_video_driver() failed to load '%s' driver.\n", tox->video.name); + exit(TOX_ERR_XINE_OPEN_VIDEO_DRIVER); } else pinfo("video driver '%s' successfully loaded.\n", tox->video.name); Index: vo_dxr3.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_dxr3.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- vo_dxr3.c 6 May 2004 19:18:34 -0000 1.20 +++ vo_dxr3.c 27 May 2004 00:27:40 -0000 1.21 @@ -54,7 +54,7 @@ /* First, we have to initialize the config entry */ (void *) xine_config_register_enum(tox->xine, "dxr3.videoout_mode", 0, videoout_modes, "Dxr3: videoout mode (tv or overlay)", - NULL, 0, NULL, NULL); + NULL, 0, NULL, NULL); /* Then, force it to TV mode */ toxine_config_update_num(tox, "dxr3.videoout_mode", mode); @@ -68,9 +68,8 @@ private->init = 1; if(tox->video.port == NULL) { - fprintf(stderr, "xine_load_video_output_plugin() failed to load '%s' driver.\n", - drivername); - exit(1); + perr("xine_load_video_output_plugin() failed to load '%s' driver.\n", drivername); + exit(TOX_ERR_XINE_OPEN_VIDEO_DRIVER); } else pinfo("video driver '%s' successfully loaded.\n", drivername); Index: vo_none.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_none.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- vo_none.c 6 May 2004 19:18:34 -0000 1.13 +++ vo_none.c 27 May 2004 00:27:40 -0000 1.14 @@ -39,9 +39,8 @@ private->init = 1; if(tox->video.port == NULL) { - fprintf(stderr, "xine_load_video_output_plugin() failed to load '%s' driver.\n", - tox->video.name); - exit(1); + perr("xine_load_video_output_plugin() failed to load '%s' driver.\n", tox->video.name); + exit(TOX_ERR_XINE_OPEN_VIDEO_DRIVER); } else pinfo("video driver '%s' successfully loaded.\n", tox->video.name); Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- vo_x11.c 6 May 2004 19:18:34 -0000 1.30 +++ vo_x11.c 27 May 2004 00:27:40 -0000 1.31 @@ -459,8 +459,8 @@ xine_gui_send_vo_data(tox->stream, XINE_GUI_SEND_SELECT_VISUAL, (void *)&vinfo); if(vinfo != (XVisualInfo *) -1) { if(!vinfo) { - fprintf (stderr, "videowin: output driver cannot select a working visual\n"); - exit(1); + perr("Output driver cannot select a working visual\n"); + exit(TOX_ERR_VOP_FAILURE); } private->visual = vinfo->visual; @@ -500,7 +500,7 @@ if(!XInitThreads()) { perr("XInitThreads failed - looks like you don't have a " "thread-safe xlib.\n"); - exit(1); + exit(TOX_ERR_VOP_FAILURE); } private->fake_rate = xine_config_register_num(tox->xine, "tox.fake_rate", 10, @@ -544,8 +544,8 @@ private->wm_hint = XAllocWMHints(); if(!private->wm_hint) { - printf ("XAllocWMHints failed\n"); - exit (1); + perr("XAllocWMHints failed\n"); + exit(TOX_ERR_VOP_FAILURE); } private->wm_hint->input = True; private->wm_hint->initial_state = NormalState; @@ -740,9 +740,8 @@ XINE_VISUAL_TYPE_X11, (void *)&vis); if(tox->video.port == NULL) { - fprintf(stderr, "xine_open_video_driver() failed to load '%s' driver.\n", - drivername); - exit(1); + perr("xine_open_video_driver() failed to load '%s' driver.\n", drivername); + exit(TOX_ERR_XINE_OPEN_VIDEO_DRIVER); } else pinfo("video driver '%s' successfully loaded.\n", drivername); |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-24 20:53:36
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16354 Modified Files: parse.c Log Message: avoid segfaulting with too long command line (like in repeat mode). Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- parse.c 19 May 2004 21:23:38 -0000 1.9 +++ parse.c 24 May 2004 20:53:25 -0000 1.10 @@ -33,10 +33,8 @@ * Push first command in remain queue to current command. */ static void toxine_parse_destock_remain(toxine_t *tox) { - char *p, *pp, *c; - char *pbuf; - char commandline[BUFSIZ]; - char remaining[BUFSIZ]; + char *p; + /* * Remain and line are already filled, perhaps a forced command line @@ -56,9 +54,16 @@ if(tox->command.remain && ((tox->command.line == NULL) || ((tox->command.line != NULL) && (strlen(tox->command.line) == 0)))) { + char *pbuf, *pp, *c, *commandline, *remaining; + int len; - memset(&commandline, 0, sizeof(commandline)); - memset(&remaining, 0, sizeof(remaining)); + if(tox->command.line && (strlen(tox->command.line) > strlen(tox->command.remain))) + len = strlen(tox->command.line); + else + len = strlen(tox->command.remain); + + commandline = (char *) xine_xmalloc(sizeof(char) * (len + 1)); + remaining = (char *) xine_xmalloc(sizeof(char) * (len + 1)); if((p = strchr(tox->command.remain, ';')) && (*(p - 1) != '\\')) { @@ -122,6 +127,9 @@ toxine_free(tox->command.remain); } + + toxine_free(commandline); + toxine_free(remaining); } } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 23:16:52
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27294 Modified Files: commands.c Log Message: @@another typo Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- commands.c 19 May 2004 21:29:02 -0000 1.70 +++ commands.c 19 May 2004 23:16:42 -0000 1.71 @@ -350,7 +350,7 @@ { "repeat", REQUIRE_ARGS, do_repeat, "repeat x time a set of commands", "repeat <x> <command>\n" - "repeat <x> { <<command><\\;command>...> }" + "repeat <x> { <command><\\;<command>...> }" }, { "right", NO_ARGS, do_events, "send XINE_EVENT_INPUT_RIGHT event to xine engine", |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 22:46:36
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21497 Modified Files: common.h script.c Log Message: rewrite script reading. Support multilines (using backslash) in script file). Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- common.h 17 May 2004 21:23:35 -0000 1.29 +++ common.h 19 May 2004 22:46:21 -0000 1.30 @@ -266,8 +266,9 @@ struct { int in_use; char *filename; - FILE *fd; - char buf[256]; + char **lines; + int current; + int num_lines; char *ln; } script; Index: script.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/script.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- script.c 17 May 2004 20:31:43 -0000 1.4 +++ script.c 19 May 2004 22:46:21 -0000 1.5 @@ -21,86 +21,133 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include "common.h" #include "commands.h" #include "utils.h" -/* - * Cleanup the EOL ('\n','\r',' ') - */ -static void toxine_script_clean_eol(toxine_t *tox) { - char *p; +static void toxine_script_free(toxine_t *tox) { + + if(tox->script.num_lines) { + while(tox->script.num_lines) { + toxine_free(tox->script.lines[(tox->script.num_lines - 1)]); + tox->script.num_lines--; + } + toxine_free(tox->script.lines); + } +} + +static int toxine_script_split_lines(toxine_t *tox, char *_buf) { + + if(_buf) { + char *buf, *p, *pp, *obuf; + + buf = strdup(_buf); + obuf = buf; + pp = buf; + + tox->script.num_lines = 0; + + while((p = strchr(pp, '\n'))) { + if(*(p - 1) == '\\') { + *(p - 1) = ' '; + *p = ' '; + } + else + pp++; + } + + while((p = xine_strsep(&buf, "\n"))) { - p = tox->script.ln; + if(p && (p <= buf) && (strlen(p))) { + + tox->script.lines = (char **) realloc(tox->script.lines, sizeof(char *) * (tox->script.num_lines + 1)); + + while((*(p + strlen(p) - 1) == '\n') || (*(p + strlen(p) - 1) == '\r')) + *(p + strlen(p) - 1) = '\0'; - if(p) { - while(*p != '\0') { - if(*p == '\n' || *p == '\r') { - *p = '\0'; - break; + tox->script.lines[tox->script.num_lines++] = strdup(p); } - - p++; } - while(p > tox->script.ln) { - --p; - - if(*p == ' ') - *p = '\0'; - else - break; - } + toxine_free(buf); } + + return (tox->script.num_lines > 0); } -/* - * Get next line from opened file. - */ static int toxine_script_get_next_line(toxine_t *tox) { - __get_next_line: - tox->script.ln = fgets(tox->script.buf, 255, tox->script.fd); - - while(tox->script.ln && (*tox->script.ln == ' ' || *tox->script.ln == '\t')) ++tox->script.ln; - - if(tox->script.ln) { - if((strncmp(tox->script.ln, "//", 2) == 0) || - (strncmp(tox->script.ln, "#", 1) == 0)) { - goto __get_next_line; - } + __again: + if(tox->script.current < (tox->script.num_lines - 1)) { + tox->script.current++; + tox->script.ln = tox->script.lines[tox->script.current]; + if(tox->script.ln && ((*(tox->script.ln) == '#') || + ((strlen(tox->script.ln) >= 2) && (*(tox->script.ln) == '/') && (*(tox->script.ln + 1) == '/')))) + goto __again; + return 1; } - - toxine_script_clean_eol(tox); - - if(tox->script.ln && !strlen(tox->script.ln)) - goto __get_next_line; - - return((tox->script.ln != NULL)); + return 0; } /* * Main loop in script mode. */ void toxine_handle_script(toxine_t *tox) { + struct stat st; + int fd; + char *buf; + + if(stat(tox->script.filename, &st) == 0) { + + if(st.st_size > 0) { + + if((fd = open(tox->script.filename, O_RDONLY)) != -1) { + off_t br; + + buf = (char *) xine_xmalloc(st.st_size + 1); + + if((br = read(fd, buf, st.st_size)) != st.st_size) { + close(fd); + toxine_free(buf); + fprintf(stderr, "read() returned wrong size (expected %lld, readed %lld)\n", st.st_size, br); + return; + } + + close(fd); + + buf[br] = '\0'; + tox->interactive = 0; + + if(toxine_script_split_lines(tox, buf)) { + + while(toxine_script_get_next_line(tox) && tox->running) { + + if(tox->script.ln) { + toxine_set_command_line(tox, tox->script.ln); + toxine_handle_command(tox, NULL); + } + + memset(&tox->command.command, 0, sizeof(tox->command.command)); + } + + toxine_free(buf); + toxine_script_free(tox); + } - if((tox->script.fd = fopen(tox->script.filename, "r")) != NULL) { - - tox->interactive = 0; - - while(toxine_script_get_next_line(tox) && tox->running) { - - if(tox->script.ln) { - toxine_set_command_line(tox, tox->script.ln); - toxine_handle_command(tox, NULL); } - - memset(&tox->command.command, 0, sizeof(tox->command.command)); + else + fprintf(stderr, "failed to open '%s': %s\n", tox->script.filename, strerror(errno)); + } - fclose(tox->script.fd); - } - else { - fprintf(stderr, "failed to open '%s': %s\n", tox->script.filename, strerror(errno)); + else + fprintf(stderr, "file is empty; '%s'\n", tox->script.filename); + } + else + fprintf(stderr, "unable to stat() '%s': %s\n", tox->script.filename, strerror(errno)); + } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 21:29:12
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7387 Modified Files: commands.c Log Message: @@typo in repeat syntax Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- commands.c 19 May 2004 21:23:38 -0000 1.69 +++ commands.c 19 May 2004 21:29:02 -0000 1.70 @@ -350,7 +350,7 @@ { "repeat", REQUIRE_ARGS, do_repeat, "repeat x time a set of commands", "repeat <x> <command>\n" - "repeat <x> { <<command><;command>...> }" + "repeat <x> { <<command><\\;command>...> }" }, { "right", NO_ARGS, do_events, "send XINE_EVENT_INPUT_RIGHT event to xine engine", |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 21:23:49
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6332 Modified Files: commands.c parse.c utils.c utils.h Log Message: add repeat command Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- commands.c 19 May 2004 20:19:03 -0000 1.68 +++ commands.c 19 May 2004 21:23:38 -0000 1.69 @@ -162,6 +162,8 @@ static void do_dumpconfig(commands_t *, toxine_t *, void *); 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 commands_t commands[] = { { "!", NO_ARGS, do_shell, @@ -345,6 +347,11 @@ "Quit toxine.", "quit" }, + { "repeat", REQUIRE_ARGS, do_repeat, + "repeat x time a set of commands", + "repeat <x> <command>\n" + "repeat <x> { <<command><;command>...> }" + }, { "right", NO_ARGS, do_events, "send XINE_EVENT_INPUT_RIGHT event to xine engine", "right" @@ -2357,7 +2364,62 @@ gettimeofday(&tv, NULL); if((ptm = localtime(&tv.tv_sec))) - pinfo("%02d:%02d:%02d.%d\n", ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)(tv.tv_usec / 1000)); + pinfo("%02d:%02d:%02d.%03d\n", ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)(tv.tv_usec / 1000)); pinfo(".\n"); } + +static void do_repeat(commands_t *command, toxine_t *tox, void *data) { + int nargs; + + nargs = toxine_is_args(tox); + if(nargs >= 2) { + char *c_repeat; + int repeat = 0; + char *f_command = NULL; + + c_repeat = (char *) toxine_get_arg(tox, 1); + if((repeat = strtol(c_repeat, &c_repeat, 10))) { + + if(toxine_is_arg_match(tox, 2, "{") && toxine_is_last_arg_match(tox, "}")) { + int i = 3; + + for(;i < tox->command.num_args; i++) { + char *arg = (char *) toxine_get_arg(tox, i); + int len = strlen(arg); + int f_len = (f_command ? strlen(f_command) : 0); + + if(!f_command) + f_command = strdup(arg); + else { + f_command = (char *) realloc(f_command, f_len + len + 2); + strcat(f_command, " "); + strcat(f_command, arg); + } + } + + } + else + f_command = strdup((char *)toxine_get_arg(tox, 2)); + + if(f_command && strlen(f_command)) { + char *r_command = NULL; + int i; + + r_command = (char *) xine_xmalloc(((strlen(f_command) + 1) * repeat) + 1); + for(i = 0; i < repeat; i++) { + strcat(r_command, f_command); + strcat(r_command, ";"); + } + + toxine_set_command_line(tox, r_command); + toxine_handle_command(tox, NULL); + toxine_free(r_command); + } + + toxine_free(f_command); + + } + } +} + Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- parse.c 17 May 2004 20:31:43 -0000 1.8 +++ parse.c 19 May 2004 21:23:38 -0000 1.9 @@ -46,7 +46,9 @@ if((tox->command.remain) && (tox->command.line)) return; - if((tox->command.remain == NULL) && (tox->command.line && (strchr(tox->command.line, ';')))) { + if((tox->command.remain == NULL) && + (tox->command.line && + ((p = strchr(tox->command.line, ';')) && (*(p - 1) != '\\')))) { tox->command.remain = strdup(tox->command.line); toxine_free(tox->command.line); } @@ -58,7 +60,7 @@ memset(&commandline, 0, sizeof(commandline)); memset(&remaining, 0, sizeof(remaining)); - if((p = strchr(tox->command.remain, ';')) != NULL) { + if((p = strchr(tox->command.remain, ';')) && (*(p - 1) != '\\')) { pp = tox->command.remain; pbuf = commandline; @@ -140,13 +142,24 @@ * parse command, extract arguments. */ void toxine_parse_command(toxine_t *tox) { - char *cmd, *cmdl; + char *p, *cmd, *cmdl; int i = 0; toxine_parse_destock_remain(tox); + + if((p = strchr(tox->command.line, ';'))) { - if(strchr(tox->command.line, ';')) - toxine_parse_handle_multicommands(tox); + if((*(p - 1) != '\\')) + toxine_parse_handle_multicommands(tox); + else { + char *pp = tox->command.line; + + while((p = strchr(pp, ';')) && (*(p - 1) == '\\')) { + *(p - 1) = ' '; + pp = p + 1; + } + } + } cmdl = tox->command.line; @@ -262,7 +275,9 @@ case ' ': if((*(pcmd - 1) != '\\') && ((get_quote == 0) && (get_dbl_quote == 0))) { - + while(*(pcmd + 1) == ' ') + pcmd++; + __end_args: sprintf(tox->command.args[nargs], "%s", buf); nargs++; Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- utils.c 17 May 2004 20:31:43 -0000 1.28 +++ utils.c 19 May 2004 21:23:38 -0000 1.29 @@ -261,6 +261,37 @@ return 0; } +int toxine_is_arg_match(toxine_t *tox, int pos, const char *arg) { + + if(tox && pos && ((arg != NULL) && (strlen(arg))) && (tox->command.num_args >= pos)) { + if(!strcmp(tox->command.args[pos - 1], arg)) + return 1; + } + + return 0; +} + +/* + * return 1 if last arg match *arg + */ +int toxine_is_last_arg_contain(toxine_t *tox, const char *arg) { + + if(tox && ((arg != NULL) && (strlen(arg))) && tox->command.num_args) { + if(!strncmp(tox->command.args[tox->command.num_args - 1], arg, strlen(tox->command.args[tox->command.num_args - 1]))) + return 1; + } + + return 0; +} +int toxine_is_last_arg_match(toxine_t *tox, const char *arg) { + + if(tox && ((arg != NULL) && (strlen(arg))) && tox->command.num_args) { + if(!strcmp(tox->command.args[tox->command.num_args - 1], arg)) + return 1; + } + + return 0; +} /* * Set current command line from line. Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- utils.h 17 May 2004 19:53:25 -0000 1.14 +++ utils.h 19 May 2004 21:23:38 -0000 1.15 @@ -35,6 +35,10 @@ int toxine_is_args(toxine_t *tox); const char *toxine_get_arg(toxine_t *tox, int num); int toxine_is_arg_contain(toxine_t *tox, int pos, const char *arg); +int toxine_is_arg_match(toxine_t *tox, int pos, const char *arg); +int toxine_is_last_arg_contain(toxine_t *tox, const char *arg); +int toxine_is_last_arg_match(toxine_t *tox, const char *arg); + int toxine_mkdir_safe(char *path); void toxine_draw_bar(toxine_t *tox, char *title, int min, int max, int val); |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-19 20:19:13
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25466 Modified Files: commands.c Log Message: add gettime command Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- commands.c 17 May 2004 21:23:35 -0000 1.67 +++ commands.c 19 May 2004 20:19:03 -0000 1.68 @@ -30,6 +30,7 @@ #include <errno.h> #include <time.h> #include <pthread.h> +#include <time.h> #include <readline.h> #include <tilde.h> @@ -160,7 +161,7 @@ static void do_echo(commands_t *, toxine_t *, void *); static void do_dumpconfig(commands_t *, toxine_t *, void *); static void do_dumpstream(commands_t *, toxine_t *, void *); - +static void do_gettime(commands_t *, toxine_t *, void *); static commands_t commands[] = { { "!", NO_ARGS, do_shell, @@ -242,6 +243,10 @@ "get video property_min_max <property> (see xine_get_video_property_min_max)\n" "get video help" }, + { "gettime", NO_ARGS, do_gettime, + "Display current time.", + "gettime" + }, { "help", OPTIONAL_ARGS, do_help, "Display the help text if a command name is specified, otherwise display all available commands.", "help [command]" @@ -2345,3 +2350,14 @@ static void do_dumpstream(commands_t *command, toxine_t *tox, void *data) { _NAPI_xine_dumpstream(tox); } + +static void do_gettime(commands_t *command, toxine_t *tox, void *data) { + struct tm *ptm; + struct timeval tv; + + gettimeofday(&tv, NULL); + if((ptm = localtime(&tv.tv_sec))) + pinfo("%02d:%02d:%02d.%d\n", ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)(tv.tv_usec / 1000)); + + pinfo(".\n"); +} |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 22:01:40
|
Update of /cvsroot/toxine/toxine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12749 Modified Files: README Log Message: fix script example Index: README =================================================================== RCS file: /cvsroot/toxine/toxine/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- README 6 May 2004 19:18:25 -0000 1.2 +++ README 17 May 2004 22:01:27 -0000 1.3 @@ -2,18 +2,20 @@ ## ## You need to use xine-lib >= 1rc3b ## -## A small script exemple: +## A small script example: -set video driver xv; set audio driver alsa09 +set video driver xv; set audio driver alsa xine_init +xine_stream_new xine_play mrl /media/AVI/Everclear\ -\ When\ It\ All\ Goes\ Wrong\ Again.avi time 10 -waitfor PLAYBACK_FINISHED +waitfor UI_PLAYBACK_FINISHED xine_play mrl /media/MPEG-I/enigma_push_the_limits.mpg waitfor status PLAY +xine_usec_sleep 900000 seek +20 -waitfor MOUSE_BUTTON +waitfor INPUT_MOUSE_BUTTON pause -waitfor MOUSE_BUTTON +waitfor INPUT_MOUSE_BUTTON pause jump 20 xine_usec_sleep 9000000 |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 21:23:49
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4757 Modified Files: commands.c common.h main.c Log Message: fix C-c segfault. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- commands.c 17 May 2004 20:31:42 -0000 1.66 +++ commands.c 17 May 2004 21:23:35 -0000 1.67 @@ -663,26 +663,6 @@ } /* - * Handle signals event. - */ -static void toxine_signals_handler (int sig) { - - switch(sig) { - /* Kill the line on C-c */ - case SIGINT: - case SIGTERM: - if(rl_prompt) { /* readline is running, otherwise we are in script mode */ - rl_kill_full_line(1, 1); - rl_redisplay(); - } - else - exit(1); - break; - - } -} - -/* * Handle user entered commands. */ void toxine_handle_command(toxine_t *tox, void *data) { Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- common.h 17 May 2004 19:53:24 -0000 1.28 +++ common.h 17 May 2004 21:23:35 -0000 1.29 @@ -23,6 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <signal.h> #include <limits.h> #include <pthread.h> @@ -182,6 +183,7 @@ } mediamark_t; struct toxine_s { + pid_t pid; int argc; char **argv; @@ -283,4 +285,6 @@ char *syntax; }; +void toxine_signals_handler (int sig); + #endif Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- main.c 17 May 2004 20:31:43 -0000 1.32 +++ main.c 17 May 2004 21:23:35 -0000 1.33 @@ -42,6 +42,8 @@ # include "getopt.h" #endif +#include <readline.h> + #include <xine.h> #include <xine/xineutils.h> @@ -69,6 +71,33 @@ }; /* + * Handle signals event. + */ +void toxine_signals_handler (int sig) { + pid_t pid = getppid(); + + if(pid == tox->pid) { + + switch(sig) { + /* Kill the line on C-c */ + case SIGINT: + case SIGTERM: + case SIGQUIT: + if(rl_prompt) { /* readline is running, otherwise we are in script mode */ + rl_kill_full_line(1, 1); + rl_redisplay(); + } + else { + tox->video.running = tox->running = 0; + exit(1); + } + break; + + } + } +} + +/* * Display version/copyright banner. */ static void toxine_show_version(toxine_t *tox) { @@ -189,6 +218,7 @@ tox = (toxine_t *) xine_xmalloc(sizeof(toxine_t)); + tox->pid = getppid(); tox->command.remain = NULL; tox->command.line = NULL; tox->command.command = NULL; |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:32:05
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25018 Modified Files: commands.c loader.c main.c parse.c playlist.c script.c utils.c Log Message: Remove declaration of errno type. Remove malloc/realloc couple, only use realloc. Remove forgotten debug printf. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- commands.c 17 May 2004 20:04:16 -0000 1.65 +++ commands.c 17 May 2004 20:31:42 -0000 1.66 @@ -44,8 +44,6 @@ #include "script.h" #include "playlist.h" -extern int errno; - static struct event_struct_s { char *name; uint32_t event; @@ -1770,7 +1768,6 @@ tox->playlist.loop = 0; if(tox->playlist.num && (tox->playlist.cur == -1)) { - printf("tox->playlist.num && (tox->playlist.cur == -1)\n"); tox->playlist.cur = 0; toxine_set_current_mrl_from_cur(tox); } Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- loader.c 17 May 2004 20:15:52 -0000 1.18 +++ loader.c 17 May 2004 20:31:43 -0000 1.19 @@ -33,8 +33,6 @@ #include "common.h" -extern int errno; - #ifdef LOCAL_BUILD #warning "Load plugins from plugins/.libs" #undef TOXINE_PLUGINDIR Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- main.c 17 May 2004 20:08:28 -0000 1.31 +++ main.c 17 May 2004 20:31:43 -0000 1.32 @@ -50,8 +50,6 @@ #include "commands.h" #include "playlist.h" -extern int errno; - static toxine_t *tox; /* options args */ Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- parse.c 16 May 2004 20:28:40 -0000 1.7 +++ parse.c 17 May 2004 20:31:43 -0000 1.8 @@ -86,11 +86,7 @@ if(p) sprintf(remaining, "%s", (toxine_atoa(p))); - if(tox->command.line) - tox->command.line = (char *) realloc(tox->command.line, - sizeof(char *) * (strlen(c) + 1)); - else - tox->command.line = (char *) xine_xmalloc(sizeof(char *) * (strlen(c) + 1)); + tox->command.line = (char *) realloc(tox->command.line, sizeof(char *) * (strlen(c) + 1)); sprintf(tox->command.line, "%s", c); @@ -105,8 +101,7 @@ } if(strlen(remaining)) { - tox->command.remain = (char *) realloc(tox->command.remain, - sizeof(char *) * (strlen(remaining) + 1)); + tox->command.remain = (char *) realloc(tox->command.remain, sizeof(char *) * (strlen(remaining) + 1)); sprintf(tox->command.remain, "%s", remaining); } else { @@ -120,13 +115,7 @@ } else { /* no ';' in remain, copy AS IS remain to line */ - if(tox->command.line) - tox->command.line = (char *) realloc(tox->command.line, - sizeof(char *) * (strlen(tox->command.remain) + 1)); - else - tox->command.line = (char *) xine_xmalloc(sizeof(char *) * - (strlen(tox->command.remain) + 1)); - + tox->command.line = (char *) realloc(tox->command.line, sizeof(char *) * (strlen(tox->command.remain) + 1)); sprintf(tox->command.line, "%s", tox->command.remain); toxine_free(tox->command.remain); @@ -180,12 +169,8 @@ cmd = NULL; if(cmd) { - if(tox->command.command) - tox->command.command = (char *) realloc(tox->command.command, - strlen(cmdl) - strlen(cmd) + 1); - else - tox->command.command = (char *) xine_xmalloc(strlen(cmdl) - strlen(cmd) + 1); - + tox->command.command = (char *) realloc(tox->command.command, strlen(cmdl) - strlen(cmd) + 1); + memset(tox->command.command, 0, sizeof(tox->command.command)); snprintf(tox->command.command, (strlen(cmdl) - strlen(cmd))+1, "%s", cmdl); @@ -303,12 +288,8 @@ } } else { - - if(tox->command.command) - tox->command.command = (char *) realloc(tox->command.command, strlen(cmdl) + 1); - else - tox->command.command = (char *) xine_xmalloc(strlen(cmdl) + 1); - + tox->command.command = (char *) realloc(tox->command.command, strlen(cmdl) + 1); + memset(tox->command.command, 0, sizeof(tox->command.command)); sprintf(tox->command.command, "%s", cmdl); } Index: playlist.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/playlist.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- playlist.c 7 Apr 2004 18:21:07 -0000 1.12 +++ playlist.c 17 May 2004 20:31:43 -0000 1.13 @@ -16,6 +16,7 @@ ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ +#warning Backport xine-ui playlists #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,8 +34,6 @@ #include "common.h" #include "utils.h" -extern int errno; - typedef struct { FILE *fd; char buf[256]; @@ -228,10 +227,7 @@ if(valid_pls) { entries_pls++; - if(entries_pls == 1) - mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else - mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); + mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); _playlist_store_mmk(&mmk[(entries_pls - 1)], playlist->ln, NULL, 0, -1); playlist->entries = entries_pls; @@ -286,10 +282,7 @@ entries_pls++; - if(entries_pls == 1) - mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else - mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); + mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); _playlist_store_mmk(&mmk[(entries_pls - 1)], playlist->ln, NULL, 0, -1); playlist->entries = entries_pls; @@ -345,10 +338,7 @@ entries_pls++; - if(entries_pls == 1) - mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else - mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); + mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); _playlist_store_mmk(&mmk[(entries_pls - 1)], entry, NULL, 0, -1); playlist->entries = entries_pls; @@ -411,10 +401,7 @@ entries_pls++; - if(entries_pls == 1) - mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else - mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); + mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); _playlist_store_mmk(&mmk[(entries_pls - 1)], playlist->ln, NULL, 0, -1); playlist->entries = entries_pls; @@ -551,10 +538,7 @@ entries_pls++; - if(entries_pls == 1) - mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else - mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); + mmk = (mediamark_t **) realloc(mmk, sizeof(mediamark_t *) * (entries_pls + 1)); _playlist_store_mmk(&mmk[(entries_pls - 1)], mmkf.mrl, mmkf.ident, mmkf.start, mmkf.end); @@ -612,15 +596,19 @@ } void playlist_add_entry(toxine_t *tox, const char *mrl, const char *ident, int start, int end) { - if(!tox->playlist.num) +#warning FIXME + /* + if(!tox->playlist.num) tox->playlist.mmk = (mediamark_t **) xine_xmalloc(sizeof(mediamark_t *) * 2); - else { + else { if(tox->playlist.num > 1) { - tox->playlist.mmk = (mediamark_t **) - realloc(tox->playlist.mmk, sizeof(mediamark_t *) * (tox->playlist.num + 1)); - } - } + */ + tox->playlist.mmk = (mediamark_t **) realloc(tox->playlist.mmk, sizeof(mediamark_t *) * (tox->playlist.num + 1)); + /* + } + } + */ if(_playlist_store_mmk(&tox->playlist.mmk[tox->playlist.num], mrl, ident, start, end)) tox->playlist.num++; } Index: script.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/script.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- script.c 7 Apr 2004 18:21:07 -0000 1.3 +++ script.c 17 May 2004 20:31:43 -0000 1.4 @@ -26,8 +26,6 @@ #include "commands.h" #include "utils.h" -extern int errno; - /* * Cleanup the EOL ('\n','\r',' ') */ Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- utils.c 17 May 2004 19:53:25 -0000 1.27 +++ utils.c 17 May 2004 20:31:43 -0000 1.28 @@ -34,7 +34,6 @@ #include "tilde.h" extern char **environ; -extern int errno; #include "common.h" #include "playlist.h" @@ -270,11 +269,7 @@ if(tox && line && strlen(line)) { - if(tox->command.line) - tox->command.line = (char *) realloc(tox->command.line, strlen(line) + 1); - else - tox->command.line = (char *) xine_xmalloc(strlen(line) + 1); - + tox->command.line = (char *) realloc(tox->command.line, strlen(line) + 1); memset(tox->command.line, 0, sizeof(tox->command.line)); sprintf(tox->command.line, "%s", line); @@ -441,11 +436,7 @@ void toxine_set_last_char_result(toxine_t *tox, const char *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); - + tox->last_result = (char *) realloc(tox->last_result, (strlen(result) + 1)); memset(tox->last_result, 0, sizeof(tox->last_result)); sprintf(tox->last_result, "%s", result); } @@ -467,11 +458,7 @@ 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); - + tox->last_result = (char *) realloc(tox->last_result, (len + 1)); memset(tox->last_result, 0, sizeof(tox->last_result)); i = 0; |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:16:04
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20682 Modified Files: Makefile.am loader.c Log Message: Finally fix the local loader recurrent bug i commit each single days ;-). Just touching .local in srr directory define the LOCAL_BUILD in loader.c. Index: Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/src/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Makefile.am 9 Apr 2004 17:43:14 -0000 1.9 +++ Makefile.am 17 May 2004 20:15:52 -0000 1.10 @@ -1,7 +1,7 @@ SUBDIRS = plugins -AM_CFLAGS = @CFLAGS@ @XINE_CFLAGS@ @READLINE_INCLUDES@ +AM_CFLAGS = @CFLAGS@ @XINE_CFLAGS@ @READLINE_INCLUDES@ `if test -f .local; then echo -DLOCAL_BUILD; fi` LIBTOOL = $(SHELL) $(top_builddir)/libtoollib-nofpic bin_PROGRAMS = toxine @@ -30,7 +30,7 @@ noinst_HEADERS = common.h utils.h commands.h parse.h xine_commands.h loader.h script.h playlist.h debug: - @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) @XINE_CFLAGS@" + @$(MAKE) CFLAGS="$(DEBUG_CFLAGS) @XINE_CFLAGS@ `if test -f .local; then echo -DLOCAL_BUILD; fi`" install-debug: debug @list='$(SUBDIRS)'; for subdir in $$list; do \ Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- loader.c 17 May 2004 20:08:28 -0000 1.17 +++ loader.c 17 May 2004 20:15:52 -0000 1.18 @@ -35,8 +35,8 @@ extern int errno; -/* #define LOCAL_BUILD 1 */ #ifdef LOCAL_BUILD +#warning "Load plugins from plugins/.libs" #undef TOXINE_PLUGINDIR #define TOXINE_PLUGINDIR "plugins/.libs" #endif |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:08:39
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19397 Modified Files: loader.c main.c Log Message: typo and loader fix Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- loader.c 17 May 2004 19:53:25 -0000 1.16 +++ loader.c 17 May 2004 20:08:28 -0000 1.17 @@ -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: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- main.c 17 May 2004 19:53:25 -0000 1.30 +++ main.c 17 May 2004 20:08:28 -0000 1.31 @@ -96,7 +96,7 @@ printf("Usage: toxine [options]\n"); printf(" -s, --script <filename> Use <filename> as toxine script file.\n"); - printf(" -S, --stdin Send commands line using stdin.\n"); + printf(" -S, --stdin Send command lines using stdin.\n"); printf(" -e, --execute <commands> Execute specified commands (like in prompt mode).\n"); printf(" -o, --output [filename] Save all messages in a file(*).\n"); printf(" *('toxine.out' if filename isn't specified).\n"); |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:04:27
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18479 Modified Files: commands.c Log Message: @@cosmetic Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- commands.c 17 May 2004 20:03:18 -0000 1.64 +++ commands.c 17 May 2004 20:04:16 -0000 1.65 @@ -797,6 +797,7 @@ if(FD_ISSET(fd, &set)) { if((len = read(fd, &command, 32767))) { char *p = command; + command[len - 1] = '\0'; while(p && (*p != '\0')) { @@ -811,6 +812,7 @@ break; } } + toxine_set_command_line(tox, command); toxine_handle_command(tox, NULL); } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:03:28
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18353 Modified Files: commands.c Log Message: fix stdin and << usage Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- commands.c 17 May 2004 19:53:24 -0000 1.63 +++ commands.c 17 May 2004 20:03:18 -0000 1.64 @@ -777,7 +777,7 @@ static void toxine_handle_stdin(toxine_t *tox) { int fd; - char c[255]; + char command[32768]; int len; fd_set set; struct timeval tv; @@ -795,11 +795,23 @@ select(fd + 1, &set, NULL, NULL, &tv); if(FD_ISSET(fd, &set)) { - len = read(fd, &c, 255); - if(len > 0) { - c[len - 1] = '\0'; - - toxine_set_command_line(tox, c); + if((len = read(fd, &command, 32767))) { + char *p = command; + command[len - 1] = '\0'; + + while(p && (*p != '\0')) { + switch(*p) { + case '\n': + *p = ';'; + p++; + break; + + default: + p++; + break; + } + } + toxine_set_command_line(tox, command); toxine_handle_command(tox, NULL); } } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 19:53:38
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15578 Modified Files: commands.c common.h loader.c main.c utils.c utils.h xine_commands.c xine_commands.h Log Message: Add stdin control feature (-S). Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- commands.c 16 May 2004 20:28:39 -0000 1.62 +++ commands.c 17 May 2004 19:53:24 -0000 1.63 @@ -775,6 +775,38 @@ } } +static void toxine_handle_stdin(toxine_t *tox) { + int fd; + char c[255]; + int len; + fd_set set; + struct timeval tv; + + fd = STDIN_FILENO; + + while(tox->running) { + + FD_ZERO(&set); + FD_SET(fd, &set); + + tv.tv_sec = 0; + tv.tv_usec = 500000; + + select(fd + 1, &set, NULL, NULL, &tv); + + if(FD_ISSET(fd, &set)) { + len = read(fd, &c, 255); + if(len > 0) { + c[len - 1] = '\0'; + + toxine_set_command_line(tox, c); + toxine_handle_command(tox, NULL); + } + } + } + +} + /* * The main loop (except for execute and script mode). */ @@ -845,7 +877,11 @@ _xine_stream_new(NULL, tox, NULL); } - if(tox->script.in_use) { + if(tox->stdin) { + tox->interactive = 0; + toxine_handle_stdin(tox); + } + else if(tox->script.in_use) { toxine_handle_script(tox); tox->video.running = tox->running = 0; } @@ -942,7 +978,7 @@ if(toxine_is_arg_contain(tox, 2, "volume")) { if(tox->audio.mixer.enable) - toxine_draw_bar("Current audio volume", 0, 100, tox->audio.mixer.volume_level); + toxine_draw_bar(tox, "Current audio volume", 0, 100, tox->audio.mixer.volume_level); else pinfo("Audio mixer is disable.\n"); @@ -1174,7 +1210,7 @@ static void do_quit(commands_t *command, toxine_t *tox, void *data) { if(tox->interactive) { - if((toxine_confirm("Do you really want to quit toxine ? [yes|no]: "))) + if((toxine_confirm(tox, "Do you really want to quit toxine ? [yes|no]: "))) tox->video.running = tox->running = 0; } else @@ -1807,7 +1843,7 @@ return_if_no_init(tox); xine_get_pos_length(tox->stream, &pos, NULL, NULL); - toxine_draw_bar("Current position", 0, 65535, pos); + toxine_draw_bar(tox, "Current position", 0, 65535, pos); } else if(toxine_is_arg_contain(tox, 2, "time")) { int seconds; @@ -1904,7 +1940,7 @@ pinfo(" ident: '%s'\n", mmk.ident); pinfo(" mrl: '%s'\n", mmk.mrl); pinfo(" start @ %d, end @ %d.\n", mmk.start, mmk.end); - confirm = (tox->interactive) ? (toxine_confirm("Add mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive) ? (toxine_confirm(tox, "Add mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_add_entry(tox, mmk.mrl, mmk.ident, mmk.start, mmk.end); @@ -1978,7 +2014,7 @@ pinfo(" ident: '%s'\n", mmk.ident); pinfo(" mrl: '%s'\n", mmk.mrl); pinfo(" start @ %d, end @ %d.\n", mmk.start, mmk.end); - confirm = (tox->interactive) ? (toxine_confirm("Add mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive) ? (toxine_confirm(tox, "Add mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_add_entry(tox, mmk.mrl, mmk.ident, mmk.start, mmk.end); @@ -2200,7 +2236,7 @@ pinfo(" mrl: '%s'\n", mmk.mrl); pinfo(" start @ %d, end @ %d.\n", mmk.start, mmk.end); - confirm = (tox->interactive) ? (toxine_confirm("Replace mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive) ? (toxine_confirm(tox, "Replace mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_replace_entry(&tox->playlist.mmk[entry], Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- common.h 16 May 2004 20:28:40 -0000 1.27 +++ common.h 17 May 2004 19:53:24 -0000 1.28 @@ -82,39 +82,51 @@ } while(0) #define poutalign() do { \ - fprintf(stdout, "%s", EMPTY_PREFIX); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, "%s", EMPTY_PREFIX); \ + fflush(stdout); \ + } \ } while(0) #define pout(FMT,ARGS...) do { \ - fprintf(stdout, FMT, ##ARGS); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, FMT, ##ARGS); \ + fflush(stdout); \ + } \ } while(0) #define perr(FMT,ARGS...) do { \ - fprintf(stdout, "%s", ERROR_PREFIX); \ - fprintf(stdout, FMT, ##ARGS); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, "%s", ERROR_PREFIX); \ + fprintf(stdout, FMT, ##ARGS); \ + fflush(stdout); \ + } \ } while(0) #define pinfo(FMT,ARGS...) do { \ - fprintf(stdout, "%s", INFO_PREFIX); \ - fprintf(stdout, FMT, ##ARGS); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, "%s", INFO_PREFIX); \ + fprintf(stdout, FMT, ##ARGS); \ + fflush(stdout); \ + } \ } while(0) #define phelp(FMT,ARGS...) do { \ - fprintf(stdout, "%s", HELP_PREFIX); \ - fprintf(stdout, FMT, ##ARGS); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, "%s", HELP_PREFIX); \ + fprintf(stdout, FMT, ##ARGS); \ + fflush(stdout); \ + } \ } while(0) #define pecho(FMT,ARGS...) do { \ - fprintf(stdout, "%s", ECHO_PREFIX); \ - fprintf(stdout, FMT, ##ARGS); \ - fflush(stdout); \ + if(!tox->stdin) { \ + fprintf(stdout, "%s", ECHO_PREFIX); \ + fprintf(stdout, FMT, ##ARGS); \ + fflush(stdout); \ + } \ } while(0) #define return_if_no_init(x) do { \ - if(((x)->xine == NULL) || !((x)->xine_state & XINE_INIT)) { \ + if(((x)->xine == NULL) || !((x)->xine_state & XINE_INIT)) { \ perr("%s(): xine engine uninitialized. Do it first.\n", \ __tox_func__); \ return; \ @@ -256,6 +268,8 @@ char buf[256]; char *ln; } script; + + int stdin; }; typedef struct commands_s commands_t; Index: loader.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/loader.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- loader.c 11 Apr 2004 13:32:04 -0000 1.15 +++ loader.c 17 May 2004 19:53:25 -0000 1.16 @@ -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: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- main.c 16 May 2004 20:35:11 -0000 1.29 +++ main.c 17 May 2004 19:53:25 -0000 1.30 @@ -55,7 +55,7 @@ static toxine_t *tox; /* options args */ -static const char *short_options = "?hs:e:o::vV:A:iI"; +static const char *short_options = "?hs:e:o::vV:A:iIS"; static struct option long_options[] = { { "help" , no_argument , 0, 'h' }, { "script" , required_argument, 0, 's' }, @@ -64,7 +64,8 @@ { "video" , required_argument, 0, 'V' }, { "audio" , required_argument, 0, 'A' }, { "interactive" , required_argument, 0, 'i' }, - { "autoinit" , no_argument, 0, 'I' }, + { "autoinit" , no_argument , 0, 'I' }, + { "stdin" , no_argument , 0, 'S' }, { "version" , no_argument , 0, 'v' }, { 0 , no_argument , 0, 0 } }; @@ -72,19 +73,19 @@ /* * Display version/copyright banner. */ -static void toxine_show_version(void) { +static void toxine_show_version(toxine_t *tox) { int major, minor, sub; - printf("This is toxine - xine shell v%s\n" - "(c) 2002-2003 by Daniel Caujolle-Bert <f1...@us...>.\n", VERSION); + pout("This is toxine - xine shell v%s\n" + "(c) 2002-2003 by Daniel Caujolle-Bert <f1...@us...>.\n", VERSION); - printf("Built with xine library %d.%d.%d (%s)\n", - XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION, XINE_VERSION); + pout("Built with xine library %d.%d.%d (%s)\n", + XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION, XINE_VERSION); xine_get_version (&major, &minor, &sub); - printf("Found xine library version: %d.%d.%d (%s).\n", - major, minor, sub, xine_get_version_string()); + pout("Found xine library version: %d.%d.%d (%s).\n", + major, minor, sub, xine_get_version_string()); } @@ -95,6 +96,7 @@ printf("Usage: toxine [options]\n"); printf(" -s, --script <filename> Use <filename> as toxine script file.\n"); + printf(" -S, --stdin Send commands line using stdin.\n"); printf(" -e, --execute <commands> Execute specified commands (like in prompt mode).\n"); printf(" -o, --output [filename] Save all messages in a file(*).\n"); printf(" *('toxine.out' if filename isn't specified).\n"); @@ -261,8 +263,12 @@ tox->autoinit = 1; break; + case 'S': + tox->stdin = 1; + break; + case 'v': /* Display version and exit*/ - toxine_show_version(); + toxine_show_version(tox); exit(1); break; @@ -292,7 +298,7 @@ fprintf(stderr, "Cannot dup2 stderr: %s\n", strerror(errno)); } - toxine_show_version(); + toxine_show_version(tox); toxine_get_extra_argv(tox, argc - optind, &argv[optind], argv[0]); Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- utils.c 16 May 2004 20:28:40 -0000 1.26 +++ utils.c 17 May 2004 19:53:25 -0000 1.27 @@ -122,7 +122,7 @@ return pbuf; } -int toxine_confirm(char *message) { +int toxine_confirm(toxine_t *tox, char *message) { char *line; char prompt[strlen(HELP_PREFIX) + strlen(message) + 1]; @@ -146,7 +146,7 @@ return 0; } -void toxine_draw_bar(char *title, int min, int max, int val) { +void toxine_draw_bar(toxine_t *tox, char *title, int min, int max, int val) { float _val = (int) val; float _min = (int) min; float _max = (int) max; @@ -628,7 +628,7 @@ } } -void toxine_show_stream_info(int info_type, uint32_t iinfo) { +void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo) { switch(info_type) { case XINE_STREAM_INFO_BITRATE: case XINE_STREAM_INFO_SEEKABLE: Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- utils.h 16 May 2004 20:28:40 -0000 1.13 +++ utils.h 17 May 2004 19:53:25 -0000 1.14 @@ -25,7 +25,7 @@ char *toxine_get_yesno_string(uint32_t val); char *toxine_get_fourcc_string(uint32_t f); char *toxine_atoa(char *str); -int toxine_confirm(char *message); +int toxine_confirm(toxine_t *tox, char *message); void toxine_update_prompt(toxine_t *tox); int toxine_system(int dont_run_as_root, char *command); int toxine_get_bool_value(const char *val); @@ -36,7 +36,7 @@ const char *toxine_get_arg(toxine_t *tox, int num); int toxine_is_arg_contain(toxine_t *tox, int pos, const char *arg); int toxine_mkdir_safe(char *path); -void toxine_draw_bar(char *title, int min, int max, int val); +void toxine_draw_bar(toxine_t *tox, char *title, int min, int max, int val); void toxine_set_last_char_result(toxine_t *tox, const char *result); void toxine_set_last_achar_result(toxine_t *tox, const char *const *result); @@ -53,7 +53,7 @@ void toxine_config_load(toxine_t *tox); void toxine_config_save(toxine_t *tox); -void toxine_show_stream_info(int info_type, uint32_t iinfo); +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.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- xine_commands.c 11 Apr 2004 13:29:38 -0000 1.44 +++ xine_commands.c 17 May 2004 19:53:25 -0000 1.45 @@ -31,6 +31,7 @@ #include <signal.h> #include <pthread.h> +#define XINE_ENABLE_EXPERIMENTAL_FEATURES 1 #include <xine.h> #include <xine/xineutils.h> @@ -676,7 +677,7 @@ } else { - printf("wrong command syntax, try 'syntax xine_play'\n"); + perr("wrong command syntax, try 'syntax xine_play'\n"); return; } @@ -772,7 +773,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); + toxine_show_stream_info(tox, stream_infos[i].type, stream_info); pinfo(".\n"); } } @@ -1107,7 +1108,7 @@ break; case XINE_PARAM_AUDIO_VOLUME: - toxine_draw_bar("audio volume", 0, 255, result); + toxine_draw_bar(tox, "audio volume", 0, 255, result); break; case XINE_PARAM_AUDIO_MUTE: @@ -1115,11 +1116,11 @@ break; case XINE_PARAM_AUDIO_COMPR_LEVEL: - toxine_draw_bar("compression level", 0, 255, result); + toxine_draw_bar(tox, "compression level", 0, 255, result); break; case XINE_PARAM_AUDIO_AMP_LEVEL: - toxine_draw_bar("amplification level", 0, 100, result); + toxine_draw_bar(tox, "amplification level", 0, 100, result); break; case XINE_PARAM_AUDIO_REPORT_LEVEL: @@ -1148,27 +1149,27 @@ break; case XINE_PARAM_VO_HUE: - toxine_draw_bar("video output hue", 0, 65535, result); + toxine_draw_bar(tox, "video output hue", 0, 65535, result); break; case XINE_PARAM_VO_SATURATION: - toxine_draw_bar("video output saturation", 0, 65535, result); + toxine_draw_bar(tox, "video output saturation", 0, 65535, result); break; case XINE_PARAM_VO_CONTRAST: - toxine_draw_bar("video output hue", 0, 65535, result); + toxine_draw_bar(tox, "video output hue", 0, 65535, result); break; case XINE_PARAM_VO_BRIGHTNESS: - toxine_draw_bar("video output brightness", 0, 65535, result); + toxine_draw_bar(tox, "video output brightness", 0, 65535, result); break; case XINE_PARAM_VO_ZOOM_X: - toxine_draw_bar("video output zoom X", 0, 100, result); + toxine_draw_bar(tox, "video output zoom X", 0, 100, result); break; case XINE_PARAM_VO_ZOOM_Y: - toxine_draw_bar("video output zoom Y", 0, 100, result); + toxine_draw_bar(tox, "video output zoom Y", 0, 100, result); break; case XINE_PARAM_VO_PAN_SCAN: @@ -1251,7 +1252,7 @@ toxine_set_last_int_result(tox, result); stime = time / 1000; slength = length / 1000; - toxine_draw_bar("", 0, length, time); + toxine_draw_bar(tox, "", 0, length, time); pinfo("position:\n"); pinfo("Stream %d (0...65535), " "time %02d:%02d:%02d (%dms).\n", @@ -2090,7 +2091,7 @@ 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); + toxine_show_stream_info(tox, stream_infos[i].type, iinfo); } pinfo(".\n"); } Index: xine_commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- xine_commands.h 7 Apr 2004 18:21:07 -0000 1.27 +++ xine_commands.h 17 May 2004 19:53:25 -0000 1.28 @@ -440,7 +440,6 @@ } - #if 0 /* ... */ /* xine_audio_port_t *xine_open_audio_driver (xine_t *self, const char *id, |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-16 20:35:21
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20464 Modified Files: main.c Log Message: @@always set tox->argv[0] Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- main.c 16 May 2004 20:28:40 -0000 1.28 +++ main.c 16 May 2004 20:35:11 -0000 1.29 @@ -155,14 +155,17 @@ * */ static void toxine_get_extra_argv(toxine_t *tox, int argc, char *argv[], char *argv_zero) { - int i; + int i = 0; - tox->argc = argc + 1; - tox->argv = (char **) xine_xmalloc(sizeof(char *) * (argc + 2)); - tox->argv[0] = strdup(argv_zero); - - for(i = 1; i < tox->argc; i++) - tox->argv[i] = strdup(argv[i - 1]); + tox->argc = argc + 1; + tox->argv = (char **) xine_xmalloc(sizeof(char *) * (argc + 2)); + tox->argv[i++] = strdup(argv_zero); + + if((argc - optind)) { + for(; i < tox->argc; i++) + tox->argv[i] = strdup(argv[i - 1]); + } + tox->argv[i] = NULL; } @@ -291,8 +294,7 @@ toxine_show_version(); - if(argc - optind) - toxine_get_extra_argv(tox, argc - optind, &argv[optind], argv[0]); + toxine_get_extra_argv(tox, argc - optind, &argv[optind], argv[0]); /* * generate and init a config "object" |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-16 20:28:50
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18819 Modified Files: commands.c common.h main.c parse.c utils.c utils.h Log Message: support any $ envvar in any command Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- commands.c 12 Apr 2004 12:34:51 -0000 1.61 +++ commands.c 16 May 2004 20:28:39 -0000 1.62 @@ -2254,114 +2254,6 @@ } } -static char *get_var(toxine_t *tox, const char *var) { - - if(tox && var) { - char *variable; - - variable = strchr(var, '$'); - - if(variable && (*variable == '$') && (*(variable + 1) != '$')) { - static char buffer[32768]; - char varname[1024]; - int found = 0; - - memset(buffer, 0, sizeof(buffer)); - memset(varname, 0, sizeof(varname)); - - if(sscanf(variable, "$\(%[a-z-A-Z-0-9-_])", &varname[0]) == 1) - found = 1; - else if(sscanf(variable, "$\{%[a-z-A-Z-0-9-_]}", &varname[0]) == 1) - found = 1; - else if(sscanf(variable, "$%[a-z-A-Z-0-9-_]", &varname[0]) == 1) - found = 1; - - if(found) { - static const char day_names[] = "SunMonTueWedThuFriSat"; - static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; - - found = 0; - if(!strncasecmp(varname, "result", 6)) { - snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); - found = 1; - } - else if(!strncasecmp(varname, "cresult", 7)) { - 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)) { - snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); - found = 1; - } - else if(!strncasecmp(varname, "xresult", 7)) { - snprintf(buffer, sizeof(buffer), "0x%x", toxine_get_last_int_result(tox)); - found = 1; - } - else if(!strncasecmp(varname, "version", 7)) { - snprintf(buffer, sizeof(buffer), "%s", VERSION); - found = 1; - } - else if(!strncasecmp(varname, "date", 4)) { - time_t curtime; - struct tm *lt; - - time(&curtime); - lt = localtime(&curtime); - 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)) { - time_t curtime; - struct tm *lt; - - time(&curtime); - lt = localtime(&curtime); - 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)) { - snprintf(buffer, sizeof(buffer), "%s", (tox->configfile) ? tox->configfile : "UNSET"); - found = 1; - } - else if(!strncasecmp(varname, "video_driver", 12)) { - snprintf(buffer, sizeof(buffer), "%s", (tox->video.name) ? tox->video.name : "UNSET"); - found = 1; - } - else if(!strncasecmp(varname, "audio_driver", 12)) { - snprintf(buffer, sizeof(buffer), "%s", (tox->audio.name) ? tox->audio.name : "UNSET"); - found = 1; - } - else if(!strncasecmp(varname, "mrl", 3)) { - snprintf(buffer, sizeof(buffer), "%s", (tox->current_mrl) ? tox->current_mrl : "UNSET"); - found = 1; - } - else if(!strncasecmp(varname, "script_file", 11)) { - snprintf(buffer, sizeof(buffer), "%s", (tox->script.filename) ? tox->script.filename : "UNSET"); - found = 1; - } - - if(found) - return &buffer[0]; - - } - } - } - - return NULL; -} - static void do_echo(commands_t *command, toxine_t *tox, void *data) { int i; int nargs = toxine_is_args(tox); @@ -2371,7 +2263,7 @@ i = 1; while(i <= nargs) { arg = toxine_get_arg(tox, i++); - if((var = get_var(tox, arg)) != NULL) + if((var = toxine_get_var(tox, arg)) != NULL) len += strlen(var); else len += strlen(arg); @@ -2393,7 +2285,7 @@ arg = toxine_get_arg(tox, i++); - if((var = get_var(tox, arg)) != NULL) + if((var = toxine_get_var(tox, arg)) != NULL) strcat(buffer, var); else strcat(buffer, arg); Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- common.h 11 Apr 2004 13:29:38 -0000 1.26 +++ common.h 16 May 2004 20:28:40 -0000 1.27 @@ -170,6 +170,9 @@ } mediamark_t; struct toxine_s { + int argc; + char **argv; + xine_t *xine; xine_stream_t *stream; xine_event_queue_t *event_queue; Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- main.c 6 May 2004 19:18:33 -0000 1.27 +++ main.c 16 May 2004 20:28:40 -0000 1.28 @@ -136,6 +136,14 @@ for(i = 0; i < 256; i++) toxine_free(tox->command.args[i]); + + if(tox->argc) { + for(i = 0; i < tox->argc; i++) + toxine_free(tox->argv[i]); + + toxine_free(tox->argv); + tox->argc = 0; + } toxine_free(tox->script.filename); @@ -144,6 +152,21 @@ } /* + * + */ +static void toxine_get_extra_argv(toxine_t *tox, int argc, char *argv[], char *argv_zero) { + int i; + + tox->argc = argc + 1; + tox->argv = (char **) xine_xmalloc(sizeof(char *) * (argc + 2)); + tox->argv[0] = strdup(argv_zero); + + for(i = 1; i < tox->argc; i++) + tox->argv[i] = strdup(argv[i - 1]); +} + + +/* * ... */ int main(int argc, char **argv) { @@ -171,6 +194,8 @@ tox->msg_fd = -1; tox->playlist.cur = -1; tox->playlist.loop = 0; + tox->argc = 0; + tox->argv = NULL; /* * parse command line @@ -266,6 +291,9 @@ toxine_show_version(); + if(argc - optind) + toxine_get_extra_argv(tox, argc - optind, &argv[optind], argv[0]); + /* * generate and init a config "object" */ Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- parse.c 7 Apr 2004 18:21:07 -0000 1.6 +++ parse.c 16 May 2004 20:28:40 -0000 1.7 @@ -242,6 +242,39 @@ goto __end_args; break; + case '$': + { + char *var; + char buffer[2048]; + char *p = buffer; + char *pp = pcmd; + + memset(&buffer, 0, sizeof(buffer)); + + while(pp && *pp && *pp != ' ') { + *p = *pp; + p++; + pp++; + } + p = '\0'; + + if((var = toxine_get_var(tox, buffer))) { + p = var; + + while(p && *p != '\0') { + *pb = *p; + pb++; + p++; + } + pcmd += strlen(buffer); + goto __end_args; + } + else + goto __store_char; + + } + break; + case ' ': if((*(pcmd - 1) != '\\') && ((get_quote == 0) && (get_dbl_quote == 0))) { Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- utils.c 11 Apr 2004 13:29:38 -0000 1.25 +++ utils.c 16 May 2004 20:28:40 -0000 1.26 @@ -670,3 +670,144 @@ break; } } + +char *toxine_get_var(toxine_t *tox, const char *var) { + + if(tox && var) { + char *variable; + + variable = strchr(var, '$'); + + if(variable && (*variable == '$') && (*(variable + 1) != '$')) { + static char buffer[32768]; + char varname[1024]; + int found = 0; + + memset(buffer, 0, sizeof(buffer)); + memset(varname, 0, sizeof(varname)); + + if(sscanf(variable, "$\(%[a-z-A-Z-0-9-_])", &varname[0]) == 1) + found = 1; + else if(sscanf(variable, "$\{%[a-z-A-Z-0-9-_]}", &varname[0]) == 1) + found = 1; + else if(sscanf(variable, "$%[a-z-A-Z-0-9-_]", &varname[0]) == 1) + found = 1; + + if(found) { + char *envvar; + + if((envvar = getenv(varname))) { + snprintf(buffer, sizeof(buffer), "%s", envvar); + + return &buffer[0]; + } + } + + if(found) { + static const char day_names[] = "SunMonTueWedThuFriSat"; + static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; + + found = 0; + if(!strncasecmp(varname, "result", 6)) { + snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); + found = 1; + } + else if(!strncasecmp(varname, "cresult", 7)) { + 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)) { + snprintf(buffer, sizeof(buffer), "%d", toxine_get_last_int_result(tox)); + found = 1; + } + else if(!strncasecmp(varname, "xresult", 7)) { + snprintf(buffer, sizeof(buffer), "0x%x", toxine_get_last_int_result(tox)); + found = 1; + } + else if(!strncasecmp(varname, "version", 7)) { + snprintf(buffer, sizeof(buffer), "%s", VERSION); + found = 1; + } + else if(!strncasecmp(varname, "date", 4)) { + time_t curtime; + struct tm *lt; + + time(&curtime); + lt = localtime(&curtime); + 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)) { + time_t curtime; + struct tm *lt; + + time(&curtime); + lt = localtime(&curtime); + 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)) { + snprintf(buffer, sizeof(buffer), "%s", (tox->configfile) ? tox->configfile : "UNSET"); + found = 1; + } + else if(!strncasecmp(varname, "video_driver", 12)) { + snprintf(buffer, sizeof(buffer), "%s", (tox->video.name) ? tox->video.name : "UNSET"); + found = 1; + } + else if(!strncasecmp(varname, "audio_driver", 12)) { + snprintf(buffer, sizeof(buffer), "%s", (tox->audio.name) ? tox->audio.name : "UNSET"); + found = 1; + } + else if(!strncasecmp(varname, "mrl", 3)) { + snprintf(buffer, sizeof(buffer), "%s", (tox->current_mrl) ? tox->current_mrl : "UNSET"); + found = 1; + } + else if(!strncasecmp(varname, "script_file", 11)) { + snprintf(buffer, sizeof(buffer), "%s", (tox->script.filename) ? tox->script.filename : "UNSET"); + found = 1; + } + else { + char *p = varname; + int isargv = 1; + + + while(p && *p != '\0') { + if(!isdigit(*p)) { + isargv = 0; + break; + } + p++; + } + + if(isargv) { + char *p = varname; + int val = strtol(p, &p, 10); + + if((val >= 0) && (val < tox->argc)) { + snprintf(buffer, sizeof(buffer), "%s", tox->argv[val]); + found = 1; + } + } + } + + if(found) + return &buffer[0]; + + } + } + } + + return NULL; +} Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- utils.h 7 Apr 2004 18:21:07 -0000 1.12 +++ utils.h 16 May 2004 20:28:40 -0000 1.13 @@ -55,4 +55,6 @@ void toxine_show_stream_info(int info_type, uint32_t iinfo); +char *toxine_get_var(toxine_t *tox, const char *var); + #endif |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:42:51
|
Update of /cvsroot/toxine/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8098 Modified Files: links.html main.html Log Message: 0.6.3 release Index: links.html =================================================================== RCS file: /cvsroot/toxine/htdocs/links.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- links.html 16 Sep 2002 21:06:35 -0000 1.6 +++ links.html 6 May 2004 19:42:43 -0000 1.7 @@ -29,7 +29,7 @@ target="main">Project Page</a></address> <address> <a - href="http://prdownloads.sourceforge.net/toxine/toxine-0.6.2.tar.gz?download" + href="http://prdownloads.sourceforge.net/toxine/toxine-0.6.3.tar.gz?download" target="main">Download</a></address> <address><u><a href="http://toxine.sourceforge.net/screenshots.html" Index: main.html =================================================================== RCS file: /cvsroot/toxine/htdocs/main.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.html 15 Jul 2002 14:36:45 -0000 1.1 +++ main.html 6 May 2004 19:42:43 -0000 1.2 @@ -38,8 +38,17 @@ </div> </blockquote> -<hr width="100%" size="2" dir="ltr"> -<h5><font color="#ffffff">(c) Daniel Caujolle-Bert, 15-07-2002 <a +<hr width="100%" size="2" dir="ltr"> +<font color="#ffff00">NEWS:</font> +<br><br> +<font color="#ff0000">05-06-2004:</font> +<font color="#ffffff">Toxine 0.6.3 has been released. +You can download it <a + href="http://prdownloads.sourceforge.net/toxine/toxine-0.6.3.tar.gz?download">here</a>. +</font> + +<hr width="100%" size="2" dir="ltr"> +<h5><font color="#ffffff">(c) Daniel Caujolle-Bert, 05-06-2004 <a href="mailto:f1...@us...">f1rmb</a></font></h5> </body> |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:19:29
|
Update of /cvsroot/toxine/toxine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177 Modified Files: ChangeLog Makefile.am README configure.ac Log Message: release preparation Index: ChangeLog =================================================================== RCS file: /cvsroot/toxine/toxine/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ChangeLog 1 Sep 2002 16:05:30 -0000 1.10 +++ ChangeLog 6 May 2004 19:18:25 -0000 1.11 @@ -1,286 +1,410 @@ -2002-09-01 Sunday 14:33 f1rmb +2004-04-12 Monday 12:45 f1rmb + + update help + +2004-04-12 Monday 12:35 f1rmb + + permit resizing + +2004-04-12 Monday 12:34 f1rmb + + fix segfault + +2004-04-11 Sunday 13:32 f1rmb + + local build, again... ;-) + +2004-04-11 Sunday 13:29 f1rmb + + return of echo command. add 'display events <bool>' + +2004-04-09 Friday 17:43 f1rmb + + support cacalib output + +2004-04-08 Thursday 16:28 f1rmb + + xine_new isn't called implicitly at startup + +2004-04-08 Thursday 15:13 f1rmb + + don't need embedded readline anymore + +2004-04-07 Wednesday 18:21 f1rmb + + Big Fat Note: you need very recent xine-lib (>= rc3b). Ton of fixes. + xine_exit/xine_new cycle works. Update licence year. + +2003-10-16 Thursday 22:21 f1rmb + + update man + +2003-10-16 Thursday 22:16 f1rmb + + update EVENT_* + +2003-10-15 Wednesday 17:32 f1rmb + + try to fix jcd tputs problem + +2003-10-15 Wednesday 16:48 f1rmb + + avoid plugin's .la file to be installed, hack libtool here too + +2003-10-15 Wednesday 16:30 f1rmb + + oops, load system's plugins + +2003-10-15 Wednesday 14:44 f1rmb + + small fix + +2003-05-22 Thursday 20:50 f1rmb + + Made it compile with gcc 3.2.2, without warnings. Made it compile + with OrT. Get rid of Shm completion event. + +2003-01-23 Thursday 18:19 f1rmb + + use system installed plugins + +2003-01-15 Wednesday 17:40 f1rmb + + first step of xine API 1.0 port + +2002-09-21 Saturday 12:23 f1rmb + + Sync to latest xine config functions renaming. Add new + xine_get_version_string. + +2002-09-21 Saturday 00:21 f1rmb + + Fix wrong reported time using xine_get_pos_length(). + +2002-09-21 Saturday 00:07 f1rmb + + rename _FREE macro. Fix a segfault on exiting. + +2002-09-20 Friday 23:54 f1rmb + + Don't overuse toxine_get_arg(). + +2002-09-20 Friday 23:48 f1rmb + + Log related functions polished. + +2002-09-20 Friday 22:48 f1rmb + + Fix aspect ratio missusing. + +2002-09-20 Friday 22:36 f1rmb + + Made it compile against latest xine CVS. Fix missinstallation of + none vo plugin in debug stage. Don't use anymore embeded xine.m4. + +2002-09-20 Friday 14:16 f1rmb + + Implement xine_config* function (and dumpconfig). + +2002-09-19 Thursday 21:04 f1rmb + + More bugfixes. exit_exit and reinit work now, even with an audio + driver. Change some char * to const char * (leave the typecast land + ;-)). + +2002-09-19 Thursday 18:59 f1rmb + + Implement xine_get/set_param. Few fixes. + +2002-09-18 Wednesday 20:34 f1rmb + + Toxine really start to work using new xine API. Change vo plugin + iface, because xine lib support exiting then re-init in the same + session (toxine support that too now). More to come. + +2002-09-01 Sunday 21:23 f1rmb + + Fix 'history' command. + +2002-09-01 Sunday 12:33 f1rmb Add missing 'menu*' new events commands. -2002-09-01 Sunday 14:22 f1rmb +2002-09-01 Sunday 12:22 f1rmb Add small shell script which start dvd playback. -2002-08-31 Saturday 01:49 f1rmb +2002-08-30 Friday 23:49 f1rmb Sync to new events. -2002-08-31 Saturday 00:27 f1rmb - - Sync to CVS vo iface. - -2002-08-24 Saturday 00:02 f1rmb +2002-08-23 Friday 22:02 f1rmb 0.6.1 release. -2002-08-22 Thursday 14:21 f1rmb +2002-08-22 Thursday 12:21 f1rmb Made compile again against 0.9.13/cvs. -2002-08-03 Saturday 00:20 f1rmb +2002-08-02 Friday 22:20 f1rmb 0.6.0 preparations. -2002-08-02 Friday 00:52 f1rmb +2002-08-01 Thursday 22:52 f1rmb Sort all toxine's commands (thanks to sortcmds tool), update man page. Few small fixes. -2002-08-01 Thursday 15:56 f1rmb +2002-08-01 Thursday 13:56 f1rmb mangen: fix for unbreakable spaces, dash handling. use __tox_func__ instead of __FUNCTION__. none vo plugin: store/report aspect ratio. -2002-08-01 Thursday 15:49 f1rmb +2002-08-01 Thursday 13:49 f1rmb Result of mangen changes. -2002-08-01 Thursday 09:22 f1rmb +2002-08-01 Thursday 07:22 f1rmb Fix mmk start/end wrong value when mmk is added non interactively. -2002-08-01 Thursday 00:33 f1rmb +2002-07-31 Wednesday 22:33 f1rmb Add echo command. Fix parsing quoted arguments. Store result of last xine API call (if available), 'echo' command can display it. Update man page. -2002-07-25 Thursday 15:47 f1rmb +2002-07-25 Thursday 13:47 f1rmb Fix interactive mode. Add some keybindings in vo_x11 (like pause/resume/speed(++/--)). -2002-07-25 Thursday 11:33 f1rmb +2002-07-25 Thursday 09:33 f1rmb Dude, man page was corrupted. -2002-07-24 Wednesday 18:28 f1rmb +2002-07-24 Wednesday 16:28 f1rmb Mediamark implementation is done. -2002-07-24 Wednesday 11:06 f1rmb +2002-07-24 Wednesday 09:06 f1rmb Few cleanups. -2002-07-24 Wednesday 10:15 f1rmb +2002-07-24 Wednesday 08:15 f1rmb add 'mediamark edit'. More bugfixes. -2002-07-23 Tuesday 17:36 f1rmb +2002-07-23 Tuesday 15:36 f1rmb More mediamark commands (fully uncomplete). Few bugfixes, adds. New loop mode (by mrl). -2002-07-20 Saturday 00:38 f1rmb +2002-07-19 Friday 22:38 f1rmb start/end mmk implemented. mmk remaining: implement all mmk commands. -2002-07-19 Friday 23:03 f1rmb +2002-07-19 Friday 21:03 f1rmb Fix interactive mode (-i) when fall from script to prompt. Implement toxine's playlist file parser (all playlist stuff will be backported to xine-ui soon). -2002-07-19 Friday 00:19 f1rmb +2002-07-18 Thursday 22:19 f1rmb Playlist switch from char** to new mediamark_t** data type. mediamark stuff is under construction and not implemented yet. -2002-07-18 Thursday 00:08 f1rmb +2002-07-17 Wednesday 22:08 f1rmb Sync to xine's API (get_input_plugin_caps). -2002-07-16 Tuesday 11:15 f1rmb +2002-07-16 Tuesday 09:15 f1rmb Fix a segfault at exit time. 'set' don't display settings anymore, instead 'display settings' do a better job. -2002-07-14 Sunday 20:53 f1rmb +2002-07-14 Sunday 18:53 f1rmb 0.5.0 release. -2002-07-14 Sunday 20:25 f1rmb +2002-07-14 Sunday 18:25 f1rmb Use readline calls to know screen width. -2002-07-14 Sunday 16:29 f1rmb +2002-07-14 Sunday 14:29 f1rmb Add 'display' command. -2002-07-14 Sunday 00:20 f1rmb +2002-07-13 Saturday 22:20 f1rmb Man page update. -2002-07-14 Sunday 00:18 f1rmb +2002-07-13 Saturday 22:18 f1rmb Few xine's config management. vo_x11: screensaver fake key rate value available through tox.fake_rate config key. -2002-07-12 Friday 16:31 f1rmb +2002-07-12 Friday 14:31 f1rmb Fix rpm build. -2002-07-12 Friday 15:40 f1rmb +2002-07-12 Friday 13:40 f1rmb Add video output plugin 'none', which display nothing, don't create a window, etc... xine's 'none' plugin is provided (it's not part of xine-lib, and i don't know if it will be). -2002-07-11 Thursday 22:30 f1rmb +2002-07-11 Thursday 20:30 f1rmb Add playlist loop feature. -2002-07-09 Tuesday 22:33 f1rmb +2002-07-09 Tuesday 20:33 f1rmb Add ability to compile DXR3 plugin for xine-lib CVS version (--enable-xinelib-cvs). By default, DXR3 plugin is build for a 0.9.12-release. -2002-07-09 Tuesday 10:12 f1rmb +2002-07-09 Tuesday 08:12 f1rmb Sync DXR3 support to xine-lib latest changes. Now, you need a fresh CVS copy of xine-lib to use dxr3 support. -2002-07-08 Monday 23:41 f1rmb +2002-07-08 Monday 21:41 f1rmb Sync with xine-lib dxr3 tv new modes (letterbox/widescreen). Now, "dxr3" is splited into "dxr3_lb" (letterboxed) and "dxr3_ws" (widescreen). -2002-07-08 Monday 23:15 f1rmb +2002-07-08 Monday 21:15 f1rmb Update timestamp/prefix at man page generation time. -2002-07-08 Monday 21:38 f1rmb +2002-07-08 Monday 19:38 f1rmb Key press in script more aren't permited. More man update. -2002-07-08 Monday 15:59 f1rmb +2002-07-08 Monday 13:59 f1rmb Expand tilde in MRLs. Fill man page a bit more. -2002-07-08 Monday 14:54 f1rmb +2002-07-08 Monday 12:54 f1rmb Add playlist load/save. Support playlist format files (only for load): XMMS/XMMS(*.pls)/*.m3u/.sfv. -2002-07-04 Thursday 17:56 f1rmb +2002-07-04 Thursday 15:56 f1rmb Add man page (first draft). mangen.c generate the commands man entries. -2002-07-03 Wednesday 14:12 f1rmb +2002-07-03 Wednesday 12:12 f1rmb typos, update cursor visiblity when fullscreen toggle is activated with vo->fullscreen() call. -2002-07-03 Wednesday 11:03 f1rmb +2002-07-03 Wednesday 09:03 f1rmb Change few functions prototype in toxine_vo_plugin_t (get rid of toxine_vo_plugin_t * param, it's self contained in the toxine_t object.). -2002-07-03 Wednesday 10:44 f1rmb +2002-07-03 Wednesday 08:44 f1rmb Forward xine_event to vo plugin. -2002-07-02 Tuesday 12:30 f1rmb +2002-07-02 Tuesday 10:30 f1rmb New spec file. -2002-07-01 Monday 23:30 f1rmb +2002-07-01 Monday 21:30 f1rmb Merge checks. -2002-06-30 Sunday 17:44 f1rmb +2002-06-30 Sunday 15:44 f1rmb Remove unused decl/comments. -2002-06-30 Sunday 17:38 f1rmb +2002-06-30 Sunday 15:38 f1rmb Add playlist support (keep 'set mrl <mrl>' compatibility). -2002-06-24 Monday 23:57 f1rmb +2002-06-24 Monday 21:57 f1rmb quit lftp after upload. -2002-06-24 Monday 23:47 f1rmb +2002-06-24 Monday 21:47 f1rmb 0.4.0 release. -2002-06-24 Monday 23:35 f1rmb +2002-06-24 Monday 21:35 f1rmb more checks for release. Need 0.9.12. -2002-06-21 Friday 15:36 f1rmb +2002-06-21 Friday 13:36 f1rmb Add Changelog support. -2002-06-21 Friday 15:14 f1rmb +2002-06-21 Friday 13:14 f1rmb Fixed missposition (X/Y) report on fullscreen->window mode. Backport fake events (no more kill xscreensaver/deactivate X ScreenSaver. -2002-06-21 Friday 10:57 f1rmb +2002-06-21 Friday 08:57 f1rmb Add get/set video fullscreen. -2002-06-13 Thursday 14:06 f1rmb +2002-06-13 Thursday 12:06 f1rmb Remove no more available XINE_LOGO engine status. -2002-06-03 Monday 23:26 f1rmb +2002-06-03 Monday 21:26 f1rmb Require 0.9.10. -2002-06-03 Monday 21:48 f1rmb +2002-06-03 Monday 19:48 f1rmb ML test. -2002-06-03 Monday 16:53 f1rmb +2002-06-03 Monday 14:53 f1rmb Add vidix support (via X11). call xine_exit() on quit (avoid vidix DGA stays). -2002-05-23 Thursday 21:46 f1rmb +2002-05-23 Thursday 19:46 f1rmb change printf() to perr(). -2002-05-21 Tuesday 00:11 f1rmb +2002-05-20 Monday 22:11 f1rmb test -2002-05-21 Tuesday 00:04 f1rmb +2002-05-20 Monday 22:04 f1rmb test -2002-05-20 Monday 23:56 f1rmb +2002-05-20 Monday 21:56 f1rmb CVS log test. -2002-05-20 Monday 18:14 f1rmb +2002-05-20 Monday 16:14 f1rmb in command execution mode, 'quit' is now required, otherwise after commands execution, toxine fall in interactive mode. This is useful when we won't use script mode, but take advantage of command line (reproducibility). -2002-05-14 Tuesday 09:03 f1rmb +2002-05-14 Tuesday 07:03 f1rmb Fix typo. -2002-05-13 Monday 22:45 f1rmb +2002-05-13 Monday 20:45 f1rmb - Initial revision + Initial import into CVS -2002-05-13 Monday 22:45 f1rmb +2002-05-13 Monday 20:45 f1rmb - Initial import into CVS + Initial revision Index: Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 9 Apr 2004 17:43:13 -0000 1.10 +++ Makefile.am 6 May 2004 19:18:25 -0000 1.11 @@ -6,7 +6,7 @@ SUBDIRS = doc m4 misc src -EXTRA_DIST = cvscompile.sh @DEPCOMP@ +EXTRA_DIST = autogen.sh @DEPCOMP@ CONFIG_CLEAN_FILES = libtool-nofpic @@ -63,3 +63,4 @@ -rm -f config.guess config.sub install-sh missing mkinstalldirs -rm -f depcomp config.log config.status libtool-nofpic stamp-h -rm -f libtoolplugin-nofpic libtoollib-nofpic + -rm -rf autom4te.cache Index: README =================================================================== RCS file: /cvsroot/toxine/toxine/README,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- README 13 May 2002 20:45:27 -0000 1.1.1.1 +++ README 6 May 2004 19:18:25 -0000 1.2 @@ -1,3 +1,7 @@ +## BIG FAT NOTE: +## +## You need to use xine-lib >= 1rc3b +## ## A small script exemple: set video driver xv; set audio driver alsa09 Index: configure.ac =================================================================== RCS file: /cvsroot/toxine/toxine/configure.ac,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- configure.ac 9 Apr 2004 17:43:14 -0000 1.8 +++ configure.ac 6 May 2004 19:18:25 -0000 1.9 @@ -19,7 +19,7 @@ dnl switch directly to 0.3.0 since toxine have is own project site. TOXINE_MAJOR=0 TOXINE_MINOR=6 -TOXINE_SUB=2 +TOXINE_SUB=3 TOXINE_PRE="`if test -f ./.cvsversion; then echo cvs;fi`" TAR_NAME="toxine-"$TOXINE_MAJOR.$TOXINE_MINOR.$TOXINE_SUB$TOXINE_PRE |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:18:44
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177/src/plugins Modified Files: Makefile.am vo_aa.c vo_caca.c vo_dxr3.c vo_none.c vo_x11.c Log Message: release preparation Index: Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 9 Apr 2004 17:43:14 -0000 1.10 +++ Makefile.am 6 May 2004 19:18:34 -0000 1.11 @@ -22,10 +22,10 @@ -lX11 -lm -lXext $(X_EXTRA_LIBS) toxine_vo_plugin_aa_la_SOURCES = vo_aa.c -toxine_vo_plugin_aa_la_LDFLAGS = -avoid-version -module $(AALIB_LIBS) -lm +toxine_vo_plugin_aa_la_LDFLAGS = -avoid-version -module $(DYNAMIC_LD_LIBS) $(AALIB_LIBS) -lm toxine_vo_plugin_caca_la_SOURCES = vo_caca.c -toxine_vo_plugin_caca_la_LDFLAGS = -avoid-version -module $(CACA_LIBS) -lm +toxine_vo_plugin_caca_la_LDFLAGS = -avoid-version -module $(DYNAMIC_LD_LIBS) $(CACA_LIBS) -lm toxine_vo_plugin_dxr3_la_SOURCES = vo_dxr3.c toxine_vo_plugin_dxr3_la_LDFLAGS = -avoid-version -module Index: vo_aa.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_aa.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- vo_aa.c 9 Apr 2004 17:43:14 -0000 1.15 +++ vo_aa.c 6 May 2004 19:18:34 -0000 1.16 @@ -43,7 +43,7 @@ aa_private_t *private = (aa_private_t *) vop->private; private->init = 1; - + private->context = aa_autoinit(&aa_defparams); if(private->context == NULL) { fprintf(stderr,"Cannot initialize AA-lib. Sorry\n"); @@ -68,8 +68,7 @@ exit(1); } else - fprintf(stderr, "video driver '%s' successfuly loaded.\n", tox->video.name); - + pinfo("video driver '%s' successfully loaded.\n", tox->video.name); } static void deinit_video_out(toxine_t *tox) { @@ -86,6 +85,7 @@ aa_flush(private->context); aa_close(private->context); } + } static void release_video_out(toxine_t *tox) { Index: vo_caca.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_caca.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- vo_caca.c 9 Apr 2004 17:43:14 -0000 1.1 +++ vo_caca.c 6 May 2004 19:18:34 -0000 1.2 @@ -35,22 +35,55 @@ typedef struct { int init; + pthread_t loop_thread; } caca_private_t; +#if 0 +static void *caca_event_loop(void *data) { + toxine_t *tox = (toxine_t *) data; + toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; + caca_private_t *private = (caca_private_t *) vop->private; + + while(tox->video.running) { + unsigned int event; + while((event = caca_get_event(CACA_EVENT_ANY))) { + + if(event == CACA_EVENT_NONE) + pinfo("NONE\n"); + else if(event & CACA_EVENT_KEY_PRESS) + pinfo("KEYPRESS\n"); + else if(event & CACA_EVENT_KEY_RELEASE) + pinfo("KEYRELEASE\n"); + else if(event & CACA_EVENT_MOUSE_PRESS) + pinfo("MOUSE_PRESS\n"); + else if(event & CACA_EVENT_MOUSE_RELEASE) + pinfo("MOUSERELEASE\n"); + else if(event & CACA_EVENT_MOUSE_MOTION) + pinfo("MOUSEMOTION\n"); + else if(event & CACA_EVENT_RESIZE) + pinfo("RESIZE\n"); + } + + } + pthread_exit(NULL); +} +#endif + static void init_video_out(toxine_t *tox) { toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; caca_private_t *private = (caca_private_t *) vop->private; private->init = 1; + tox->video.port = xine_open_video_driver(tox->xine, tox->video.name, XINE_VISUAL_TYPE_CACA, NULL); - + if(tox->video.port == NULL) { fprintf(stderr, "xine_open_video_driver() failed to load '%s' driver.\n", tox->video.name); exit(1); } else - fprintf(stderr, "video driver '%s' successfuly loaded.\n", tox->video.name); + pinfo("video driver '%s' successfully loaded.\n", tox->video.name); } @@ -95,6 +128,23 @@ static void fullscreen(toxine_t *tox) { } +#if 0 +static void *event_loop(void *data) { + toxine_t *tox = (toxine_t *) data; + toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; + caca_private_t *private = (caca_private_t *) vop->private; + + pthread_detach(pthread_self()); + + while(tox->video.running) { + caca_refresh(); + xine_usec_sleep(33000); + } + + pthread_exit(NULL); +} +#endif + toxine_vo_plugin_t *toxine_load_vo_plugin(toxine_t *tox) { toxine_vo_plugin_t *caca; caca_private_t *private; @@ -103,7 +153,7 @@ private = (caca_private_t *) xine_xmalloc(sizeof(caca_private_t)); private->init = 0; - + caca->video_out_init = init_video_out; caca->video_out_event_loop = NULL; caca->video_out_deinit = deinit_video_out; @@ -118,4 +168,3 @@ return caca; } - Index: vo_dxr3.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_dxr3.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- vo_dxr3.c 9 Apr 2004 17:43:14 -0000 1.19 +++ vo_dxr3.c 6 May 2004 19:18:34 -0000 1.20 @@ -73,7 +73,7 @@ exit(1); } else - fprintf(stderr, "video driver '%s' successfuly loaded.\n", drivername); + pinfo("video driver '%s' successfully loaded.\n", drivername); } Index: vo_none.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_none.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- vo_none.c 9 Apr 2004 17:43:14 -0000 1.12 +++ vo_none.c 6 May 2004 19:18:34 -0000 1.13 @@ -44,7 +44,7 @@ exit(1); } else - fprintf(stderr, "video driver '%s' successfuly loaded.\n", tox->video.name); + pinfo("video driver '%s' successfully loaded.\n", tox->video.name); } Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- vo_x11.c 12 Apr 2004 12:45:14 -0000 1.29 +++ vo_x11.c 6 May 2004 19:18:34 -0000 1.30 @@ -745,7 +745,7 @@ exit(1); } else - fprintf(stderr, "video driver '%s' successfuly loaded.\n", drivername); + pinfo("video driver '%s' successfully loaded.\n", drivername); } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:18:43
|
Update of /cvsroot/toxine/toxine/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177/misc Modified Files: relchk.sh.in Log Message: release preparation Index: relchk.sh.in =================================================================== RCS file: /cvsroot/toxine/toxine/misc/relchk.sh.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- relchk.sh.in 24 Jun 2002 21:35:05 -0000 1.1 +++ relchk.sh.in 6 May 2004 19:18:33 -0000 1.2 @@ -2,6 +2,7 @@ ## ## A simple compare directory content utility. ## + topdir="`pwd`" distdir="@TAR_NAME@" log="$topdir/dist-log" @@ -10,15 +11,15 @@ getdir() { for file in `ls`; do - if test -d $file -a $file != "CVS" -a $file != $distdir; then + if test -d $file -a $file != "CVS" -a $file != $distdir -a $file != "autom4te.cache"; then (cd $file && getdir) || (cd ..) else if test ! -d $file -a \ $file != $log -a \ $file != $logerror -a \ - $file != "CVS" -a \ $file != ${0##*/} -a \ - $file != "$distdir.tar.gz"; then + $file != "$distdir.tar.gz" -a \ + $file != "config.status"; then orifile=`pwd`/$file @@ -40,11 +41,9 @@ main() { rm -f $log $logerror - echo "--- Log start <`date +%c`> ---" > $log - echo "--- Log error start <`date +%c`> ---" > $logerror - - ./cvscompile.sh $CONFIG_ARGS && make dist && mv $distdir.tar.gz $distdir.tmp.tar.gz - make clean && make distclean && mv $distdir.tmp.tar.gz $distdir.tar.gz + make config.status && make dist && mv $distdir.tar.gz $distdir.tmp.tar.gz && \ + cp config.status config.tmp.status && make clean && make distclean && \ + mv $distdir.tmp.tar.gz $distdir.tar.gz && mv config.tmp.status config.status && \ tar -xzf $distdir.tar.gz echo "Check is running, be patient..." @@ -52,9 +51,8 @@ rm -rf $distdir rm -f $distdir.tar.gz - - echo "--- Log end <`date +%c`> ---" >> $log - echo "--- Log error end <`date +%c`> ---" >> $logerror + ./config.status --recheck + ./config.status echo " * Log is ${log##*/}" echo " * Error log is ${logerror##*/}" |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:18:43
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177/doc/man/en Modified Files: toxine.1 Log Message: release preparation Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- toxine.1 16 Oct 2003 22:21:05 -0000 1.22 +++ toxine.1 6 May 2004 19:18:26 -0000 1.23 @@ -1,7 +1,7 @@ .\" -*-Nroff-*- .\"" .\"" -.TH TOXINE 1x 2003-10-17 "toxine" +.TH TOXINE 1x 2004-04-16 "toxine" .SH NAME toxine \- a text program, using xine library. .SH SYNOPSIS @@ -188,6 +188,8 @@ .br \ \ display current <[position | time]> .br +\ \ display events <[yes | no | 1 | 0 | true | false] | [status]> +.br \ \ display settings .br .br |
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-06 19:18:43
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177/src Modified Files: main.c Log Message: release preparation Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- main.c 8 Apr 2004 16:28:03 -0000 1.26 +++ main.c 6 May 2004 19:18:33 -0000 1.27 @@ -270,7 +270,7 @@ * generate and init a config "object" */ { - char *cfgfile = ".xine/config2"; + char *cfgfile = ".xine/toxine_config"; if (!(tox->configfile = getenv ("XINERC"))) { tox->configfile = (char *) xine_xmalloc((strlen((xine_get_homedir())) + strlen(cfgfile))+2); @@ -283,7 +283,7 @@ tox->playlist.mmk = NULL; tox->playlist.thread_num = 0;; tox->loop_mode = PLAYLIST_LOOP; - // tox->last_result = NULL; + tox->last_result = NULL; for(i = 0; i < 256; i++) tox->command.args[i] = (char *) xine_xmalloc(sizeof(char *) * 2048); |