diff options
author | wm4 <wm4@nowhere> | 2016-05-29 17:13:22 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-05-29 19:00:55 +0200 |
commit | 0348cd080f7f2236f0e79b9b84fb04ca0d3dec55 (patch) | |
tree | af23c62a7678f62af0947fca1e1954ffd04b8584 /video/filter/vf.c | |
parent | 49f73eaf7b6f58e82376fc764ab0743c039d5278 (diff) | |
download | mpv-0348cd080f7f2236f0e79b9b84fb04ca0d3dec55.tar.bz2 mpv-0348cd080f7f2236f0e79b9b84fb04ca0d3dec55.tar.xz |
video: remove d3d11 video processor use from OpenGL interop
We now have a video filter that uses the d3d11 video processor, so it
makes no sense to have one in the VO interop code. The VO uses it for
formats not directly supported by ANGLE (so the video data is converted
to a RGB texture, which ANGLE can take in).
Change this so that the video filter is automatically inserted if
needed. Move the code that maps RGB surfaces to its own inteorp backend.
Add a bunch of new image formats, which are used to enforce the new
constraints, and to automatically insert the filter only when needed.
The added vf mechanism to auto-insert the d3d11vpp filter is very dumb
and primitive, and will work only for this specific purpose. The format
negotiation mechanism in the filter chain is generally not very pretty,
and mostly broken as well. (libavfilter has a different mechanism, and
these mechanisms don't match well, so vf_lavfi uses some sort of hack.
It only works because hwaccel and non-hwaccel formats are strictly
separated.)
The RGB interop is now only used with older ANGLE versions. The only
reason I'm keeping it is because it's relatively isolated (uses only
existing mechanisms and adds no new concepts), and because I want to be
able to compare the behavior of the old code with the new one for
testing. It will be removed eventually.
If ANGLE has NV12 interop, P010 is now handled by converting to NV12
with the video processor, instead of converting it to RGB and using the
old mechanism to import that as a texture.
Diffstat (limited to 'video/filter/vf.c')
-rw-r--r-- | video/filter/vf.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c index 9c741a4bfa..b59dcca76b 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -518,7 +518,23 @@ static void query_formats(uint8_t *fmts, struct vf_instance *vf) static bool is_conv_filter(struct vf_instance *vf) { - return vf && strcmp(vf->info->name, "scale") == 0; + return vf && (strcmp(vf->info->name, "scale") == 0 || vf->autoinserted); +} + +static const char *find_conv_filter(uint8_t *fmts_out) +{ + for (int n = 0; filter_list[n]; n++) { + if (filter_list[n]->test_conversion) { + for (int a = IMGFMT_START; a < IMGFMT_END; a++) { + for (int b = IMGFMT_START; b < IMGFMT_END; b++) { + if (fmts_out[b - IMGFMT_START] && + filter_list[n]->test_conversion(a, b)) + return filter_list[n]->name; + } + } + } + } + return "scale"; } static void update_formats(struct vf_chain *c, struct vf_instance *vf, @@ -539,7 +555,8 @@ static void update_formats(struct vf_chain *c, struct vf_instance *vf, // filters after vf work, but vf can't output any format the filters // after it accept), try to insert a conversion filter. MP_INFO(c, "Using conversion filter.\n"); - struct vf_instance *conv = vf_open(c, "scale", NULL); + const char *filter = find_conv_filter(vf->last_outfmts); + struct vf_instance *conv = vf_open(c, filter, NULL); if (conv) { conv->autoinserted = true; conv->next = vf->next; |