[FFmpeg-devel] [PATCH v2] Fix undefined reference to xcb_shape_rectangles in xcbgrab.c

Boris Reisig voip at boris.ca
Mon Nov 24 09:00:05 CET 2014


Sorry, here's an update of my  patch that works with 
(--enable-libxcb-shape)  and without (--disable-libxcb-shape) now. 
Attached is v2 of the patch.

On 11/23/2014 5:13 PM, Michael Niedermayer wrote:
> Hi
>
> On Sun, Nov 23, 2014 at 02:48:54PM -0600, Boris Reisig wrote:
>> It seems when using the latest ffmpeg from master git, there's an
>> incompatible change in the last few weeks that prevents libxcb-shape
>> from being detected properly in ffmpeg so it wouldn't compile
>> properly.  I have written a patch to fix the detection to make
>> ffmpeg compile properly.
>>
>>
>> Example if if failing to compile.
>>
>> INSTALL doc/libavcodec.3
>> INSTALL doc/libavformat.3
>> INSTALL doc/libavdevice.3
>> INSTALL doc/libavfilter.3
>> LD      ffmpeg_g
>> libavdevice/libavdevice.a(xcbgrab.o): In function `xcbgrab_read_header':
>> xcbgrab.c:(.text.unlikely+0x52c): undefined reference to
>> `xcb_shape_rectangles'
>> collect2: error: ld returned 1 exit status
>> Makefile:122: recipe for target 'ffmpeg_g' failed
>> make: *** [ffmpeg_g] Error 1
> a quite similar patch was already posted, and i have the same question
> as with that one, does this work with --disable-libxcb-shape ?
>
> Please someone confirm that it does work with --disable-libxcb-shape
> or if not please adjust the patch so it does something appropriate
> also carl has posted a untested alternative patch in the previous
> thread "[FFmpeg-devel] [PATCH] libxcb-xhsape in configure"
> i really would like to apply a fix for this but i need a bit feedback
> on which is best and what works
>
> Thanks
>
> [...]
>

-------------- next part --------------
# This fixes the latest ffmpeg not compiling the latest libxcb with shape support. Boris Reisig <voip at boris.ca>
diff -uNr ffmpeg-2.4.3-original/configure ffmpeg-2.4.3/configure
--- ffmpeg-2.4.3-original/configure	2014-11-24 01:46:13.961047773 -0600
+++ ffmpeg-2.4.3/configure	2014-11-24 01:46:43.840464702 -0600
@@ -254,6 +254,7 @@
   --enable-libxcb          enable X11 grabbing using XCB [auto]
   --enable-libxcb-shm      enable X11 grabbing shm communication [auto]
   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [auto]
+  --enable-libxcb-shape    enable X11 grabbing shape rendering [auto]
   --enable-libxvid         enable Xvid encoding via xvidcore,
                            native MPEG-4/Xvid encoder exists [no]
   --enable-libzmq          enable message passing via libzmq [no]
@@ -1386,6 +1387,7 @@
     libxavs
     libxcb
     libxcb_shm
+    libxcb_shape
     libxcb_xfixes
     libxvid
     libzmq
@@ -5047,8 +5049,13 @@
             enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
         } && enable libxcb_xfixes; }
 
-    add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags
-    add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs
+    disabled libxcb_shape || {
+        check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || {
+            enabled libxcb_shape && die "ERROR: libxcb_shape not found";
+        } && enable libxcb_shape; }
+
+    add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags
+    add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs $xcb_shape_libs
 fi
 fi
 
diff -uNr ffmpeg-2.4.3-original/libavdevice/xcbgrab.c ffmpeg-2.4.3/libavdevice/xcbgrab.c
--- ffmpeg-2.4.3-original/libavdevice/xcbgrab.c	2014-11-24 01:46:14.091045233 -0600
+++ ffmpeg-2.4.3/libavdevice/xcbgrab.c	2014-11-24 01:47:42.529319460 -0600
@@ -33,6 +33,10 @@
 #include <xcb/shm.h>
 #endif
 
+#if CONFIG_LIBXCB_SHAPE
+#include <xcb/shape.h>
+#endif
+
 #include "libavformat/avformat.h"
 #include "libavformat/internal.h"
 
@@ -576,7 +580,7 @@
                       XCB_COPY_FROM_PARENT,
                       mask, values);
 
-#if XCB_SHAPE_RECTANGLES
+#if CONFIG_LIBXCB_SHAPE
     xcb_shape_rectangles(c->conn, XCB_SHAPE_SO_SUBTRACT,
                          XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
                          c->window,


More information about the ffmpeg-devel mailing list