Commit Graph

10 Commits

Author SHA1 Message Date
wm4 2a9534871d command: add property returning detected hwdec API
This is somewhat imperfect, because detection of hw decoding APIs is
mostly done on demand, and often avoided if not necessary. (For example,
we know very well that there are no hw decoders for certain codecs.)

This also requires every hwdec backend to identify itself (see hwdec.h
changes).
2015-02-02 22:43:13 +01:00
wm4 c80a1b7aa9 vo_opengl: let hwdec driver report the exact image format
Hardware decoding/displaying with vo_opengl is done by replacing the
normal video textures with textures provided by the hardware decoding
API OpenGL interop code. Often, this changes the format (vaglx and vdpau
return RGBA, vda returns packed YUV).

If the format is changed, there was a chance (or at least a higher
potential for bugs) that the shader generation code could be confused by
the mismatch of formats, and would create incorrect conversions.

Simplify this by requiring the hwdec interop driver to set the format it
will return to us. This affects all fields, not just some (done by
replacing the format with the value of the converted_imgfmt field in
init_format), in particular fields like colorlevels.

Currently, no hwdec interop driver does anything sophisticated, and the
win is mostly from the mp_image_params_guess_csp() function, which will
reset fields like colorlevels to expected value if RGBA is used.
2015-01-29 19:53:49 +01:00
wm4 74581a6106 video: handle hwdec screenshots differently
Instead of converting the hw surface to an image in the VO, provide a
generic way to convet hw surfaces, and use this in the screenshot code.

It's all relatively straightforward, except vdpau is being terrible. It
needs a huge chunk of new code, because copying back is not simple.
2015-01-22 18:18:23 +01:00
wm4 3e12e79b8f gl_hwdec_vda: refuse to work with old OpenGL versions
The way we use rectangle textures (required by VDA for no reason) works
onl in OpenGL 3.0 or higher. Below that, the shader will fail to
compile. We could add support for older OpenGL versions, but that would
be a major pain.

This normally doesn't matter; mpv itself always creates OpenGL 3.2
contexts on OSX. But it could matter if a client API user uses
vo_opengl_cb, and gives it a 2.1 context (which OSX also allows you to
create).
2014-12-31 21:04:52 +01:00
wm4 920512d358 vo_opengl: move hwdec parts into their own files
This wasn't done before because there was no advantage in "abstracting"
it. This changed, and putting this into its own files is better than
messing it into gl_common.c/h.
2014-12-03 23:01:19 +01:00
wm4 bfa7893fe9 vda: make independent from cocoa backend
Basically, don't access the vo field.

There's also no reason anymore to access MPGLContext. We still need to
access loaded GL functions though, so add a field for that to gl_hwdec.

Untested.
2014-12-03 21:02:33 +01:00
Stefano Pigozzi 82afc0f343 vda: use implicit current GL context
Removes the dependency from the Cocoa backend in case we are not using
it but still wanna use VDA GL introp.
2014-12-03 20:40:06 +01:00
Stefano Pigozzi d4f37174a1 vda: fix build on OS X 10.7
Looks like on 10.8 OpenGL.h recursively includes CGLIOSurface.h. That is not
the case for 10.7 so the build was broken on that version of OS X.
2014-01-02 22:45:39 +01:00
Stefano Pigozzi ca956af446 gl_video: change internal API for hwdec mp_image download
Previous API worked under the assumption that download_image is always called
after map_image. In practice this is true, but it's better to have a much
generic API that doesn't depend on the order in which the functions are called.
2013-12-02 21:26:17 +01:00
Stefano Pigozzi a74d9c1803 vo_opengl: support for vda hardware decoding
The harder work was done in the previous commits. After that this feature comes
out almost for free.

The only problem is I can't get the textures created with CGLTexImageIOSurface2D
to download properly, thus the code performs download using some CoreVideo APIs.

If someone knows why download of textures created with CGLTexImageIOSurface2D
doesn't work please contact me :)
2013-12-02 09:03:31 +01:00