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
2871328713 @item framerate
2871428714 Maximum framerate at which the desktop will be captured - the interval between
2871528715 successive frames will not be smaller than the inverse of the framerate. When
28716−the desktop is not being updated often enough, the filter will duplicate
28717−a previous frame. Note that there is no background buffering going on, so when
28718−the filter is not polled often enough then the actual inter-frame interval may
28719−be significantly larger.
28716+@var{dup_frames} is true (the default) and the desktop is not being updated
28717+often enough, the filter will duplicate a previous frame. Note that there is no
28718+background buffering going on, so when the filter is not polled often enough
28719+then the actual inter-frame interval may be significantly larger.
2872028720
2872128721 Defaults to 30 FPS.
2872228722
@@ -28749,6 +28749,13 @@ Passes all supported output formats to DDA and returns what DDA decides to use. · 26 unmodified lines
2874928749 Filter initialization will fail if 10 bit format is requested but unavailable.
2875028750 @end table
2875128751
28752+@item dup_frames
28753+When this option is set to true (the default), the filter will duplicate frames
28754+when the desktop has not been updated in order to maintain approximately
28755+constant target framerate. When this option is set to false, the filter will
28756+wait for the desktop to be updated (inter-frame intervals may vary significantly
28757+in this case).
28758+
2875228759 @end table
2875328760
2875428761 @subsection Examples
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