Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
a0e994c0
Commit
a0e994c0
authored
Feb 13, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export vlc's xml api.
parent
7276b808
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
211 additions
and
0 deletions
+211
-0
modules/misc/lua/Modules.am
modules/misc/lua/Modules.am
+1
-0
modules/misc/lua/demux.c
modules/misc/lua/demux.c
+1
-0
modules/misc/lua/extension.c
modules/misc/lua/extension.c
+1
-0
modules/misc/lua/intf.c
modules/misc/lua/intf.c
+1
-0
modules/misc/lua/libs.h
modules/misc/lua/libs.h
+1
-0
modules/misc/lua/libs/xml.c
modules/misc/lua/libs/xml.c
+205
-0
modules/misc/lua/meta.c
modules/misc/lua/meta.c
+1
-0
No files found.
modules/misc/lua/Modules.am
View file @
a0e994c0
...
@@ -33,6 +33,7 @@ SOURCES_lua = \
...
@@ -33,6 +33,7 @@ SOURCES_lua = \
libs/video.c \
libs/video.c \
libs/vlm.c \
libs/vlm.c \
libs/volume.c \
libs/volume.c \
libs/xml.c \
$(NULL)
$(NULL)
libvlc_LTLIBRARIES += liblua_plugin.la
libvlc_LTLIBRARIES += liblua_plugin.la
modules/misc/lua/demux.c
View file @
a0e994c0
...
@@ -138,6 +138,7 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename,
...
@@ -138,6 +138,7 @@ static int probe_luascript( vlc_object_t *p_this, const char * psz_filename,
luaL_register
(
L
,
"vlc"
,
p_reg
);
luaL_register
(
L
,
"vlc"
,
p_reg
);
luaopen_msg
(
L
);
luaopen_msg
(
L
);
luaopen_strings
(
L
);
luaopen_strings
(
L
);
luaopen_xml
(
L
);
lua_pushlightuserdata
(
L
,
p_demux
);
lua_pushlightuserdata
(
L
,
p_demux
);
lua_setfield
(
L
,
-
2
,
"private"
);
lua_setfield
(
L
,
-
2
,
"private"
);
lua_pushstring
(
L
,
p_demux
->
psz_path
);
lua_pushstring
(
L
,
p_demux
->
psz_path
);
...
...
modules/misc/lua/extension.c
View file @
a0e994c0
...
@@ -736,6 +736,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
...
@@ -736,6 +736,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
luaopen_video
(
L
);
luaopen_video
(
L
);
luaopen_vlm
(
L
);
luaopen_vlm
(
L
);
luaopen_volume
(
L
);
luaopen_volume
(
L
);
luaopen_xml
(
L
);
/* Register extension specific functions */
/* Register extension specific functions */
lua_getglobal
(
L
,
"vlc"
);
lua_getglobal
(
L
,
"vlc"
);
...
...
modules/misc/lua/intf.c
View file @
a0e994c0
...
@@ -197,6 +197,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -197,6 +197,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
luaopen_vlm
(
L
);
luaopen_vlm
(
L
);
luaopen_volume
(
L
);
luaopen_volume
(
L
);
luaopen_gettext
(
L
);
luaopen_gettext
(
L
);
luaopen_xml
(
L
);
/* clean up */
/* clean up */
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
...
...
modules/misc/lua/libs.h
View file @
a0e994c0
...
@@ -44,5 +44,6 @@ void luaopen_vlm( lua_State * );
...
@@ -44,5 +44,6 @@ void luaopen_vlm( lua_State * );
void
luaopen_volume
(
lua_State
*
);
void
luaopen_volume
(
lua_State
*
);
void
luaopen_gettext
(
lua_State
*
);
void
luaopen_gettext
(
lua_State
*
);
void
luaopen_input_item
(
lua_State
*
L
,
input_item_t
*
item
);
void
luaopen_input_item
(
lua_State
*
L
,
input_item_t
*
item
);
void
luaopen_xml
(
lua_State
*
L
);
#endif
#endif
modules/misc/lua/libs/xml.c
0 → 100644
View file @
a0e994c0
/*****************************************************************************
* xml.c: XML related functions
*****************************************************************************
* Copyright (C) 2010 Antoine Cellerier
* $Id$
*
* 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
*****************************************************************************/
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_xml.h>
#include <lua.h>
/* Low level lua C API */
#include <lauxlib.h>
/* Higher level C API */
#include "../vlc.h"
#include "../libs.h"
/*****************************************************************************
* XML
*****************************************************************************/
static
int
vlclua_xml_create_reader
(
lua_State
*
);
static
int
vlclua_xml_load_catalog
(
lua_State
*
);
static
int
vlclua_xml_add_catalog
(
lua_State
*
);
static
const
luaL_Reg
vlclua_xml_reg
[]
=
{
{
"create_reader"
,
vlclua_xml_create_reader
},
{
"load_catalog"
,
vlclua_xml_load_catalog
},
{
"add_catalog"
,
vlclua_xml_add_catalog
},
{
NULL
,
NULL
}
};
static
int
vlclua_xml_delete
(
lua_State
*
L
)
{
xml_t
*
p_xml
=
*
(
xml_t
**
)
luaL_checkudata
(
L
,
1
,
"xml"
);
xml_Delete
(
p_xml
);
return
0
;
}
static
int
vlclua_xml_create
(
lua_State
*
L
)
{
xml_t
*
p_xml
=
xml_Create
(
vlclua_get_this
(
L
)
);
if
(
!
p_xml
)
return
luaL_error
(
L
,
"XML module creation failed."
);
xml_t
**
pp_xml
=
lua_newuserdata
(
L
,
sizeof
(
xml_t
*
)
);
*
pp_xml
=
p_xml
;
if
(
luaL_newmetatable
(
L
,
"xml"
)
)
{
lua_newtable
(
L
);
luaL_register
(
L
,
NULL
,
vlclua_xml_reg
);
lua_setfield
(
L
,
-
2
,
"__index"
);
lua_pushcfunction
(
L
,
vlclua_xml_delete
);
lua_setfield
(
L
,
-
2
,
"__gc"
);
}
lua_setmetatable
(
L
,
-
2
);
return
1
;
}
static
int
vlclua_xml_load_catalog
(
lua_State
*
L
)
{
xml_t
*
p_xml
=
*
(
xml_t
**
)
luaL_checkudata
(
L
,
1
,
"xml"
);
const
char
*
psz_catalog
=
luaL_checkstring
(
L
,
2
);
xml_CatalogLoad
(
p_xml
,
psz_catalog
);
return
0
;
}
static
int
vlclua_xml_add_catalog
(
lua_State
*
L
)
{
xml_t
*
p_xml
=
*
(
xml_t
**
)
luaL_checkudata
(
L
,
1
,
"xml"
);
const
char
*
psz_str1
=
luaL_checkstring
(
L
,
2
);
const
char
*
psz_str2
=
luaL_checkstring
(
L
,
3
);
const
char
*
psz_str3
=
luaL_checkstring
(
L
,
4
);
xml_CatalogAdd
(
p_xml
,
psz_str1
,
psz_str2
,
psz_str3
);
return
0
;
}
/*****************************************************************************
* XML Reader
*****************************************************************************/
static
int
vlclua_xml_reader_read
(
lua_State
*
);
static
int
vlclua_xml_reader_node_type
(
lua_State
*
);
static
int
vlclua_xml_reader_name
(
lua_State
*
);
static
int
vlclua_xml_reader_value
(
lua_State
*
);
static
int
vlclua_xml_reader_next_attr
(
lua_State
*
);
static
int
vlclua_xml_reader_use_dtd
(
lua_State
*
);
static
const
luaL_Reg
vlclua_xml_reader_reg
[]
=
{
{
"read"
,
vlclua_xml_reader_read
},
{
"node_type"
,
vlclua_xml_reader_node_type
},
{
"name"
,
vlclua_xml_reader_name
},
{
"value"
,
vlclua_xml_reader_value
},
{
"next_attr"
,
vlclua_xml_reader_next_attr
},
{
"use_dtd"
,
vlclua_xml_reader_use_dtd
},
{
NULL
,
NULL
}
};
static
int
vlclua_xml_reader_delete
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
xml_ReaderDelete
(
p_reader
->
p_xml
,
p_reader
);
return
0
;
}
static
int
vlclua_xml_create_reader
(
lua_State
*
L
)
{
xml_t
*
p_xml
=
*
(
xml_t
**
)
luaL_checkudata
(
L
,
1
,
"xml"
);
stream_t
*
p_stream
=
*
(
stream_t
**
)
luaL_checkudata
(
L
,
2
,
"stream"
);
xml_reader_t
*
p_reader
=
xml_ReaderCreate
(
p_xml
,
p_stream
);
if
(
!
p_reader
)
return
luaL_error
(
L
,
"XML reader creation failed."
);
xml_reader_t
**
pp_reader
=
lua_newuserdata
(
L
,
sizeof
(
xml_reader_t
*
)
);
*
pp_reader
=
p_reader
;
if
(
luaL_newmetatable
(
L
,
"xml_reader"
)
)
{
lua_newtable
(
L
);
luaL_register
(
L
,
NULL
,
vlclua_xml_reader_reg
);
lua_setfield
(
L
,
-
2
,
"__index"
);
lua_pushcfunction
(
L
,
vlclua_xml_reader_delete
);
lua_setfield
(
L
,
-
2
,
"__gc"
);
}
lua_setmetatable
(
L
,
-
2
);
return
1
;
}
static
int
vlclua_xml_reader_read
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
lua_pushinteger
(
L
,
xml_ReaderRead
(
p_reader
)
);
return
1
;
}
static
int
vlclua_xml_reader_node_type
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
static
const
char
*
ppsz_type
[]
=
{
"none"
,
"startelem"
,
"endelem"
,
"text"
};
lua_pushstring
(
L
,
ppsz_type
[
xml_ReaderNodeType
(
p_reader
)]
);
return
1
;
}
static
int
vlclua_xml_reader_name
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
lua_pushstring
(
L
,
xml_ReaderName
(
p_reader
)
);
return
1
;
}
static
int
vlclua_xml_reader_value
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
lua_pushstring
(
L
,
xml_ReaderValue
(
p_reader
)
);
return
1
;
}
static
int
vlclua_xml_reader_next_attr
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
lua_pushinteger
(
L
,
xml_ReaderNextAttr
(
p_reader
)
);
return
1
;
}
static
int
vlclua_xml_reader_use_dtd
(
lua_State
*
L
)
{
xml_reader_t
*
p_reader
=
*
(
xml_reader_t
**
)
luaL_checkudata
(
L
,
1
,
"xml_reader"
);
bool
b_value
=
lua_toboolean
(
L
,
2
);
lua_pushinteger
(
L
,
xml_ReaderUseDTD
(
p_reader
,
b_value
)
);
return
1
;
}
void
luaopen_xml
(
lua_State
*
L
)
{
lua_pushcfunction
(
L
,
vlclua_xml_create
);
lua_setfield
(
L
,
-
2
,
"xml"
);
}
modules/misc/lua/meta.c
View file @
a0e994c0
...
@@ -71,6 +71,7 @@ static lua_State * init( vlc_object_t *p_this, input_item_t * p_item, const char
...
@@ -71,6 +71,7 @@ static lua_State * init( vlc_object_t *p_this, input_item_t * p_item, const char
luaopen_variables
(
L
);
luaopen_variables
(
L
);
luaopen_object
(
L
);
luaopen_object
(
L
);
luaopen_misc
(
L
);
luaopen_misc
(
L
);
luaopen_xml
(
L
);
luaopen_input_item
(
L
,
p_item
);
luaopen_input_item
(
L
,
p_item
);
lua_pushlightuserdata
(
L
,
p_this
);
lua_pushlightuserdata
(
L
,
p_this
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment