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
65c6b73a
Commit
65c6b73a
authored
Nov 14, 2014
by
Thomas Guillem
Committed by
Jean-Baptiste Kempf
Nov 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nativewindowpriv: add lock/unlock Data
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
46814a09
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
7 deletions
+58
-7
modules/video_output/android/nativewindowpriv.c
modules/video_output/android/nativewindowpriv.c
+50
-5
modules/video_output/android/utils.c
modules/video_output/android/utils.c
+4
-2
modules/video_output/android/utils.h
modules/video_output/android/utils.h
+4
-0
No files found.
modules/video_output/android/nativewindowpriv.c
View file @
65c6b73a
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdbool.h>
#include <android/native_window.h>
#if ANDROID_API <= 13
#if ANDROID_API <= 13
#include <ui/android_native_buffer.h>
#include <ui/android_native_buffer.h>
#include <ui/egl/android_natives.h>
#include <ui/egl/android_natives.h>
...
@@ -51,6 +53,8 @@ typedef struct native_window_priv native_window_priv;
...
@@ -51,6 +53,8 @@ typedef struct native_window_priv native_window_priv;
struct
native_window_priv
struct
native_window_priv
{
{
ANativeWindow
*
anw
;
ANativeWindow
*
anw
;
gralloc_module_t
const
*
gralloc
;
int
usage
;
};
};
#define LOG_TAG "VLC/ANW"
#define LOG_TAG "VLC/ANW"
...
@@ -76,6 +80,7 @@ struct native_window_priv
...
@@ -76,6 +80,7 @@ struct native_window_priv
native_window_priv
*
ANativeWindowPriv_connect
(
void
*
window
)
native_window_priv
*
ANativeWindowPriv_connect
(
void
*
window
)
{
{
native_window_priv
*
priv
;
native_window_priv
*
priv
;
hw_module_t
const
*
module
;
ANativeWindow
*
anw
=
(
ANativeWindow
*
)
window
;
ANativeWindow
*
anw
=
(
ANativeWindow
*
)
window
;
if
(
anw
->
common
.
magic
!=
ANDROID_NATIVE_WINDOW_MAGIC
&&
if
(
anw
->
common
.
magic
!=
ANDROID_NATIVE_WINDOW_MAGIC
&&
...
@@ -84,6 +89,10 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
...
@@ -84,6 +89,10 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
return
NULL
;
return
NULL
;
}
}
if
(
hw_get_module
(
GRALLOC_HARDWARE_MODULE_ID
,
&
module
)
!=
0
)
return
NULL
;
#if ANDROID_API >= 14
#if ANDROID_API >= 14
if
(
native_window_api_connect
(
anw
,
NATIVE_WINDOW_API_MEDIA
)
!=
0
)
{
if
(
native_window_api_connect
(
anw
,
NATIVE_WINDOW_API_MEDIA
)
!=
0
)
{
LOGE
(
"native_window_api_connect FAIL"
);
LOGE
(
"native_window_api_connect FAIL"
);
...
@@ -100,6 +109,7 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
...
@@ -100,6 +109,7 @@ native_window_priv *ANativeWindowPriv_connect( void *window )
return
NULL
;
return
NULL
;
}
}
priv
->
anw
=
anw
;
priv
->
anw
=
anw
;
priv
->
gralloc
=
(
gralloc_module_t
const
*
)
module
;
return
priv
;
return
priv
;
}
}
...
@@ -116,21 +126,20 @@ int ANativeWindowPriv_disconnect( native_window_priv *priv )
...
@@ -116,21 +126,20 @@ int ANativeWindowPriv_disconnect( native_window_priv *priv )
int
ANativeWindowPriv_setup
(
native_window_priv
*
priv
,
int
w
,
int
h
,
int
hal_format
,
bool
is_hw
,
int
hw_usage
)
int
ANativeWindowPriv_setup
(
native_window_priv
*
priv
,
int
w
,
int
h
,
int
hal_format
,
bool
is_hw
,
int
hw_usage
)
{
{
int
usage
=
0
;
status_t
err
;
status_t
err
;
LOGD
(
"setup: %p, %d, %d, %X, %X
\n
"
,
LOGD
(
"setup: %p, %d, %d, %X, %X
\n
"
,
priv
->
anw
,
w
,
h
,
hal_format
,
hw_usage
);
priv
->
anw
,
w
,
h
,
hal_format
,
hw_usage
);
if
(
is_hw
)
if
(
is_hw
)
usage
=
hw_usage
|
GRALLOC_USAGE_HW_RENDER
|
GRALLOC_USAGE_HW_TEXTURE
;
priv
->
usage
=
hw_usage
|
GRALLOC_USAGE_HW_RENDER
|
GRALLOC_USAGE_HW_TEXTURE
;
else
else
usage
=
GRALLOC_USAGE_SW_READ_NEVER
|
GRALLOC_USAGE_SW_WRITE_OFTEN
;
priv
->
usage
=
GRALLOC_USAGE_SW_READ_NEVER
|
GRALLOC_USAGE_SW_WRITE_OFTEN
;
#if ANDROID_API >= 11
#if ANDROID_API >= 11
usage
|=
GRALLOC_USAGE_EXTERNAL_DISP
;
priv
->
usage
|=
GRALLOC_USAGE_EXTERNAL_DISP
;
#endif
#endif
err
=
native_window_set_usage
(
priv
->
anw
,
usage
);
err
=
native_window_set_usage
(
priv
->
anw
,
priv
->
usage
);
CHECK_ERR
();
CHECK_ERR
();
#if ANDROID_API <= 13
#if ANDROID_API <= 13
...
@@ -224,6 +233,42 @@ int ANativeWindowPriv_lock( native_window_priv *priv, void *p_handle )
...
@@ -224,6 +233,42 @@ int ANativeWindowPriv_lock( native_window_priv *priv, void *p_handle )
return
0
;
return
0
;
}
}
int
ANativeWindowPriv_lockData
(
native_window_priv
*
priv
,
void
*
p_handle
,
ANativeWindow_Buffer
*
p_out_anb
)
{
ANativeWindowBuffer_t
*
anb
=
(
ANativeWindowBuffer_t
*
)
p_handle
;
status_t
err
=
NO_ERROR
;
void
*
p_data
;
CHECK_ANB
();
err
=
priv
->
gralloc
->
lock
(
priv
->
gralloc
,
anb
->
handle
,
priv
->
usage
,
0
,
0
,
anb
->
width
,
anb
->
height
,
&
p_data
);
CHECK_ERR
();
if
(
p_out_anb
)
{
p_out_anb
->
bits
=
p_data
;
p_out_anb
->
width
=
anb
->
width
;
p_out_anb
->
height
=
anb
->
height
;
p_out_anb
->
stride
=
anb
->
stride
;
p_out_anb
->
format
=
anb
->
format
;
}
return
0
;
}
int
ANativeWindowPriv_unlockData
(
native_window_priv
*
priv
,
void
*
p_handle
)
{
ANativeWindowBuffer_t
*
anb
=
(
ANativeWindowBuffer_t
*
)
p_handle
;
status_t
err
=
NO_ERROR
;
CHECK_ANB
();
err
=
priv
->
gralloc
->
unlock
(
priv
->
gralloc
,
anb
->
handle
);
CHECK_ERR
();
return
0
;
}
int
ANativeWindowPriv_queue
(
native_window_priv
*
priv
,
void
*
p_handle
)
int
ANativeWindowPriv_queue
(
native_window_priv
*
priv
,
void
*
p_handle
)
{
{
ANativeWindowBuffer_t
*
anb
=
(
ANativeWindowBuffer_t
*
)
p_handle
;
ANativeWindowBuffer_t
*
anb
=
(
ANativeWindowBuffer_t
*
)
p_handle
;
...
...
modules/video_output/android/utils.c
View file @
65c6b73a
...
@@ -63,14 +63,16 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
...
@@ -63,14 +63,16 @@ int LoadNativeWindowPrivAPI(native_window_priv_api_t *native)
native
->
setCrop
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_setCrop"
);
native
->
setCrop
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_setCrop"
);
native
->
dequeue
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_dequeue"
);
native
->
dequeue
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_dequeue"
);
native
->
lock
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_lock"
);
native
->
lock
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_lock"
);
native
->
lockData
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_lockData"
);
native
->
unlockData
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_unlockData"
);
native
->
queue
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_queue"
);
native
->
queue
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_queue"
);
native
->
cancel
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_cancel"
);
native
->
cancel
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_cancel"
);
native
->
setOrientation
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_setOrientation"
);
native
->
setOrientation
=
dlsym
(
RTLD_DEFAULT
,
"ANativeWindowPriv_setOrientation"
);
return
native
->
connect
&&
native
->
disconnect
&&
native
->
setup
&&
return
native
->
connect
&&
native
->
disconnect
&&
native
->
setup
&&
native
->
getMinUndequeued
&&
native
->
setBufferCount
&&
native
->
setCrop
&&
native
->
getMinUndequeued
&&
native
->
setBufferCount
&&
native
->
setCrop
&&
native
->
dequeue
&&
native
->
lock
&&
native
->
queue
&&
native
->
cancel
&&
native
->
dequeue
&&
native
->
lock
&&
native
->
lockData
&&
native
->
unlockData
&&
native
->
setOrientation
?
0
:
-
1
;
native
->
queue
&&
native
->
cancel
&&
native
->
setOrientation
?
0
:
-
1
;
}
}
extern
void
jni_getMouseCoordinates
(
int
*
,
int
*
,
int
*
,
int
*
);
extern
void
jni_getMouseCoordinates
(
int
*
,
int
*
,
int
*
,
int
*
);
...
...
modules/video_output/android/utils.h
View file @
65c6b73a
...
@@ -60,6 +60,8 @@ typedef int (*ptr_ANativeWindowPriv_setBufferCount) (native_window_priv *, unsig
...
@@ -60,6 +60,8 @@ typedef int (*ptr_ANativeWindowPriv_setBufferCount) (native_window_priv *, unsig
typedef
int
(
*
ptr_ANativeWindowPriv_setCrop
)
(
native_window_priv
*
,
int
,
int
,
int
,
int
);
typedef
int
(
*
ptr_ANativeWindowPriv_setCrop
)
(
native_window_priv
*
,
int
,
int
,
int
,
int
);
typedef
int
(
*
ptr_ANativeWindowPriv_dequeue
)
(
native_window_priv
*
,
void
**
);
typedef
int
(
*
ptr_ANativeWindowPriv_dequeue
)
(
native_window_priv
*
,
void
**
);
typedef
int
(
*
ptr_ANativeWindowPriv_lock
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_lock
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_lockData
)
(
native_window_priv
*
,
void
*
,
ANativeWindow_Buffer
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_unlockData
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_queue
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_queue
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_cancel
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_cancel
)
(
native_window_priv
*
,
void
*
);
typedef
int
(
*
ptr_ANativeWindowPriv_setOrientation
)
(
native_window_priv
*
,
int
);
typedef
int
(
*
ptr_ANativeWindowPriv_setOrientation
)
(
native_window_priv
*
,
int
);
...
@@ -74,6 +76,8 @@ typedef struct
...
@@ -74,6 +76,8 @@ typedef struct
ptr_ANativeWindowPriv_setCrop
setCrop
;
ptr_ANativeWindowPriv_setCrop
setCrop
;
ptr_ANativeWindowPriv_dequeue
dequeue
;
ptr_ANativeWindowPriv_dequeue
dequeue
;
ptr_ANativeWindowPriv_lock
lock
;
ptr_ANativeWindowPriv_lock
lock
;
ptr_ANativeWindowPriv_lockData
lockData
;
ptr_ANativeWindowPriv_unlockData
unlockData
;
ptr_ANativeWindowPriv_queue
queue
;
ptr_ANativeWindowPriv_queue
queue
;
ptr_ANativeWindowPriv_cancel
cancel
;
ptr_ANativeWindowPriv_cancel
cancel
;
ptr_ANativeWindowPriv_setOrientation
setOrientation
;
ptr_ANativeWindowPriv_setOrientation
setOrientation
;
...
...
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