diff options
author | wm4 <wm4@nowhere> | 2018-01-16 11:53:44 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-30 03:10:27 -0800 |
commit | 76276c92104c31ee936ba5c76a76072f09978c5f (patch) | |
tree | 5f514978ef0326ed76adc9e82ac276daac9e257f /video/filter/refqueue.h | |
parent | edb4970ca8b9bee8e54222a1e119af9d355d451a (diff) | |
download | mpv-76276c92104c31ee936ba5c76a76072f09978c5f.tar.bz2 mpv-76276c92104c31ee936ba5c76a76072f09978c5f.tar.xz |
video: rewrite filtering glue code
Get rid of the old vf.c code. Replace it with a generic filtering
framework, which can potentially handle more than just --vf. At least
reimplementing --af with this code is planned.
This changes some --vf semantics (including runtime behavior and the
"vf" command). The most important ones are listed in interface-changes.
vf_convert.c is renamed to f_swscale.c. It is now an internal filter
that can not be inserted by the user manually.
f_lavfi.c is a refactor of player/lavfi.c. The latter will be removed
once --lavfi-complex is reimplemented on top of f_lavfi.c. (which is
conceptually easy, but a big mess due to the data flow changes).
The existing filters are all changed heavily. The data flow of the new
filter framework is different. Especially EOF handling changes - EOF is
now a "frame" rather than a state, and must be passed through exactly
once.
Another major thing is that all filters must support dynamic format
changes. The filter reconfig() function goes away. (This sounds complex,
but since all filters need to handle EOF draining anyway, they can use
the same code, and it removes the mess with reconfig() having to predict
the output format, which completely breaks with libavfilter anyway.)
In addition, there is no automatic format negotiation or conversion.
libavfilter's primitive and insufficient API simply doesn't allow us to
do this in a reasonable way. Instead, filters can use f_autoconvert as
sub-filter, and tell it which formats they support. This filter will in
turn add actual conversion filters, such as f_swscale, to perform
necessary format changes.
vf_vapoursynth.c uses the same basic principle of operation as before,
but with worryingly different details in data flow. Still appears to
work.
The hardware deint filters (vf_vavpp.c, vf_d3d11vpp.c, vf_vdpaupp.c) are
heavily changed. Fortunately, they all used refqueue.c, which is for
sharing the data flow logic (especially for managing future/past
surfaces and such). It turns out it can be used to factor out most of
the data flow. Some of these filters accepted software input. Instead of
having ad-hoc upload code in each filter, surface upload is now
delegated to f_autoconvert, which can use f_hwupload to perform this.
Exporting VO capabilities is still a big mess (mp_stream_info stuff).
The D3D11 code drops the redundant image formats, and all code uses the
hw_subfmt (sw_format in FFmpeg) instead. Although that too seems to be a
big mess for now.
f_async_queue is unused.
Diffstat (limited to 'video/filter/refqueue.h')
-rw-r--r-- | video/filter/refqueue.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/video/filter/refqueue.h b/video/filter/refqueue.h index bb23506ac2..0a8ace0031 100644 --- a/video/filter/refqueue.h +++ b/video/filter/refqueue.h @@ -3,22 +3,26 @@ #include <stdbool.h> +#include "filters/filter.h" + // A helper for deinterlacers which require past/future reference frames. struct mp_refqueue; -struct mp_refqueue *mp_refqueue_alloc(void); -void mp_refqueue_free(struct mp_refqueue *q); +struct mp_refqueue *mp_refqueue_alloc(struct mp_filter *f); + +void mp_refqueue_add_in_format(struct mp_refqueue *q, int fmt, int subfmt); void mp_refqueue_set_refs(struct mp_refqueue *q, int past, int future); void mp_refqueue_flush(struct mp_refqueue *q); -void mp_refqueue_add_input(struct mp_refqueue *q, struct mp_image *img); -bool mp_refqueue_need_input(struct mp_refqueue *q); -bool mp_refqueue_has_output(struct mp_refqueue *q); -void mp_refqueue_next(struct mp_refqueue *q); -void mp_refqueue_next_field(struct mp_refqueue *q); struct mp_image *mp_refqueue_get(struct mp_refqueue *q, int pos); +struct mp_image *mp_refqueue_execute_reinit(struct mp_refqueue *q); +bool mp_refqueue_can_output(struct mp_refqueue *q); +void mp_refqueue_write_out_pin(struct mp_refqueue *q, struct mp_image *mpi); + +struct mp_image *mp_refqueue_get_format(struct mp_refqueue *q); + enum { MP_MODE_DEINT = (1 << 0), // deinterlacing enabled MP_MODE_OUTPUT_FIELDS = (1 << 1), // output fields separately |