Commit 9ce47af9 authored by Austin Yuan's avatar Austin Yuan

1) clean up Android header file to make it work in C file (from zhaohan.ren at intel.com)

2) rearrange va/Makefile.am (from elaine.wang at intel.com)
3) apply the new VACodedBufferSegment to encode test APP
Signed-off-by: default avatarAustin Yuan <shengquan.yuan@gmail.com>
parent 07c83798
...@@ -105,20 +105,16 @@ static int upload_source_YUV_once_for_all() ...@@ -105,20 +105,16 @@ static int upload_source_YUV_once_for_all()
static int save_coded_buf(VABufferID coded_buf, int current_frame, int frame_skipped) static int save_coded_buf(VABufferID coded_buf, int current_frame, int frame_skipped)
{ {
void *coded_p=NULL; void *coded_p=NULL;
int coded_size,coded_offset,wrt_size; VACodedBufferSegment *buf_list = NULL;
VAStatus va_status; VAStatus va_status;
unsigned int coded_size = 0;
va_status = vaMapBuffer(va_dpy,coded_buf,&coded_p);
CHECK_VASTATUS(va_status,"vaMapBuffer");
coded_size = *((unsigned long *) coded_p); /* first DWord is the coded video size */ va_status = vaMapBuffer(va_dpy,coded_buf,(void **)(&buf_list));
coded_offset = *((unsigned long *) (coded_p + 4)); /* second DWord is byte offset */ CHECK_VASTATUS(va_status,"vaMapBuffer");
while (buf_list != NULL) {
wrt_size = write(coded_fd,coded_p+coded_offset,coded_size); printf("Write %d bytes\n", buf_list->size);
if (wrt_size != coded_size) { coded_size += write(coded_fd, buf_list->buf, buf_list->size);
fprintf(stderr, "Trying to write %d bytes, but actual %d bytes\n", buf_list = buf_list->next;
coded_size, wrt_size);
exit(1);
} }
vaUnmapBuffer(va_dpy,coded_buf); vaUnmapBuffer(va_dpy,coded_buf);
......
# For libva_android # For libva
# ===================================================== # =====================================================
LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir)
LIBVA_MINOR_VERSION := 31 LIBVA_DRIVERS_PATH = /system/lib
LIBVA_MAJOR_VERSION := 0
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := \ #LIBVA_MINOR_VERSION := 31
va.c \ #LIBVA_MAJOR_VERSION := 0
va_trace.c \
android/va_android.cpp
LOCAL_SRC_FILES := \
va.c \
va_trace.c \
LOCAL_CFLAGS += -DHAVE_CONFIG_H \ LOCAL_CFLAGS += \
-DANDROID \ -DANDROID \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""
LOCAL_C_INCLUDES += \ LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \ $(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/x11 $(LOCAL_PATH)/x11 \
$(LOCAL_PATH)/..
LOCAL_CXX := g++ LOCAL_COPY_HEADERS := \
va.h \
va_version.h \
va_backend.h \
va_version.h.in \
x11/va_dricommon.h
LOCAL_COPY_HEADERS_TO := libva/va LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_COPY_HEADERS := \ LOCAL_MODULE := libva
va.h \
va_backend.h \
va_version.h.in \
x11/va_dricommon.h \
va_android.h
LOCAL_MODULE := libva_android
LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
# For libva_android_tpi # For libva-android
# ===================================================== # =====================================================
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
va_tpi.c \ android/va_android.cpp
LOCAL_CFLAGS += \
-DANDROID
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/x11
LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_COPY_HEADERS := va_android.h
LOCAL_MODULE := libva-android
include $(BUILD_SHARED_LIBRARY)
# For libva-tpi
# =====================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := va_tpi.c
LOCAL_CFLAGS += -DANDROID \ LOCAL_CFLAGS += -DANDROID
LOCAL_C_INCLUDES += \ LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \ $(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/..
LOCAL_COPY_HEADERS_TO := libva/va LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_COPY_HEADERS := \ LOCAL_COPY_HEADERS := \
va.h \ va_tpi.h \
va_backend.h \ va_backend_tpi.h
va_tpi.h \
va_backend_tpi.h
LOCAL_SHARED_LIBRARIES := libva_android LOCAL_SHARED_LIBRARIES := libva
LOCAL_MODULE := libva_android_tpi LOCAL_MODULE := libva-tpi
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
...@@ -27,17 +27,25 @@ INCLUDES = \ ...@@ -27,17 +27,25 @@ INCLUDES = \
LDADD = \ LDADD = \
$(LIBVA_LT_LDFLAGS) $(LIBVA_LT_LDFLAGS)
libva_x11_backend = libva-x11.la libva_la_SOURCES = va.c va_trace.c
libva_x11_backenddir = x11
libva_ladir = $(libdir) libva_ladir = $(libdir)
libva_la_LDFLAGS = $(LDADD) -no-undefined libva_la_LDFLAGS = $(LDADD) -no-undefined
libva_la_LIBADD = $(LIBVA_LIBS) -ldl libva_la_LIBADD = $(LIBVA_LIBS) -ldl
libva_tpi_la_SOURCES = va_tpi.c
libva_tpi_ladir = $(libdir) libva_tpi_ladir = $(libdir)
libva_tpi_la_LDFLAGS = $(LDADD) -no-undefined libva_tpi_la_LDFLAGS = $(LDADD) -no-undefined
libva_tpi_la_LIBADD = $(libvacorelib) -ldl libva_tpi_la_LIBADD = $(libvacorelib) -ldl
libva_tpi_la_DEPENDENCIES = libva.la libva_tpi_la_DEPENDENCIES = $(libvacorelib)
libva_x11_backend = libva-x11.la
libva_x11_backenddir = x11
libva_x11_la_SOURCES =
libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS)
libva_x11_la_LDFLAGS = $(LDADD)
libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
if BUILD_DUMMY_BACKEND if BUILD_DUMMY_BACKEND
libva_dummy_backend = libva-dummy.la libva_dummy_backend = libva-dummy.la
...@@ -66,14 +74,6 @@ libva_glx_backend = ...@@ -66,14 +74,6 @@ libva_glx_backend =
libva_glx_backenddir = libva_glx_backenddir =
endif endif
libva_x11_la_SOURCES =
libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS)
libva_x11_la_LDFLAGS = $(LDADD)
libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
libva_la_SOURCES = va.c va_trace.c
libva_tpi_la_SOURCES = va_tpi.c
lib_LTLIBRARIES = libva.la libva-tpi.la $(libva_x11_backend) $(libva_dummy_backend) $(libva_glx_backend) lib_LTLIBRARIES = libva.la libva-tpi.la $(libva_x11_backend) $(libva_dummy_backend) $(libva_glx_backend)
DIST_SUBDIRS = x11 glx dummy DIST_SUBDIRS = x11 glx dummy
......
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
#include <va/va.h> #include <va/va.h>
#ifdef ANDROID
#include <ui/ISurface.h>
using namespace android;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* /*
* Returns a suitable VADisplay for VA API * Returns a suitable VADisplay for VA API
*/ */
...@@ -18,11 +14,19 @@ VADisplay vaGetDisplay ( ...@@ -18,11 +14,19 @@ VADisplay vaGetDisplay (
void *android_dpy void *android_dpy
); );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#ifdef ANDROID #ifdef ANDROID
#include <ui/ISurface.h>
using namespace android;
/* /*
* Output rendering * Output rendering
* Following is the rendering interface for X windows, * Following is the rendering interface for Android system,
* to get the decode output surface to a X drawable * to get the decode output surface to an ISurface object.
* It basically performs a de-interlacing (if needed), * It basically performs a de-interlacing (if needed),
* color space conversion and scaling to the destination * color space conversion and scaling to the destination
* rectangle * rectangle
...@@ -43,9 +47,8 @@ VAStatus vaPutSurface ( ...@@ -43,9 +47,8 @@ VAStatus vaPutSurface (
unsigned int number_cliprects, /* number of clip rects in the clip list */ unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* PutSurface flags */ unsigned int flags /* PutSurface flags */
); );
#endif
#endif /* ANDROID */
#ifdef __cplusplus #endif /* __cplusplus */
}
#endif
#endif /* _VA_ANDROID_H_ */ #endif /* _VA_ANDROID_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment