[FFmpeg-devel] [PATCH 3/4] libavdevice/avfoundation: add capture_screen_mouse_clicks option

matthieu.bouron at gmail.com matthieu.bouron at gmail.com
Fri Mar 13 20:16:54 CET 2015


From: Matthieu Bouron <matthieu.bouron at gmail.com>

Support mouse clicks capture while recording a screen on OSX >= 10.7.
---
 libavdevice/avfoundation.m | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index e574518..8112229 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -95,6 +95,7 @@ typedef struct
     int             width, height;
 
     int             capture_screen_cursor;
+    int             capture_screen_mouse_clicks;
 
     int             list_devices;
     int             video_device_index;
@@ -715,6 +716,12 @@ static int avf_read_header(AVFormatContext *s)
             }
 #endif
 
+            if (ctx->capture_screen_mouse_clicks) {
+                capture_screen_input.capturesMouseClicks = YES;
+            } else {
+                capture_screen_input.capturesMouseClicks = NO;
+            }
+
             video_device = (AVCaptureDevice*) capture_screen_input;
             capture_screen = 1;
 #endif
@@ -758,6 +765,12 @@ static int avf_read_header(AVFormatContext *s)
                     capture_screen_input.capturesCursor = NO;
                 }
 #endif
+
+                if (ctx->capture_screen_mouse_clicks) {
+                    capture_screen_input.capturesMouseClicks = YES;
+                } else {
+                    capture_screen_input.capturesMouseClicks = NO;
+                }
             }
         }
 #endif
@@ -975,6 +988,8 @@ static const AVOption options[] = {
     { "framerate", "set frame rate", offsetof(AVFContext, framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "ntsc"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
     { "size", "set video size", offsetof(AVFContext, width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
     { "capture_screen_cursor", "capture the screen cursor", offsetof(AVFContext, capture_screen_cursor), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+    { "capture_screen_mouse_clicks", "capture the screen mouse clicks", offsetof(AVFContext, capture_screen_mouse_clicks), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+
     { NULL },
 };
 
-- 
2.3.2



More information about the ffmpeg-devel mailing list