hardware/intel/common/libva
Revision | 9ce47af9a2df4ecbe562c1a92bf1fe8889928be8 (tree) |
---|---|
Time | 2010-06-02 11:22:01 |
Author | Austin Yuan <shengquan.yuan@gmai...> |
Commiter | 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: Austin Yuan <shengquan.yuan@gmail.com>
@@ -105,20 +105,16 @@ static int upload_source_YUV_once_for_all() | ||
105 | 105 | static int save_coded_buf(VABufferID coded_buf, int current_frame, int frame_skipped) |
106 | 106 | { |
107 | 107 | void *coded_p=NULL; |
108 | - int coded_size,coded_offset,wrt_size; | |
108 | + VACodedBufferSegment *buf_list = NULL; | |
109 | 109 | VAStatus va_status; |
110 | - | |
111 | - va_status = vaMapBuffer(va_dpy,coded_buf,&coded_p); | |
112 | - CHECK_VASTATUS(va_status,"vaMapBuffer"); | |
110 | + unsigned int coded_size = 0; | |
113 | 111 | |
114 | - coded_size = *((unsigned long *) coded_p); /* first DWord is the coded video size */ | |
115 | - coded_offset = *((unsigned long *) (coded_p + 4)); /* second DWord is byte offset */ | |
116 | - | |
117 | - wrt_size = write(coded_fd,coded_p+coded_offset,coded_size); | |
118 | - if (wrt_size != coded_size) { | |
119 | - fprintf(stderr, "Trying to write %d bytes, but actual %d bytes\n", | |
120 | - coded_size, wrt_size); | |
121 | - exit(1); | |
112 | + va_status = vaMapBuffer(va_dpy,coded_buf,(void **)(&buf_list)); | |
113 | + CHECK_VASTATUS(va_status,"vaMapBuffer"); | |
114 | + while (buf_list != NULL) { | |
115 | + printf("Write %d bytes\n", buf_list->size); | |
116 | + coded_size += write(coded_fd, buf_list->buf, buf_list->size); | |
117 | + buf_list = buf_list->next; | |
122 | 118 | } |
123 | 119 | vaUnmapBuffer(va_dpy,coded_buf); |
124 | 120 |
@@ -1,67 +1,89 @@ | ||
1 | -# For libva_android | |
1 | +# For libva | |
2 | 2 | # ===================================================== |
3 | 3 | |
4 | 4 | LOCAL_PATH:= $(call my-dir) |
5 | 5 | |
6 | -LIBVA_MINOR_VERSION := 31 | |
7 | -LIBVA_MAJOR_VERSION := 0 | |
6 | +LIBVA_DRIVERS_PATH = /system/lib | |
8 | 7 | |
9 | 8 | include $(CLEAR_VARS) |
10 | 9 | |
11 | -LOCAL_SRC_FILES := \ | |
12 | - va.c \ | |
13 | - va_trace.c \ | |
14 | - android/va_android.cpp | |
10 | +#LIBVA_MINOR_VERSION := 31 | |
11 | +#LIBVA_MAJOR_VERSION := 0 | |
15 | 12 | |
13 | +LOCAL_SRC_FILES := \ | |
14 | + va.c \ | |
15 | + va_trace.c \ | |
16 | 16 | |
17 | -LOCAL_CFLAGS += -DHAVE_CONFIG_H \ | |
18 | - -DANDROID \ | |
17 | +LOCAL_CFLAGS += \ | |
18 | + -DANDROID \ | |
19 | + -DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\"" | |
19 | 20 | |
20 | 21 | LOCAL_C_INCLUDES += \ |
21 | - $(TARGET_OUT_HEADERS)/libva \ | |
22 | - $(LOCAL_PATH)/x11 | |
22 | + $(TARGET_OUT_HEADERS)/libva \ | |
23 | + $(LOCAL_PATH)/x11 \ | |
24 | + $(LOCAL_PATH)/.. | |
23 | 25 | |
24 | -LOCAL_CXX := g++ | |
26 | +LOCAL_COPY_HEADERS := \ | |
27 | + va.h \ | |
28 | + va_version.h \ | |
29 | + va_backend.h \ | |
30 | + va_version.h.in \ | |
31 | + x11/va_dricommon.h | |
25 | 32 | |
26 | 33 | LOCAL_COPY_HEADERS_TO := libva/va |
27 | 34 | |
28 | -LOCAL_COPY_HEADERS := \ | |
29 | - va.h \ | |
30 | - va_backend.h \ | |
31 | - va_version.h.in \ | |
32 | - x11/va_dricommon.h \ | |
33 | - va_android.h | |
34 | - | |
35 | -LOCAL_MODULE := libva_android | |
35 | +LOCAL_MODULE := libva | |
36 | 36 | |
37 | 37 | LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils |
38 | 38 | |
39 | 39 | include $(BUILD_SHARED_LIBRARY) |
40 | 40 | |
41 | 41 | |
42 | -# For libva_android_tpi | |
42 | +# For libva-android | |
43 | 43 | # ===================================================== |
44 | 44 | |
45 | 45 | include $(CLEAR_VARS) |
46 | 46 | |
47 | 47 | LOCAL_SRC_FILES := \ |
48 | - va_tpi.c \ | |
48 | + android/va_android.cpp | |
49 | + | |
50 | +LOCAL_CFLAGS += \ | |
51 | + -DANDROID | |
52 | + | |
53 | +LOCAL_C_INCLUDES += \ | |
54 | + $(TARGET_OUT_HEADERS)/libva \ | |
55 | + $(LOCAL_PATH)/x11 | |
56 | + | |
57 | +LOCAL_COPY_HEADERS_TO := libva/va | |
58 | + | |
59 | +LOCAL_COPY_HEADERS := va_android.h | |
60 | + | |
61 | +LOCAL_MODULE := libva-android | |
62 | + | |
63 | +include $(BUILD_SHARED_LIBRARY) | |
64 | + | |
65 | + | |
66 | +# For libva-tpi | |
67 | +# ===================================================== | |
68 | + | |
69 | +include $(CLEAR_VARS) | |
70 | + | |
71 | +LOCAL_SRC_FILES := va_tpi.c | |
49 | 72 | |
50 | -LOCAL_CFLAGS += -DANDROID \ | |
73 | +LOCAL_CFLAGS += -DANDROID | |
51 | 74 | |
52 | 75 | LOCAL_C_INCLUDES += \ |
53 | - $(TARGET_OUT_HEADERS)/libva \ | |
76 | + $(TARGET_OUT_HEADERS)/libva \ | |
77 | + $(LOCAL_PATH)/.. | |
54 | 78 | |
55 | 79 | LOCAL_COPY_HEADERS_TO := libva/va |
56 | 80 | |
57 | 81 | LOCAL_COPY_HEADERS := \ |
58 | - va.h \ | |
59 | - va_backend.h \ | |
60 | - va_tpi.h \ | |
61 | - va_backend_tpi.h | |
82 | + va_tpi.h \ | |
83 | + va_backend_tpi.h | |
62 | 84 | |
63 | -LOCAL_SHARED_LIBRARIES := libva_android | |
85 | +LOCAL_SHARED_LIBRARIES := libva | |
64 | 86 | |
65 | -LOCAL_MODULE := libva_android_tpi | |
87 | +LOCAL_MODULE := libva-tpi | |
66 | 88 | |
67 | 89 | include $(BUILD_SHARED_LIBRARY) |
@@ -27,17 +27,25 @@ INCLUDES = \ | ||
27 | 27 | LDADD = \ |
28 | 28 | $(LIBVA_LT_LDFLAGS) |
29 | 29 | |
30 | -libva_x11_backend = libva-x11.la | |
31 | -libva_x11_backenddir = x11 | |
32 | - | |
30 | +libva_la_SOURCES = va.c va_trace.c | |
33 | 31 | libva_ladir = $(libdir) |
34 | 32 | libva_la_LDFLAGS = $(LDADD) -no-undefined |
35 | 33 | libva_la_LIBADD = $(LIBVA_LIBS) -ldl |
36 | 34 | |
35 | +libva_tpi_la_SOURCES = va_tpi.c | |
37 | 36 | libva_tpi_ladir = $(libdir) |
38 | 37 | libva_tpi_la_LDFLAGS = $(LDADD) -no-undefined |
39 | 38 | libva_tpi_la_LIBADD = $(libvacorelib) -ldl |
40 | -libva_tpi_la_DEPENDENCIES = libva.la | |
39 | +libva_tpi_la_DEPENDENCIES = $(libvacorelib) | |
40 | + | |
41 | + | |
42 | +libva_x11_backend = libva-x11.la | |
43 | +libva_x11_backenddir = x11 | |
44 | + | |
45 | +libva_x11_la_SOURCES = | |
46 | +libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) | |
47 | +libva_x11_la_LDFLAGS = $(LDADD) | |
48 | +libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la | |
41 | 49 | |
42 | 50 | if BUILD_DUMMY_BACKEND |
43 | 51 | libva_dummy_backend = libva-dummy.la |
@@ -66,14 +74,6 @@ libva_glx_backend = | ||
66 | 74 | libva_glx_backenddir = |
67 | 75 | endif |
68 | 76 | |
69 | -libva_x11_la_SOURCES = | |
70 | -libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) | |
71 | -libva_x11_la_LDFLAGS = $(LDADD) | |
72 | -libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la | |
73 | - | |
74 | -libva_la_SOURCES = va.c va_trace.c | |
75 | -libva_tpi_la_SOURCES = va_tpi.c | |
76 | - | |
77 | 77 | lib_LTLIBRARIES = libva.la libva-tpi.la $(libva_x11_backend) $(libva_dummy_backend) $(libva_glx_backend) |
78 | 78 | |
79 | 79 | DIST_SUBDIRS = x11 glx dummy |
@@ -3,14 +3,10 @@ | ||
3 | 3 | |
4 | 4 | #include <va/va.h> |
5 | 5 | |
6 | -#ifdef ANDROID | |
7 | -#include <ui/ISurface.h> | |
8 | -using namespace android; | |
9 | -#endif | |
10 | - | |
11 | 6 | #ifdef __cplusplus |
12 | 7 | extern "C" { |
13 | 8 | #endif |
9 | + | |
14 | 10 | /* |
15 | 11 | * Returns a suitable VADisplay for VA API |
16 | 12 | */ |
@@ -18,11 +14,19 @@ VADisplay vaGetDisplay ( | ||
18 | 14 | void *android_dpy |
19 | 15 | ); |
20 | 16 | |
17 | +#ifdef __cplusplus | |
18 | +} | |
19 | +#endif | |
20 | + | |
21 | +#ifdef __cplusplus | |
21 | 22 | #ifdef ANDROID |
23 | +#include <ui/ISurface.h> | |
24 | +using namespace android; | |
25 | + | |
22 | 26 | /* |
23 | 27 | * Output rendering |
24 | - * Following is the rendering interface for X windows, | |
25 | - * to get the decode output surface to a X drawable | |
28 | + * Following is the rendering interface for Android system, | |
29 | + * to get the decode output surface to an ISurface object. | |
26 | 30 | * It basically performs a de-interlacing (if needed), |
27 | 31 | * color space conversion and scaling to the destination |
28 | 32 | * rectangle |
@@ -43,9 +47,8 @@ VAStatus vaPutSurface ( | ||
43 | 47 | unsigned int number_cliprects, /* number of clip rects in the clip list */ |
44 | 48 | unsigned int flags /* PutSurface flags */ |
45 | 49 | ); |
46 | -#endif | |
47 | - | |
48 | -#ifdef __cplusplus | |
49 | -} | |
50 | -#endif | |
50 | + | |
51 | +#endif /* ANDROID */ | |
52 | +#endif /* __cplusplus */ | |
53 | + | |
51 | 54 | #endif /* _VA_ANDROID_H_ */ |