Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
GSoC
GSoC2018
macOS
vlc
Commits
8a57fce9
Commit
8a57fce9
authored
Nov 16, 2016
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
luasd: helper function to fetch longname
parent
ceb9d2ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
15 deletions
+41
-15
modules/lua/services_discovery.c
modules/lua/services_discovery.c
+35
-0
modules/lua/vlc.c
modules/lua/vlc.c
+2
-15
modules/lua/vlc.h
modules/lua/vlc.h
+4
-0
No files found.
modules/lua/services_discovery.c
View file @
8a57fce9
...
...
@@ -40,6 +40,41 @@ static int DoSearch( services_discovery_t *p_sd, const char *psz_query );
static
int
FillDescriptor
(
services_discovery_t
*
,
services_discovery_descriptor_t
*
);
static
int
Control
(
services_discovery_t
*
p_sd
,
int
i_command
,
va_list
args
);
// When successful, the returned string is stored on top of the lua
// stack and remains valid as long as it is kept in the stack.
#undef vlclua_sd_description
const
char
*
vlclua_sd_description
(
vlc_object_t
*
obj
,
lua_State
*
L
,
const
char
*
filename
)
{
lua_getglobal
(
L
,
"descriptor"
);
if
(
!
lua_isfunction
(
L
,
-
1
)
)
{
msg_Warn
(
obj
,
"No 'descriptor' function in '%s'"
,
filename
);
lua_pop
(
L
,
1
);
return
NULL
;
}
if
(
lua_pcall
(
L
,
0
,
1
,
0
)
)
{
msg_Warn
(
obj
,
"Error while running script %s, "
"function descriptor(): %s"
,
filename
,
lua_tostring
(
L
,
-
1
)
);
lua_pop
(
L
,
1
);
return
NULL
;
}
lua_getfield
(
L
,
-
1
,
"title"
);
if
(
!
lua_isstring
(
L
,
-
1
)
)
{
msg_Warn
(
obj
,
"'descriptor' function in '%s' returned no title"
,
filename
);
lua_pop
(
L
,
2
);
return
NULL
;
}
return
lua_tostring
(
L
,
-
1
);
}
static
const
char
*
const
ppsz_sd_options
[]
=
{
"sd"
,
"longname"
,
NULL
};
/*****************************************************************************
...
...
modules/lua/vlc.c
View file @
8a57fce9
...
...
@@ -678,25 +678,12 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
lua_close
(
L
);
continue
;
}
const
char
*
psz_longname
;
char
*
temp
=
strchr
(
*
ppsz_file
,
'.'
);
if
(
temp
)
*
temp
=
'\0'
;
lua_getglobal
(
L
,
"descriptor"
);
if
(
!
lua_isfunction
(
L
,
lua_gettop
(
L
)
)
||
lua_pcall
(
L
,
0
,
1
,
0
)
)
{
msg_Warn
(
probe
,
"No 'descriptor' function in '%s'"
,
psz_filename
);
lua_pop
(
L
,
1
);
const
char
*
psz_longname
=
vlclua_sd_description
(
probe
,
L
,
psz_filename
);
if
(
psz_longname
==
NULL
)
psz_longname
=
*
ppsz_file
;
}
else
{
lua_getfield
(
L
,
-
1
,
"title"
);
if
(
lua_isstring
(
L
,
-
1
)
)
psz_longname
=
lua_tostring
(
L
,
-
1
);
else
psz_longname
=
*
ppsz_file
;
}
char
*
psz_file_esc
=
config_StringEscape
(
*
ppsz_file
);
char
*
psz_longname_esc
=
config_StringEscape
(
psz_longname
);
...
...
modules/lua/vlc.h
View file @
8a57fce9
...
...
@@ -91,6 +91,10 @@ void Close_Extension( vlc_object_t * );
int
Open_LuaSD
(
vlc_object_t
*
);
void
Close_LuaSD
(
vlc_object_t
*
);
// Helper
const
char
*
vlclua_sd_description
(
vlc_object_t
*
,
lua_State
*
,
const
char
*
);
#define vlclua_sd_description(a, b, c) vlclua_sd_description(VLC_OBJECT(a), b, c)
/*****************************************************************************
* Lua debug
*****************************************************************************/
...
...
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