mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 13:28:17 +00:00
Windows Graphics Capture only delivers a frame when the captured content changes, so a static source makes gfxcapture output nothing at all. An fps filter after it cannot help, since it has no later frame to duplicate up to, and anything muxed alongside stalls as well. Add a dup_frames option, like ddagrab has. When no new frame arrived within one 1/max_framerate interval, output a new reference to the last frame, or a black frame before the source delivered its first one. Repeats are stamped with their deadline in the QPC clock, the same clock as SystemRelativeTime, and the next deadline counts from the previous one, so timer overshoot shows up neither in the timestamps nor in the rate. A captured frame timestamped at or before the last output is bumped to keep timestamps increasing. The new option is on by default, since the current behaviour is arguably surprising and clashes with how a lot of the filter chain and the fftools work. Signed-off-by: Rafael Henrique Gonçalves de Oliveira <rafaelh9six@gmail.com> Co-authored-by: Timo Rothenpieler <timo@rothenpieler.org>
87 lines
2.2 KiB
C
87 lines
2.2 KiB
C
/*
|
|
* This file is part of FFmpeg.
|
|
*
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef AVFILTER_VSRC_GFXCAPTURE_H
|
|
#define AVFILTER_VSRC_GFXCAPTURE_H
|
|
|
|
#include "libavutil/log.h"
|
|
#include "libavutil/rational.h"
|
|
#include "libavfilter/avfilter.h"
|
|
|
|
typedef struct GfxCaptureContextCpp GfxCaptureContextCpp;
|
|
|
|
enum GfxResizeMode {
|
|
GFX_RESIZE_CROP = 0,
|
|
GFX_RESIZE_SCALE,
|
|
GFX_RESIZE_SCALE_ASPECT,
|
|
GFX_RESIZE_NB
|
|
};
|
|
|
|
enum GfxScaleMode {
|
|
GFX_SCALE_POINT = 0,
|
|
GFX_SCALE_BILINEAR,
|
|
GFX_SCALE_BICUBIC,
|
|
GFX_SCALE_NB
|
|
};
|
|
|
|
enum GfxMonitorIdx {
|
|
GFX_MONITOR_IDX_WINDOW = -1,
|
|
GFX_MONITOR_IDX_DEFAULT = -2
|
|
};
|
|
|
|
typedef struct GfxCaptureContext {
|
|
const AVClass *avclass;
|
|
|
|
GfxCaptureContextCpp *ctx;
|
|
|
|
const char *window_text;
|
|
const char *window_class;
|
|
const char *window_exe;
|
|
int monitor_idx;
|
|
|
|
uint64_t user_hwnd;
|
|
uint64_t user_hmonitor;
|
|
|
|
int capture_cursor;
|
|
int capture_border;
|
|
int display_border;
|
|
AVRational frame_rate;
|
|
int canvas_width, canvas_height;
|
|
int crop_left, crop_top, crop_right, crop_bottom;
|
|
int out_fmt;
|
|
int resize_mode;
|
|
int scale_mode;
|
|
int premult_alpha;
|
|
int dup_frames;
|
|
} GfxCaptureContext;
|
|
|
|
#ifdef __cplusplus
|
|
#define NOEXCEPT noexcept
|
|
#else
|
|
#define NOEXCEPT
|
|
#endif
|
|
|
|
av_cold int ff_gfxcapture_init(AVFilterContext *avctx) NOEXCEPT;
|
|
av_cold void ff_gfxcapture_uninit(AVFilterContext *avctx) NOEXCEPT;
|
|
int ff_gfxcapture_activate(AVFilterContext *avctx) NOEXCEPT;
|
|
int ff_gfxcapture_config_props(AVFilterLink *outlink) NOEXCEPT;
|
|
|
|
#undef NOEXCEPT
|
|
|
|
#endif /* AVFILTER_VSRC_GFXCAPTURE_H */
|