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

Unified · Split

2 files
  1. doc/filters.texi +11 −4
  2. libavfilter/vsrc_ddagrab.c +6 −1
doc/filters.texi+11−4
@@ -28713,10 +28713,10 @@ it'll always be captured. · 28712 unmodified lines
28713@item framerate28713@item framerate
28714Maximum framerate at which the desktop will be captured - the interval between28714Maximum framerate at which the desktop will be captured - the interval between
28715successive frames will not be smaller than the inverse of the framerate. When28715successive frames will not be smaller than the inverse of the framerate. When
28716the desktop is not being updated often enough, the filter will duplicate28716@var{dup_frames} is true (the default) and the desktop is not being updated
28717a previous frame. Note that there is no background buffering going on, so when28717often enough, the filter will duplicate a previous frame. Note that there is no
28718the filter is not polled often enough then the actual inter-frame interval may28718background buffering going on, so when the filter is not polled often enough
28719be significantly larger.28719then the actual inter-frame interval may be significantly larger.
28720 28720
28721Defaults to 30 FPS.28721Defaults to 30 FPS.
28722 28722
@@ -28749,6 +28749,13 @@ Passes all supported output formats to DDA and returns what DDA decides to use. · 26 unmodified lines
28749Filter initialization will fail if 10 bit format is requested but unavailable.28749Filter initialization will fail if 10 bit format is requested but unavailable.
28750@end table28750@end table
28751 28751
28752@item dup_frames
28753When this option is set to true (the default), the filter will duplicate frames
28754when the desktop has not been updated in order to maintain approximately
28755constant target framerate. When this option is set to false, the filter will
28756wait for the desktop to be updated (inter-frame intervals may vary significantly
28757in this case).
28758
28752@end table28759@end table
28753 28760
28754@subsection Examples28761@subsection Examples
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