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
0e4fb813
Commit
0e4fb813
authored
Feb 03, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC VLM: save a few kilobytes of code
parent
4678f5e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
src/control/vlm.c
src/control/vlm.c
+22
-17
No files found.
src/control/vlm.c
View file @
0e4fb813
...
...
@@ -469,27 +469,32 @@ int libvlc_vlm_del_media( libvlc_instance_t *p_instance, const char *psz_name )
return
0
;
}
static
vlm_media_t
*
get_media
(
libvlc_instance_t
*
p_instance
,
vlm_t
**
restrict
pp_vlm
,
const
char
*
name
)
{
vlm_media_t
*
p_media
;
vlm_t
*
p_vlm
;
int64_t
id
;
VLM_RET
(
p_vlm
,
NULL
);
if
(
vlm_Control
(
p_vlm
,
VLM_GET_MEDIA_ID
,
name
,
&
id
)
||
vlm_Control
(
p_vlm
,
VLM_GET_MEDIA
,
id
,
&
p_media
)
)
return
NULL
;
*
pp_vlm
=
p_vlm
;
return
p_media
;
}
#define VLM_CHANGE(psz_error, code ) do { \
vlm_media_t *p_media; \
vlm_t *p_vlm; \
int64_t id; \
VLM_RET(p_vlm, -1); \
if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) || \
vlm_Control( p_vlm, VLM_GET_MEDIA, id, &p_media ) ) { \
libvlc_printerr( psz_error, psz_name ); \
return -1; \
} \
if( !p_media ) goto error; \
\
code; \
\
if( vlm_Control( p_vlm, VLM_CHANGE_MEDIA, p_media ) ) { \
vlm_media_t *p_media = get_media( p_instance, &p_vlm, psz_name ); \
if( p_media != NULL ) { \
code; \
if( vlm_Control( p_vlm, VLM_CHANGE_MEDIA, p_media ) ) \
p_vlm = NULL; \
vlm_media_Delete( p_media ); \
goto error; \
if( p_vlm != NULL ) \
return 0; \
} \
vlm_media_Delete( p_media ); \
return 0; \
error: \
libvlc_printerr( psz_error, psz_name ); \
return -1; \
} while(0)
...
...
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