Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
73e0e21f
Commit
73e0e21f
authored
Mar 12, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
var_LocationParse: helper for DVB/V4L2-style MRLs
parent
ec6df3cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
include/vlc_variables.h
include/vlc_variables.h
+3
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/variables.c
src/misc/variables.c
+42
-1
No files found.
include/vlc_variables.h
View file @
73e0e21f
...
...
@@ -736,6 +736,9 @@ VLC_EXPORT( int, var_InheritURational, ( vlc_object_t *, unsigned *num, unsigned
#define var_GetNonEmptyString(a,b) var_GetNonEmptyString( VLC_OBJECT(a),b)
#define var_GetAddress(a,b) var_GetAddress( VLC_OBJECT(a),b)
VLC_EXPORT
(
int
,
var_LocationParse
,
(
vlc_object_t
*
,
const
char
*
mrl
,
const
char
*
prefix
)
);
#define var_LocationParse(o, m, p) var_LocationParse(VLC_OBJECT(o), m, p)
/**
* @}
*/
...
...
src/libvlccore.sym
View file @
73e0e21f
...
...
@@ -486,6 +486,7 @@ var_TriggerCallback
var_Type
var_Inherit
var_InheritURational
var_LocationParse
video_format_CopyCrop
video_format_ScaleCropAr
video_format_FixRgb
...
...
src/misc/variables.c
View file @
73e0e21f
...
...
@@ -1079,8 +1079,49 @@ cleanup:
free
(
psz_name
);
}
#undef var_LocationParse
/**
* Parses a set of colon-separated <variable name>=<value> pairs. Some access
* (or access_demux) plugins uses this scheme in media resource location.
* @note Only trusted/safe variables are allowed. This is intended.
*
* @warning Only use this for plugins implementing VLC-specific resource
* location schemes. This would not make any sense for standardized ones.
*
* @param obj VLC object on which to set variables (and emit error messages)
* @param mrl string to parse
* @param pref prefix to prepend to option names in the string
*
* @return VLC_ENOMEM on error, VLC_SUCCESS on success.
*/
int
var_LocationParse
(
vlc_object_t
*
obj
,
const
char
*
mrl
,
const
char
*
pref
)
{
int
ret
=
VLC_SUCCESS
;
size_t
preflen
=
strlen
(
pref
);
assert
(
mrl
!=
NULL
);
while
(
*
mrl
!=
'\0'
)
{
mrl
+=
strspn
(
mrl
,
":"
);
/* skip leading colon(s) */
/* Following functions are local */
size_t
len
=
strcspn
(
mrl
,
":"
);
char
*
buf
=
malloc
(
preflen
+
len
);
if
(
likely
(
buf
!=
NULL
))
{
/* NOTE: this does not support the "no-<varname>" bool syntax. */
/* DO NOT use asprintf() here; it won't work! Think again. */
snprintf
(
buf
,
preflen
+
len
,
"%s%s"
,
pref
,
mrl
);
var_OptionParse
(
obj
,
buf
,
false
);
free
(
buf
);
}
else
ret
=
VLC_ENOMEM
;
mrl
+=
len
;
}
return
ret
;
}
/**
* Waits until the variable is inactive (i.e. not executing a callback)
...
...
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