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
101 int out_fmt;101 int out_fmt;
102 int allow_fallback;102 int allow_fallback;
103 int force_fmt;103 int force_fmt;
104 int dup_frames;
104} DdagrabContext;105} DdagrabContext;
105 106
106#define OFFSET(x) offsetof(DdagrabContext, x)107#define OFFSET(x) offsetof(DdagrabContext, x)
@@ -124,6 +125,8 @@ static const AVOption ddagrab_options[] = { · 17 unmodified lines
124 OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },125 OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
125 { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)",126 { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)",
126 OFFSET(force_fmt), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },127 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 },
127 { NULL }130 { NULL }
128};131};
129 132
@@ -1067,7 +1070,9 @@ static int ddagrab_request_frame(AVFilterLink *outlink) · 937 unmodified lines
1067 now -= dda->first_pts;1070 now -= dda->first_pts;
1068 1071
1069 if (!dda->probed_texture) {1072 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);
1071 } else {1076 } else {
1072 cur_texture = dda->probed_texture;1077 cur_texture = dda->probed_texture;
1073 dda->probed_texture = NULL;1078 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