]> git.sesse.net Git - ffmpeg/commitdiff
lavd/x11grab: add an option to disable MIT-SHM.
authorNicolas George <george@nsup.org>
Tue, 15 Jul 2014 09:37:47 +0000 (11:37 +0200)
committerNicolas George <george@nsup.org>
Thu, 17 Jul 2014 16:12:15 +0000 (18:12 +0200)
With remote displays supporting the MIT-SHM extension,
the extension is detected and used, but attaching fails
asynchronously.

doc/indevs.texi
libavdevice/x11grab.c

index 420580877612b8fce8f43a2ae6b99e3f5f5e5c3d..4ca12ff6cc22533f608fce547c78b7dc1299ac53 100644 (file)
@@ -895,6 +895,10 @@ ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_siz
 
 @item video_size
 Set the video frame size. Default value is @code{vga}.
+
+@item use_shm
+Use the MIT-SHM extension for shared memory. Default value is @code{1}.
+It may be necessary to disable it for remote displays.
 @end table
 
 @c man end INPUT DEVICES
index 7271e6cb0c879694237aee800e171fad454f9bf2..45bea807a37b6a85f3e1c51c5d29dbdf96760c5f 100644 (file)
@@ -166,7 +166,7 @@ x11grab_read_header(AVFormatContext *s1)
     int x_off = 0;
     int y_off = 0;
     int screen;
-    int use_shm;
+    int use_shm = 0;
     char *dpyname, *offset;
     int ret = 0;
     Colormap color_map;
@@ -223,8 +223,10 @@ x11grab_read_header(AVFormatContext *s1)
         av_log(s1, AV_LOG_INFO, "followmouse is enabled, resetting grabbing region to x: %d y: %d\n", x_off, y_off);
     }
 
+    if (x11grab->use_shm) {
     use_shm = XShmQueryExtension(dpy);
     av_log(s1, AV_LOG_INFO, "shared memory extension%s found\n", use_shm ? "" : " not");
+    }
 
     if(use_shm) {
         int scr = XDefaultScreen(dpy);
@@ -641,6 +643,7 @@ static const AVOption options[] = {
     { "framerate",  "set video frame rate",      OFFSET(framerate),   AV_OPT_TYPE_VIDEO_RATE, {.str = "ntsc"}, 0, 0, DEC },
     { "show_region", "show the grabbing region", OFFSET(show_region), AV_OPT_TYPE_INT,        {.i64 = 0}, 0, 1, DEC },
     { "video_size",  "set video frame size",     OFFSET(width),       AV_OPT_TYPE_IMAGE_SIZE, {.str = "vga"}, 0, 0, DEC },
+    { "use_shm",     "use MIT-SHM extension",    OFFSET(use_shm),     AV_OPT_TYPE_INT,        {.i64 = 1}, 0, 1, DEC },
     { NULL },
 };