[Libva] [PATCH 2/2] test/encode: add avcenc target for Android.mk

Xiang, Haihao haihao.xiang at intel.com
Fri May 18 00:23:07 PDT 2012


It is OK for me.

Thanks
Haihao

> -----Original Message-----
> From: libva-bounces+haihao.xiang=intel.com at lists.freedesktop.org
> [mailto:libva-bounces+haihao.xiang=intel.com at lists.freedesktop.org] On
> Behalf Of Haitao Huang
> Sent: Thursday, May 17, 2012 3:48 PM
> To: libva at lists.freedesktop.org
> Subject: [Libva] [PATCH 2/2] test/encode: add avcenc target for Android.mk
> 
> Signed-off-by: Haitao Huang <haitao.huang at intel.com>
> ---
>  test/encode/Android.mk |   20 ++++++++++++++++++++
>  test/encode/avcenc.c   |   26 ++++++++++++++++++++------
>  2 files changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/test/encode/Android.mk b/test/encode/Android.mk index
> 8395cdd..d075a5e 100755
> --- a/test/encode/Android.mk
> +++ b/test/encode/Android.mk
> @@ -24,3 +24,23 @@ LOCAL_SHARED_LIBRARIES := libva-android libva
> libdl libdrm libcutils libutils li
> 
>  include $(BUILD_EXECUTABLE)
> 
> +
> +include $(CLEAR_VARS)
> +
> +LOCAL_SRC_FILES := \
> +       avcenc.c
> +
> +LOCAL_CFLAGS += \
> +    -DANDROID
> +
> +LOCAL_C_INCLUDES += \
> +  $(TARGET_OUT_HEADERS)/libva	\
> +
> +LOCAL_MODULE_TAGS := optional
> +LOCAL_MODULE :=	avcenc
> +
> +LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils
> +libutils libgui
> +
> +include $(BUILD_EXECUTABLE)
> +
> +
> diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c index
> 71c0644..33f0aaa 100644
> --- a/test/encode/avcenc.c
> +++ b/test/encode/avcenc.c
> @@ -9,8 +9,9 @@
>  #include <string.h>
>  #include <stdlib.h>
>  #include <getopt.h>
> +#ifndef ANDROID
>  #include <X11/Xlib.h>
> -
> +#endif
>  #include <unistd.h>
> 
>  #include <sys/time.h>
> @@ -24,8 +25,11 @@
> 
>  #include <va/va.h>
>  #include <va/va_enc_h264.h>
> +#ifdef ANDROID
> +#include <va/va_android.h>
> +#else
>  #include <va/va_x11.h>
> -
> +#endif
>  #define NAL_REF_IDC_NONE        0
>  #define NAL_REF_IDC_LOW         1
>  #define NAL_REF_IDC_MEDIUM      2
> @@ -53,6 +57,8 @@
>          exit(1);
> \
>      }
> 
> +#define Display unsigned int
> +
>  static Display *x11_display;
>  static VADisplay va_dpy;
> 
> @@ -118,8 +124,12 @@ static void create_encode_pipe()
>      VAConfigAttrib attrib[2];
>      int major_ver, minor_ver;
>      VAStatus va_status;
> -
> +#ifdef ANDROID
> +    x11_display = (Display*)malloc(sizeof(Display));
> +    *(x11_display ) = 0x18c34078;
> +#else
>      x11_display = XOpenDisplay(":0.0");
> +#endif
>      assert(x11_display);
> 
>      va_dpy = vaGetDisplay(x11_display); @@ -177,7 +187,11 @@ static
> void destory_encode_pipe()
>      vaDestroyContext(va_dpy,avcenc_context.context_id);
>      vaDestroyConfig(va_dpy,avcenc_context.config_id);
>      vaTerminate(va_dpy);
> +#ifdef ANDROID
> +    free(x11_display);
> +#else
>      XCloseDisplay(x11_display);
> +#endif
>  }
> 
>  /***************************************************
> @@ -647,8 +661,8 @@ get_coded_bitsteam_length(unsigned char *buffer,
> int buffer_length)
>      return i;
>  }
>  #endif
> -
> -static unsigned int
> +#ifndef swap32
> +static unsigned int
>  swap32(unsigned int val)
>  {
>      unsigned char *pval = (unsigned char *)&val; @@ -658,7 +672,7 @@
> swap32(unsigned int val)
>              (pval[2] << 8)      |
>              (pval[3] << 0));
>  }
> -
> +#endif
>  static void
>  bitstream_start(bitstream *bs)
>  {
> --
> 1.7.5.4
> 
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list