History

lavfi/vsrc_ddagrab: add an option to avoid duplicating frames

Anton Khirnov committed 2 years ago

Commit 0291b6f1 parent 66f028a2 files · +17 −5Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vsrc_ddagrab.c+6−1
@@ -101,6 +101,7 @@ typedef struct DdagrabContext { · 100 unmodified lines
101101 int out_fmt;
102102 int allow_fallback;
103103 int force_fmt;
104+ int dup_frames;
104105 } DdagrabContext;
105106
106107 #define OFFSET(x) offsetof(DdagrabContext, x)
@@ -124,6 +125,8 @@ static const AVOption ddagrab_options[] = { · 17 unmodified lines
124125 OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
125126 { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)",
126127 OFFSET(force_fmt), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
128+ { "dup_frames", "duplicate frames to maintain framerate",
129+ OFFSET(dup_frames), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
127130 { NULL }
128131 };
129132
@@ -1067,7 +1070,9 @@ static int ddagrab_request_frame(AVFilterLink *outlink) · 937 unmodified lines
10671070 now -= dda->first_pts;
10681071
10691072 if (!dda->probed_texture) {
1070− ret = next_frame_internal(avctx, &cur_texture, 0);
1073+ do {
1074+ ret = next_frame_internal(avctx, &cur_texture, 0);
1075+ } while (ret == AVERROR(EAGAIN) && !dda->dup_frames);
10711076 } else {
10721077 cur_texture = dda->probed_texture;
10731078 dda->probed_texture = NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t