aboutsummaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2018-01-16 11:53:44 +0100
committerGravatar Kevin Mitchell <kevmitch@gmail.com>2018-01-30 03:10:27 -0800
commit76276c92104c31ee936ba5c76a76072f09978c5f (patch)
tree5f514978ef0326ed76adc9e82ac276daac9e257f /options
parentedb4970ca8b9bee8e54222a1e119af9d355d451a (diff)
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 'options')
-rw-r--r--options/m_option.h1
-rw-r--r--options/options.c14
-rw-r--r--options/options.h7
3 files changed, 19 insertions, 3 deletions
diff --git a/options/m_option.h b/options/m_option.h
index 8c8ae855d1..f47dac294e 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -405,7 +405,6 @@ char *format_file_size(int64_t size);
// certain groups of options.
#define UPDATE_OPT_FIRST (1 << 7)
#define UPDATE_TERM (1 << 7) // terminal options
-#define UPDATE_DEINT (1 << 8) // --deinterlace
#define UPDATE_OSD (1 << 10) // related to OSD rendering
#define UPDATE_BUILTIN_SCRIPTS (1 << 11) // osc/ytdl/stats
#define UPDATE_IMGPAR (1 << 12) // video image params overrides
diff --git a/options/options.c b/options/options.c
index 44a9571598..ce602f2683 100644
--- a/options/options.c
+++ b/options/options.c
@@ -297,6 +297,18 @@ const struct m_sub_options dvd_conf = {
};
#undef OPT_BASE_STRUCT
+#define OPT_BASE_STRUCT struct filter_opts
+
+const struct m_sub_options filter_conf = {
+ .opts = (const struct m_option[]){
+ OPT_FLAG("deinterlace", deinterlace, 0),
+ {0}
+ },
+ .size = sizeof(OPT_BASE_STRUCT),
+ .change_flags = UPDATE_IMGPAR,
+};
+
+#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct MPOpts
const m_option_t mp_opts[] = {
@@ -494,7 +506,7 @@ const m_option_t mp_opts[] = {
.deprecation_message = "use --vf + enable/disable flags"),
OPT_SETTINGSLIST("vf", vf_settings, 0, &vf_obj_list, ),
- OPT_FLAG("deinterlace", deinterlace, UPDATE_DEINT),
+ OPT_SUBSTRUCT("", filter_opts, filter_conf, 0),
OPT_STRING("ad", audio_decoders, 0),
OPT_STRING("vd", video_decoders, 0),
diff --git a/options/options.h b/options/options.h
index 97f01e21f9..a3444dbd4d 100644
--- a/options/options.h
+++ b/options/options.h
@@ -281,7 +281,7 @@ typedef struct MPOpts {
int pitch_correction;
struct m_obj_settings *vf_settings, *vf_defs;
struct m_obj_settings *af_settings, *af_defs;
- int deinterlace;
+ struct filter_opts *filter_opts;
float movie_aspect;
int aspect_method;
char **sub_name;
@@ -353,6 +353,10 @@ struct dvd_opts {
char *device;
};
+struct filter_opts {
+ int deinterlace;
+};
+
extern const m_option_t mp_opts[];
extern const struct MPOpts mp_default_opts;
extern const struct m_sub_options vo_sub_opts;
@@ -360,6 +364,7 @@ extern const struct m_sub_options stream_cache_conf;
extern const struct m_sub_options dvd_conf;
extern const struct m_sub_options mp_subtitle_sub_opts;
extern const struct m_sub_options mp_osd_render_sub_opts;
+extern const struct m_sub_options filter_conf;
int hwdec_validate_opt(struct mp_log *log, const m_option_t *opt,
struct bstr name, struct bstr param);