Unified · Split
| @@ -28713,10 +28713,10 @@ it'll always be captured. · 28712 unmodified lines | ||
| 28713 | 28713 | @item framerate |
| 28714 | 28714 | Maximum framerate at which the desktop will be captured - the interval between |
| 28715 | 28715 | 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. | |
| 28720 | 28720 | |
| 28721 | 28721 | Defaults 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 | ||
| 28749 | 28749 | Filter initialization will fail if 10 bit format is requested but unavailable. |
| 28750 | 28750 | @end table |
| 28751 | 28751 | |
| 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 | + | |
| 28752 | 28759 | @end table |
| 28753 | 28760 | |
| 28754 | 28761 | @subsection Examples |
| @@ -101,6 +101,7 @@ typedef struct DdagrabContext { · 100 unmodified lines | ||
| 101 | 101 | int out_fmt; |
| 102 | 102 | int allow_fallback; |
| 103 | 103 | int force_fmt; |
| 104 | + int dup_frames; | |
| 104 | 105 | } DdagrabContext; |
| 105 | 106 | |
| 106 | 107 | #define OFFSET(x) offsetof(DdagrabContext, x) |
| @@ -124,6 +125,8 @@ static const AVOption ddagrab_options[] = { · 17 unmodified lines | ||
| 124 | 125 | OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, |
| 125 | 126 | { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)", |
| 126 | 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 | 130 | { NULL } |
| 128 | 131 | }; |
| 129 | 132 | |
| @@ -1067,7 +1070,9 @@ static int ddagrab_request_frame(AVFilterLink *outlink) · 937 unmodified lines | ||
| 1067 | 1070 | now -= dda->first_pts; |
| 1068 | 1071 | |
| 1069 | 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 | 1076 | } else { |
| 1072 | 1077 | cur_texture = dda->probed_texture; |
| 1073 | 1078 | dda->probed_texture = NULL; |