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()
static int save_coded_buf(VABufferID coded_buf, int current_frame, int frame_skipped)
{
void *coded_p=NULL;
int coded_size,coded_offset,wrt_size;
VACodedBufferSegment *buf_list = NULL;
VAStatus va_status;
va_status = vaMapBuffer(va_dpy,coded_buf,&coded_p);
CHECK_VASTATUS(va_status,"vaMapBuffer");
unsigned int coded_size = 0;
coded_size = *((unsigned long *) coded_p); /* first DWord is the coded video size */
coded_offset = *((unsigned long *) (coded_p + 4)); /* second DWord is byte offset */
wrt_size = write(coded_fd,coded_p+coded_offset,coded_size);
if (wrt_size != coded_size) {
fprintf(stderr, "Trying to write %d bytes, but actual %d bytes\n",
coded_size, wrt_size);
exit(1);
va_status = vaMapBuffer(va_dpy,coded_buf,(void **)(&buf_list));
CHECK_VASTATUS(va_status,"vaMapBuffer");
while (buf_list != NULL) {
printf("Write %d bytes\n", buf_list->size);
coded_size += write(coded_fd, buf_list->buf, buf_list->size);
buf_list = buf_list->next;
}
vaUnmapBuffer(va_dpy,coded_buf);
......
# For libva_android
# For libva
# =====================================================
LOCAL_PATH:= $(call my-dir)
LIBVA_MINOR_VERSION := 31
LIBVA_MAJOR_VERSION := 0
LIBVA_DRIVERS_PATH = /system/lib
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
va.c \
va_trace.c \
android/va_android.cpp
#LIBVA_MINOR_VERSION := 31
#LIBVA_MAJOR_VERSION := 0
LOCAL_SRC_FILES := \
va.c \
va_trace.c \
LOCAL_CFLAGS += -DHAVE_CONFIG_H \
-DANDROID \
LOCAL_CFLAGS += \
-DANDROID \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""
LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/x11
$(TARGET_OUT_HEADERS)/libva \
$(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 := \
va.h \
va_backend.h \
va_version.h.in \
x11/va_dricommon.h \
va_android.h
LOCAL_MODULE := libva_android
LOCAL_MODULE := libva
LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils
include $(BUILD_SHARED_LIBRARY)
# For libva_android_tpi
# For libva-android
# =====================================================
include $(CLEAR_VARS)
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 += \
$(TARGET_OUT_HEADERS)/libva \
$(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/..
LOCAL_COPY_HEADERS_TO := libva/va
LOCAL_COPY_HEADERS := \
va.h \
va_backend.h \
va_tpi.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)
......@@ -27,17 +27,25 @@ INCLUDES = \
LDADD = \
$(LIBVA_LT_LDFLAGS)
libva_x11_backend = libva-x11.la
libva_x11_backenddir = x11
libva_la_SOURCES = va.c va_trace.c
libva_ladir = $(libdir)
libva_la_LDFLAGS = $(LDADD) -no-undefined
libva_la_LIBADD = $(LIBVA_LIBS) -ldl
libva_tpi_la_SOURCES = va_tpi.c
libva_tpi_ladir = $(libdir)
libva_tpi_la_LDFLAGS = $(LDADD) -no-undefined
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
libva_dummy_backend = libva-dummy.la
......@@ -66,14 +74,6 @@ libva_glx_backend =
libva_glx_backenddir =
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)
DIST_SUBDIRS = x11 glx dummy
......
......@@ -3,14 +3,10 @@
#include <va/va.h>
#ifdef ANDROID
#include <ui/ISurface.h>
using namespace android;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns a suitable VADisplay for VA API
*/
......@@ -18,11 +14,19 @@ VADisplay vaGetDisplay (
void *android_dpy
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#ifdef ANDROID
#include <ui/ISurface.h>
using namespace android;
/*
* Output rendering
* Following is the rendering interface for X windows,
* to get the decode output surface to a X drawable
* Following is the rendering interface for Android system,
* to get the decode output surface to an ISurface object.
* It basically performs a de-interlacing (if needed),
* color space conversion and scaling to the destination
* rectangle
......@@ -43,9 +47,8 @@ VAStatus vaPutSurface (
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* PutSurface flags */
);
#endif
#ifdef __cplusplus
}
#endif
#endif /* ANDROID */
#endif /* __cplusplus */
#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