[FFmpeg-devel] [PATCH] avdevice/avfoundation: add scaleFactor attribute for avfoundation

sharpbai sharpbai at gmail.com
Fri Jul 28 10:55:01 EEST 2017


From: sharpbai <tian.bai at duobei.com>

feature: add scaleFactor attribute for avfoundation
added by: siyuan.wang at duobei.com
added by: yiren.li at duobei.com
---
 libavdevice/avfoundation.m | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index e2ddf47..22cff1f 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -96,6 +96,7 @@ typedef struct
 
     int             capture_cursor;
     int             capture_mouse_clicks;
+    float           scaleFactor;
 
     int             list_devices;
     int             video_device_index;
@@ -748,6 +749,9 @@ static int avf_read_header(AVFormatContext *s)
             } else {
                 capture_screen_input.capturesMouseClicks = NO;
             }
+            if (ctx->scaleFactor != 1 && ctx->scaleFactor > 0) {
+                capture_screen_input.scaleFactor = ctx->scaleFactor;
+            }
 
             video_device = (AVCaptureDevice*) capture_screen_input;
             capture_screen = 1;
@@ -1025,6 +1029,7 @@ static const AVOption options[] = {
     { "video_size", "set video size", offsetof(AVFContext, width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
     { "capture_cursor", "capture the screen cursor", offsetof(AVFContext, capture_cursor), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
     { "capture_mouse_clicks", "capture the screen mouse clicks", offsetof(AVFContext, capture_mouse_clicks), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+    { "scaleFactor", "scale screen factor range", offsetof(AVFContext, scaleFactor), AV_OPT_TYPE_FLOAT, {.i64=1}, 0, 2, AV_OPT_FLAG_DECODING_PARAM },
 
     { NULL },
 };
-- 
2.2.1



More information about the ffmpeg-devel mailing list