toxine-cvs Mailing List for toxine
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...> - 2005-08-21 08:23:40
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7654 Modified Files: main.c Log Message: gcc 4 compliant patch from Diego 'Flameeyes' Pettenò <flameeyes AT gentoo DOT org> Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- main.c 19 Jul 2004 10:01:45 -0000 1.44 +++ main.c 21 Aug 2005 08:23:31 -0000 1.45 @@ -255,8 +255,8 @@ } toxine_free(tox->configfile); - toxine_free((char *)tox->video.name); - toxine_free((char *)tox->audio.name); + free((char *)tox->video.name); + free((char *)tox->audio.name); toxine_command_free_commands(tox->command.current); // toxine_free(tox->last_result); |
From: Daniel Caujolle-B. <f1...@us...> - 2005-08-02 09:05:54
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17595/src Modified Files: commands.c Log Message: add setenv command, fix typo. (patch from Harald Barth <haba AT pdc DOT kth DOT se>) Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- commands.c 23 Jul 2004 12:51:39 -0000 1.84 +++ commands.c 2 Aug 2005 09:05:45 -0000 1.85 @@ -181,6 +181,7 @@ static void do_pause(commands_t *, toxine_t *, void *); static void do_jump(commands_t *, toxine_t *, void *); static void do_seek(commands_t *, toxine_t *, void *); +static void do_setenv(commands_t *, toxine_t *, void *); static void do_shell(commands_t *, toxine_t *, void *); static void do_version(commands_t *, toxine_t *, void *); static void do_help(commands_t *, toxine_t *, void *); @@ -403,6 +404,10 @@ "set watchdog <[yes | no | 1 | 0 | on | off]>\n" "set watchdog timeout <secs>" }, + { "setenv", OPTIONAL_ARGS, do_setenv, + "Change the environment of the current process.", + "setenv variable value" + }, { "shell", OPTIONAL_ARGS, do_shell, "Execute a shell, or a command if an argument to this command is given.", "shell [command]" @@ -1472,6 +1477,22 @@ } /* + * Set environment + */ +static void do_setenv(commands_t *command, toxine_t *tox, void *data) { + int retval; + + if(tox->command.num_args == 2) { + retval = setenv(toxine_get_arg(tox, 1), toxine_get_arg(tox, 2), 1); + if (retval != 0) + pinfo("setenv failed\n"); + } + else + pinfo("setenv wrong number of args (%d).\n", tox->command.num_args); +} + + +/* * Execute a shell command (or a shell itself) */ static void do_shell(commands_t *command, toxine_t *tox, void *data) { @@ -1484,7 +1505,7 @@ int i; for(i = 0; i < num_args; i++) - sprintf(buffer, "%s %s", buffer, (toxine_get_arg(tox, (i+1)))); + snprintf(buffer, 2048, "%s %s", buffer, (toxine_get_arg(tox, (i+1)))); } else sprintf(buffer, "%s", "/bin/sh --login"); |
From: Daniel Caujolle-B. <f1...@us...> - 2005-08-02 09:05:53
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17595/doc/man/en Modified Files: toxine.1 Log Message: add setenv command, fix typo. (patch from Harald Barth <haba AT pdc DOT kth DOT se>) Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- toxine.1 23 Jul 2004 09:25:42 -0000 1.29 +++ toxine.1 2 Aug 2005 09:05:37 -0000 1.30 @@ -698,7 +698,7 @@ .br \ \ set audio mute .br -\ \ set interative <[yes | no | 1 | 0 | true | false]> +\ \ set interactive <[yes | no | 1 | 0 | true | false]> .br \ \ set mrl <mrl> .br @@ -710,6 +710,23 @@ .br .br .TP +.BR setenv +.br +.BR action: +.br +Set variable in the current process' environment, can be used to change the xine library's behaviour. +.br + +.BR syntax: +.br +\ \ setenv variable value +.br + +.BR example: +.br +\ \ setenv XINE_WAVE_OUTPUT myfile.wav +.br +.TP .BR shell .br .BR action: |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 12:51:48
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1518/plugins Modified Files: vo_x11.c Log Message: fix thread scheduling priority code compilation. Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- vo_x11.c 18 Jul 2004 20:55:36 -0000 1.36 +++ vo_x11.c 23 Jul 2004 12:51:39 -0000 1.37 @@ -765,12 +765,17 @@ { pthread_attr_t pth_attrs; +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING struct sched_param pth_params; +#endif pthread_attr_init(&pth_attrs); + +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); +#endif pthread_create(&private->timed_thread, &pth_attrs, timed_loop, (void *)tox); } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 12:51:48
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1518 Modified Files: commands.c xine_commands.c Log Message: fix thread scheduling priority code compilation. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -r1.83 -r1.84 --- commands.c 23 Jul 2004 12:09:47 -0000 1.83 +++ commands.c 23 Jul 2004 12:51:39 -0000 1.84 @@ -609,8 +609,6 @@ */ int toxine_video_out_init(toxine_t *tox) { int i = 0; - pthread_attr_t pth_attrs; - struct sched_param pth_params; error_code_clear(tox); @@ -671,13 +669,20 @@ tox->video.loop_thread = 0; if(tox->video.cur_plugin->video_out_event_loop) { + pthread_attr_t pth_attrs; +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + struct sched_param pth_params; +#endif + pthread_attr_init(&pth_attrs); + +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); - - pthread_create(&tox->video.loop_thread, &pth_attrs, - tox->video.cur_plugin->video_out_event_loop, (void *)tox); +#endif + + pthread_create(&tox->video.loop_thread, &pth_attrs, tox->video.cur_plugin->video_out_event_loop, (void *)tox); } } Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- xine_commands.c 23 Jul 2004 09:25:42 -0000 1.55 +++ xine_commands.c 23 Jul 2004 12:51:39 -0000 1.56 @@ -644,17 +644,22 @@ (tox->playlist.mmk[tox->playlist.cur]->start < tox->playlist.mmk[tox->playlist.cur]->end)) { pthread_attr_t pth_attrs; - struct sched_param pth_params; +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + struct sched_param pth_params; +#endif void *v; if(tox->playlist.thread_num > 0) pthread_join(tox->playlist.end_thread, &v); - pthread_attr_init(&pth_attrs); + pthread_attr_init(&pth_attrs); + +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); - +#endif + pthread_create(&tox->playlist.end_thread, &pth_attrs, toxine_end_thread,(void *)tox); } } |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 12:09:55
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27641 Modified Files: commands.c utils.c utils.h Log Message: @@update audio vol/mute when requesting values. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- commands.c 23 Jul 2004 09:25:42 -0000 1.82 +++ commands.c 23 Jul 2004 12:09:47 -0000 1.83 @@ -1088,16 +1088,20 @@ if(toxine_is_arg_contain(tox, 2, "volume")) { - if(tox->audio.mixer.enable) + if(tox->audio.mixer.enable) { + toxine_get_audio_volume_value(tox); toxine_draw_bar(tox, "Current audio volume", 0, 100, tox->audio.mixer.volume_level); + } else pinfo("Audio mixer is disable.\n"); } else if(toxine_is_arg_contain(tox, 2, "mute")) { - if(tox->audio.mixer.enable) + if(tox->audio.mixer.enable) { + toxine_get_audio_mute_value(tox); pinfo("Audio mute status: %s\n", (tox->audio.mixer.mute) ? "muted" : "unmuted"); + } else pinfo("Audio mixer is disable.\n"); Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- utils.c 23 Jul 2004 09:25:42 -0000 1.34 +++ utils.c 23 Jul 2004 12:09:47 -0000 1.35 @@ -633,10 +633,20 @@ } } +void toxine_get_audio_volume_value(toxine_t *tox) { + if(tox->xine_state & XINE_OPEN) + tox->audio.mixer.volume_level = xine_get_param(tox->stream, XINE_PARAM_AUDIO_VOLUME); +} + +void toxine_get_audio_mute_value(toxine_t *tox) { + if(tox->xine_state & XINE_OPEN) + tox->audio.mixer.mute = xine_get_param(tox->stream, XINE_PARAM_AUDIO_MUTE); +} + void toxine_update_infos(toxine_t *tox) { if(tox->xine_state & XINE_OPEN) { - tox->audio.mixer.volume_level = xine_get_param(tox->stream, XINE_PARAM_AUDIO_VOLUME); - tox->audio.mixer.mute = xine_get_param(tox->stream, XINE_PARAM_AUDIO_MUTE); + toxine_get_audio_volume_value(tox); + toxine_get_audio_mute_value(tox); } } Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- utils.h 23 Jul 2004 09:25:42 -0000 1.18 +++ utils.h 23 Jul 2004 12:09:47 -0000 1.19 @@ -52,6 +52,8 @@ void toxine_config_load(toxine_t *tox); void toxine_config_save(toxine_t *tox); +void toxine_get_audio_volume_value(toxine_t *tox); +void toxine_get_audio_mute_value(toxine_t *tox); void toxine_update_infos(toxine_t *tox); void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo); |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 12:02:20
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26339 Modified Files: parse.c Log Message: @@remove printf trace Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- parse.c 18 Jul 2004 20:31:40 -0000 1.11 +++ parse.c 23 Jul 2004 12:02:10 -0000 1.12 @@ -339,7 +339,6 @@ case '{': in_brace++; - printf("BRACE %d: %s\n", in_brace, pc); if(in_brace == 1) { } else |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 09:25:51
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5303/src Modified Files: commands.c utils.c utils.h xine_commands.c Log Message: Add sleep command. Update audio volume/mute on stream opening. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- commands.c 19 Jul 2004 20:45:33 -0000 1.81 +++ commands.c 23 Jul 2004 09:25:42 -0000 1.82 @@ -195,6 +195,7 @@ static void do_dumpstream(commands_t *, toxine_t *, void *); static void do_gettime(commands_t *, toxine_t *, void *); static void do_repeat(commands_t *, toxine_t *, void *); +static void do_sleep(commands_t *, toxine_t *, void *); static commands_t commands[] = { @@ -406,6 +407,10 @@ "Execute a shell, or a command if an argument to this command is given.", "shell [command]" }, + { "sleep", REQUIRE_ARGS, do_sleep, + "Sleep for x seconds", + "sleep <secs>" + }, { "stop", NO_ARGS, do_stop, "Stop playback", "stop" @@ -485,6 +490,7 @@ if(result) { tox->xine_state |= XINE_OPEN; + toxine_update_infos(tox); _xine_play(NULL, tox, (void *)NO_ARGS); } else @@ -1331,6 +1337,7 @@ pinfo("-- returned %d\n", result); if(result) { tox->xine_state |= XINE_OPEN; + toxine_update_infos(tox); _xine_play(command, tox, (void *)NO_ARGS); } else @@ -2623,3 +2630,21 @@ } } } + +static void do_sleep(commands_t *command, toxine_t *tox, void *data) { + char *csecs; + unsigned int secs; + + csecs = (char *) toxine_get_arg(tox, 1); + secs = (unsigned int) strtol(csecs, &csecs, 10); + if(secs) { + int i; + + pinfo("sleeping %d secs: ", secs); + for(i = 0; i < secs; i++) { + pout("."); + sleep(1); + } + pinfo("\n.\n"); + } +} Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- utils.c 18 Jul 2004 20:31:40 -0000 1.33 +++ utils.c 23 Jul 2004 09:25:42 -0000 1.34 @@ -633,6 +633,13 @@ } } +void toxine_update_infos(toxine_t *tox) { + if(tox->xine_state & XINE_OPEN) { + tox->audio.mixer.volume_level = xine_get_param(tox->stream, XINE_PARAM_AUDIO_VOLUME); + tox->audio.mixer.mute = xine_get_param(tox->stream, XINE_PARAM_AUDIO_MUTE); + } +} + void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo) { error_code_clear(tox); Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- utils.h 18 Jul 2004 20:31:40 -0000 1.17 +++ utils.h 23 Jul 2004 09:25:42 -0000 1.18 @@ -52,6 +52,7 @@ void toxine_config_load(toxine_t *tox); void toxine_config_save(toxine_t *tox); +void toxine_update_infos(toxine_t *tox); void toxine_show_stream_info(toxine_t *tox, int info_type, uint32_t iinfo); char *toxine_get_var(toxine_t *tox, const char *var); Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- xine_commands.c 19 Jul 2004 20:45:33 -0000 1.54 +++ xine_commands.c 23 Jul 2004 09:25:42 -0000 1.55 @@ -590,10 +590,13 @@ if(!result) error_code_set(tox, TOX_ERR_XINE_OPEN); + else { + tox->xine_state |= XINE_OPEN; + toxine_update_infos(tox); + } toxine_set_last_int_result(tox, result); pinfo("-- returned %d\n", result); - tox->xine_state |= XINE_OPEN; pinfo(".\n"); } } @@ -767,9 +770,11 @@ open_result = xine_open(tox->stream, mrl); stop_watchdog(tox); - start_watchdog(tox, "xine_play"); - result = xine_play(tox->stream, start, time); - stop_watchdog(tox); + if(open_result) { + start_watchdog(tox, "xine_play"); + result = xine_play(tox->stream, start, time); + stop_watchdog(tox); + } if(!open_result || !result) { if(!open_result) { |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-23 09:25:51
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5303/doc/man/en Modified Files: toxine.1 Log Message: Add sleep command. Update audio volume/mute on stream opening. Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- toxine.1 19 Jul 2004 20:45:33 -0000 1.28 +++ toxine.1 23 Jul 2004 09:25:42 -0000 1.29 @@ -1,7 +1,7 @@ .\" -*-Nroff-*- .\"" .\"" -.TH TOXINE 1x 2004-07-19 "toxine" +.TH TOXINE 1x 2004-07-23 "toxine" .SH NAME toxine \- a text program, using xine library. .SH SYNOPSIS @@ -723,6 +723,19 @@ .br .br .TP +.BR sleep +.br +.BR action: +.br +Sleep for x seconds +.br + +.BR syntax: +.br +\ \ sleep <secs> +.br +.br +.TP .BR stop .br .BR action: @@ -1279,7 +1292,7 @@ .BR syntax: .br -\ \ _xine_config_get_first_entry +\ \ xine_config_get_first_entry .br .br .TP @@ -1292,7 +1305,7 @@ .BR syntax: .br -\ \ _xine_config_get_next_entry +\ \ xine_config_get_next_entry .br .br .TP @@ -1305,7 +1318,7 @@ .BR syntax: .br -\ \ _xine_config_lookup_entry <key> +\ \ xine_config_lookup_entry <key> .br .br .TP @@ -1318,7 +1331,7 @@ .BR syntax: .br -\ \ _xine_config_update_entry <key> <value> +\ \ xine_config_update_entry <key> <value> .br .br .TP |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-21 22:19:27
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12016 Modified Files: xine_commands.h Log Message: @@typo Index: xine_commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- xine_commands.h 19 Jul 2004 20:45:34 -0000 1.32 +++ xine_commands.h 21 Jul 2004 22:19:19 -0000 1.33 @@ -410,19 +410,19 @@ }, \ { "xine_config_get_first_entry", NO_ARGS, _xine_config_get_first_entry, \ "Get first entry in xine config object.", \ - "_xine_config_get_first_entry" \ + "xine_config_get_first_entry" \ }, \ { "xine_config_get_next_entry", NO_ARGS, _xine_config_get_next_entry, \ "Get next entry in xine config object.", \ - "_xine_config_get_next_entry" \ + "xine_config_get_next_entry" \ }, \ { "xine_config_lookup_entry", REQUIRE_ARGS, _xine_config_lookup_entry, \ "Retrieve config entry matching with a keystring.", \ - "_xine_config_lookup_entry <key>" \ + "xine_config_lookup_entry <key>" \ }, \ { "xine_config_update_entry", REQUIRE_ARGS, _xine_config_update_entry, \ "Update value of specified entry.", \ - "_xine_config_update_entry <key> <value>" \ + "xine_config_update_entry <key> <value>" \ }, \ { "xine_config_load", OPTIONAL_ARGS, _xine_config_load, \ "Load a config file (filename is optional).", \ |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 20:45:43
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17444/src Modified Files: commands.c xine_commands.c xine_commands.h Log Message: add newest vdr xine's events support Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- commands.c 19 Jul 2004 17:19:22 -0000 1.80 +++ commands.c 19 Jul 2004 20:45:33 -0000 1.81 @@ -97,9 +97,41 @@ { "PVR_REALTIME" , XINE_EVENT_PVR_REALTIME }, { "PVR_PAUSE" , XINE_EVENT_PVR_PAUSE }, { "SET_MPEG_DATA" , XINE_EVENT_SET_MPEG_DATA }, + { "VDR_RED" , XINE_EVENT_VDR_RED }, + { "VDR_GREEN" , XINE_EVENT_VDR_GREEN }, + { "VDR_YELLOW" , XINE_EVENT_VDR_YELLOW }, + { "VDR_BLUE" , XINE_EVENT_VDR_BLUE }, + { "VDR_PLAY" , XINE_EVENT_VDR_PLAY }, + { "VDR_PAUSE" , XINE_EVENT_VDR_PAUSE }, + { "VDR_STOP" , XINE_EVENT_VDR_STOP }, + { "VDR_RECORD" , XINE_EVENT_VDR_RECORD }, + { "VDR_FASTFWD" , XINE_EVENT_VDR_FASTFWD }, + { "VDR_FASTREW" , XINE_EVENT_VDR_FASTREW }, + { "VDR_POWER" , XINE_EVENT_VDR_POWER }, + { "VDR_CHANNELPLUS" , XINE_EVENT_VDR_CHANNELPLUS }, + { "VDR_CHANNELMINUS" , XINE_EVENT_VDR_CHANNELMINUS }, + { "VDR_SCHEDULE" , XINE_EVENT_VDR_SCHEDULE }, + { "VDR_CHANNELS" , XINE_EVENT_VDR_CHANNELS }, + { "VDR_TIMERS" , XINE_EVENT_VDR_TIMERS }, + { "VDR_RECORDINGS" , XINE_EVENT_VDR_RECORDINGS }, + { "VDR_SETUP" , XINE_EVENT_VDR_SETUP }, + { "VDR_COMMANDS" , XINE_EVENT_VDR_COMMANDS }, + { "VDR_BACK" , XINE_EVENT_VDR_BACK }, + { "VDR_USER1" , XINE_EVENT_VDR_USER1 }, + { "VDR_USER2" , XINE_EVENT_VDR_USER2 }, + { "VDR_USER3" , XINE_EVENT_VDR_USER3 }, + { "VDR_USER4" , XINE_EVENT_VDR_USER4 }, + { "VDR_USER5" , XINE_EVENT_VDR_USER5 }, + { "VDR_USER6" , XINE_EVENT_VDR_USER6 }, + { "VDR_USER7" , XINE_EVENT_VDR_USER7 }, + { "VDR_USER8" , XINE_EVENT_VDR_USER8 }, + { "VDR_USER9" , XINE_EVENT_VDR_USER9 }, + { "VDR_VOLPLUS" , XINE_EVENT_VDR_VOLPLUS }, + { "VDR_VOLMINUS" , XINE_EVENT_VDR_VOLMINUS }, + { "VDR_MUTE" , XINE_EVENT_VDR_MUTE }, /* Following aren't xine's events, just hack */ - { "FOREVER" , XINE_EVENT_SET_MPEG_DATA + 1 }, - { "NOTHING" , XINE_EVENT_SET_MPEG_DATA + 1 }, + { "FOREVER" , XINE_EVENT_VDR_MUTE + 1 }, + { "NOTHING" , XINE_EVENT_VDR_MUTE + 1 }, { NULL , 0 } }; @@ -406,7 +438,15 @@ " INPUT_NUMBER_7 | INPUT_NUMBER_8 | INPUT_NUMBER_9 |\n" " INPUT_NUMBER_10_ADD | SET_V4L2 | PVR_SAVE |\n" " PVR_REPORT_NAME | PVR_REALTIME | PVR_PAUSE |\n" - " SET_MPEG_DATA | FOREVER | NOTHING]>\n" + " SET_MPEG_DATA | VDR_RED | VDR_GREEN | VDR_YELLOW |\n" + " VDR_BLUE | VDR_PLAY | VDR_PAUSE | VDR_STOP | VDR_RECORD |\n" + " VDR_FASTFWD | VDR_FASTREW | VDR_POWER | VDR_CHANNELPLUS \n" + " VDR_CHANNELMINUS | VDR_SCHEDULE | VDR_CHANNELS |\n" + " VDR_TIMERS | VDR_RECORDINGS | VDR_SETUP | VDR_COMMANDS |\n" + " VDR_BACK | VDR_USER1 | VDR_USER2 | VDR_USER3 | VDR_USER4 |\n" + " VDR_USER5 | VDR_USER6 | VDR_USER7 | VDR_USER8 |\n" + " VDR_USER9 | VDR_VOLPLUS | VDR_VOLMINUS | VDR_MUTE |\n" + " FOREVER | NOTHING]>\n" "waitfor status <[PLAY | STOP | QUIT | PAUSE | SLOW_4 | SLOW_2 | NORMAL |\n" " FAST_2 | FAST_4]>" }, Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- xine_commands.c 19 Jul 2004 09:00:47 -0000 1.53 +++ xine_commands.c 19 Jul 2004 20:45:33 -0000 1.54 @@ -123,6 +123,38 @@ { "XINE_EVENT_PVR_REALTIME" , XINE_EVENT_PVR_REALTIME }, { "XINE_EVENT_PVR_PAUSE" , XINE_EVENT_PVR_PAUSE }, { "XINE_EVENT_SET_MPEG_DATA" , XINE_EVENT_SET_MPEG_DATA }, + { "XINE_EVENT_VDR_RED" , XINE_EVENT_VDR_RED }, + { "XINE_EVENT_VDR_GREEN" , XINE_EVENT_VDR_GREEN }, + { "XINE_EVENT_VDR_YELLOW" , XINE_EVENT_VDR_YELLOW }, + { "XINE_EVENT_VDR_BLUE" , XINE_EVENT_VDR_BLUE }, + { "XINE_EVENT_VDR_PLAY" , XINE_EVENT_VDR_PLAY }, + { "XINE_EVENT_VDR_PAUSE" , XINE_EVENT_VDR_PAUSE }, + { "XINE_EVENT_VDR_STOP" , XINE_EVENT_VDR_STOP }, + { "XINE_EVENT_VDR_RECORD" , XINE_EVENT_VDR_RECORD }, + { "XINE_EVENT_VDR_FASTFWD" , XINE_EVENT_VDR_FASTFWD }, + { "XINE_EVENT_VDR_FASTREW" , XINE_EVENT_VDR_FASTREW }, + { "XINE_EVENT_VDR_POWER" , XINE_EVENT_VDR_POWER }, + { "XINE_EVENT_VDR_CHANNELPLUS" , XINE_EVENT_VDR_CHANNELPLUS }, + { "XINE_EVENT_VDR_CHANNELMINUS" , XINE_EVENT_VDR_CHANNELMINUS }, + { "XINE_EVENT_VDR_SCHEDULE" , XINE_EVENT_VDR_SCHEDULE }, + { "XINE_EVENT_VDR_CHANNELS" , XINE_EVENT_VDR_CHANNELS }, + { "XINE_EVENT_VDR_TIMERS" , XINE_EVENT_VDR_TIMERS }, + { "XINE_EVENT_VDR_RECORDINGS" , XINE_EVENT_VDR_RECORDINGS }, + { "XINE_EVENT_VDR_SETUP" , XINE_EVENT_VDR_SETUP }, + { "XINE_EVENT_VDR_COMMANDS" , XINE_EVENT_VDR_COMMANDS }, + { "XINE_EVENT_VDR_BACK" , XINE_EVENT_VDR_BACK }, + { "XINE_EVENT_VDR_USER1" , XINE_EVENT_VDR_USER1 }, + { "XINE_EVENT_VDR_USER2" , XINE_EVENT_VDR_USER2 }, + { "XINE_EVENT_VDR_USER3" , XINE_EVENT_VDR_USER3 }, + { "XINE_EVENT_VDR_USER4" , XINE_EVENT_VDR_USER4 }, + { "XINE_EVENT_VDR_USER5" , XINE_EVENT_VDR_USER5 }, + { "XINE_EVENT_VDR_USER6" , XINE_EVENT_VDR_USER6 }, + { "XINE_EVENT_VDR_USER7" , XINE_EVENT_VDR_USER7 }, + { "XINE_EVENT_VDR_USER8" , XINE_EVENT_VDR_USER8 }, + { "XINE_EVENT_VDR_USER9" , XINE_EVENT_VDR_USER9 }, + { "XINE_EVENT_VDR_VOLPLUS" , XINE_EVENT_VDR_VOLPLUS }, + { "XINE_EVENT_VDR_VOLMINUS" , XINE_EVENT_VDR_VOLMINUS }, + { "XINE_EVENT_VDR_MUTE" , XINE_EVENT_VDR_MUTE }, { NULL , 0 } }; Index: xine_commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- xine_commands.h 12 Jun 2004 23:52:41 -0000 1.31 +++ xine_commands.h 19 Jul 2004 20:45:34 -0000 1.32 @@ -396,7 +396,17 @@ " XINE_EVENT_INPUT_NUMBER_7 | XINE_EVENT_INPUT_NUMBER_8 | XINE_EVENT_INPUT_NUMBER_9 |\n" \ " XINE_EVENT_INPUT_NUMBER_10_ADD | XINE_EVENT_SET_V4L2 | XINE_EVENT_PVR_SAVE |\n" \ " XINE_EVENT_PVR_REPORT_NAME | XINE_EVENT_PVR_REALTIME | XINE_EVENT_PVR_PAUSE |\n" \ - " XINE_EVENT_SET_MPEG_DATA]" \ + " XINE_EVENT_SET_MPEG_DATA | XINE_EVENT_VDR_RED | XINE_EVENT_VDR_GREEN |\n" \ + " XINE_EVENT_VDR_YELLOW | XINE_EVENT_VDR_BLUE | XINE_EVENT_VDR_PLAY |\n" \ + " XINE_EVENT_VDR_PAUSE | XINE_EVENT_VDR_STOP | XINE_EVENT_VDR_RECORD |\n" \ + " XINE_EVENT_VDR_FASTFWD | XINE_EVENT_VDR_FASTREW | XINE_EVENT_VDR_POWER |\n" \ + " XINE_EVENT_VDR_CHANNELPLUS | XINE_EVENT_VDR_CHANNELMINUS | XINE_EVENT_VDR_SCHEDULE |\n" \ + " XINE_EVENT_VDR_CHANNELS | XINE_EVENT_VDR_TIMERS | XINE_EVENT_VDR_RECORDINGS |\n" \ + " XINE_EVENT_VDR_SETUP | XINE_EVENT_VDR_COMMANDS | XINE_EVENT_VDR_BACK |\n" \ + " XINE_EVENT_VDR_USER1 | XINE_EVENT_VDR_USER2 | XINE_EVENT_VDR_USER3 |\n" \ + " XINE_EVENT_VDR_USER4 | XINE_EVENT_VDR_USER5 | XINE_EVENT_VDR_USER6 |\n" \ + " XINE_EVENT_VDR_USER7 | XINE_EVENT_VDR_USER8 | XINE_EVENT_VDR_USER9 |\n" \ + " XINE_EVENT_VDR_VOLPLUS | XINE_EVENT_VDR_VOLMINUS | XINE_EVENT_VDR_MUTE]" \ }, \ { "xine_config_get_first_entry", NO_ARGS, _xine_config_get_first_entry, \ "Get first entry in xine config object.", \ |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 20:45:43
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17444/doc/man/en Modified Files: toxine.1 Log Message: add newest vdr xine's events support Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- toxine.1 19 Jul 2004 17:27:07 -0000 1.27 +++ toxine.1 19 Jul 2004 20:45:33 -0000 1.28 @@ -784,7 +784,7 @@ .BR syntax: .br -\ \ waitfor <[UI_PLAYBACK_FINISHED | UI_CHANNELS_CHANGED | UI_SET_TITLE | UI_MESSAGE | FRAME_FORMAT_CHANGE | AUDIO_LEVEL | QUIT | PROGRESS | MRL_REFERENCE | UI_NUM_BUTTONS | SPU_BUTTON | DROPPED_FRAMES | INPUT_MOUSE_BUTTON | INPUT_MOUSE_MOVE | INPUT_MENU1 | INPUT_MENU2 | INPUT_MENU3 | INPUT_MENU4 | INPUT_MENU5 | INPUT_MENU6 | INPUT_MENU7 | INPUT_UP | INPUT_DOWN | INPUT_LEFT | INPUT_RIGHT | INPUT_SELECT | INPUT_NEXT | INPUT_PREVIOUS | INPUT_ANGLE_NEXT | INPUT_ANGLE_PREVIOUS | INPUT_BUTTON_FORCE | INPUT_NUMBER_0 | INPUT_NUMBER_1 | INPUT_NUMBER_2 | INPUT_NUMBER_3 | INPUT_NUMBER_4 | INPUT_NUMBER_5 | INPUT_NUMBER_6 | INPUT_NUMBER_7 | INPUT_NUMBER_8 | INPUT_NUMBER_9 | INPUT_NUMBER_10_ADD | SET_V4L2 | PVR_SAVE | PVR_REPORT_NAME | PVR_REALTIME | PVR_PAUSE | SET_MPEG_DATA | FOREVER | NOTHING]> +\ \ waitfor <[UI_PLAYBACK_FINISHED | UI_CHANNELS_CHANGED | UI_SET_TITLE | UI_MESSAGE | FRAME_FORMAT_CHANGE | AUDIO_LEVEL | QUIT | PROGRESS | MRL_REFERENCE | UI_NUM_BUTTONS | SPU_BUTTON | DROPPED_FRAMES | INPUT_MOUSE_BUTTON | INPUT_MOUSE_MOVE | INPUT_MENU1 | INPUT_MENU2 | INPUT_MENU3 | INPUT_MENU4 | INPUT_MENU5 | INPUT_MENU6 | INPUT_MENU7 | INPUT_UP | INPUT_DOWN | INPUT_LEFT | INPUT_RIGHT | INPUT_SELECT | INPUT_NEXT | INPUT_PREVIOUS | INPUT_ANGLE_NEXT | INPUT_ANGLE_PREVIOUS | INPUT_BUTTON_FORCE | INPUT_NUMBER_0 | INPUT_NUMBER_1 | INPUT_NUMBER_2 | INPUT_NUMBER_3 | INPUT_NUMBER_4 | INPUT_NUMBER_5 | INPUT_NUMBER_6 | INPUT_NUMBER_7 | INPUT_NUMBER_8 | INPUT_NUMBER_9 | INPUT_NUMBER_10_ADD | SET_V4L2 | PVR_SAVE | PVR_REPORT_NAME | PVR_REALTIME | PVR_PAUSE | SET_MPEG_DATA | VDR_RED | VDR_GREEN | VDR_YELLOW | VDR_BLUE | VDR_PLAY | VDR_PAUSE | VDR_STOP | VDR_RECORD | VDR_FASTFWD | VDR_FASTREW | VDR_POWER | VDR_CHANNELPLUS VDR_CHANNELMINUS | VDR_SCHEDULE | VDR_CHANNELS | VDR_TIMERS | VDR_RECORDINGS | VDR_SETUP | VDR_COMMANDS | VDR_BACK | VDR_USER1 | VDR_USER2 | VDR_USER3 | VDR_USER4 | VDR_USER5 | VDR_USER6 | VDR_USER7 | VDR_USER8 | VDR_USER9 | VDR_VOLPLUS | VDR_VOLMINUS | VDR_MUTE | FOREVER | NOTHING]> .br \ \ waitfor status <[PLAY | STOP | QUIT | PAUSE | SLOW_4 | SLOW_2 | NORMAL | FAST_2 | FAST_4]> .br @@ -1266,7 +1266,7 @@ .br \ \ \- event can be: .br -\ \ [XINE_EVENT_UI_PLAYBACK_FINISHED | XINE_EVENT_UI_CHANNELS_CHANGED | XINE_EVENT_UI_SET_TITLE | XINE_EVENT_UI_MESSAGE | XINE_EVENT_FRAME_FORMAT_CHANGE | XINE_EVENT_AUDIO_LEVEL | XINE_EVENT_QUIT | XINE_EVENT_PROGRESS | XINE_EVENT_MRL_REFERENCE | XINE_EVENT_UI_NUM_BUTTONS | XINE_EVENT_SPU_BUTTON | XINE_EVENT_DROPPED_FRAMES | XINE_EVENT_INPUT_MOUSE_BUTTON | XINE_EVENT_INPUT_MOUSE_MOVE | XINE_EVENT_INPUT_MENU1 | XINE_EVENT_INPUT_MENU2 | XINE_EVENT_INPUT_MENU3 | XINE_EVENT_INPUT_MENU4 | XINE_EVENT_INPUT_MENU5 | XINE_EVENT_INPUT_MENU6 | XINE_EVENT_INPUT_MENU7 | XINE_EVENT_INPUT_UP | XINE_EVENT_INPUT_DOWN | XINE_EVENT_INPUT_LEFT | XINE_EVENT_INPUT_RIGHT | XINE_EVENT_INPUT_SELECT | XINE_EVENT_INPUT_NEXT | XINE_EVENT_INPUT_PREVIOUS | XINE_EVENT_INPUT_ANGLE_NEXT | XINE_EVENT_INPUT_ANGLE_PREVIOUS | XINE_EVENT_INPUT_BUTTON_FORCE | XINE_EVENT_INPUT_NUMBER_0 | XINE_EVENT_INPUT_NUMBER_1 | XINE_EVENT_INPUT_NUMBER_2 | XINE_EVENT_INPUT_NUMBER_3 | XINE_EVENT_INPUT_NUMBER_4 | XINE_EVENT_INPUT_NUMBER_5 | XINE_EVENT_INPUT_NUMBER_6 | XINE_EVENT_INPUT_NUMBER_7 | XINE_EVENT_INPUT_NUMBER_8 | XINE_EVENT_INPUT_NUMBER_9 | XINE_EVENT_INPUT_NUMBER_10_ADD | XINE_EVENT_SET_V4L2 | XINE_EVENT_PVR_SAVE | XINE_EVENT_PVR_REPORT_NAME | XINE_EVENT_PVR_REALTIME | XINE_EVENT_PVR_PAUSE | XINE_EVENT_SET_MPEG_DATA] +\ \ [XINE_EVENT_UI_PLAYBACK_FINISHED | XINE_EVENT_UI_CHANNELS_CHANGED | XINE_EVENT_UI_SET_TITLE | XINE_EVENT_UI_MESSAGE | XINE_EVENT_FRAME_FORMAT_CHANGE | XINE_EVENT_AUDIO_LEVEL | XINE_EVENT_QUIT | XINE_EVENT_PROGRESS | XINE_EVENT_MRL_REFERENCE | XINE_EVENT_UI_NUM_BUTTONS | XINE_EVENT_SPU_BUTTON | XINE_EVENT_DROPPED_FRAMES | XINE_EVENT_INPUT_MOUSE_BUTTON | XINE_EVENT_INPUT_MOUSE_MOVE | XINE_EVENT_INPUT_MENU1 | XINE_EVENT_INPUT_MENU2 | XINE_EVENT_INPUT_MENU3 | XINE_EVENT_INPUT_MENU4 | XINE_EVENT_INPUT_MENU5 | XINE_EVENT_INPUT_MENU6 | XINE_EVENT_INPUT_MENU7 | XINE_EVENT_INPUT_UP | XINE_EVENT_INPUT_DOWN | XINE_EVENT_INPUT_LEFT | XINE_EVENT_INPUT_RIGHT | XINE_EVENT_INPUT_SELECT | XINE_EVENT_INPUT_NEXT | XINE_EVENT_INPUT_PREVIOUS | XINE_EVENT_INPUT_ANGLE_NEXT | XINE_EVENT_INPUT_ANGLE_PREVIOUS | XINE_EVENT_INPUT_BUTTON_FORCE | XINE_EVENT_INPUT_NUMBER_0 | XINE_EVENT_INPUT_NUMBER_1 | XINE_EVENT_INPUT_NUMBER_2 | XINE_EVENT_INPUT_NUMBER_3 | XINE_EVENT_INPUT_NUMBER_4 | XINE_EVENT_INPUT_NUMBER_5 | XINE_EVENT_INPUT_NUMBER_6 | XINE_EVENT_INPUT_NUMBER_7 | XINE_EVENT_INPUT_NUMBER_8 | XINE_EVENT_INPUT_NUMBER_9 | XINE_EVENT_INPUT_NUMBER_10_ADD | XINE_EVENT_SET_V4L2 | XINE_EVENT_PVR_SAVE | XINE_EVENT_PVR_REPORT_NAME | XINE_EVENT_PVR_REALTIME | XINE_EVENT_PVR_PAUSE | XINE_EVENT_SET_MPEG_DATA | XINE_EVENT_VDR_RED | XINE_EVENT_VDR_GREEN | XINE_EVENT_VDR_YELLOW | XINE_EVENT_VDR_BLUE | XINE_EVENT_VDR_PLAY | XINE_EVENT_VDR_PAUSE | XINE_EVENT_VDR_STOP | XINE_EVENT_VDR_RECORD | XINE_EVENT_VDR_FASTFWD | XINE_EVENT_VDR_FASTREW | XINE_EVENT_VDR_POWER | XINE_EVENT_VDR_CHANNELPLUS | XINE_EVENT_VDR_CHANNELMINUS | XINE_EVENT_VDR_SCHEDULE | XINE_EVENT_VDR_CHANNELS | XINE_EVENT_VDR_TIMERS | XINE_EVENT_VDR_RECORDINGS | XINE_EVENT_VDR_SETUP | XINE_EVENT_VDR_COMMANDS | XINE_EVENT_VDR_BACK | XINE_EVENT_VDR_USER1 | XINE_EVENT_VDR_USER2 | XINE_EVENT_VDR_USER3 | XINE_EVENT_VDR_USER4 | XINE_EVENT_VDR_USER5 | XINE_EVENT_VDR_USER6 | XINE_EVENT_VDR_USER7 | XINE_EVENT_VDR_USER8 | XINE_EVENT_VDR_USER9 | XINE_EVENT_VDR_VOLPLUS | XINE_EVENT_VDR_VOLMINUS | XINE_EVENT_VDR_MUTE] .br .br .TP |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 17:27:15
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7526 Modified Files: toxine.1 toxine.1.header Log Message: @@more updates Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- toxine.1 19 Jul 2004 17:20:42 -0000 1.26 +++ toxine.1 19 Jul 2004 17:27:07 -0000 1.27 @@ -22,7 +22,7 @@ You can use multiple commands in a single line. Each commands may be separated with a semicolon ';', like: .sp -\fBset video driver xv; set audio driver alsa09; xine_init; playlist add ~/my_stream.mpg; play\fP +\fBset video driver xv; set audio driver alsa; init; playlist add ~/my_stream.mpg; play\fP .TP For spaced MRLs, dont forget to quote the whole MRL, like: .sp @@ -49,7 +49,7 @@ #!/home/daniel/usr/bin/toxine -s set video driver xv -set audio driver alsa09 +set audio driver alsa xine_init xine_stream_new xine_play mrl ~/my_stream.mpg @@ -61,7 +61,7 @@ quit .fi .TP -Like in interactive mode, you can use multi-commands line, separated with a ';' character. A line which begin with a '#' or '//' is ignored. +Like in interactive mode, you can use multi-commands line, separated with a ';' character. A line which begin with a '#' is ignored. .TP For the complete commands summary, see below. .SH OPTIONS @@ -69,6 +69,9 @@ with two dashes (\`\-\'). A summary of options are included below. .TP +.BR \-C,\ \-\-config-file\ <filename> +Use <filename> as toxine configuration file [default is $HOME/.xine/toxine_config]. +.TP .BR \-s,\ \-\-script\ <filename> Use <filename> as toxine script file. .TP @@ -102,7 +105,7 @@ Display this help text. .TP .BR \ \ \ \ \-\-error\-codes[=num] -Display errorcodes descriptions. If \fBnum\fP is specified, the error description will be printed. +Display error codes descriptions. If \fBnum\fP is specified, the error description will be printed. .br .SH COMMANDS .TP Index: toxine.1.header =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1.header,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- toxine.1.header 6 Jul 2004 09:50:13 -0000 1.5 +++ toxine.1.header 19 Jul 2004 17:27:07 -0000 1.6 @@ -22,7 +22,7 @@ You can use multiple commands in a single line. Each commands may be separated with a semicolon ';', like: .sp -\fBset video driver xv; set audio driver alsa09; xine_init; playlist add ~/my_stream.mpg; play\fP +\fBset video driver xv; set audio driver alsa; init; playlist add ~/my_stream.mpg; play\fP .TP For spaced MRLs, dont forget to quote the whole MRL, like: .sp @@ -49,7 +49,7 @@ #!@PREFIX@/bin/toxine -s set video driver xv -set audio driver alsa09 +set audio driver alsa xine_init xine_stream_new xine_play mrl ~/my_stream.mpg @@ -61,7 +61,7 @@ quit .fi .TP -Like in interactive mode, you can use multi-commands line, separated with a ';' character. A line which begin with a '#' or '//' is ignored. +Like in interactive mode, you can use multi-commands line, separated with a ';' character. A line which begin with a '#' is ignored. .TP For the complete commands summary, see below. .SH OPTIONS @@ -69,6 +69,9 @@ with two dashes (\`\-\'). A summary of options are included below. .TP +.BR \-C,\ \-\-config-file\ <filename> +Use <filename> as toxine configuration file [default is $HOME/.xine/toxine_config]. +.TP .BR \-s,\ \-\-script\ <filename> Use <filename> as toxine script file. .TP @@ -102,6 +105,6 @@ Display this help text. .TP .BR \ \ \ \ \-\-error\-codes[=num] -Display errorcodes descriptions. If \fBnum\fP is specified, the error description will be printed. +Display error codes descriptions. If \fBnum\fP is specified, the error description will be printed. .br .SH COMMANDS |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 17:21:05
|
Update of /cvsroot/toxine/toxine/doc/man/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6467 Modified Files: toxine.1 Log Message: @@update man page Index: toxine.1 =================================================================== RCS file: /cvsroot/toxine/toxine/doc/man/en/toxine.1,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- toxine.1 18 Jul 2004 20:31:40 -0000 1.25 +++ toxine.1 19 Jul 2004 17:20:42 -0000 1.26 @@ -1,7 +1,7 @@ .\" -*-Nroff-*- .\"" .\"" -.TH TOXINE 1x 2004-07-18 "toxine" +.TH TOXINE 1x 2004-07-19 "toxine" .SH NAME toxine \- a text program, using xine library. .SH SYNOPSIS @@ -309,17 +309,11 @@ .br \ \ get audio driver .br -\ \ get audio capabilities -.br -\ \ get video capabilities +\ \ get video driver .br \ \ get video fullscreen .br -\ \ get video property <property> (see xine_get_video_property) -.br -\ \ get video property_min_max <property> (see xine_get_video_property_min_max) -.br -\ \ get video help +\ \ .br .br .TP @@ -695,16 +689,12 @@ .br \ \ set video fullscreen .br -\ \ set video property <property> <value> (see xine_set_video_property) -.br \ \ set audio driver <name> .br \ \ set audio volume <level> .br \ \ set audio mute .br -\ \ set audio volume <level> -.br \ \ set interative <[yes | no | 1 | 0 | true | false]> .br \ \ set mrl <mrl> |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 17:19:30
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6230 Modified Files: commands.c Log Message: @@Fix some segfaults. Remove syntaxes references of obsolete commands. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- commands.c 18 Jul 2004 20:31:40 -0000 1.79 +++ commands.c 19 Jul 2004 17:19:22 -0000 1.80 @@ -230,17 +230,13 @@ "Quit toxine.", "exit" }, - { "get", OPTIONAL_ARGS, do_get, + { "get", REQUIRE_ARGS, do_get, "Get some internal values.", "get audio volume\n" "get audio mute\n" "get audio driver\n" - "get audio capabilities\n" - "get video capabilities\n" + "get video driver\n" "get video fullscreen\n" - "get video property <property> (see xine_get_video_property)\n" - "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.", @@ -361,15 +357,13 @@ "send XINE_EVENT_INPUT_SELECT event to xine engine", "select" }, - { "set", OPTIONAL_ARGS, do_set, + { "set", REQUIRE_ARGS, do_set, "Set some internal values.", "set video driver <name>\n" "set video fullscreen\n" - "set video property <property> <value> (see xine_set_video_property)\n" "set audio driver <name>\n" "set audio volume <level>\n" "set audio mute\n" - "set audio volume <level>\n" "set interative <[yes | no | 1 | 0 | true | false]>\n" "set mrl <mrl>\n" "set loop <[playlist | mrl]>\n" @@ -1057,13 +1051,13 @@ else if(toxine_is_arg_contain(tox, 2, "mute")) { if(tox->audio.mixer.enable) - pinfo("Audio mute status: %s\n", (tox->audio.mixer.mute)?"muted":"unmuted"); + pinfo("Audio mute status: %s\n", (tox->audio.mixer.mute) ? "muted" : "unmuted"); else pinfo("Audio mixer is disable.\n"); } else if(toxine_is_arg_contain(tox, 2, "driver") || toxine_is_arg_contain(tox, 2, "name")) - pinfo("current audio driver name: %s\n", (tox->audio.name)?tox->audio.name:"not set"); + pinfo("current audio driver name: %s\n", (tox->audio.name) ? tox->audio.name : "not set"); } } @@ -1094,33 +1088,9 @@ pinfo("%s\n", help); } } - - } - - } - else if(nargs >= 3) { - - if(toxine_is_arg_contain(tox, 2, "property")) { - char buffer[1024]; - - memset(&buffer, 0, sizeof(buffer)); - sprintf(buffer, "%s %s", "xine_get_video_property", toxine_get_arg(tox, 3)); - - toxine_command_insert_command_line(tox, buffer); - toxine_handle_command(tox, NULL); - - } - else if(toxine_is_arg_contain(tox, 2, "property_min_max")) { - char buffer[1024]; - - memset(&buffer, 0, sizeof(buffer)); - sprintf(buffer, "%s %s", "xine_get_video_property_min_max", toxine_get_arg(tox, 3)); - - toxine_command_insert_command_line(tox, buffer); - toxine_handle_command(tox, NULL); - } - + else if(toxine_is_arg_contain(tox, 2, "driver") || toxine_is_arg_contain(tox, 2, "name")) + pinfo("current video driver name: %s\n", (tox->video.name) ? tox->video.name : "not set"); } } } @@ -1167,22 +1137,7 @@ else if(toxine_is_arg_contain(tox, 1, "video")) { if(nargs >= 2) { - if(toxine_is_arg_contain(tox, 2, "property")) { - - if(nargs >= 4) { - char buffer[1024]; - - memset(&buffer, 0, sizeof(buffer)); - sprintf(buffer, "%s %s %s", - "xine_set_param", toxine_get_arg(tox, 3), toxine_get_arg(tox, 4)); - - toxine_command_insert_command_line(tox, buffer); - toxine_handle_command(tox, NULL); - - } - - } - else if(toxine_is_arg_contain(tox, 2, "driver")) { + if(toxine_is_arg_contain(tox, 2, "driver")) { if(nargs >= 3) { if(tox->xine_state & XINE_INIT) { @@ -1239,21 +1194,15 @@ tox->audio.mixer.volume_level = atoi(toxine_get_arg(tox, 3)); - sprintf(buffer, "%s %d", - "xine_set_param XINE_PARAM_AUDIO_VOLUME", tox->audio.mixer.volume_level); - + sprintf(buffer, "%s %d", "xine_set_param XINE_PARAM_AUDIO_VOLUME", tox->audio.mixer.volume_level); toxine_command_insert_command_line(tox, buffer); - toxine_handle_command(tox, NULL); } } } - else if(toxine_is_arg_contain(tox, 2, "mute")) { - + else if(toxine_is_arg_contain(tox, 2, "mute")) toxine_command_insert_command_line(tox, "xine_set_param XINE_PARAM_AUDIO_MUTE"); - toxine_handle_command(tox, NULL); - } } } else if(toxine_is_arg_contain(tox, 1, "watchdog")) { @@ -1862,7 +1811,6 @@ while((mrl = toxine_get_arg(tox, i)) != NULL) { - //if(strlen(toxine_atoa(mrl))) { if(strlen(mrl)) { char *expanded_mrl; |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 10:01:53
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31108 Modified Files: main.c Log Message: @@no need to fork() Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- main.c 19 Jul 2004 09:59:33 -0000 1.43 +++ main.c 19 Jul 2004 10:01:45 -0000 1.44 @@ -292,7 +292,10 @@ } -static int _real_main(int argc, char **argv) { +/* + * ... + */ +int main(int argc, char **argv) { int c = '?'; int option_index = 0; int interactive = 1; @@ -488,63 +491,3 @@ return last_error; } - -/* - * ... - */ -int main(int argc, char **argv) { - struct sigaction action; - int pid, status, ret; - - if(getuid() == 0) { - fprintf(stderr, "You cannot run this program as root.\n"); - exit(TOX_ERR_INTERNAL); - } - - signal(SIGHUP, SIG_IGN); - signal(SIGUSR1, SIG_IGN); - signal(SIGUSR2, SIG_IGN); - signal(SIGINT, SIG_IGN); - signal(SIGTERM, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGALRM, SIG_IGN); - - action.sa_handler = toxine_signals_handler; - sigemptyset(&(action.sa_mask)); - action.sa_flags = 0; - if(sigaction(SIGSEGV, &action, NULL) != 0) - fprintf(stderr, "sigaction(SIGSEGV) failed: %s\n", strerror(errno)); - - pid = fork(); - switch(pid) { - case -1: - fprintf(stderr, "fork() failed: %s\n", strerror(errno)); - exit(TOX_ERR_FORK); - break; - - case 0: /* Child process */ - ret = _real_main(argc, argv); - exit(ret); - break; - - default: /* Parent */ - if(waitpid(pid, &status, 0) == -1) { - switch(errno) { - case EINTR: - case ENOMEM: - ret = TOX_ERR_FORK; - break; - default: - ret = TOX_ERR_SUCCESS; - break; - } - } - else { - ret = WEXITSTATUS(status); - break; - } - break; - } - - return ret; -} |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 09:59:45
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30704 Modified Files: main.c Log Message: really handle SEGV signal... Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- main.c 19 Jul 2004 09:00:47 -0000 1.42 +++ main.c 19 Jul 2004 09:59:33 -0000 1.43 @@ -82,38 +82,40 @@ * Handle signals event. */ void toxine_signals_handler (int sig) { - pid_t pid = getppid(); + pid_t pid; - if(pid == tox->pid) { - - switch(sig) { - /* Segfault */ - case SIGSEGV: - perr("SIGSEGV received.\n"); + /* Segfault */ + if(sig == SIGSEGV) { + perr("SIGSEGV received.\n"); #ifdef __linux__ - { - void *backtrace_array[255]; - char **backtrace_strings; - int entries, i; - - if((entries = backtrace(backtrace_array, 255))) { - if((backtrace_strings = backtrace_symbols(backtrace_array, entries))) { - perr("Backtrace:\n"); - - for(i = 0; i < entries; i++) { - poutalign(); - pout("[%d] %s\n", i, backtrace_strings[i]); - } - - free(backtrace_strings); - perr("--\n"); + { + void *backtrace_array[255]; + char **backtrace_strings; + int entries, i; + + if((entries = backtrace(backtrace_array, 255))) { + if((backtrace_strings = backtrace_symbols(backtrace_array, entries))) { + perr("Backtrace:\n"); + + for(i = 0; i < entries; i++) { + poutalign(); + pout("[%d] %s\n", i, backtrace_strings[i]); } + + free(backtrace_strings); + perr("--\n"); } } + } #endif - exit(TOX_ERR_SIGSEGV); - break; + exit(TOX_ERR_SIGSEGV); + } + + pid = getppid(); + if(pid == tox->pid) { + + switch(sig) { /* Kill the line on C-c */ case SIGINT: if(tox->interactive != 1) { @@ -491,6 +493,7 @@ * ... */ int main(int argc, char **argv) { + struct sigaction action; int pid, status, ret; if(getuid() == 0) { @@ -506,6 +509,12 @@ signal(SIGQUIT, SIG_IGN); signal(SIGALRM, SIG_IGN); + action.sa_handler = toxine_signals_handler; + sigemptyset(&(action.sa_mask)); + action.sa_flags = 0; + if(sigaction(SIGSEGV, &action, NULL) != 0) + fprintf(stderr, "sigaction(SIGSEGV) failed: %s\n", strerror(errno)); + pid = fork(); switch(pid) { case -1: |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-19 09:00:57
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22218 Modified Files: main.c xine_commands.c Log Message: fix forgotten configfile hack (new -C). Ignore many signals in parent. Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- main.c 18 Jul 2004 22:27:02 -0000 1.41 +++ main.c 19 Jul 2004 09:00:47 -0000 1.42 @@ -61,9 +61,10 @@ #define ERROR_CODES 1000 /* options args */ -static const char *short_options = "?hs:e:o::vV:A:iIS"; +static const char *short_options = "?hs:e:o::vV:A:iISC:"; static struct option long_options[] = { { "help" , no_argument , 0, 'h' }, + { "config-file" , required_argument, 0, 'C' }, { "script" , required_argument, 0, 's' }, { "execute" , required_argument, 0, 'e' }, { "output" , optional_argument, 0, 'o' }, @@ -115,6 +116,11 @@ /* Kill the line on C-c */ case SIGINT: + if(tox->interactive != 1) { + tox->video.running = tox->running = 0; + exit(TOX_ERR_SIGINT); + return; + } case SIGTERM: case SIGQUIT: if(rl_prompt) { /* readline is running, otherwise we are in script mode */ @@ -131,7 +137,6 @@ exit(TOX_ERR_SIGQUIT); } break; - } } } @@ -209,6 +214,7 @@ static void toxine_print_usage(void) { printf("Usage: toxine [options]\n"); + printf(" -C, --config-file <filename> Use <filename> as toxine configuration file.\n"); printf(" -s, --script <filename> Use <filename> as toxine script file.\n"); printf(" -S, --stdin Send command lines using stdin.\n"); printf(" -e, --execute <commands> Execute specified commands (like in prompt mode).\n"); @@ -306,6 +312,7 @@ tox->pid = getppid(); pthread_mutex_init(&tox->watchdog.mutex, NULL); + tox->configfile = NULL; tox->watchdog.enabled = 0; tox->watchdog.running = 0; tox->watchdog.timeout = 15; /* 15 secs timeout */ @@ -325,6 +332,13 @@ while((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != EOF) { switch(c) { + case 'C': + { + char *_optarg = toxine_atoa(optarg); + tox->configfile = strdup(_optarg); + } + break; + case 's': /* use a script file */ if(optarg != NULL) { @@ -442,12 +456,12 @@ /* * generate and init a config "object" */ - { + if(!tox->configfile) { char *cfgfile = ".xine/toxine_config"; if (!(tox->configfile = getenv ("XINERC"))) { const char *homedir; - + start_watchdog(tox, "xine_get_homedir"); homedir = xine_get_homedir(); stop_watchdog(tox); @@ -455,7 +469,6 @@ tox->configfile = (char *) xine_xmalloc((strlen(homedir) + strlen(cfgfile))+2); sprintf(tox->configfile, "%s/%s", homedir, cfgfile); } - } tox->playlist.mmk = NULL; @@ -467,9 +480,7 @@ toxine_run(tox, argc - optind, &argv[optind]); - __end: - last_error = tox->last_error; toxine_release(tox); @@ -480,13 +491,21 @@ * ... */ int main(int argc, char **argv) { - int pid, status, ret; + int pid, status, ret; if(getuid() == 0) { fprintf(stderr, "You cannot run this program as root.\n"); exit(TOX_ERR_INTERNAL); } + signal(SIGHUP, SIG_IGN); + signal(SIGUSR1, SIG_IGN); + signal(SIGUSR2, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGTERM, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGALRM, SIG_IGN); + pid = fork(); switch(pid) { case -1: Index: xine_commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/xine_commands.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- xine_commands.c 12 Jun 2004 11:44:56 -0000 1.52 +++ xine_commands.c 19 Jul 2004 09:00:47 -0000 1.53 @@ -509,7 +509,7 @@ if(!(tox->xine_state & XINE_NEW)) _xine_new(NULL, tox, NULL); - + pinfo("xine_init():\n"); start_watchdog(tox, "xine_init"); xine_init(tox->xine); @@ -2268,18 +2268,9 @@ } 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); - if(tox->configfile) - free((char *)tox->configfile); - tox->configfile = strdup(filename); - } - pinfo("xine_config_load(%s):\n", tox->configfile); start_watchdog(tox, "xine_config_load"); xine_config_load(tox->xine, tox->configfile); @@ -2288,18 +2279,14 @@ } void _xine_config_save(commands_t *command, toxine_t *tox, void *data) { - const char *filename = NULL; toxine_unset_last_result(tox); return_if_no_init(tox); error_code_clear(tox); - if(toxine_is_args(tox)) - filename = toxine_get_arg(tox, 1); - - pinfo("xine_config_save(%s):\n", (filename) ? filename : tox->configfile); + pinfo("xine_config_save(%s):\n", tox->configfile); start_watchdog(tox, "xine_config_save"); - xine_config_save(tox->xine, ((filename) ? filename : tox->configfile)); + xine_config_save(tox->xine, tox->configfile); stop_watchdog(tox); pinfo(".\n"); |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 22:27:11
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7743 Modified Files: errors.c errors.h main.c Log Message: avoid deadlock with getppid() by forking. Index: errors.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/errors.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- errors.c 1 Jun 2004 21:49:51 -0000 1.4 +++ errors.c 18 Jul 2004 22:27:02 -0000 1.5 @@ -33,6 +33,9 @@ { "Success.", "TOX_ERR_SUCCESS", TOX_ERR_SUCCESS }, + { "fork() failed.", + "TOX_ERR_FORK", TOX_ERR_FORK + }, { "Deadlock occured. Generally this returned value is set when watchdog was triggered.", "TOX_ERR_DEADLOCK", TOX_ERR_DEADLOCK }, Index: errors.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/errors.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- errors.h 27 May 2004 21:23:43 -0000 1.3 +++ errors.h 18 Jul 2004 22:27:02 -0000 1.4 @@ -24,6 +24,7 @@ typedef enum { TOX_ERR_SUCCESS, /* Everything was fine */ + TOX_ERR_FORK, /* Unable to fork() */ TOX_ERR_DEADLOCK, /* Deadlock happened */ TOX_ERR_SIGSEGV, /* SIGSEGV received */ TOX_ERR_SIGINT, /* SIGINT received */ Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- main.c 18 Jul 2004 20:31:40 -0000 1.40 +++ main.c 18 Jul 2004 22:27:02 -0000 1.41 @@ -32,6 +32,7 @@ #include <errno.h> #include <unistd.h> #include <sys/types.h> +#include <sys/wait.h> #include <sys/stat.h> #include <string.h> #include <fcntl.h> @@ -283,10 +284,7 @@ } -/* - * ... - */ -int main(int argc, char **argv) { +static int _real_main(int argc, char **argv) { int c = '?'; int option_index = 0; int interactive = 1; @@ -300,7 +298,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(TOX_ERR_WRONG_VERSION); + return TOX_ERR_WRONG_VERSION; } tox = (toxine_t *) xine_xmalloc(sizeof(toxine_t)); @@ -340,7 +338,8 @@ } else { perr("Script filename is required to -S/--script option\n"); - exit(TOX_ERR_BAD_CMDLINE); + error_code_set(tox, TOX_ERR_BAD_CMDLINE); + goto __end; } break; @@ -357,7 +356,8 @@ if((tox->msg_fd = open(ofile, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, 0644)) < 0) { perr("Cannot open %s: %s\n", ofile, strerror(errno)); - exit(TOX_ERR_INTERNAL); + error_code_set(tox, TOX_ERR_INTERNAL); + goto __end; } } @@ -387,7 +387,8 @@ case 'v': /* Display version and exit*/ toxine_show_version(tox); - exit(TOX_ERR_SUCCESS); + error_code_set(tox, TOX_ERR_SUCCESS); + goto __end; break; case ERROR_CODES: @@ -397,19 +398,23 @@ } else toxine_print_error_codes(tox); - exit(TOX_ERR_SUCCESS); + + error_code_set(tox, TOX_ERR_SUCCESS); + goto __end; break; case 'h': /* Display usage */ case '?': toxine_print_usage(); - exit(TOX_ERR_SUCCESS); + error_code_set(tox, TOX_ERR_SUCCESS); + goto __end; break; default: toxine_print_usage(); perr("Invalid argument %d => exit\n",c); - exit(TOX_ERR_BAD_CMDLINE); + error_code_set(tox, TOX_ERR_BAD_CMDLINE); + goto __end; } } @@ -417,7 +422,8 @@ if((!tox->script.in_use) && (!tox->command.execute)) { perr("You can't use message redirection in prompt mode.\n"); toxine_release(tox); - exit(TOX_ERR_BAD_CMDLINE); + error_code_set(tox, TOX_ERR_BAD_CMDLINE); + goto __end; } if(dup2(tox->msg_fd, STDOUT_FILENO) < 0) @@ -460,8 +466,57 @@ tox->interactive = interactive ? 1 : 0; toxine_run(tox, argc - optind, &argv[optind]); + + + __end: + last_error = tox->last_error; toxine_release(tox); return last_error; } + +/* + * ... + */ +int main(int argc, char **argv) { + int pid, status, ret; + + if(getuid() == 0) { + fprintf(stderr, "You cannot run this program as root.\n"); + exit(TOX_ERR_INTERNAL); + } + + pid = fork(); + switch(pid) { + case -1: + fprintf(stderr, "fork() failed: %s\n", strerror(errno)); + exit(TOX_ERR_FORK); + break; + + case 0: /* Child process */ + ret = _real_main(argc, argv); + exit(ret); + break; + + default: /* Parent */ + if(waitpid(pid, &status, 0) == -1) { + switch(errno) { + case EINTR: + case ENOMEM: + ret = TOX_ERR_FORK; + break; + default: + ret = TOX_ERR_SUCCESS; + break; + } + } + else { + ret = WEXITSTATUS(status); + break; + } + break; + } + + return ret; +} |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 21:18:40
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26943 Modified Files: Makefile.am Added Files: vo_fb.c Log Message: fb plugin added (keyboard isn't supported yet). --- NEW FILE: vo_fb.c --- /* ** Copyright (C) 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 <stdarg.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "common.h" typedef struct { int init; } fb_private_t; static void init_video_out(toxine_t *tox) { toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; fb_private_t *private = (fb_private_t *) vop->private; private->init = 1; start_watchdog(tox, "xine_open_video_driver"); tox->video.port = xine_open_video_driver(tox->xine, tox->video.name, XINE_VISUAL_TYPE_FB, NULL); stop_watchdog(tox); if(tox->video.port == NULL) { 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); } static void deinit_video_out(toxine_t *tox) { toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.cur_plugin; fb_private_t *private = (fb_private_t *) vop->private; start_watchdog(tox, "xine_close_video_driver"); xine_close_video_driver(tox->xine, tox->video.port); stop_watchdog(tox); tox->video.port = NULL; private->init = 0; } static void release_video_out(toxine_t *tox) { toxine_vo_plugin_t *vop = (toxine_vo_plugin_t *) tox->video.last_plugin; fb_private_t *private = (fb_private_t *) vop->private; if(private->init) deinit_video_out(tox); free(private); free(vop); } static const char *get_identifier(void) { return "framebuffer video out"; } static char *_vo_fb_names[] = { "fb", NULL }; static const char **get_names(void) { return (const char **)_vo_fb_names; } static const char *get_help(void) { return "Video out plugin supporting framebuffer driver.\n"; } static int is_fullscreen(toxine_t *tox) { return 1; } static void fullscreen(toxine_t *tox) { } toxine_vo_plugin_t *toxine_load_vo_plugin(toxine_t *tox) { toxine_vo_plugin_t *fb; fb_private_t *private; fb = (toxine_vo_plugin_t *) xine_xmalloc(sizeof(toxine_vo_plugin_t)); private = (fb_private_t *) xine_xmalloc(sizeof(fb_private_t)); private->init = 0; fb->video_out_init = init_video_out; fb->video_out_event_loop = NULL; fb->video_out_deinit = deinit_video_out; fb->video_out_release = release_video_out; fb->get_identifier = get_identifier; fb->get_names = get_names; fb->get_help = get_help; fb->is_fullscreen = is_fullscreen; fb->receive_xine_event = NULL; fb->fullscreen = fullscreen; fb->private = (void *) private; return fb; } Index: Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Makefile.am 6 May 2004 19:18:34 -0000 1.11 +++ Makefile.am 18 Jul 2004 21:18:32 -0000 1.12 @@ -15,7 +15,7 @@ endif lib_LTLIBRARIES = $(aa_plugin) $(caca_plugin) toxine_vo_plugin_x11.la \ - toxine_vo_plugin_dxr3.la toxine_vo_plugin_none.la + toxine_vo_plugin_dxr3.la toxine_vo_plugin_none.la toxine_vo_plugin_fb.la toxine_vo_plugin_x11_la_SOURCES = vo_x11.c toxine_vo_plugin_x11_la_LDFLAGS = -avoid-version -module $(X_LIBS) $(XTEST_LIBS) \ @@ -33,6 +33,9 @@ toxine_vo_plugin_none_la_SOURCES = vo_none.c toxine_vo_plugin_none_la_LDFLAGS = -avoid-version -module +toxine_vo_plugin_fb_la_SOURCES = vo_fb.c +toxine_vo_plugin_fb_la_LDFLAGS = -avoid-version -module + noinst_HEADERS = vo_plugin.h debug: |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 20:55:44
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23339 Modified Files: vo_x11.c Log Message: no need to discard X events. Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- vo_x11.c 18 Jul 2004 20:31:41 -0000 1.35 +++ vo_x11.c 18 Jul 2004 20:55:36 -0000 1.36 @@ -1074,7 +1074,6 @@ pthread_join(private->timed_thread, NULL); XLockDisplay(private->display); - XSync(private->display, True); XUnmapWindow(private->display, private->x11_drawable[private->fullscreen].video_window); XSync(private->display, False); /* Waiting til' window's unmapped. */ |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 20:44:56
|
Update of /cvsroot/toxine/toxine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21795 Modified Files: autogen.sh Log Message: @@Really handle XINE_CONFIG now ;-) Index: autogen.sh =================================================================== RCS file: /cvsroot/toxine/toxine/autogen.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- autogen.sh 6 Jul 2004 09:50:45 -0000 1.2 +++ autogen.sh 18 Jul 2004 20:44:45 -0000 1.3 @@ -224,7 +224,7 @@ fi echo $_echo_n " + Running aclocal: $_echo_c" - aclocalinclude=`xine-config --acflags` + aclocalinclude=`if [ ! -z "$XINE_CONFIG" ]; then $XINE_CONFIG --acflags; else xine-config --acflags; fi` aclocal -I m4 $aclocalinclude echo "done." |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 20:42:47
|
Update of /cvsroot/toxine/toxine/m4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21550/m4 Modified Files: readline.m4 Log Message: @@Handle XINE_CONFIG. Fix an auto* warning in readline.m4 Index: readline.m4 =================================================================== RCS file: /cvsroot/toxine/toxine/m4/readline.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- readline.m4 14 Jul 2004 21:34:35 -0000 1.4 +++ readline.m4 18 Jul 2004 20:42:39 -0000 1.5 @@ -2,7 +2,7 @@ dnl Rewritten from scratch. --wojtekka dnl -AC_DEFUN(AC_CHECK_READLINE,[ +AC_DEFUN([AC_CHECK_READLINE],[ AC_SUBST(READLINE_LIBS) AC_SUBST(READLINE_INCLUDES) |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 20:31:51
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19802/src Modified Files: commands.c commands.h common.h main.c parse.c parse.h script.c script.h utils.c utils.h Log Message: -New command parser. -Fix stdin and -e bug. -Release all VOPs when leaving. -Fix interactive option (-i) -Support multiple variables usage in command arguments. -Rework script parsing code. Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- commands.c 1 Jun 2004 21:49:51 -0000 1.78 +++ commands.c 18 Jul 2004 20:31:40 -0000 1.79 @@ -224,10 +224,7 @@ " - $audio_driver: audio driver name (*).\n" " - $mrl: current mrl (*).\n" " - $script_file: file script name (*).\n" - " (*): display 'UNSET' when it's unspecified/unavailable.\n" - "\n" - " variable name syntax can be $foo, $(foo) or ${foo}\n" - "" + " (*): display 'UNSET' when it's unspecified/unavailable." }, { "exit", NO_ARGS, do_quit, "Quit toxine.", @@ -716,24 +713,26 @@ do { - toxine_parse_command(tox); - - if(strlen(tox->command.line)) { + if(toxine_command_have_current(tox)) { + const char *command = toxine_command_get_current_command(tox); + + toxine_command_prepare_args(tox); /* * Is the command match with one available ? */ i = found = 0; while((commands[i].command != NULL) && (found == 0)) { - if(!strncasecmp(tox->command.command, commands[i].command, strlen(tox->command.command))) { + + if(!strncasecmp(command, commands[i].command, strlen(command))) { if((commands[i].argtype == REQUIRE_ARGS) - && (tox->command.num_args <= 0)) { + && (toxine_command_get_current_num_args(tox) <= 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)) { + else if((commands[i].argtype == NO_ARGS) && (toxine_command_get_current_num_args(tox) > 0)) { perr("Command '%s' doesn't require argument.\n", commands[i].command); if(tox->script.in_use || tox->stdin) exit(TOX_ERR_WRONG_SYNTAX); @@ -752,7 +751,7 @@ } if(!found) { - perr("unhandled command '%s'.\n", tox->command.command); + perr("unhandled command '%s'.\n", command); if(tox->script.in_use || tox->stdin) exit(TOX_ERR_UNKNOWN_CMD); @@ -760,9 +759,9 @@ } - toxine_free(tox->command.line); - - } while((tox->command.remain != NULL)); + toxine_command_next(tox); + + } while(toxine_command_have_current(tox) || toxine_command_have_next(tox)); } /* @@ -798,18 +797,6 @@ return cmd; } -/* - * Called when we leave toxine. - */ -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); - } -} - static void toxine_handle_stdin(toxine_t *tox) { int fd; char command[32768]; @@ -819,6 +806,9 @@ fd = STDIN_FILENO; + if(toxine_command_have_current(tox)) + toxine_handle_command(tox, NULL); + while(tox->running) { FD_ZERO(&set); @@ -848,7 +838,7 @@ } } - toxine_set_command_line(tox, command); + toxine_command_insert_command_line(tox, command); toxine_handle_command(tox, NULL); } } @@ -948,7 +938,11 @@ toxine_handle_stdin(tox); } else if(tox->script.in_use) { - toxine_handle_script(tox); + tox->interactive = 0; + + if(toxine_read_script(tox)) + toxine_handle_command(tox, NULL); + tox->video.running = tox->running = 0; } else { @@ -986,8 +980,8 @@ char *line; line = grabbed_line; - - toxine_set_command_line(tox, line); + + toxine_command_append_command_line(tox, line); toxine_handle_command(tox, NULL); add_history(toxine_atoa(line)); @@ -1020,8 +1014,16 @@ _xine_exit(NULL, tox, NULL); } - if(tox->video.last_plugin && tox->video.last_plugin->video_out_release) - tox->video.last_plugin->video_out_release(tox); + { /* Release vops */ + int i; + + for(i = 0; i < tox->video.plugins_num; i++) { + if(tox->video.plugins[i]->video_out_release) { + tox->video.last_plugin = tox->video.plugins[i]; + tox->video.plugins[i]->video_out_release(tox); + } + } + } } @@ -1104,7 +1106,7 @@ memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "%s %s", "xine_get_video_property", toxine_get_arg(tox, 3)); - toxine_set_command_line(tox, buffer); + toxine_command_insert_command_line(tox, buffer); toxine_handle_command(tox, NULL); } @@ -1114,7 +1116,7 @@ memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "%s %s", "xine_get_video_property_min_max", toxine_get_arg(tox, 3)); - toxine_set_command_line(tox, buffer); + toxine_command_insert_command_line(tox, buffer); toxine_handle_command(tox, NULL); } @@ -1174,7 +1176,7 @@ sprintf(buffer, "%s %s %s", "xine_set_param", toxine_get_arg(tox, 3), toxine_get_arg(tox, 4)); - toxine_set_command_line(tox, buffer); + toxine_command_insert_command_line(tox, buffer); toxine_handle_command(tox, NULL); } @@ -1240,7 +1242,7 @@ sprintf(buffer, "%s %d", "xine_set_param XINE_PARAM_AUDIO_VOLUME", tox->audio.mixer.volume_level); - toxine_set_command_line(tox, buffer); + toxine_command_insert_command_line(tox, buffer); toxine_handle_command(tox, NULL); } @@ -1248,7 +1250,7 @@ } else if(toxine_is_arg_contain(tox, 2, "mute")) { - toxine_set_command_line(tox, "xine_set_param XINE_PARAM_AUDIO_MUTE"); + toxine_command_insert_command_line(tox, "xine_set_param XINE_PARAM_AUDIO_MUTE"); toxine_handle_command(tox, NULL); } @@ -1303,8 +1305,8 @@ * leave toxine. */ static void do_quit(commands_t *command, toxine_t *tox, void *data) { - - if(tox->interactive) { + + if(tox->interactive == 1) { if((toxine_confirm(tox, "Do you really want to quit toxine ? [yes|no]: "))) tox->video.running = tox->running = 0; } @@ -1323,7 +1325,7 @@ return_if_no_stream(tox); error_code_clear(tox); - if(tox->command.num_args) + if(toxine_command_get_current_num_args(tox)) toxine_set_current_mrl(tox, (toxine_get_arg(tox, 1))); else if(!tox->current_mrl) toxine_set_current_mrl_from_cur(tox); @@ -1337,6 +1339,7 @@ start_watchdog(tox, "xine_open"); result = xine_open(tox->stream, tox->current_mrl); stop_watchdog(tox); + pinfo("-- returned %d\n", result); if(result) { tox->xine_state |= XINE_OPEN; _xine_play(command, tox, (void *)NO_ARGS); @@ -1471,10 +1474,11 @@ int retval; if(!tox->script.in_use) { - if(tox->command.num_args) { + int num_args = toxine_command_get_current_num_args(tox); + if(num_args) { int i; - for(i = 0; i < tox->command.num_args; i++) + for(i = 0; i < num_args; i++) sprintf(buffer, "%s %s", buffer, (toxine_get_arg(tox, (i+1)))); } else @@ -1539,7 +1543,7 @@ error_code_clear(tox); - if(!tox->command.num_args) { + if(!toxine_command_get_current_num_args(tox)) { int i = 0, j; int maxlen = 0; int curpos = 0; @@ -2159,7 +2163,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(tox, "Add mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive == 1) ? (toxine_confirm(tox, "Add mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_add_entry(tox, mmk.mrl, mmk.ident, mmk.start, mmk.end); @@ -2234,7 +2238,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(tox, "Add mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive == 1) ? (toxine_confirm(tox, "Add mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_add_entry(tox, mmk.mrl, mmk.ident, mmk.start, mmk.end); @@ -2460,7 +2464,7 @@ pinfo(" mrl: '%s'\n", mmk.mrl); pinfo(" start @ %d, end @ %d.\n", mmk.start, mmk.end); - confirm = (tox->interactive) ? (toxine_confirm(tox, "Replace mediamark ? [yes|no]: ")) : 1; + confirm = (tox->interactive == 1) ? (toxine_confirm(tox, "Replace mediamark ? [yes|no]: ")) : 1; if(confirm) { playlist_replace_entry(&tox->playlist.mmk[entry], @@ -2524,44 +2528,41 @@ int i; int nargs = toxine_is_args(tox); int len = 0; - const char *var, *arg; + const char *arg; error_code_clear(tox); - + i = 1; while(i <= nargs) { - arg = toxine_get_arg(tox, i++); - if((var = toxine_get_var(tox, arg)) != NULL) - len += strlen(var); - else - len += strlen(arg); + arg = toxine_get_arg(tox, i); + + len += strlen(arg); + + i++; } if(len) { len += nargs; { - char buffer[(len * 2)]; - - memset(&buffer, 0, sizeof(buffer)); + char *buffer = NULL; i = 1; while(i <= nargs) { - + if(i > 1) - strcat(buffer, " "); - - arg = toxine_get_arg(tox, i++); - - if((var = toxine_get_var(tox, arg)) != NULL) - strcat(buffer, var); - else - strcat(buffer, arg); - + toxine_strcat(&buffer, " "); + + arg = toxine_get_arg(tox, i); + toxine_strcat(&buffer, (char *)arg); + + i++; } - sprintf(buffer, "%s%c", buffer, '\n'); + + toxine_strcat(&buffer, "\n"); pecho(buffer); + toxine_free(buffer); } } @@ -2623,48 +2624,13 @@ 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))) { + toxine_command_t *rcmd; - 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); + if((rcmd = toxine_command_scissor(tox, (char *) toxine_get_arg(tox, 2)))) + toxine_command_n_insert_commands(tox, repeat, rcmd); } } Index: commands.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- commands.h 7 Apr 2004 18:21:07 -0000 1.6 +++ commands.h 18 Jul 2004 20:31:40 -0000 1.7 @@ -23,15 +23,10 @@ #include <xine.h> #include "common.h" -#define NO_ARGS 1 -#define REQUIRE_ARGS 2 -#define OPTIONAL_ARGS 3 - void toxine_event_listener(void *, const xine_event_t *); int toxine_video_out_init(toxine_t *); int toxine_audio_out_init(toxine_t *); void toxine_handle_command(toxine_t *, void *); -void toxine_stop(toxine_t *); void toxine_run(toxine_t *, int, char **); void *toxine_end_thread(void *); Index: common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- common.h 1 Jun 2004 22:15:46 -0000 1.34 +++ common.h 18 Jul 2004 20:31:40 -0000 1.35 @@ -33,6 +33,7 @@ typedef struct toxine_s toxine_t; #include "utils.h" +#include "parse.h" #include "vo_plugin.h" #include "errors.h" @@ -60,6 +61,10 @@ #define _cfg_entry_t xine_cfg_entry_t #endif +#define NO_ARGS 1 +#define REQUIRE_ARGS 2 +#define OPTIONAL_ARGS 3 + #define INFO_PREFIX " (I) " #define HELP_PREFIX " (?) " #define ECHO_PREFIX " (e) " @@ -95,7 +100,53 @@ } \ } while(0) -#define poutalign() do { \ +#if 0 +#define toxine_strcat(d, fmt, ags...) do { \ + if((d) && (fmt)) { \ + va_list vargs; \ + char *__buf; \ + int n, size = 100; \ + \ + if((__buf = xine_xmalloc(size))) { \ + while(1) { \ + va_start(vargs, fmt); \ + n = vsnprintf(__buf, size, fmt, vargs); \ + va_end(vargs); \ + \ + if(n > -1 && n < size) \ + break; \ + \ + if(n > -1) \ + size = n + 1; \ + else \ + size *= 2; \ + \ + if(!(__buf = realloc(__buf, size))) \ + break; \ + } \ + \ + if(__buf) { \ + int len = strlen((d)) + strlen(__buf) + 1; \ + (d) = (char *) realloc((d), len); \ + strcat((d), __buf); \ + free(__buf); \ + } \ + } \ + } \ + } while(0) +#endif +#if 0 +#define toxine_strcat(d, s) do { \ + if((d) && (s)) { \ + int len = ((d) ? strlen((d)) : 0); \ + \ + (d) = (char *) realloc((d), len + strlen((s)) + 1); \ + strcat((d), (s)); \ + } \ + } while(0) +#endif + +#define poutalign() do { \ if(!tox->stdin) { \ fprintf(stdout, "%s", EMPTY_PREFIX); \ fflush(stdout); \ @@ -314,11 +365,7 @@ struct { int execute; - char *remain; - char *line; - char *command; - int num_args; - char *args[256]; + toxine_command_t *current; } command; char *current_mrl; @@ -339,10 +386,6 @@ struct { int in_use; char *filename; - char **lines; - int current; - int num_lines; - char *ln; } script; int stdin; Index: main.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/main.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- main.c 1 Jun 2004 22:15:46 -0000 1.39 +++ main.c 18 Jul 2004 20:31:40 -0000 1.40 @@ -248,14 +248,9 @@ toxine_free(tox->configfile); toxine_free((char *)tox->video.name); toxine_free((char *)tox->audio.name); - toxine_free(tox->command.line); - toxine_free(tox->command.remain); - toxine_free(tox->command.command); + toxine_command_free_commands(tox->command.current); // toxine_free(tox->last_result); - 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]); @@ -295,7 +290,6 @@ int c = '?'; int option_index = 0; int interactive = 1; - int i; toxine_error_code_t last_error; pthread_t pth; @@ -317,9 +311,7 @@ tox->watchdog.enabled = 0; tox->watchdog.running = 0; tox->watchdog.timeout = 15; /* 15 secs timeout */ - tox->command.remain = NULL; - tox->command.line = NULL; - tox->command.command = NULL; + tox->command.current = NULL; tox->command.execute = 0; tox->xine_state = 0; tox->msg_fd = -1; @@ -355,7 +347,7 @@ case 'e': /* execute commands */ if(optarg != NULL) { tox->command.execute = 1; - tox->command.line = strdup(toxine_atoa(optarg)); + toxine_command_append_command_line(tox, toxine_atoa(optarg)); } break; @@ -465,13 +457,7 @@ tox->loop_mode = PLAYLIST_LOOP; tox->last_result = NULL; - for(i = 0; i < 256; i++) - tox->command.args[i] = (char *) xine_xmalloc(sizeof(char *) * 2048); - - if(interactive) - tox->interactive = 1; - else - tox->interactive = 0; + tox->interactive = interactive ? 1 : 0; toxine_run(tox, argc - optind, &argv[optind]); last_error = tox->last_error; Index: parse.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- parse.c 24 May 2004 20:53:25 -0000 1.10 +++ parse.c 18 Jul 2004 20:31:40 -0000 1.11 @@ -25,305 +25,641 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <ctype.h> #include "common.h" #include "utils.h" -/* - * Push first command in remain queue to current command. - */ -static void toxine_parse_destock_remain(toxine_t *tox) { - char *p; +#undef TRACE +struct toxine_command_s { + char *command; + + int num_args; + char **args; - /* - * Remain and line are already filled, perhaps a forced command line - * happen here: don't handle it here - */ + toxine_command_t *next; +}; - if((tox->command.remain) && (tox->command.line)) - return; - - 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); +#define CLEAN_BUFFER_EOL() \ + do { \ + if(strlen(buffer)) { \ + char *p = buffer + (strlen(buffer) - 1); \ + \ + while(*p && (*p == ' ')) { \ + if(((p - 1) >= buffer) && (*(p - 1) == '\\')) \ + break; \ + *p = '\0'; \ + if((p - 1) >= buffer) \ + p--; \ + } \ + \ + if(strlen(buffer)) { \ + char *p = buffer + (strlen(buffer) - 1); \ + \ + while(*p && (*p == ';')) { \ + if(((p - 1) >= buffer) && (*(p - 1) == '\\')) \ + break; \ + *p = '\0'; \ + if((p - 1) >= buffer) \ + p--; \ + } \ + } \ + \ + if(!strlen(buffer)) \ + pd = NULL; \ + } \ + } while(0) + +#define _COMMAND_ADD() \ + do { \ + if(!top_command) \ + top_command = cur_command = _command_new(); \ + \ + else { \ + cur_command->next = _command_new(); \ + cur_command = cur_command->next; \ + } \ + _command_add(tox, cur_command, buffer); \ + } while(0) + +#ifdef TRACE +void _command_dump(toxine_t *tox, toxine_command_t *command) { + + while(command) { + pout("-> '%s' [%d]\n", command->command, command->num_args); + if(command->num_args) { + int i = 0; + + while(command->args[i]) { + pout(" + '%s'\n", command->args[i]); + i++; + } + } + pout("--\n"); + command = command->next; } +} +#endif - 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; - - if(tox->command.line && (strlen(tox->command.line) > strlen(tox->command.remain))) - len = strlen(tox->command.line); - else - len = strlen(tox->command.remain); +static void _command_free(toxine_command_t *command) { + if(command) { + free(command->command); + if(command->num_args) { + int i = 0; + + while(command->args[i]) { + free(command->args[i]); + i++; + } + free(command->args); + } + free(command); + } +} - commandline = (char *) xine_xmalloc(sizeof(char) * (len + 1)); - remaining = (char *) xine_xmalloc(sizeof(char) * (len + 1)); +static toxine_command_t *_command_new(void) { + toxine_command_t *cmd; + + cmd = (toxine_command_t *) xine_xmalloc(sizeof(toxine_command_t)); + cmd->command = NULL; + cmd->num_args = 0; + cmd->args = NULL; + cmd->next = NULL; + + return cmd; +} + +static toxine_command_t *_command_clone(toxine_command_t *command) { + toxine_command_t *cmd = NULL; + + if(command) { + cmd = _command_new(); + cmd->command = strdup(command->command); + cmd->next = command->next; - if((p = strchr(tox->command.remain, ';')) && (*(p - 1) != '\\')) { + if((cmd->num_args = command->num_args)) { + int i = 0; - pp = tox->command.remain; - pbuf = commandline; + cmd->args = (char **) xine_xmalloc(sizeof(char *) * (command->num_args + 1)); - while(pp < p) { - *pbuf = *pp; - pp++; - pbuf++; + while(command->args[i]) { + cmd->args[i] = strdup(command->args[i]); + i++; } - *pbuf = '\0'; + } + } + + return cmd; +} + +static toxine_command_t *_command_n_copy(toxine_t *tox, toxine_command_t *command, unsigned int n) { + toxine_command_t *top = command; + + if(command && (n > 1)) { + toxine_command_t *cmd = top; + int count = 1; + int i, j; + + while(cmd->next) { + count++; + cmd = cmd->next; + } + + for(i = 0; i < (n - 1); i++) { + toxine_command_t *pcmd = top; - if(strlen(commandline)) { - c = &commandline[strlen(commandline)]; - while((*c == ';') && (c >= commandline)) { - *c = '\0'; - c--; - } + for(j = 0; j < count; j++) { + cmd->next = _command_clone(pcmd); + cmd = cmd->next; + cmd->next = NULL; + pcmd = pcmd->next; } + } + } + +#ifdef TRACE + _command_dump(tox, top); +#endif + return top; +} + +static void _command_add(toxine_t *tox, toxine_command_t *command, char *cmd) { + if(command && cmd) { + if(command->command) { + perr("INTERNAL ERROR: command '%s' is already sets to '%s'\n", cmd, command->command); + free(command->command); + } + command->command = strdup(cmd); + } +} + +static void _command_add_arg(toxine_t *tox, toxine_command_t *command, char *arg) { + if(command && arg && strlen(arg)) { + char *_arg = strdup(arg); + char *parg, *p; + + p = _arg; + while(p && ((*p == '{') || (*p == ' '))) + p++; + + parg = p; + + p = (_arg + (strlen(_arg) - 1)); + while(p && (p > parg) && ((*p == '}') || (*p == ' '))) + *p-- = '\0'; + + command->args = (char **) realloc(command->args, sizeof(char *) * (command->num_args + 2)); + command->args[command->num_args] = strdup(parg); + command->args[command->num_args + 1] = NULL; + command->num_args++; + free(_arg); + } +} + +toxine_command_t *toxine_command_scissor(toxine_t *tox, char *command) { + toxine_command_t *top_command = NULL; + + if(command && strlen(command)) { + toxine_command_t *cur_command = NULL; + char *cmd_line = strdup(command); + int in_brace = 0; + int in_bracket = 0; + int got_command = 0; + char quote = 0; + char *buffer;//[strlen(command) + 1]; + char *ps, *pe; + char *pc, *pd; + + buffer = (char *) xine_xmalloc(strlen(cmd_line) + 1); + + ps = cmd_line; + pe = cmd_line + strlen(cmd_line); + + while(*ps && (*ps == ' ' || *ps == ';')) + ps++; + + while((pe > ps) && ((*pe == ' ') && (*(pe - 1) != '\\'))) + *(pe--) = '\0'; + + /* Now extract command and arguments */ + pc = ps; + pd = buffer; + + while(*pc) { - c = toxine_atoa(commandline); - - if(*p == ';') - p++; - - if(p) - sprintf(remaining, "%s", (toxine_atoa(p))); - - tox->command.line = (char *) realloc(tox->command.line, sizeof(char *) * (strlen(c) + 1)); - - sprintf(tox->command.line, "%s", c); - - if(p) { - /* remove last ';' */ - if(strchr(remaining, ';')) { - p = &remaining[strlen(remaining)]; - while((*p == ';') && (p >= remaining)) { - *p = '\0'; - p--; + switch(*pc) { + + case '\n': + case '\r': + if((pd - 1) >= buffer) + pd--; + break; + + + case '\\': + *(pd++) = *pc; + *pd = *(++pc); + break; + + + case ' ': + if(in_brace || in_bracket) { + if(strlen(buffer)) + *pd = *pc; + } + else { + CLEAN_BUFFER_EOL(); + + if(strlen(buffer)) { + + if(!got_command) { + _COMMAND_ADD(); + pd = NULL; + got_command = 1; + } + else { + _command_add_arg(tox, cur_command, buffer); + pd = NULL; + } } } - if(strlen(remaining)) { - tox->command.remain = (char *) realloc(tox->command.remain, sizeof(char *) * (strlen(remaining) + 1)); - sprintf(tox->command.remain, "%s", remaining); + while(*pc && (*(pc + 1) == ' ')) + pc++; + break; + + + case ';': + if(in_brace) { + *pd = *pc; } else { - toxine_free(tox->command.remain); + if(got_command) { + CLEAN_BUFFER_EOL(); + _command_add_arg(tox, cur_command, buffer); + pd = NULL; + } + else { + + CLEAN_BUFFER_EOL(); + + if(strlen(buffer)) + _COMMAND_ADD(); + + pd = NULL; + } + + got_command = 0; } + break; + + + case '[': + in_bracket++; +#ifdef TRACE + if(in_bracket > 1) + perr("Wrong syntax\n"); +#endif + break; + + + case ']': + if(in_bracket) { + in_bracket--; + CLEAN_BUFFER_EOL(); + _command_add_arg(tox, cur_command, buffer); + pd = NULL; + } +#ifdef TRACE + else + perr("Bad syntax\n"); +#endif + break; + case '{': + in_brace++; + printf("BRACE %d: %s\n", in_brace, pc); + if(in_brace == 1) { + } + else + *pd = *pc; + break; + + + case '}': + if(in_brace) { + in_brace--; + + if(!in_brace) { + CLEAN_BUFFER_EOL(); + _command_add_arg(tox, cur_command, buffer); + pd = NULL; + } + else { + *pd = *pc; + } + } +#ifdef TRACE + else + perr("Something's wrong in wonderland...\n"); +#endif + break; + + + case '"': + quote = '"'; + case '\'': + { + char *opc; + + if(quote == 0) { + if(!strchr((pc + 1), '\'')) + goto __store_as_is; + quote = '\''; + } + + opc = ++pc; + + while(*pc && (*pc != quote)) + *(pd++) = *(pc++); + + if(opc != pc) + pd--; + + quote = 0; + } + break; + + + default: + __store_as_is: + *pd = *pc; + break; + } + + pc++; + + if(!pd) { + memset(buffer, 0, strlen(cmd_line) + 1); + pd = buffer; } else { - toxine_free(tox->command.remain); + if((pd > buffer) || ((pd == buffer) && (*pd != '\0'))) + pd++; } - } - else { /* no ';' in remain, copy AS IS remain to line */ - tox->command.line = (char *) realloc(tox->command.line, sizeof(char *) * (strlen(tox->command.remain) + 1)); - sprintf(tox->command.line, "%s", tox->command.remain); + + if(pd) { + CLEAN_BUFFER_EOL(); - toxine_free(tox->command.remain); + if(strlen(buffer)) { + + if(!got_command) + _COMMAND_ADD(); + else + _command_add_arg(tox, cur_command, buffer); + } } - - toxine_free(commandline); - toxine_free(remaining); + + free(buffer); + free(cmd_line); } + + return top_command; } /* - * handle multicommand line. + * return argument number. */ -static void toxine_parse_handle_multicommands(toxine_t *tox) { +int toxine_is_args(toxine_t *tox) { + if(!tox) + return -1; - if(tox->command.remain) - perr("Ooch, Unexpected state, remain isn't empty\n"); - else { - tox->command.remain = strdup(tox->command.line); - toxine_parse_destock_remain(tox); - } + return (tox->command.current ? + tox->command.current->num_args : 0); } /* - * parse command, extract arguments. + * return argumemnt <num>, NULL if there is not argument. */ -void toxine_parse_command(toxine_t *tox) { - char *p, *cmd, *cmdl; - int i = 0; - - toxine_parse_destock_remain(tox); +const char *toxine_get_arg(toxine_t *tox, int num) { + if((!tox || !tox->command.current) || (num < 1) || (tox->command.current->num_args < num)) + return NULL; - if((p = strchr(tox->command.line, ';'))) { - - if((*(p - 1) != '\\')) - toxine_parse_handle_multicommands(tox); - else { - char *pp = tox->command.line; + return(tox->command.current->args[num - 1]); +} - while((p = strchr(pp, ';')) && (*(p - 1) == '\\')) { - *(p - 1) = ' '; - pp = p + 1; - } - } +/* + * return 1 if *arg match with argument <pos> + */ +int toxine_is_arg_contain(toxine_t *tox, int pos, const char *arg) { + + if(tox && tox->command.current && pos && ((arg != NULL) && (strlen(arg))) && (tox->command.current->num_args >= pos)) { + if(!strncmp(tox->command.current->args[pos - 1], arg, strlen(tox->command.current->args[pos - 1]))) + return 1; + } + + return 0; +} +int toxine_is_arg_match(toxine_t *tox, int pos, const char *arg) { + + if(tox && tox->command.current && pos && ((arg != NULL) && (strlen(arg))) && (tox->command.current->num_args >= pos)) { + if(!strcmp(tox->command.current->args[pos - 1], arg)) + return 1; } + + return 0; +} - cmdl = tox->command.line; +/* + * return 1 if last arg match *arg + */ +int toxine_is_last_arg_contain(toxine_t *tox, const char *arg) { - if(tox->command.num_args) { - for(i = 0; i < tox->command.num_args; i++) - memset(tox->command.args[i], 0, sizeof(tox->command.args[i])); + if(tox && tox->command.current && ((arg != NULL) && (strlen(arg))) && tox->command.current->num_args) { + if(!strncmp(tox->command.current->args[tox->command.current->num_args - 1], arg, + strlen(tox->command.current->args[tox->command.current->num_args - 1]))) + return 1; } - tox->command.num_args = 0; + return 0; +} +int toxine_is_last_arg_match(toxine_t *tox, const char *arg) { - while((*cmdl == ' ') || (*cmdl == '\t')) - cmdl++; + if(tox && tox->command.current && ((arg != NULL) && (strlen(arg))) && tox->command.current->num_args) { + if(!strcmp(tox->command.current->args[tox->command.current->num_args - 1], arg)) + return 1; + } - cmd = cmdl; + return 0; +} - while(*cmd != '\0' && (*cmd != ' ' && *(cmd - 1) != '\\') && *cmd != '\t') - cmd++; +void toxine_command_n_insert_commands(toxine_t *tox, unsigned int n, toxine_command_t *command) { + if(tox && command) { + toxine_command_t *current = tox->command.current; + toxine_command_t *ncmd = _command_n_copy(tox, command, n); - if(cmd >= (cmdl + strlen(cmdl))) - cmd = NULL; + if(!current) + tox->command.current = ncmd; + else { + toxine_command_t *cmd = tox->command.current->next; - if(cmd) { - tox->command.command = (char *) realloc(tox->command.command, strlen(cmdl) - strlen(cmd) + 1); + current->next = ncmd; + + while(ncmd->next) + ncmd = ncmd->next; + + ncmd->next = cmd; + } + } +} - memset(tox->command.command, 0, sizeof(tox->command.command)); - snprintf(tox->command.command, (strlen(cmdl) - strlen(cmd))+1, "%s", cmdl); - - cmd = toxine_atoa(cmd); +void toxine_command_n_append_commands(toxine_t *tox, unsigned int n, toxine_command_t *command) { + if(tox && command) { + toxine_command_t *current = tox->command.current; + toxine_command_t *ncmd = _command_n_copy(tox, command, n); + + if(!current) { + tox->command.current = ncmd; + } + else { + toxine_command_t *pcmd = command; + + while(pcmd->next) + pcmd = pcmd->next; + + pcmd->next = ncmd; + } + } +} + +void toxine_command_insert_command_line(toxine_t *tox, char *line) { + if(tox && line && strlen(line)) + toxine_command_n_insert_commands(tox, 1, (toxine_command_scissor(tox, line))); +} + +void toxine_command_n_insert_command_line(toxine_t *tox, unsigned int n, char *line) { + if(tox && line && strlen(line)) + toxine_command_n_insert_commands(tox, n, (toxine_command_scissor(tox, line))); +} + +void toxine_command_append_command_line(toxine_t *tox, char *line) { + if(tox && line && strlen(line)) + toxine_command_n_append_commands(tox, 1, (toxine_command_scissor(tox, line))); +} + +void toxine_command_n_append_command_line(toxine_t *tox, unsigned int n, char *line) { + if(tox && line && strlen(line)) + toxine_command_n_append_commands(tox, n, (toxine_command_scissor(tox, line))); +} + +int toxine_command_have_current(toxine_t *tox) { + if(tox && tox->command.current && tox->command.current->command && strlen(tox->command.current->command)) + return 1; + + return 0; +} + +void toxine_command_free_commands(toxine_command_t *commands) { + if(commands) { + toxine_command_t *cmd = commands; - /* - * Extract and store args - */ - if(cmd < (cmdl + strlen(cmdl))) { - char *pcmd, *pb, buf[256]; - int nargs = 0; - int get_quote = 0, get_dbl_quote = 0; + while(cmd) { + toxine_command_t *pcmd = cmd; - pcmd = cmd; - memset(&buf, 0, sizeof(buf)); - pb = buf; + cmd = pcmd->next; - while(*(pcmd - 1) != '\0') { - - switch(*pcmd) { + _command_free(pcmd); + } + } +} - case '"': - case '\'': - if(*(pcmd - 1) != '\\') { - if(*pcmd == '\'') { - if(!get_dbl_quote) - get_quote++; - } - else if(*pcmd == '"') { - if(!get_quote) - get_dbl_quote++; - } +void toxine_command_next(toxine_t *tox) { + toxine_command_t *current; + + if(tox && (current = tox->command.current)) { + tox->command.current = tox->command.current->next; + _command_free(current); + } +} - if(get_quote == 2) - get_quote = 0; - else if(get_dbl_quote == 2) - get_dbl_quote = 0; - } - else { - pb--; - goto __store_char; - } - - break; - - case '\t': - if((!get_quote) && (!get_dbl_quote)) - goto __end_args; - else - goto __store_char; - break; - - case '\0': - goto __end_args; - break; - - case '$': - { - char *var; - char buffer[2048]; - char *p = buffer; - char *pp = pcmd; - - memset(&buffer, 0, sizeof(buffer)); +int toxine_command_have_next(toxine_t *tox) { + if(tox && tox->command.current) + return (tox->command.current->next ? 1 : 0); - while(pp && *pp && *pp != ' ') { - *p = *pp; - p++; - pp++; - } - p = '\0'; + return 0; +} + +const char *toxine_command_get_current_command(toxine_t *tox) { + if(tox && tox->command.current) + return tox->command.current->command; + + return NULL; +} + +int toxine_command_get_current_num_args(toxine_t *tox) { + if(tox && tox->command.current) + return tox->command.current->num_args; + + return 0; +} - if((var = toxine_get_var(tox, buffer))) { - p = var; +void toxine_command_prepare_args(toxine_t *tox) { + if(tox && tox->command.current && tox->command.current->num_args) { + int i = 0; + char *p; + + while((p = tox->command.current->args[i])) { + + if(strchr(p, '$')) { + char *pp = p; + char *newarg = NULL; + char *var = NULL; + + while(pp && (*pp != '\0')) { + + switch(*pp) { + case '$': + { + char *d = pp; + char *_var = NULL; - while(p && *p != '\0') { - *pb = *p; - pb++; - p++; + toxine_strcat(&_var, "%c", *d); + d++; + while(d && (*d != '\0') && ((*d != '$') && ((isalnum(*d)) || (*d == '_')))) { + toxine_strcat(&_var, "%c", *d); + d++; } - pcmd += strlen(buffer); - goto __end_args; - } - else - goto __store_char; - - } - break; + pp = d; - case ' ': - if((*(pcmd - 1) != '\\') && ((get_quote == 0) && (get_dbl_quote == 0))) { - while(*(pcmd + 1) == ' ') - pcmd++; + if((var = toxine_get_var(tox, _var))) + toxine_strcat(&newarg, var); + else + toxine_strcat(&newarg, _var); + toxine_free(_var); + } + break; - __end_args: - sprintf(tox->command.args[nargs], "%s", buf); - nargs++; - memset(&buf, 0, sizeof(buf)); - pb = buf; - } - else { - if(*(pcmd - 1) == '\\') - pb--; - goto __store_char; + default: + toxine_strcat(&newarg, "%c", *pp); + pp++; + break; } - break; - - default: - __store_char: - *pb = *pcmd; - pb++; - break; } - pcmd++; + + if(!var && !newarg) + toxine_strcat(&newarg, p); + + toxine_free(var); + + tox->command.current->args[i] = (char *) realloc(tox->command.current->args[i], strlen(newarg) + 1); + strcpy(tox->command.current->args[i], newarg); + + toxine_free(newarg); } - tox->command.num_args = nargs; + + i++; } } - else { - 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); - } - -#if 0 - { - int k; - pinfo("tox->command = '%s'\n", tox->command.command); - if(tox->command.num_args) - for(k = 0; k < tox->command.num_args; k++) - pinfo("tox->command_arg[%d] = '%s'\n", k, tox->command.args[k]); - } -#endif } Index: parse.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/parse.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- parse.h 7 Apr 2004 18:21:07 -0000 1.3 +++ parse.h 18 Jul 2004 20:31:40 -0000 1.4 @@ -22,6 +22,30 @@ #include "common.h" -void toxine_parse_command(toxine_t *tox); +typedef struct toxine_command_s toxine_command_t; + +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); + +toxine_command_t *toxine_command_scissor(toxine_t *tox, char *command); +void toxine_command_n_insert_commands(toxine_t *tox, unsigned int n, toxine_command_t *command); +void toxine_command_n_append_commands(toxine_t *tox, unsigned int n, toxine_command_t *command); +void toxine_command_insert_command_line(toxine_t *tox, char *line); +void toxine_command_n_insert_command_line(toxine_t *tox, unsigned int n, char *line); +void toxine_command_append_command_line(toxine_t *tox, char *line); +void toxine_command_n_append_command_line(toxine_t *tox, unsigned int n, char *line); +void toxine_command_free_commands(toxine_command_t *commands); + +int toxine_command_have_current(toxine_t *tox); +void toxine_command_next(toxine_t *tox); +int toxine_command_have_next(toxine_t *tox); + +const char *toxine_command_get_current_command(toxine_t *tox); +int toxine_command_get_current_num_args(toxine_t *tox); +void toxine_command_prepare_args(toxine_t *tox); #endif Index: script.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/script.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- script.c 27 May 2004 00:27:39 -0000 1.6 +++ script.c 18 Jul 2004 20:31:40 -0000 1.7 @@ -29,115 +29,103 @@ #include "commands.h" #include "utils.h" -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 char *_script_prepare_buffer(char *buffer) { + char *buf = NULL; + char *p; -static int toxine_script_split_lines(toxine_t *tox, char *_buf) { - - if(_buf) { - char *buf, *p, *pp, *obuf; + if(buffer) { + char *pbuf; - buf = strdup(_buf); - obuf = buf; - pp = buf; - - tox->script.num_lines = 0; + buf = strdup(buffer); + pbuf = buf; - while((p = strchr(pp, '\n'))) { - if(*(p - 1) == '\\') { - *(p - 1) = ' '; - *p = ' '; - } - else - pp++; - } + while((p = xine_strsep(&pbuf, "\n"))) { + int no_space = 0; + + if(strlen(p)) { - while((p = xine_strsep(&buf, "\n"))) { + if(*p == '#') { + char *ps = p; + + while(ps && (*ps != '\0')) + *ps++ = ' '; + + } + else { + char *pp, *c; + + pp = p; + while(pp && (*pp != '\0')) { + if(*pp != ' ') { + no_space = 1; + break; + } + pp++; + } + + pp = p; + if((c = strchr(pp, '#'))) { + if(*(c - 1) == ' ') { + while(c && (*c != '\0')) + *c++ = ' '; + } + } - 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'; + } + } - tox->script.lines[tox->script.num_lines++] = strdup(p); + if(*(p + strlen(p) - 1) == '\\') { + *(p + strlen(p) - 1) = ' '; + *(p + strlen(p)) = ' '; + } + else { + if(!no_space) + *(p + strlen(p)) = ' '; + else { + if(*(p + strlen(p)) != ';') + *(p + strlen(p)) = ';'; + } } } - - toxine_free(buf); } - - return (tox->script.num_lines > 0); -} - -static int toxine_script_get_next_line(toxine_t *tox) { - - __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; - } - return 0; + + return buf; } -/* - * Main loop in script mode. - */ -void toxine_handle_script(toxine_t *tox) { +int toxine_read_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; + char *buf, *buffer; + 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); perr("read() returned wrong size (expected %lld, readed %lld)\n", st.st_size, br); - return; + return 0; } 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); + buf[br] = '\0'; + + /* Prepare the single line */ + if((buffer = _script_prepare_buffer(buf))) { + // printf("BUFFER: '%s'\n", buffer); + toxine_command_insert_command_line(tox, buffer); + toxine_free(buffer); } - + + toxine_free(buf); + return 1; } else { perr("Failed to open '%s': %s\n", tox->script.filename, strerror(errno)); @@ -156,4 +144,5 @@ error_code_set(tox, TOX_ERR_INTERNAL); } + return 0; } Index: script.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/script.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- script.h 7 Apr 2004 18:21:07 -0000 1.3 +++ script.h 18 Jul 2004 20:31:40 -0000 1.4 @@ -22,6 +22,6 @@ #include "common.h" -void toxine_handle_script(toxine_t *tox); +int toxine_read_script(toxine_t *tox); #endif Index: utils.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- utils.c 13 Jun 2004 17:26:36 -0000 1.32 +++ utils.c 18 Jul 2004 20:31:40 -0000 1.33 @@ -29,6 +29,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> +#include <stdarg.h> #include "readline.h" #include "tilde.h" @@ -236,84 +237,6 @@ } /* - * return argument number. - */ -int toxine_is_args(toxine_t *tox) { - if(!tox) - return -1; - - return tox->command.num_args; -} - -/* - * return argumemnt <num>, NULL if there is not argument. - */ -const char *toxine_get_arg(toxine_t *tox, int num) { - if((tox == NULL) || (num < 1) || (tox->command.num_args < num)) - return NULL; - - return(tox->command.args[num - 1]); -} - -/* - * return 1 if *arg match with argument <pos> - */ -int toxine_is_arg_contain(toxine_t *tox, int pos, const char *arg) { - - if(tox && pos && ((arg != NULL) && (strlen(arg))) && (tox->command.num_args >= pos)) { - if(!strncmp(tox->command.args[pos - 1], arg, strlen(tox->command.args[pos - 1]))) - return 1; - } - - 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. - */ -void toxine_set_command_line(toxine_t *tox, char *line) { - - if(tox && line && strlen(line)) { - - 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); - - } -} - -/* * Look for first entry in playlist matching with 'mrl' */ static int toxine_lookup_in_playlist(toxine_t *tox, const char *mrl) { @@ -716,6 +639,7 @@ switch(info_type) { case XINE_STREAM_INFO_BITRATE: case XINE_STREAM_INFO_SEEKABLE: + case XINE_STREAM_INFO_VIDEO_HANDLED: case XINE_STREAM_INFO_AUDIO_HANDLED: case XINE_STREAM_INFO_HAS_CHAPTERS: case XINE_STREAM_INFO_HAS_VIDEO: @@ -738,7 +662,6 @@ case XINE_STREAM_INFO_VIDEO_CHANNELS: case XINE_STREAM_INFO_VIDEO_STREAMS: case XINE_STREAM_INFO_VIDEO_BITRATE: - case XINE_STREAM_INFO_VIDEO_HANDLED: case XINE_STREAM_INFO_FRAME_DURATION: case XINE_STREAM_INFO_AUDIO_CHANNELS: case XINE_STREAM_INFO_AUDIO_BITS: @@ -746,6 +669,9 @@ case XINE_STREAM_INFO_AUDIO_BITRATE: case XINE_STREAM_INFO_MAX_AUDIO_CHANNEL: case XINE_STREAM_INFO_MAX_SPU_CHANNEL: + case XINE_STREAM_INFO_AUDIO_MODE: + case XINE_STREAM_INFO_SKIPPED_FRAMES: + case XINE_STREAM_INFO_DISCARDED_FRAMES: pinfo("%d\n", iinfo); break; @@ -757,144 +683,162 @@ } char *toxine_get_var(toxine_t *tox, const char *var) { - static char buffer[32768]; - + char *buffer = NULL; + error_code_clear(tox); - memset(buffer, 0, sizeof(buffer)); if(tox && var) { char *variable; - variable = strchr(var, '$'); - - if(variable && (*variable == '$') && (*(variable + 1) != '$')) { - char varname[1024]; - int found = 0; + if((variable = strchr(var, '$'))) { - 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((*variable == '$') && (*(variable + 1) != '$')) { + char varname[1024]; + int found = 0; - 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"; + memset(varname, 0, sizeof(varname)); - 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)); + if(sscanf(variable, "$\(%[a-z-A-Z-0-9-_])", &varname[0]) == 1) 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"); + else if(sscanf(variable, "$\{%[a-z-A-Z-0-9-_]}", &varname[0]) == 1) 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)); + else if(sscanf(variable, "$%[a-z-A-Z-0-9-_]", &varname[0]) == 1) found = 1; + + if(found) { + char *envvar; + + if((envvar = getenv(varname))) { + toxine_strcat(&buffer, envvar); + return buffer; + } } - else if(!strncasecmp(varname, "time", 4)) { - time_t curtime; - struct tm *lt; + + if(found) { + static const char day_names[] = "SunMonTueWedThuFriSat"; + static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; - 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; + if(!strncasecmp(varname, "result", 6)) + toxine_strcat(&buffer, "%d", toxine_get_last_int_result(tox)); + else if(!strncasecmp(varname, "cresult", 7)) + toxine_strcat(&buffer, "%s", toxine_get_last_char_result(tox)); + else if(!strncasecmp(varname, "cxresult", 7)) { + char *p = toxine_get_last_char_result(tox); + if(p) { + int val = strtol(p, &p, 10); + + toxine_strcat(&buffer, "0x%x", val); } - p++; - } + else + toxine_strcat(&buffer, "Nothing available"); - if(isargv) { + } + else if(!strncasecmp(varname, "iresult", 7)) + toxine_strcat(&buffer, "%d", toxine_get_last_int_result(tox)); + else if(!strncasecmp(varname, "xresult", 7)) + toxine_strcat(&buffer, "0x%x", toxine_get_last_int_result(tox)); + else if(!strncasecmp(varname, "version", 7)) + toxine_strcat(&buffer, "%s", VERSION); + else if(!strncasecmp(varname, "date", 4)) { + time_t curtime; + struct tm *lt; + + time(&curtime); + lt = localtime(&curtime); + toxine_strcat(&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)); + } + else if(!strncasecmp(varname, "time", 4)) { + time_t curtime; + struct tm *lt; + + time(&curtime); + lt = localtime(&curtime); + toxine_strcat(&buffer, "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); + } + else if(!strncasecmp(varname, "config_file", 11)) + toxine_strcat(&buffer, "%s", (tox->configfile) ? tox->configfile : "UNSET"); + else if(!strncasecmp(varname, "video_driver", 12)) + toxine_strcat(&buffer, "%s", (tox->video.name) ? tox->video.name : "UNSET"); + else if(!strncasecmp(varname, "audio_driver", 12)) + toxine_strcat(&buffer, "%s", (tox->audio.name) ? tox->audio.name : "UNSET"); + else if(!strncasecmp(varname, "mrl", 3)) + toxine_strcat(&buffer, "%s", (tox->current_mrl) ? tox->current_mrl : "UNSET"); + else if(!strncasecmp(varname, "script_file", 11)) + toxine_strcat(&buffer, "%s", (tox->script.filename) ? tox->script.filename : "UNSET"); + else { char *p = varname; - int val = strtol(p, &p, 10); + int isargv = 1; - if((val >= 0) && (val < tox->argc)) { - snprintf(buffer, sizeof(buffer), "%s", tox->argv[val]); - found = 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)) + toxine_strcat(&buffer, "%s", tox->argv[val]); + } } } + } + } + } - if(found) - return &buffer[0]; + return buffer; +} +char *toxine_strcat(char **dest, char *fmt, ...) { + char *p = NULL; + + if(fmt) { + va_list vargs; + int n, size = 100; + char *buf; + + if((buf = xine_xmalloc(size))) { + + while(1) { + va_start(vargs, fmt); + n = vsnprintf(buf, size, fmt, vargs); + va_end(vargs); + + if(n > -1 && n < size) + break; + + if(n > -1) + size = n + 1; + else + size *= 2; + + if(!(buf = realloc(buf, size))) + break; + } + + if(buf) { + + if((*dest)) { + int len = ((*dest) ? strlen((*dest)) : 0) + strlen(buf) + 1; + + (*dest) = (char *) realloc((*dest), len); + p = strncat((*dest), buf, strlen(buf)); + } + else + p = (*dest) = strdup(buf); + + free(buf); } - } + else + printf("%s(): buf is NULL\n", __func__); + } } - - snprintf(buffer, sizeof(buffer), "%s", var); - return &buffer[0]; + + return p; } Index: utils.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/utils.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- utils.h 27 May 2004 00:27:39 -0000 1.16 +++ utils.h 18 Jul 2004 20:31:40 -0000 1.17 @@ -21,6 +21,7 @@ #define __TOXINE_UTILS_H__ #include "common.h" +#include <stdarg.h> char *toxine_get_yesno_string(uint32_t val); char *toxine_get_fourcc_string(uint32_t f); @@ -32,12 +33,6 @@ void toxine_set_command_line(toxine_t *tox, char *line); void toxine_set_current_mrl_from_cur(toxine_t *tox); void toxine_set_current_mrl(toxine_t *tox, const char *mrl); -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(toxine_t *tox, char *path); void toxine_draw_bar(toxine_t *tox, char *title, int min, int max, int val); @@ -61,4 +56,5 @@ char *toxine_get_var(toxine_t *tox, const char *var); +char *toxine_strcat(char **dest, char *fmt, ...); #endif |
From: Daniel Caujolle-B. <f1...@us...> - 2004-07-18 20:31:50
|
Update of /cvsroot/toxine/toxine/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19802/src/plugins Modified Files: vo_x11.c Log Message: -New command parser. -Fix stdin and -e bug. -Release all VOPs when leaving. -Fix interactive option (-i) -Support multiple variables usage in command arguments. -Rework script parsing code. Index: vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- vo_x11.c 31 May 2004 20:37:06 -0000 1.34 +++ vo_x11.c 18 Jul 2004 20:31:41 -0000 1.35 @@ -1068,22 +1068,28 @@ XWindowAttributes wattr; Status status; + private->init = 0; + pthread_mutex_lock(&private->mutex); pthread_join(private->timed_thread, NULL); - start_watchdog(tox, "xine_close_video_driver"); - xine_close_video_driver(tox->xine, tox->video.port); - stop_watchdog(tox); - tox->video.port = NULL; - XLockDisplay(private->display); + XSync(private->display, True); XUnmapWindow(private->display, private->x11_drawable[private->fullscreen].video_window); + XSync(private->display, False); /* Waiting til' window's unmapped. */ do { status = XGetWindowAttributes(private->display, private->x11_drawable[private->fullscreen].video_window, &wattr); } while((status != BadDrawable) && (status != BadWindow) && (wattr.map_state == IsViewable)); + XUnlockDisplay(private->display); + start_watchdog(tox, "xine_close_video_driver"); + xine_close_video_driver(tox->xine, tox->video.port); + stop_watchdog(tox); + tox->video.port = NULL; + + XLockDisplay(private->display); XFreeCursor(private->display, private->cursor.cursors[0]); XFreeCursor(private->display, private->cursor.cursors[1]); @@ -1102,7 +1108,6 @@ pthread_mutex_unlock(&private->mutex); pthread_mutex_destroy(&private->mutex); - private->init = 0; } /* |