[vlc-commits] Remove the xcb-image dependency
Ludovic Fauvet
git at videolan.org
Sat Dec 22 04:31:11 CET 2012
npapi-vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Sat Dec 22 02:08:57 2012 +0100| [eb9a760359148ff580f76ab9bdd43ec6c2155534] | committer: Ludovic Fauvet
Remove the xcb-image dependency
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=eb9a760359148ff580f76ab9bdd43ec6c2155534
---
configure.ac | 2 +-
npapi/vlcwindowless_xcb.cpp | 39 +++++++++++++++++++++++----------------
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index 385e8fe..bd172dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,7 +243,7 @@ dnl GTK+ for linux toolbar
AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build the GTK+ toolbars in NPAPI plugin [default=auto]]),, [with_gtk=yes])
gtk_found=no
AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ], [
- PKG_CHECK_MODULES(XCB, [xcb xcb-image],[xcb_found=yes])
+ PKG_CHECK_MODULES(XCB, [xcb],[xcb_found=yes])
AS_IF([ test "x$with_gtk" != "xno" ],
[
PKG_CHECK_MODULES(GTK, [gtk+-2.0], [gtk_found=yes])
diff --git a/npapi/vlcwindowless_xcb.cpp b/npapi/vlcwindowless_xcb.cpp
index 44a9709..a60f821 100644
--- a/npapi/vlcwindowless_xcb.cpp
+++ b/npapi/vlcwindowless_xcb.cpp
@@ -25,7 +25,6 @@
#include <xcb/xcb.h>
#include <xcb/xproto.h>
-#include <xcb/xcb_image.h>
#include <cstring>
#include <cstdlib>
@@ -92,6 +91,9 @@ bool VlcWindowlessXCB::handle_event(void *event)
switch (xevent->type) {
case GraphicsExpose:
+ xcb_gcontext_t gc;
+ xcb_void_cookie_t cookie;
+ xcb_generic_error_t* err;
XGraphicsExposeEvent *xgeevent = reinterpret_cast<XGraphicsExposeEvent *>(xevent);
/* Something went wrong during initialization */
@@ -104,18 +106,6 @@ bool VlcWindowlessXCB::handle_event(void *event)
if (m_media_width == 0 || m_media_height == 0)
break;
- /* Create our X11 image */
- xcb_image_t *image = xcb_image_create_native(
- m_conn,
- m_media_width,
- m_media_height,
- XCB_IMAGE_FORMAT_Z_PIXMAP,
- 24,
- &m_frame_buf[0],
- m_frame_buf.size(),
- NULL
- );
-
/* Compute the position of the video */
int left = (npwindow.width - m_media_width) / 2;
int top = (npwindow.height - m_media_height) / 2;
@@ -132,11 +122,28 @@ bool VlcWindowlessXCB::handle_event(void *event)
*/
/* Push the frame in X11 */
- xcb_gcontext_t gc = xcb_generate_id(m_conn);
+ gc = xcb_generate_id(m_conn);
xcb_create_gc(m_conn, gc, xgeevent->drawable, 0, NULL);
- //FIXME xcb_put_image_checked is more efficient than xcb_image_*
- xcb_image_put(m_conn, xgeevent->drawable, gc, image, left, top, 0);
+ /* Push the frame in X11 */
+ cookie = xcb_put_image_checked(
+ m_conn,
+ XCB_IMAGE_FORMAT_Z_PIXMAP,
+ xgeevent->drawable,
+ gc,
+ m_media_width,
+ m_media_height,
+ left, top,
+ 0, 24,
+ m_media_width * m_media_height * 4,
+ (const uint8_t*)&m_frame_buf[0]);
+
+ if (err = xcb_request_check(m_conn, cookie))
+ {
+ fprintf(stderr, "Unable to put picture into drawable. Error %d\n",
+ err->error_code);
+ free(err);
+ }
/* Flush the the connection */
xcb_flush(m_conn);
More information about the vlc-commits
mailing list