2014-12-03 20:54:04 +00:00
|
|
|
#ifndef MPGL_HWDEC_H_
|
|
|
|
#define MPGL_HWDEC_H_
|
|
|
|
|
2017-08-10 19:36:57 +00:00
|
|
|
#include "video/mp_image.h"
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
#include "ra.h"
|
2014-12-03 20:54:04 +00:00
|
|
|
#include "video/hwdec.h"
|
|
|
|
|
2022-02-27 20:07:58 +00:00
|
|
|
// Helper to organize/load hwdecs dynamically
|
|
|
|
struct ra_hwdec_ctx {
|
|
|
|
// Set these before calling `ra_hwdec_ctx_init`
|
|
|
|
struct mp_log *log;
|
|
|
|
struct mpv_global *global;
|
|
|
|
struct ra *ra;
|
|
|
|
|
|
|
|
bool loading_done;
|
|
|
|
struct ra_hwdec **hwdecs;
|
|
|
|
int num_hwdecs;
|
|
|
|
};
|
|
|
|
|
|
|
|
int ra_hwdec_validate_opt(struct mp_log *log, const m_option_t *opt,
|
|
|
|
struct bstr name, const char **value);
|
|
|
|
|
2022-03-12 19:24:51 +00:00
|
|
|
int ra_hwdec_validate_drivers_only_opt(struct mp_log *log,
|
|
|
|
const m_option_t *opt,
|
|
|
|
struct bstr name, const char **value);
|
|
|
|
|
2022-02-27 20:07:58 +00:00
|
|
|
void ra_hwdec_ctx_init(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *devs,
|
|
|
|
const char *opt, bool load_all_by_default);
|
|
|
|
void ra_hwdec_ctx_uninit(struct ra_hwdec_ctx *ctx);
|
|
|
|
|
|
|
|
void ra_hwdec_ctx_load_fmt(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *devs,
|
2022-03-20 19:31:38 +00:00
|
|
|
struct hwdec_imgfmt_request *params);
|
2022-02-27 20:07:58 +00:00
|
|
|
|
|
|
|
// Gets the right `ra_hwdec` for a format, if any
|
|
|
|
struct ra_hwdec *ra_hwdec_get(struct ra_hwdec_ctx *ctx, int imgfmt);
|
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
struct ra_hwdec {
|
|
|
|
const struct ra_hwdec_driver *driver;
|
2014-12-03 20:54:04 +00:00
|
|
|
struct mp_log *log;
|
2015-11-17 20:07:41 +00:00
|
|
|
struct mpv_global *global;
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
struct ra *ra;
|
2016-05-09 17:42:03 +00:00
|
|
|
struct mp_hwdec_devices *devs;
|
2016-05-19 10:02:08 +00:00
|
|
|
// GLSL extensions required to sample textures from this.
|
|
|
|
const char **glsl_extensions;
|
2014-12-03 20:54:04 +00:00
|
|
|
// For free use by hwdec driver
|
|
|
|
void *priv;
|
2014-12-09 16:47:02 +00:00
|
|
|
// For working around the vdpau vs. vaapi mess.
|
2015-11-09 10:58:38 +00:00
|
|
|
bool probing;
|
2016-09-12 13:08:38 +00:00
|
|
|
// Used in overlay mode only.
|
|
|
|
float overlay_colorkey[4];
|
vo_opengl: refactor how hwdec interop exports textures
Rename gl_hwdec_driver.map_image to map_frame, and let it fill out a
struct gl_hwdec_frame describing the exact texture layout. This gives
more flexibility to what the hwdec interop can export. In particular, it
can export strange component orders/permutations and textures with
padded size. (The latter originating from cropped video.)
The way gl_hwdec_frame works is in the spirit of the rest of the
vo_opengl video processing code, which tends to put as much information
in immediate state (as part of the dataflow), instead of declaring it
globally. To some degree this duplicates the texplane and img_tex
structs, but until we somehow unify those, it's better to give the hwdec
state its own struct. The fact that changing the hwdec struct would
require changes and testing on at least 4 platform/GPU combinations
makes duplicating it almost a requirement to avoid pain later.
Make gl_hwdec_driver.reinit set the new image format and remove the
gl_hwdec.converted_imgfmt field.
Likewise, gl_hwdec.gl_texture_target is replaced with
gl_hwdec_plane.gl_target.
Split out a init_image_desc function from init_format. The latter is not
called in the hwdec case at all anymore. Setting up most of struct
texplane is also completely separate in the hwdec and normal cases.
video.c does not check whether the hwdec "mapped" image format is
supported. This should not really happen anyway, and if it does, the
hwdec interop backend must fail at creation time, so this is not an
issue.
2016-05-10 16:29:10 +00:00
|
|
|
};
|
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
struct ra_hwdec_mapper {
|
|
|
|
const struct ra_hwdec_mapper_driver *driver;
|
|
|
|
struct mp_log *log;
|
|
|
|
struct ra *ra;
|
|
|
|
void *priv;
|
|
|
|
struct ra_hwdec *owner;
|
|
|
|
// Input frame parameters. (Set before init(), immutable.)
|
|
|
|
struct mp_image_params src_params;
|
|
|
|
// Output frame parameters (represents the format the textures return). Must
|
|
|
|
// be set by init(), immutable afterwards,
|
|
|
|
struct mp_image_params dst_params;
|
|
|
|
|
|
|
|
// The currently mapped source image (or the image about to be mapped in
|
|
|
|
// ->map()). NULL if unmapped. The mapper can also clear this reference if
|
|
|
|
// the mapped textures contain a full copy.
|
|
|
|
struct mp_image *src;
|
vo_opengl: refactor how hwdec interop exports textures
Rename gl_hwdec_driver.map_image to map_frame, and let it fill out a
struct gl_hwdec_frame describing the exact texture layout. This gives
more flexibility to what the hwdec interop can export. In particular, it
can export strange component orders/permutations and textures with
padded size. (The latter originating from cropped video.)
The way gl_hwdec_frame works is in the spirit of the rest of the
vo_opengl video processing code, which tends to put as much information
in immediate state (as part of the dataflow), instead of declaring it
globally. To some degree this duplicates the texplane and img_tex
structs, but until we somehow unify those, it's better to give the hwdec
state its own struct. The fact that changing the hwdec struct would
require changes and testing on at least 4 platform/GPU combinations
makes duplicating it almost a requirement to avoid pain later.
Make gl_hwdec_driver.reinit set the new image format and remove the
gl_hwdec.converted_imgfmt field.
Likewise, gl_hwdec.gl_texture_target is replaced with
gl_hwdec_plane.gl_target.
Split out a init_image_desc function from init_format. The latter is not
called in the hwdec case at all anymore. Setting up most of struct
texplane is also completely separate in the hwdec and normal cases.
video.c does not check whether the hwdec "mapped" image format is
supported. This should not really happen anyway, and if it does, the
hwdec interop backend must fail at creation time, so this is not an
issue.
2016-05-10 16:29:10 +00:00
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
// The mapped textures and metadata about them. These fields change if a
|
|
|
|
// new frame is mapped (or unmapped), but otherwise remain constant.
|
|
|
|
// The common code won't mess with these, so you can e.g. set them in the
|
|
|
|
// .init() callback.
|
|
|
|
struct ra_tex *tex[4];
|
2014-12-03 20:54:04 +00:00
|
|
|
};
|
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
// This can be used to map frames of a specific hw format as GL textures.
|
|
|
|
struct ra_hwdec_mapper_driver {
|
|
|
|
// Used to create ra_hwdec_mapper.priv.
|
|
|
|
size_t priv_size;
|
|
|
|
|
|
|
|
// Init the mapper implementation. At this point, the field src_params,
|
|
|
|
// fns, devs, priv are initialized.
|
|
|
|
int (*init)(struct ra_hwdec_mapper *mapper);
|
|
|
|
// Destroy the mapper. unmap is called before this.
|
|
|
|
void (*uninit)(struct ra_hwdec_mapper *mapper);
|
|
|
|
|
|
|
|
// Map mapper->src as texture, and set mapper->frame to textures using it.
|
2022-04-25 11:27:18 +00:00
|
|
|
// It is expected that the textures remain valid until the next unmap
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
// or uninit call.
|
|
|
|
// The function is allowed to unref mapper->src if it's not needed (i.e.
|
|
|
|
// this function creates a copy).
|
|
|
|
// The underlying format can change, so you might need to do some form
|
|
|
|
// of change detection. You also must reject unsupported formats with an
|
|
|
|
// error.
|
|
|
|
// On error, returns negative value on error and remains unmapped.
|
|
|
|
int (*map)(struct ra_hwdec_mapper *mapper);
|
|
|
|
// Unmap the frame. Does nothing if already unmapped. Optional.
|
|
|
|
void (*unmap)(struct ra_hwdec_mapper *mapper);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ra_hwdec_driver {
|
2017-12-01 04:09:05 +00:00
|
|
|
// Name of the interop backend. This is used for informational purposes and
|
|
|
|
// for use with debugging options.
|
2016-02-01 19:02:52 +00:00
|
|
|
const char *name;
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
// Used to create ra_hwdec.priv.
|
|
|
|
size_t priv_size;
|
|
|
|
// One of the hardware surface IMGFMT_ that must be passed to map_image later.
|
|
|
|
// Terminated with a 0 entry. (Extend the array size as needed.)
|
|
|
|
const int imgfmts[3];
|
|
|
|
|
2016-05-09 17:42:03 +00:00
|
|
|
// Create the hwdec device. It must add it to hw->devs, if applicable.
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
int (*init)(struct ra_hwdec *hw);
|
|
|
|
void (*uninit)(struct ra_hwdec *hw);
|
|
|
|
|
|
|
|
// This will be used to create a ra_hwdec_mapper from ra_hwdec.
|
|
|
|
const struct ra_hwdec_mapper_driver *mapper;
|
|
|
|
|
|
|
|
// The following function provides an alternative API. Each ra_hwdec_driver
|
|
|
|
// must have either provide a mapper or overlay_frame (not both or none), and
|
2016-09-12 13:08:38 +00:00
|
|
|
// if overlay_frame is set, it operates in overlay mode. In this mode,
|
|
|
|
// OSD etc. is rendered via OpenGL, but the video is rendered as a separate
|
|
|
|
// layer below it.
|
|
|
|
// Non-overlay mode is strictly preferred, so try not to use overlay mode.
|
2017-08-09 18:57:37 +00:00
|
|
|
// Set the given frame as overlay, replacing the previous one. This can also
|
|
|
|
// just change the position of the overlay.
|
|
|
|
// hw_image==src==dst==NULL is passed to clear the overlay.
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
int (*overlay_frame)(struct ra_hwdec *hw, struct mp_image *hw_image,
|
2017-08-09 18:57:37 +00:00
|
|
|
struct mp_rect *src, struct mp_rect *dst, bool newframe);
|
2014-12-03 20:54:04 +00:00
|
|
|
};
|
|
|
|
|
vo_gpu: make it possible to load multiple hwdec interop drivers
Make the VO<->decoder interface capable of supporting multiple hwdec
APIs at once. The main gain is that this simplifies autoprobing a lot.
Before this change, it could happen that the VO loaded the "wrong" hwdec
API, and the decoder was stuck with the choice (breaking hw decoding).
With the change applied, the VO simply loads all available APIs, so
autoprobing trickery is left entirely to the decoder.
In the past, we were quite careful about not accidentally loading the
wrong interop drivers. This was in part to make sure autoprobing works,
but also because libva had this obnoxious bug of dumping garbage to
stderr when using the API. libva was fixed, so this is not a problem
anymore.
The --opengl-hwdec-interop option is changed in various ways (again...),
and renamed to --gpu-hwdec-interop. It does not have much use anymore,
other than debugging. It's notable that the order in the hwdec interop
array ra_hwdec_drivers[] still matters if multiple drivers support the
same image formats, so the option can explicitly force one, if that
should ever be necessary, or more likely, for debugging. One example are
the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both
support d3d11 input.
vo_gpu now always loads the interop lazily by default, but when it does,
it loads them all. vo_opengl_cb now always loads them when the GL
context handle is initialized. I don't expect that this causes any
problems.
It's now possible to do things like changing between vdpau and nvdec
decoding at runtime.
This is also preparation for cleaning up vd_lavc.c hwdec autoprobing.
It's another reason why hwdec_devices_request_all() does not take a
hwdec type anymore.
2017-12-01 04:05:00 +00:00
|
|
|
extern const struct ra_hwdec_driver *const ra_hwdec_drivers[];
|
|
|
|
|
|
|
|
struct ra_hwdec *ra_hwdec_load_driver(struct ra *ra, struct mp_log *log,
|
|
|
|
struct mpv_global *global,
|
|
|
|
struct mp_hwdec_devices *devs,
|
|
|
|
const struct ra_hwdec_driver *drv,
|
|
|
|
bool is_auto);
|
2017-01-17 13:51:08 +00:00
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
void ra_hwdec_uninit(struct ra_hwdec *hwdec);
|
|
|
|
|
|
|
|
bool ra_hwdec_test_format(struct ra_hwdec *hwdec, int imgfmt);
|
2014-12-03 20:54:04 +00:00
|
|
|
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
struct ra_hwdec_mapper *ra_hwdec_mapper_create(struct ra_hwdec *hwdec,
|
2022-04-09 21:58:59 +00:00
|
|
|
const struct mp_image_params *params);
|
vo_opengl: separate hwdec context and mapping, port it to use ra
This does two separate rather intrusive things:
1. Make the hwdec context (which does initialization, provides the
device to the decoder, and other basic state) and frame mapping
(getting textures from a mp_image) separate. This is more
flexible, and you could map multiple images at once. It will
help removing some hwdec special-casing from video.c.
2. Switch all hwdec API use to ra. Of course all code is still
GL specific, but in theory it would be possible to support other
backends. The most important change is that the hwdec interop
returns ra objects, instead of anything GL specific. This removes
the last dependency on GL-specific header files from video.c.
I'm mixing these separate changes because both requires essentially
rewriting all the glue code, so better do them at once. For the same
reason, this change isn't done incrementally.
hwdec_ios.m is untested, since I can't test it. Apart from superficial
mistakes, this also requires dealing with Apple's texture format
fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED
and GL_RG. We also need to report the correct format via ra_tex to
the renderer, which is done by find_la_variant(). It's unknown whether
this works correctly.
hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my
RPI out of a dusty pile of devices and cables, so, later.)
2017-08-10 15:48:33 +00:00
|
|
|
void ra_hwdec_mapper_free(struct ra_hwdec_mapper **mapper);
|
|
|
|
void ra_hwdec_mapper_unmap(struct ra_hwdec_mapper *mapper);
|
|
|
|
int ra_hwdec_mapper_map(struct ra_hwdec_mapper *mapper, struct mp_image *img);
|
2016-09-30 11:46:27 +00:00
|
|
|
|
2022-03-12 19:24:51 +00:00
|
|
|
// Get the primary image format for the given driver name.
|
|
|
|
// Returns IMGFMT_NONE if the name doesn't get matched.
|
|
|
|
int ra_hwdec_driver_get_imgfmt_for_name(const char *name);
|
|
|
|
|
2014-12-03 20:54:04 +00:00
|
|
|
#endif
|