Message ID | 1501228501-23802-1-git-send-email-sharpbai@gmail.com |
---|---|
State | Superseded |
Headers | show |
2017-07-28 15:55 GMT+08:00 sharpbai <sharpbai@gmail.com>: > From: sharpbai <tian.bai@duobei.com> > > feature: add scaleFactor attribute for avfoundation > added by: siyuan.wang@duobei.com > added by: yiren.li@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 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Add the option into document please.
2017-07-28 16:34 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>: > 2017-07-28 15:55 GMT+08:00 sharpbai <sharpbai@gmail.com>: >> From: sharpbai <tian.bai@duobei.com> >> >> feature: add scaleFactor attribute for avfoundation >> added by: siyuan.wang@duobei.com >> added by: yiren.li@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@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > Add the option into document please.
On Fri, Jul 28, 2017 at 15:55:01 +0800, sharpbai wrote: > + float scaleFactor; No camelCase in ffmpeg for plain variables. > + { "scaleFactor", "scale screen factor range", offsetof(AVFContext, scaleFactor), AV_OPT_TYPE_FLOAT, {.i64=1}, 0, 2, AV_OPT_FLAG_DECODING_PARAM }, No camelCase for ffmpeg options. And shouldn't that be "{.dbl=1}"? Moritz
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 }, };
From: sharpbai <tian.bai@duobei.com> feature: add scaleFactor attribute for avfoundation added by: siyuan.wang@duobei.com added by: yiren.li@duobei.com --- libavdevice/avfoundation.m | 5 +++++ 1 file changed, 5 insertions(+)