vlc/modules/lua/stream_filter.c

322 lines
8.5 KiB
C
Raw Normal View History

Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/*****************************************************************************
* stream_filter.c : Lua playlist stream filter module
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
*****************************************************************************
* Copyright (C) 2007-2008 the VideoLAN team
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
*
* Authors: Antoine Cellerier <dionoea at videolan tod org>
*
* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <vlc_common.h>
#include <vlc_access.h>
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
#include "vlc.h"
#include "libs.h"
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/*****************************************************************************
* Demux specific functions
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
*****************************************************************************/
struct vlclua_playlist
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
lua_State *L;
char *filename;
char *access;
const char *path;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
};
static int vlclua_demux_peek( lua_State *L )
{
stream_t *s = (stream_t *)vlclua_get_this(L);
int n = luaL_checkinteger( L, 1 );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
const uint8_t *p_peek;
ssize_t val = vlc_stream_Peek(s->s, &p_peek, n);
if (val > 0)
lua_pushlstring(L, (const char *)p_peek, val);
else
lua_pushnil( L );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
return 1;
}
static int vlclua_demux_read( lua_State *L )
{
stream_t *s = (stream_t *)vlclua_get_this(L);
int n = luaL_checkinteger( L, 1 );
char *buf = malloc(n);
if (buf != NULL)
{
ssize_t val = vlc_stream_Read(s->s, buf, n);
if (val > 0)
lua_pushlstring(L, buf, val);
else
lua_pushnil( L );
free(buf);
}
else
lua_pushnil( L );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
return 1;
}
static int vlclua_demux_readline( lua_State *L )
{
stream_t *s = (stream_t *)vlclua_get_this(L);
char *line = vlc_stream_ReadLine(s->s);
if (line != NULL)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
lua_pushstring(L, line);
free(line);
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
else
lua_pushnil( L );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
return 1;
}
/*****************************************************************************
* Called through lua_scripts_batch_execute to call 'probe' on
* the script pointed by psz_filename.
*****************************************************************************/
static int probe_luascript(vlc_object_t *obj, const char *filename,
const luabatch_context_t *ctx)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
stream_t *s = (stream_t *)obj;
struct vlclua_playlist *sys = s->p_sys;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/* Initialise Lua state structure */
lua_State *L = luaL_newstate();
if( !L )
return VLC_ENOMEM;
sys->L = L;
/* Load Lua libraries */
luaL_openlibs( L ); /* FIXME: Don't open all the libs? */
vlclua_set_this(L, s);
/* Functions to register */
static const luaL_Reg p_reg[] =
{
{ "peek", vlclua_demux_peek },
{ NULL, NULL }
};
luaL_register_namespace( L, "vlc", p_reg );
luaopen_msg( L );
luaopen_strings( L );
2010-02-27 00:52:26 +01:00
luaopen_stream( L );
luaopen_variables( L );
2010-02-13 14:54:04 +01:00
luaopen_xml( L );
if (sys->path != NULL)
lua_pushstring(L, sys->path);
else
lua_pushnil(L);
lua_setfield( L, -2, "path" );
if (sys->access != NULL)
lua_pushstring(L, sys->access);
else
lua_pushnil(L);
lua_setfield( L, -2, "access" );
lua_pop( L, 1 );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/* Setup the module search path */
if (vlclua_add_modules_path(L, filename))
{
msg_Warn(s, "error setting the module search path for %s", filename);
goto error;
}
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/* Load and run the script(s) */
if (vlclua_dofile(VLC_OBJECT(s), L, filename))
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
msg_Warn(s, "error loading script %s: %s", filename,
lua_tostring(L, lua_gettop(L)));
goto error;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
lua_getglobal( L, "probe" );
if( !lua_isfunction( L, -1 ) )
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
msg_Warn(s, "error running script %s: function %s(): %s",
filename, "probe", "not found");
goto error;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
if( lua_pcall( L, 0, 1, 0 ) )
{
msg_Warn(s, "error running script %s: function %s(): %s",
filename, "probe", lua_tostring(L, lua_gettop(L)));
goto error;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
if( lua_gettop( L ) )
{
if( lua_toboolean( L, 1 ) )
{
msg_Dbg(s, "Lua playlist script %s's "
"probe() function was successful", filename );
lua_pop( L, 1 );
sys->filename = strdup(filename);
return VLC_SUCCESS;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
}
(void) ctx;
error:
lua_pop( L, 1 );
lua_close(sys->L);
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
return VLC_EGENERIC;
}
static int ReadDir(stream_t *s, input_item_node_t *node)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
struct vlclua_playlist *sys = s->p_sys;
lua_State *L = sys->L;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
/* Functions to register for parse() function call only */
static const luaL_Reg p_reg_parse[] =
{
{ "read", vlclua_demux_read },
{ "readline", vlclua_demux_readline },
{ NULL, NULL }
};
luaL_register_namespace( L, "vlc", p_reg_parse );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
lua_getglobal( L, "parse" );
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
if( !lua_isfunction( L, -1 ) )
{
msg_Warn(s, "error running script %s: function %s(): %s",
sys->filename, "parse", "not found");
return VLC_EINVAL;
}
if( lua_pcall( L, 0, 1, 0 ) )
{
msg_Warn(s, "error running script %s: function %s(): %s",
sys->filename, "parse", lua_tostring(L, lua_gettop(L)));
return VLC_EINVAL;
}
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
if (!lua_gettop(L))
{
msg_Err(s, "script went completely foobar");
return VLC_EINVAL;
}
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
if (!lua_istable(L, -1))
{
msg_Warn(s, "Playlist should be a table.");
return VLC_EINVAL;
}
lua_pushnil(L);
/* playlist nil */
while (lua_next(L, -2))
{
input_item_t *item = vlclua_read_input_item(VLC_OBJECT(s), L);
if (item != NULL)
{
/* copy the original URL to the meta data,
* if "URL" is still empty */
char *url = input_item_GetURL(item);
if (url == NULL && s->psz_url != NULL)
input_item_SetURL(item, s->psz_url);
free(url);
input_item_node_AppendItem(node, item);
input_item_Release(item);
}
/* pop the value, keep the key for the next lua_next() call */
lua_pop(L, 1);
}
/* playlist */
return VLC_SUCCESS;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
/*****************************************************************************
* Import_LuaPlaylist: main import function
*****************************************************************************/
int Import_LuaPlaylist(vlc_object_t *obj)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
stream_t *s = (stream_t *)obj;
if( lua_Disabled( obj ) )
return VLC_EGENERIC;
struct vlclua_playlist *sys = malloc(sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
s->p_sys = sys;
sys->access = NULL;
sys->path = NULL;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
if (s->psz_url != NULL)
{ /* Backward compatibility hack: Lua scripts expect the URI scheme and
* the rest of the URI separately. */
const char *p = strstr(s->psz_url, "://");
if (p != NULL)
{
sys->access = strndup(s->psz_url, p - s->psz_url);
sys->path = p + 3;
}
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
int ret = vlclua_scripts_batch_execute(VLC_OBJECT(s), "playlist",
probe_luascript, NULL);
if (ret != VLC_SUCCESS)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
free(sys->access);
free(sys);
return ret;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
s->pf_readdir = ReadDir;
s->pf_control = access_vaDirectoryControlHelper;
return VLC_SUCCESS;
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}
void Close_LuaPlaylist(vlc_object_t *obj)
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
{
stream_t *s = (stream_t *)obj;
struct vlclua_playlist *sys = s->p_sys;
free(sys->filename);
assert(sys->L != NULL);
lua_close(sys->L);
free(sys->access);
free(sys);
Add a new type of VLC Lua module: Interfaces. Two things led me to add this new type of Lua modules: * Most interfaces duplicate code from one another (rc and telnet both deal with sockets, rc and hotkeys duplicate VLC interfacing code) * It's easier to code in Lua than in C (for high level stuff) (* Users can code their own module easily, all they need is a text editor.) Most of the changes in modules/misc/ are Lua wrappers for different C APIs in VLC. I'd say that 90% of those wrappers won't change, the other 10% might need small changes (mostly to simplify the C code). The VLC Lua "interface" module will look for lua scripts in the *share*/luaintf/ directory. Files in *share*/luaintf/modules/ are lua modules which can be used by multiple VLC Lua modules (using require "modulename"). This commit includes 4 Lua interface modules: * dummy.lua: the default module. Prints error messages and quits. * rc.lua: equivalent to the legacy rc.c module. Also includes a bunch of new features (+ multiple socket connections at a time work!). See file for more details. * telnet.lua: equivalent to the legacy telnet.c module. See file for more details. * hotkeys.lua: a rewrite of the hotkey handling module. This module is still experimental. I'll need to change VLC core hotkeys stuff to make it work like I want (ie: 1 hotkey triggers 1 action instead of the current 1 action can have 1 hotkey). This version executes 3 dummy actions when keys 'q', 'w' or 'x' are pressed. What's left to do: * Port the http interface plugin to this framework (at least for the macros/rpn part ... using <?vlc some lua code ?> à la PHP would be way easier than what we currently have). * Finish work on the hotkeys module. * Code a real telnet/rc module with autocompletion and all the cool features usually found in a telnet/terminal interface. * Trash the legacy C modules. Stuff to test (which I can't test myself): * Win32 and Mac OS X specific changes to Makefile.am * Console interface under Win32. I expect it not to work. Other stuff included in this changeset are: * Code cleanup (I'm sure that it's still possible to simplify some of the old lua bindings code). * That's pretty much it in fact :/
2007-11-04 22:42:27 +01:00
}