summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-12 15:08:38 +0200
committerwm4 <wm4@nowhere>2016-09-12 19:58:58 +0200
commit274e71ee8b774d6c9c69929a548a83c343202be1 (patch)
tree1176b9933fb04d730e0eeec4bcb3bc024725d618 /video/out/opengl/hwdec.h
parent343f5ca24beeddc69f49d43448acc05b982176ad (diff)
downloadmpv-274e71ee8b774d6c9c69929a548a83c343202be1.tar.bz2
mpv-274e71ee8b774d6c9c69929a548a83c343202be1.tar.xz
vo_opengl: add hw overlay support and use it for RPI
This overlay support specifically skips the OpenGL rendering chain, and uses GL rendering only for OSD/subtitles. This is for devices which don't have performant GL support. hwdec_rpi.c contains code ported from vo_rpi.c. vo_rpi.c is going to be deprecated. I left in the code for uploading sw surfaces (as it might be slightly more efficient for rendering sw decoded video), although it's dead code for now.
Diffstat (limited to 'video/out/opengl/hwdec.h')
-rw-r--r--video/out/opengl/hwdec.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/video/out/opengl/hwdec.h b/video/out/opengl/hwdec.h
index 29ccd18a42..ce59b67e58 100644
--- a/video/out/opengl/hwdec.h
+++ b/video/out/opengl/hwdec.h
@@ -16,6 +16,8 @@ struct gl_hwdec {
void *priv;
// For working around the vdpau vs. vaapi mess.
bool probing;
+ // Used in overlay mode only.
+ float overlay_colorkey[4];
};
struct gl_hwdec_plane {
@@ -53,6 +55,21 @@ struct gl_hwdec_driver {
void (*unmap)(struct gl_hwdec *hw);
void (*destroy)(struct gl_hwdec *hw);
+
+ // The following functions provide an alternative API. Each gl_hwdec_driver
+ // must have either map_frame or overlay_frame set (not both or none), and
+ // 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.
+
+ // Set the given frame as overlay, replacing the previous one.
+ // hw_image==NULL is passed to clear the overlay.
+ int (*overlay_frame)(struct gl_hwdec *hw, struct mp_image *hw_image);
+
+ // Move overlay position within the "window".
+ void (*overlay_adjust)(struct gl_hwdec *hw, int w, int h,
+ struct mp_rect *src, struct mp_rect *dst);
};
struct gl_hwdec *gl_hwdec_load_api(struct mp_log *log, GL *gl,