Message ID | 1501234457-29599-1-git-send-email-sharpbai@gmail.com |
---|---|
State | Superseded |
Headers | show |
sharpbai <sharpbai@gmail.com>于2017年7月28日 周五下午5:34写道: > From: sharpbai <tian.bai@duobei.com> > > feature: add scaleFactor attribute for avfoundation > added by: siyuan.wang@duobei.com > added by: yiren.li@duobei.com > --- > doc/indevs.texi | 3 +++ > libavdevice/avfoundation.m | 6 ++++++ > 2 files changed, 9 insertions(+) > > diff --git a/doc/indevs.texi b/doc/indevs.texi > index 09e3321..8873477 100644 > --- a/doc/indevs.texi > +++ b/doc/indevs.texi > @@ -139,6 +139,9 @@ Capture the mouse pointer. Default is 0. > @item -capture_mouse_clicks > Capture the screen mouse clicks. Default is 0. > > +@item -scale_factor > +Scale factor for capture the screen. Default is 1. > + > @end table > > @subsection Examples > diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m > index e2ddf47..92e4063 100644 > --- a/libavdevice/avfoundation.m > +++ b/libavdevice/avfoundation.m > @@ -96,6 +96,7 @@ typedef struct > > int capture_cursor; > int capture_mouse_clicks; > + float scale_factor; > > int list_devices; > int video_device_index; > @@ -735,6 +736,10 @@ static int avf_read_header(AVFormatContext *s) > capture_screen_input.minFrameDuration = > CMTimeMake(ctx->framerate.den, ctx->framerate.num); > } > > + if (ctx->scale_factor != 1 && ctx->scale_factor > 0) { > + capture_screen_input.scaleFactor = ctx->scale_factor; > + } > + > #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 > if (ctx->capture_cursor) { > capture_screen_input.capturesCursor = YES; > @@ -1025,6 +1030,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 }, > + { "scale_factor", "scale screen factor range", offsetof(AVFContext, > scale_factor), 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 > LGTM
Hi, Am 28.07.17 um 11:34 schrieb sharpbai: > From: sharpbai <tian.bai@duobei.com> > > feature: add scaleFactor attribute for avfoundation > added by: siyuan.wang@duobei.com > added by: yiren.li@duobei.com > --- > doc/indevs.texi | 3 +++ > libavdevice/avfoundation.m | 6 ++++++ > 2 files changed, 9 insertions(+) > > diff --git a/doc/indevs.texi b/doc/indevs.texi > index 09e3321..8873477 100644 > --- a/doc/indevs.texi > +++ b/doc/indevs.texi > @@ -139,6 +139,9 @@ Capture the mouse pointer. Default is 0. > @item -capture_mouse_clicks > Capture the screen mouse clicks. Default is 0. > > +@item -scale_factor > +Scale factor for capture the screen. Default is 1. > + the default is "1.0". > @end table > > [...] > { "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 }, > + { "scale_factor", "scale screen factor range", offsetof(AVFContext, scale_factor), AV_OPT_TYPE_FLOAT, {.i64=1}, 0, 2, AV_OPT_FLAG_DECODING_PARAM }, Should initialized by "{.dbl=1.0}" like Moritz suggested. Also, did you test with 0.0 < scale_factor < 1.0 values? Why stop at factor 2.0? Did you test for scale_factor > 2.0? Also please add this new option to the documentation. -Thilo
diff --git a/doc/indevs.texi b/doc/indevs.texi index 09e3321..8873477 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -139,6 +139,9 @@ Capture the mouse pointer. Default is 0. @item -capture_mouse_clicks Capture the screen mouse clicks. Default is 0. +@item -scale_factor +Scale factor for capture the screen. Default is 1. + @end table @subsection Examples diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index e2ddf47..92e4063 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -96,6 +96,7 @@ typedef struct int capture_cursor; int capture_mouse_clicks; + float scale_factor; int list_devices; int video_device_index; @@ -735,6 +736,10 @@ static int avf_read_header(AVFormatContext *s) capture_screen_input.minFrameDuration = CMTimeMake(ctx->framerate.den, ctx->framerate.num); } + if (ctx->scale_factor != 1 && ctx->scale_factor > 0) { + capture_screen_input.scaleFactor = ctx->scale_factor; + } + #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (ctx->capture_cursor) { capture_screen_input.capturesCursor = YES; @@ -1025,6 +1030,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 }, + { "scale_factor", "scale screen factor range", offsetof(AVFContext, scale_factor), 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 --- doc/indevs.texi | 3 +++ libavdevice/avfoundation.m | 6 ++++++ 2 files changed, 9 insertions(+)