diff options
author | wm4 <wm4@nowhere> | 2015-01-03 03:01:58 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-03 03:01:58 +0100 |
commit | f5ed13bcd4aacd362db9da3b5ad3f8747f13d944 (patch) | |
tree | 289bf7a376236d2da9547f5bbcdb9e62529025b2 /video/filter/vf.h | |
parent | 73ea0ddc080a53b5474205703ba3b189d0352d3a (diff) | |
download | mpv-f5ed13bcd4aacd362db9da3b5ad3f8747f13d944.tar.bz2 mpv-f5ed13bcd4aacd362db9da3b5ad3f8747f13d944.tar.xz |
video: better pipelining with vf_vapoursynth
Most of this is explained in the code comments. This change should
improve performance with vapoursynth, especially if concurrent requests
are used.
This should change nothing if vf_vapoursynth is not in the filter chain,
since non-threaded filters obviously can not asynchronously finish
filtering of frames.
Diffstat (limited to 'video/filter/vf.h')
-rw-r--r-- | video/filter/vf.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/video/filter/vf.h b/video/filter/vf.h index e7e53bc3ce..4ff8398229 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -84,6 +84,12 @@ typedef struct vf_instance { // May be called multiple times, even if the filter gives no output. int (*filter_out)(struct vf_instance *vf); + // Optional function that checks whether the filter needs additional + // input. This is for filters with asynchronous behavior: they filter + // frames in the background, and to get good pipelining behavior, new + // data should be fed, even if the playback core doesn't need any yet. + bool (*needs_input)(struct vf_instance *vf); + void (*uninit)(struct vf_instance *vf); char *label; @@ -121,6 +127,12 @@ struct vf_chain { struct MPOpts *opts; struct mpv_global *global; struct mp_hwdec_info *hwdec; + + // Call when the filter chain wants new processing (for filters with + // asynchronous behavior) - must be immutable once filters are created, + // since they are supposed to call it from foreign threads. + void (*wakeup_callback)(void *ctx); + void *wakeup_callback_ctx; }; typedef struct vf_seteq { @@ -150,6 +162,7 @@ int vf_control_any(struct vf_chain *c, int cmd, void *arg); int vf_control_by_label(struct vf_chain *c, int cmd, void *arg, bstr label); int vf_filter_frame(struct vf_chain *c, struct mp_image *img); int vf_output_frame(struct vf_chain *c, bool eof); +int vf_needs_input(struct vf_chain *c); struct mp_image *vf_read_output_frame(struct vf_chain *c); void vf_seek_reset(struct vf_chain *c); struct vf_instance *vf_append_filter(struct vf_chain *c, const char *name, |