tests: avcenc: use common VA display creation routines.
authorDmitry Ermilov <dmitry.ermilov@intel.com>
Thu, 7 Jun 2012 15:45:15 +0000 (19:45 +0400)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 26 Sep 2012 09:40:33 +0000 (11:40 +0200)
Signed-off-by: Dmitry Ermilov <dmitry.ermilov@intel.com>
test/encode/Makefile.am
test/encode/avcenc.c

index de42d31..b3e4056 100644 (file)
 
 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
 
index 85afdfd..1459ba9 100644 (file)
  * ./avcenc <width> <height> <input file> <output file> [qp]
  */  
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <getopt.h>
-#include <X11/Xlib.h>
-
 #include <unistd.h>
 
 #include <sys/types.h>
@@ -43,7 +44,7 @@
 #include <time.h>
 
 #include <va/va.h>
-#include <va/va_x11.h>
+#include "va_display.h"
 
 #define NAL_REF_IDC_NONE        0
 #define NAL_REF_IDC_LOW         1
@@ -72,7 +73,6 @@
         exit(1);                                                        \
     }
 
-static Display *x11_display;
 static VADisplay va_dpy;
 static VAContextID context_id;
 static VAConfigID config_id;
@@ -100,10 +100,7 @@ static void create_encode_pipe()
     int major_ver, minor_ver;
     VAStatus va_status;
 
-    x11_display = XOpenDisplay(":0.0");
-    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");
 
@@ -158,7 +155,7 @@ static void destory_encode_pipe()
     vaDestroyContext(va_dpy,context_id);
     vaDestroyConfig(va_dpy,config_id);
     vaTerminate(va_dpy);
-    XCloseDisplay(x11_display);
+    va_close_display(va_dpy);
 }
 
 /***************************************************