[FFmpeg-devel] [PATCH 2/4] libavdevice/avfoundation: add capture_screen_cursor option

Thilo Borgmann thilo.borgmann at mail.de
Sat Mar 21 17:35:27 CET 2015


Am 18.03.15 um 09:36 schrieb Matthieu Bouron:
> On Sat, Mar 14, 2015 at 11:11 AM, Matthieu Bouron <matthieu.bouron at gmail.com
>> wrote:
> 
>>
>>
>> On Sat, Mar 14, 2015 at 10:50 AM, Matthieu Bouron <
>> matthieu.bouron at gmail.com> wrote:
>>
>>>
>>>
>>> On Sat, Mar 14, 2015 at 8:29 AM, Carl Eugen Hoyos <cehoyos at ag.or.at>
>>> wrote:
>>>
>>>>  <matthieu.bouron <at> gmail.com> writes:
>>>>
>>>>> +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
>>>>
>>>> Please make this "#if !TARGET_OS_IPHONE && ..."
>>>> to avoid warnings when compiling for iOS.
>>>>
>>>> Carl Eugen
>>>>
>>>> _______________________________________________
>>>> ffmpeg-devel mailing list
>>>> ffmpeg-devel at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>
>>>
>>> Hello Carl,
>>>
>>> Both code blocks are already contained in the following blocks:
>>>
>>> #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
>>> [...]
>>> #endif
>>>
>>> Do you still want the #if !TARGET_OS_IPHONE for consistency ?
>>>
>>
>> New patch attached with the #if !TARGET_OS_IPHONE condition.
>>
> 
> ping

>From 315a96b694702f2182264bb4b01d04fc7848f9a3 Mon Sep 17 00:00:00 2001
From: Matthieu Bouron <matthieu.bouron at gmail.com>
Date: Sat, 7 Mar 2015 22:01:03 +0100
Subject: [PATCH 2/4] libavdevice/avfoundation: add capture_screen_cursor
 option

Add support for cursor capturing while recording a screen for OSX >=
10.8.
---
 libavdevice/avfoundation.m | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 86e6578..792dfa6 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -94,6 +94,8 @@ typedef struct
     AVRational      framerate;
     int             width, height;

+    int             capture_screen_cursor;
+
     int             list_devices;
     int             video_device_index;
     int             video_stream_index;
@@ -706,6 +708,14 @@ static int avf_read_header(AVFormatContext *s)
                 capture_screen_input.minFrameDuration =
CMTimeMake(ctx->framerate.den, ctx->framerate.num);
             }

+#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+            if (ctx->capture_screen_cursor) {
+                capture_screen_input.capturesCursor = YES;
+            } else {
+                capture_screen_input.capturesCursor = NO;
+            }
+#endif
+
             video_device = (AVCaptureDevice*) capture_screen_input;
             capture_screen = 1;
 #endif
@@ -741,6 +751,14 @@ static int avf_read_header(AVFormatContext *s)
                 if (ctx->framerate.num > 0) {
                     capture_screen_input.minFrameDuration =
CMTimeMake(ctx->framerate.den, ctx->framerate.num);
                 }
+
+#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+                if (ctx->capture_screen_cursor) {
+                    capture_screen_input.capturesCursor = YES;
+                } else {
+                    capture_screen_input.capturesCursor = NO;
+                }
+#endif
             }
         }
 #endif
@@ -957,6 +975,7 @@ static const AVOption options[] = {
     { "pixel_format", "set pixel format", offsetof(AVFContext, pixel_format),
AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_YUV420P}, 0, INT_MAX,
AV_OPT_FLAG_DECODING_PARAM},
     { "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 },

I suggest to rename the option to "capture_cursor"... _screen_ in it seems to be
redundant.


     { NULL },
 };

-- 
1.9.3 (Apple Git-50)


Ok otherwise.

-Thilo


More information about the ffmpeg-devel mailing list