Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
5fb3e3a3
Commit
5fb3e3a3
authored
Nov 07, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/control/rc.c: ported MRL parsing (changeset 9232) from 0.8.1 branch.
parent
b418c25a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
4 deletions
+89
-4
modules/control/rc.c
modules/control/rc.c
+89
-4
No files found.
modules/control/rc.c
View file @
5fb3e3a3
...
...
@@ -71,6 +71,8 @@ static void Run ( intf_thread_t * );
static
vlc_bool_t
ReadCommand
(
intf_thread_t
*
,
char
*
,
int
*
);
static
playlist_item_t
*
parse_MRL
(
intf_thread_t
*
,
char
*
);
static
int
Input
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
Playlist
(
vlc_object_t
*
,
char
const
*
,
...
...
@@ -821,11 +823,17 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
{
playlist_Stop
(
p_playlist
);
}
else
if
(
!
strcmp
(
psz_cmd
,
"add"
)
)
else
if
(
!
strcmp
(
psz_cmd
,
"add"
)
&&
newval
.
psz_string
&&
*
newval
.
psz_string
)
{
msg_rc
(
_
(
"trying to add %s to playlist
\n
"
),
newval
.
psz_string
);
playlist_Add
(
p_playlist
,
newval
.
psz_string
,
newval
.
psz_string
,
PLAYLIST_GO
|
PLAYLIST_APPEND
,
PLAYLIST_END
);
playlist_item_t
*
p_item
=
parse_MRL
(
p_intf
,
newval
.
psz_string
);
if
(
p_item
)
{
msg_rc
(
_
(
"trying to add %s to playlist
\n
"
),
newval
.
psz_string
);
playlist_AddItem
(
p_playlist
,
p_item
,
PLAYLIST_GO
|
PLAYLIST_APPEND
,
PLAYLIST_END
);
}
}
else
if
(
!
strcmp
(
psz_cmd
,
"playlist"
)
)
{
...
...
@@ -1202,3 +1210,80 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
return
VLC_FALSE
;
}
/*****************************************************************************
* parse_MRL: build a playlist item from a full mrl
*****************************************************************************
* MRL format: "simplified-mrl [:option-name[=option-value]]"
* We don't check for '"' or '\'', we just assume that a ':' that follows a
* space is a new option. Should be good enough for our purpose.
*****************************************************************************/
static
playlist_item_t
*
parse_MRL
(
intf_thread_t
*
p_intf
,
char
*
psz_mrl
)
{
#define SKIPSPACE( p ) { while( *p && ( *p == ' ' || *p == '\t' ) ) p++; }
#define SKIPTRAILINGSPACE( p, d ) \
{ char *e=d; while( e > p && (*(e-1)==' ' || *(e-1)=='\t') ){e--;*e=0;} }
playlist_item_t
*
p_item
=
NULL
;
char
*
psz_item
=
NULL
,
*
psz_item_mrl
=
NULL
,
*
psz_orig
;
char
**
ppsz_options
=
NULL
;
int
i
,
i_options
=
0
;
if
(
!
psz_mrl
)
return
0
;
psz_mrl
=
psz_orig
=
strdup
(
psz_mrl
);
while
(
*
psz_mrl
)
{
SKIPSPACE
(
psz_mrl
);
psz_item
=
psz_mrl
;
for
(
;
*
psz_mrl
;
psz_mrl
++
)
{
if
(
(
*
psz_mrl
==
' '
||
*
psz_mrl
==
'\t'
)
&&
psz_mrl
[
1
]
==
':'
)
{
/* We have a complete item */
break
;
}
if
(
(
*
psz_mrl
==
' '
||
*
psz_mrl
==
'\t'
)
&&
(
psz_mrl
[
1
]
==
'"'
||
psz_mrl
[
1
]
==
'\''
)
&&
psz_mrl
[
2
]
==
':'
)
{
/* We have a complete item */
break
;
}
}
if
(
*
psz_mrl
)
{
*
psz_mrl
=
0
;
psz_mrl
++
;
}
SKIPTRAILINGSPACE
(
psz_item
,
psz_item
+
strlen
(
psz_item
)
);
/* Remove '"' and '\'' if necessary */
if
(
*
psz_item
==
'"'
&&
psz_item
[
strlen
(
psz_item
)
-
1
]
==
'"'
)
{
psz_item
++
;
psz_item
[
strlen
(
psz_item
)
-
1
]
=
0
;
}
if
(
*
psz_item
==
'\''
&&
psz_item
[
strlen
(
psz_item
)
-
1
]
==
'\''
)
{
psz_item
++
;
psz_item
[
strlen
(
psz_item
)
-
1
]
=
0
;
}
if
(
!
psz_item_mrl
)
psz_item_mrl
=
psz_item
;
else
if
(
*
psz_item
)
{
i_options
++
;
ppsz_options
=
realloc
(
ppsz_options
,
i_options
*
sizeof
(
char
*
)
);
ppsz_options
[
i_options
-
1
]
=
&
psz_item
[
1
];
}
if
(
*
psz_mrl
)
SKIPSPACE
(
psz_mrl
);
}
/* Now create a playlist item */
if
(
psz_item_mrl
)
{
p_item
=
playlist_ItemNew
(
p_intf
,
psz_item_mrl
,
psz_item_mrl
);
for
(
i
=
0
;
i
<
i_options
;
i
++
)
{
playlist_ItemAddOption
(
p_item
,
ppsz_options
[
i
]
);
}
}
if
(
i_options
)
free
(
ppsz_options
);
free
(
psz_orig
);
return
p_item
;
}
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