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

Steven Liu lingjiujianke at gmail.com
Fri Jul 28 11:43:04 EEST 2017


2017-07-28 16:34 GMT+08:00 Steven Liu <lingjiujianke at gmail.com>:
> 2017-07-28 15:55 GMT+08:00 sharpbai <sharpbai at gmail.com>:
>> 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;
I saw the method from :
https://developer.apple.com/documentation/avfoundation/avcapturescreeninput/1390311-scalefactor
said:

SDK

macOS 10.7+

I cannot sure if this attribute need check about the depend version.
>>
>>      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
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> Add the option into document please.


More information about the ffmpeg-devel mailing list