Commit 2ca14d84 authored by Thilo Borgmann's avatar Thilo Borgmann

lavd/avfoundation.m: Add an option to drop late frames.

Retains current behaviour by the default value.
parent 343ccfcc
...@@ -98,6 +98,7 @@ typedef struct ...@@ -98,6 +98,7 @@ typedef struct
int capture_cursor; int capture_cursor;
int capture_mouse_clicks; int capture_mouse_clicks;
int capture_raw_data; int capture_raw_data;
int drop_late_frames;
int video_is_muxed; int video_is_muxed;
int list_devices; int list_devices;
...@@ -496,7 +497,7 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device) ...@@ -496,7 +497,7 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
[ctx->video_output setVideoSettings:capture_dict]; [ctx->video_output setVideoSettings:capture_dict];
} }
[ctx->video_output setAlwaysDiscardsLateVideoFrames:YES]; [ctx->video_output setAlwaysDiscardsLateVideoFrames:ctx->drop_late_frames];
ctx->avf_delegate = [[AVFFrameReceiver alloc] initWithContext:ctx]; ctx->avf_delegate = [[AVFFrameReceiver alloc] initWithContext:ctx];
...@@ -1135,6 +1136,7 @@ static const AVOption options[] = { ...@@ -1135,6 +1136,7 @@ static const AVOption options[] = {
{ "capture_cursor", "capture the screen cursor", offsetof(AVFContext, capture_cursor), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "capture_cursor", "capture the screen cursor", offsetof(AVFContext, capture_cursor), AV_OPT_TYPE_BOOL, {.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_BOOL, {.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_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "capture_raw_data", "capture the raw data from device connection", offsetof(AVFContext, capture_raw_data), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "capture_raw_data", "capture the raw data from device connection", offsetof(AVFContext, capture_raw_data), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "drop_late_frames", "drop frames that are available later than expected", offsetof(AVFContext, drop_late_frames), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL }, { NULL },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment