[vlc-devel] [PATCH 03/19] nativewindowpriv: add is_hw arg in setup
Thomas Guillem
thomas at gllm.fr
Fri Nov 14 17:09:54 CET 2014
---
modules/codec/omxil/omxil.c | 1 +
modules/video_output/android/nativewindowpriv.c | 8 ++++++--
modules/video_output/android/utils.h | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 5b1be01..19bf3f7 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -2223,6 +2223,7 @@ static int HwBuffer_AllocateBuffers( decoder_t *p_dec, OmxPort *p_port )
def->format.video.nFrameWidth,
def->format.video.nFrameHeight,
colorFormat,
+ true,
(int) i_hw_usage ) != 0 )
{
msg_Err( p_dec, "can't setup OMXHWBuffer" );
diff --git a/modules/video_output/android/nativewindowpriv.c b/modules/video_output/android/nativewindowpriv.c
index 4f870e5..86e0c38 100644
--- a/modules/video_output/android/nativewindowpriv.c
+++ b/modules/video_output/android/nativewindowpriv.c
@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#if ANDROID_API <= 13
#include <ui/android_native_buffer.h>
@@ -113,7 +114,7 @@ int ANativeWindowPriv_disconnect( native_window_priv *priv )
return 0;
}
-int ANativeWindowPriv_setup( native_window_priv *priv, int w, int h, int hal_format, 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;
@@ -121,7 +122,10 @@ int ANativeWindowPriv_setup( native_window_priv *priv, int w, int h, int hal_for
LOGD( "setup: %p, %d, %d, %X, %X\n",
priv->anw, w, h, hal_format, hw_usage );
- usage |= hw_usage | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
+ if (is_hw)
+ usage = hw_usage | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
+ else
+ usage= GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN;
#if ANDROID_API >= 11
usage |= GRALLOC_USAGE_EXTERNAL_DISP;
#endif
diff --git a/modules/video_output/android/utils.h b/modules/video_output/android/utils.h
index 86215f2..571477c 100644
--- a/modules/video_output/android/utils.h
+++ b/modules/video_output/android/utils.h
@@ -54,7 +54,7 @@ void Manage(vout_display_t *);
typedef struct native_window_priv native_window_priv;
typedef native_window_priv *(*ptr_ANativeWindowPriv_connect) (void *);
typedef int (*ptr_ANativeWindowPriv_disconnect) (native_window_priv *);
-typedef int (*ptr_ANativeWindowPriv_setup) (native_window_priv *, int, int, int, int );
+typedef int (*ptr_ANativeWindowPriv_setup) (native_window_priv *, int, int, int, bool, int );
typedef int (*ptr_ANativeWindowPriv_getMinUndequeued) (native_window_priv *, unsigned int *);
typedef int (*ptr_ANativeWindowPriv_setBufferCount) (native_window_priv *, unsigned int );
typedef int (*ptr_ANativeWindowPriv_setCrop) (native_window_priv *, int, int, int, int);
--
2.1.1
More information about the vlc-devel
mailing list