summaryrefslogtreecommitdiffstats
path: root/video/hwdec.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-01 08:01:08 +0100
committerwm4 <wm4@nowhere>2017-12-01 08:05:16 +0100
commita0d9e15342ad48f51841d4fbfe3ae47e10e45592 (patch)
treee08465a5e54136e55ab2a35b2382fb9d8d06d634 /video/hwdec.h
parentafd5f3227ec38fea70bf7abfcd107a9493aa21fc (diff)
downloadmpv-a0d9e15342ad48f51841d4fbfe3ae47e10e45592.tar.bz2
mpv-a0d9e15342ad48f51841d4fbfe3ae47e10e45592.tar.xz
video: refactor hw device creation for hwdec copy modes
Lots of shit code for nothing. We probably could just use libavutil's code for all of this. But for now go with this, since it tends to prevent stupid terminal messages during probing (libavutil has no mechanism to selectively suppress errors specifically during probing). Ignores the "emulated" API flag (for avoiding vaapi/vdpau wrappers), but it doesn't matter that much for -copy anyway.
Diffstat (limited to 'video/hwdec.h')
-rw-r--r--video/hwdec.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/video/hwdec.h b/video/hwdec.h
index f8a77465f3..69fb86a277 100644
--- a/video/hwdec.h
+++ b/video/hwdec.h
@@ -111,9 +111,14 @@ void *hwdec_devices_load(struct mp_hwdec_devices *devs, enum hwdec_type type);
char *hwdec_devices_get_names(struct mp_hwdec_devices *devs);
struct mp_image;
+struct mpv_global;
+
+struct hwcontext_create_dev_params {
+ bool probing; // if true, don't log errors if unavailable
+};
// Per AV_HWDEVICE_TYPE_* functions, queryable via hwdec_get_hwcontext_fns().
-// For now, all entries are strictly optional.
+// All entries are strictly optional.
struct hwcontext_fns {
int av_hwdevice_type;
// Set any mp_image fields that require hwcontext specific code, such as
@@ -124,10 +129,19 @@ struct hwcontext_fns {
void (*complete_image_params)(struct mp_image *img);
// Fill in special format-specific requirements.
void (*refine_hwframes)(struct AVBufferRef *hw_frames_ctx);
+ // Returns a AVHWDeviceContext*. Used for copy hwdecs.
+ struct AVBufferRef *(*create_dev)(struct mpv_global *global,
+ struct mp_log *log,
+ struct hwcontext_create_dev_params *params);
};
// The parameter is of type enum AVHWDeviceType (as in int to avoid extensive
// recursive includes). May return NULL for unknown device types.
const struct hwcontext_fns *hwdec_get_hwcontext_fns(int av_hwdevice_type);
+extern const struct hwcontext_fns hwcontext_fns_d3d11;
+extern const struct hwcontext_fns hwcontext_fns_dxva2;
+extern const struct hwcontext_fns hwcontext_fns_vaapi;
+extern const struct hwcontext_fns hwcontext_fns_vdpau;
+
#endif