[Libva] [PATCH 2/3] tests: avcenc: use common VA display creation routines.
Gwenole Beauchesne
gb.devel at gmail.com
Tue Jul 10 09:16:04 PDT 2012
From: Dmitry Ermilov <dmitry.ermilov at intel.com>
Signed-off-by: Dmitry Ermilov <dmitry.ermilov at intel.com>
---
test/encode/Makefile.am | 20 ++++++++++++++++----
test/encode/avcenc.c | 24 ++++--------------------
2 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/test/encode/Makefile.am b/test/encode/Makefile.am
index de42d31..b3e4056 100644
--- a/test/encode/Makefile.am
+++ b/test/encode/Makefile.am
@@ -22,15 +22,27 @@
bin_PROGRAMS = h264encode avcenc
-INCLUDES = -I$(top_srcdir)
+libva_helpers = \
+ $(top_builddir)/test/common/libva-display.la \
+ $(NULL)
-TEST_LIBS = $(top_builddir)/va/$(libvabackendlib) $(top_builddir)/va/$(libvacorelib) -lpthread -lX11
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/test/common \
+ $(NULL)
+
+TEST_LIBS = \
+ $(top_builddir)/va/$(libvabackendlib) \
+ $(top_builddir)/va/$(libvacorelib) \
+ $(libva_helpers) \
+ $(NULL)
h264encode_LDADD = $(TEST_LIBS)
h264encode_SOURCES = h264encode_x11.c
-avcenc_LDADD= $(TEST_LIBS)
-avcenc_SOURCES= avcenc.c
+avcenc_LDADD = $(TEST_LIBS)
+avcenc_SOURCES = avcenc.c
+avcenc_DEPENDENCIES = $(libva_helpers)
EXTRA_DIST = h264encode_common.c
diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c
index d6f9ac0..df9ee2f 100644
--- a/test/encode/avcenc.c
+++ b/test/encode/avcenc.c
@@ -28,13 +28,11 @@
* ./avcenc <width> <height> <input file> <output file> [qp]
*/
+#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
-#ifndef ANDROID
-#include <X11/Xlib.h>
-#endif
#include <unistd.h>
#include <sys/time.h>
@@ -48,12 +46,7 @@
#include <va/va.h>
#include <va/va_enc_h264.h>
-#ifdef ANDROID
-#include <va/va_android.h>
-#define Display unsigned int
-#else
-#include <va/va_x11.h>
-#endif
+#include "va_display.h"
#define NAL_REF_IDC_NONE 0
#define NAL_REF_IDC_LOW 1
@@ -82,7 +75,6 @@
exit(1); \
}
-static Display *x11_display;
static VADisplay va_dpy;
static int picture_width, picture_width_in_mbs;
@@ -148,15 +140,7 @@ static void create_encode_pipe()
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);
+ va_dpy = va_open_display();
va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
CHECK_VASTATUS(va_status, "vaInitialize");
@@ -211,7 +195,7 @@ static void destory_encode_pipe()
vaDestroyContext(va_dpy,avcenc_context.context_id);
vaDestroyConfig(va_dpy,avcenc_context.config_id);
vaTerminate(va_dpy);
- XCloseDisplay(x11_display);
+ va_close_display(va_dpy);
}
/***************************************************
--
1.7.9.5
More information about the Libva
mailing list