Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
7a3a6d64
Commit
7a3a6d64
authored
Jun 18, 2011
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua playlist: add custom metadata to extra metadata instead of input item information.
Fix #4822 and #4823.
parent
db493e33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
48 deletions
+20
-48
modules/lua/vlc.c
modules/lua/vlc.c
+20
-48
No files found.
modules/lua/vlc.c
View file @
7a3a6d64
...
@@ -404,6 +404,12 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
...
@@ -404,6 +404,12 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
void
__vlclua_read_custom_meta_data
(
vlc_object_t
*
p_this
,
lua_State
*
L
,
void
__vlclua_read_custom_meta_data
(
vlc_object_t
*
p_this
,
lua_State
*
L
,
input_item_t
*
p_input
)
input_item_t
*
p_input
)
{
{
/* Lock the input item and create the meta table if needed */
vlc_mutex_lock
(
&
p_input
->
lock
);
if
(
!
p_input
->
p_meta
)
p_input
->
p_meta
=
vlc_meta_New
();
/* ... item */
/* ... item */
lua_getfield
(
L
,
-
1
,
"meta"
);
lua_getfield
(
L
,
-
1
,
"meta"
);
/* ... item meta */
/* ... item meta */
...
@@ -414,60 +420,26 @@ void __vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L,
...
@@ -414,60 +420,26 @@ void __vlclua_read_custom_meta_data( vlc_object_t *p_this, lua_State *L,
while
(
lua_next
(
L
,
-
2
)
)
while
(
lua_next
(
L
,
-
2
)
)
{
{
/* ... item meta key value */
/* ... item meta key value */
if
(
!
lua_isstring
(
L
,
-
2
)
)
printf
(
"%s => %s
\n
"
,
lua_typename
(
L
,
lua_type
(
L
,
-
2
)),
{
lua_typename
(
L
,
lua_type
(
L
,
-
1
)));
msg_Warn
(
p_this
,
"Custom meta data category name must be "
if
(
!
lua_isstring
(
L
,
-
2
)
||
!
lua_isstring
(
L
,
-
1
)
)
"a string"
);
}
else
if
(
!
lua_istable
(
L
,
-
1
)
)
{
msg_Warn
(
p_this
,
"Custom meta data category contents "
"must be a table"
);
}
else
{
const
char
*
psz_meta_category
=
lua_tostring
(
L
,
-
2
);
msg_Dbg
(
p_this
,
"Found custom meta data category: %s"
,
psz_meta_category
);
lua_pushnil
(
L
);
/* ... item meta key value nil */
while
(
lua_next
(
L
,
-
2
)
)
{
/* ... item meta key value key2 value2 */
if
(
!
lua_isstring
(
L
,
-
2
)
)
{
msg_Warn
(
p_this
,
"Custom meta category item name "
"must be a string."
);
}
else
if
(
!
lua_isstring
(
L
,
-
1
)
)
{
msg_Warn
(
p_this
,
"Custom meta category item value "
"must be a string."
);
}
else
{
{
const
char
*
psz_meta_name
=
msg_Err
(
p_this
,
"'meta' keys and values must be strings"
);
lua_tostring
(
L
,
-
2
);
lua_pop
(
L
,
1
);
/* pop "value" */
const
char
*
psz_meta_value
=
continue
;
lua_tostring
(
L
,
-
1
);
msg_Dbg
(
p_this
,
"Custom meta %s, %s: %s"
,
psz_meta_category
,
psz_meta_name
,
psz_meta_value
);
input_item_AddInfo
(
p_input
,
psz_meta_category
,
psz_meta_name
,
"%s"
,
psz_meta_value
);
}
lua_pop
(
L
,
1
);
/* pop item */
/* ... item meta key value key2 */
}
/* ... item meta key value */
}
}
lua_pop
(
L
,
1
);
/* pop category */
const
char
*
psz_key
=
lua_tostring
(
L
,
-
2
);
/* ... item meta key */
const
char
*
psz_value
=
lua_tostring
(
L
,
-
1
);
vlc_meta_AddExtra
(
p_input
->
p_meta
,
psz_key
,
psz_value
);
lua_pop
(
L
,
1
);
/* pop "value" */
}
}
/* ... item meta */
}
}
lua_pop
(
L
,
1
);
/* pop "meta" */
lua_pop
(
L
,
1
);
/* pop "meta" */
/* ... item -> back to original stack */
/* ... item -> back to original stack */
vlc_mutex_unlock
(
&
p_input
->
lock
);
}
}
/*****************************************************************************
/*****************************************************************************
...
...
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