diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-11-19 12:46:48 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-01-30 09:32:39 +0100 |
commit | 0291b6f824c5cbae5d919559845df4e73dcc459a (patch) | |
tree | afec26311adbf6fa0bd67701ecfefe137c8dd0e9 /libavfilter/vsrc_ddagrab.c | |
parent | 66f028accbcc88d56716065f7a40a681a798064a (diff) | |
download | ffmpeg-0291b6f824c5cbae5d919559845df4e73dcc459a.tar.gz |
lavfi/vsrc_ddagrab: add an option to avoid duplicating frames
Tested-by: Jiří Eliášek, Misha Aizatulin
Diffstat (limited to 'libavfilter/vsrc_ddagrab.c')
-rw-r--r-- | libavfilter/vsrc_ddagrab.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 9c59faf53e..51e928d785 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -101,6 +101,7 @@ typedef struct DdagrabContext { int out_fmt; int allow_fallback; int force_fmt; + int dup_frames; } DdagrabContext; #define OFFSET(x) offsetof(DdagrabContext, x) @@ -124,6 +125,8 @@ static const AVOption ddagrab_options[] = { OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)", OFFSET(force_fmt), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, + { "dup_frames", "duplicate frames to maintain framerate", + OFFSET(dup_frames), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, { NULL } }; @@ -1067,7 +1070,9 @@ static int ddagrab_request_frame(AVFilterLink *outlink) now -= dda->first_pts; if (!dda->probed_texture) { - ret = next_frame_internal(avctx, &cur_texture, 0); + do { + ret = next_frame_internal(avctx, &cur_texture, 0); + } while (ret == AVERROR(EAGAIN) && !dda->dup_frames); } else { cur_texture = dda->probed_texture; dda->probed_texture = NULL; |