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
5182f4f5
Commit
5182f4f5
authored
Feb 09, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
androidsurface: simplify dlopen code
parent
aa037641
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
24 deletions
+32
-24
modules/video_output/androidsurface.c
modules/video_output/androidsurface.c
+32
-24
No files found.
modules/video_output/androidsurface.c
View file @
5182f4f5
...
@@ -129,34 +129,40 @@ static vlc_mutex_t single_instance = VLC_STATIC_MUTEX;
...
@@ -129,34 +129,40 @@ static vlc_mutex_t single_instance = VLC_STATIC_MUTEX;
static
inline
void
*
LoadSurface
(
const
char
*
psz_lib
,
vout_display_sys_t
*
sys
)
static
inline
void
*
LoadSurface
(
const
char
*
psz_lib
,
vout_display_sys_t
*
sys
)
{
{
void
*
p_library
=
dlopen
(
psz_lib
,
RTLD_NOW
);
void
*
p_library
=
dlopen
(
psz_lib
,
RTLD_NOW
);
if
(
p_library
)
{
if
(
!
p_library
)
sys
->
s_lock
=
(
Surface_lock
)(
dlsym
(
p_library
,
ANDROID_SYM_S_LOCK
));
return
NULL
;
sys
->
s_lock2
=
(
Surface_lock2
)(
dlsym
(
p_library
,
ANDROID_SYM_S_LOCK2
));
sys
->
s_unlockAndPost
=
sys
->
s_lock
=
(
Surface_lock
)(
dlsym
(
p_library
,
ANDROID_SYM_S_LOCK
));
(
Surface_unlockAndPost
)(
dlsym
(
p_library
,
ANDROID_SYM_S_UNLOCK
));
sys
->
s_lock2
=
(
Surface_lock2
)(
dlsym
(
p_library
,
ANDROID_SYM_S_LOCK2
));
if
((
sys
->
s_lock
||
sys
->
s_lock2
)
&&
sys
->
s_unlockAndPost
)
{
sys
->
s_unlockAndPost
=
return
p_library
;
(
Surface_unlockAndPost
)(
dlsym
(
p_library
,
ANDROID_SYM_S_UNLOCK
));
}
dlclose
(
p_library
);
if
((
sys
->
s_lock
||
sys
->
s_lock2
)
&&
sys
->
s_unlockAndPost
)
}
return
p_library
;
dlclose
(
p_library
);
return
NULL
;
return
NULL
;
}
}
static
void
*
InitLibrary
(
vout_display_sys_t
*
sys
)
static
void
*
InitLibrary
(
vout_display_sys_t
*
sys
)
{
{
void
*
p_library
;
static
const
char
*
libs
[]
=
{
if
((
p_library
=
LoadSurface
(
"libsurfaceflinger_client.so"
,
sys
)))
"libsurfaceflinger_client.so"
,
return
p_library
;
"libgui.so"
,
if
((
p_library
=
LoadSurface
(
"libgui.so"
,
sys
)))
"libui.so"
return
p_library
;
};
return
LoadSurface
(
"libui.so"
,
sys
);
for
(
size_t
i
=
0
;
i
<
sizeof
(
libs
)
/
sizeof
(
*
libs
);
i
++
)
{
void
*
lib
=
LoadSurface
(
libs
[
i
],
sys
);
if
(
lib
)
return
lib
;
}
return
NULL
;
}
}
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
vout_display_t
*
vd
=
(
vout_display_t
*
)
p_this
;
vout_display_t
*
vd
=
(
vout_display_t
*
)
p_this
;
vout_display_sys_t
*
sys
;
void
*
p_library
;
/* */
/* */
if
(
vlc_mutex_trylock
(
&
single_instance
)
!=
0
)
{
if
(
vlc_mutex_trylock
(
&
single_instance
)
!=
0
)
{
...
@@ -165,15 +171,15 @@ static int Open(vlc_object_t *p_this)
...
@@ -165,15 +171,15 @@ static int Open(vlc_object_t *p_this)
}
}
/* Allocate structure */
/* Allocate structure */
sys
=
(
struct
vout_display_sys_t
*
)
calloc
(
1
,
sizeof
(
*
sys
));
vout_display_sys_t
*
sys
=
(
struct
vout_display_sys_t
*
)
calloc
(
1
,
sizeof
(
*
sys
));
if
(
!
sys
)
{
if
(
!
sys
)
{
vlc_mutex_unlock
(
&
single_instance
);
vlc_mutex_unlock
(
&
single_instance
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
/* */
/* */
sys
->
p_library
=
p_library
=
InitLibrary
(
sys
);
sys
->
p_library
=
InitLibrary
(
sys
);
if
(
!
p_library
)
{
if
(
!
sys
->
p_library
)
{
free
(
sys
);
free
(
sys
);
msg_Err
(
vd
,
"Could not initialize libui.so/libgui.so/libsurfaceflinger_client.so!"
);
msg_Err
(
vd
,
"Could not initialize libui.so/libgui.so/libsurfaceflinger_client.so!"
);
vlc_mutex_unlock
(
&
single_instance
);
vlc_mutex_unlock
(
&
single_instance
);
...
@@ -266,8 +272,8 @@ static int Open(vlc_object_t *p_this)
...
@@ -266,8 +272,8 @@ static int Open(vlc_object_t *p_this)
enomem:
enomem:
free
(
rsc
->
p_sys
);
free
(
rsc
->
p_sys
);
dlclose
(
sys
->
p_library
);
free
(
sys
);
free
(
sys
);
dlclose
(
p_library
);
vlc_mutex_unlock
(
&
single_instance
);
vlc_mutex_unlock
(
&
single_instance
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -285,9 +291,9 @@ static void Close(vlc_object_t *p_this)
...
@@ -285,9 +291,9 @@ static void Close(vlc_object_t *p_this)
static
picture_pool_t
*
Pool
(
vout_display_t
*
vd
,
unsigned
count
)
static
picture_pool_t
*
Pool
(
vout_display_t
*
vd
,
unsigned
count
)
{
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
VLC_UNUSED
(
count
);
VLC_UNUSED
(
count
);
return
sys
->
pool
;
return
vd
->
sys
->
pool
;
}
}
#define ALIGN_16_PIXELS( x ) ( ( ( x ) + 15 ) / 16 * 16 )
#define ALIGN_16_PIXELS( x ) ( ( ( x ) + 15 ) / 16 * 16 )
...
@@ -376,6 +382,8 @@ static void AndroidUnlockSurface(picture_t *picture)
...
@@ -376,6 +382,8 @@ static void AndroidUnlockSurface(picture_t *picture)
static
void
Display
(
vout_display_t
*
vd
,
picture_t
*
picture
,
subpicture_t
*
subpicture
)
static
void
Display
(
vout_display_t
*
vd
,
picture_t
*
picture
,
subpicture_t
*
subpicture
)
{
{
/* FIXME ? */
VLC_UNUSED
(
vd
);
VLC_UNUSED
(
vd
);
VLC_UNUSED
(
subpicture
);
VLC_UNUSED
(
subpicture
);
picture_Release
(
picture
);
picture_Release
(
picture
);
...
...
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