summaryrefslogtreecommitdiffstats
path: root/libvo/vo_corevideo.m
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-19 19:25:18 +0200
committerwm4 <wm4@nowhere>2012-10-24 21:56:34 +0200
commit4d11f32162b08e3b48ae382e2ed0a151035f8aea (patch)
treec588341bf672fd935de45a05bef99e0d8f20892f /libvo/vo_corevideo.m
parenta4f9077f6c1a897120616cc70c1ca37c6a247be2 (diff)
downloadmpv-4d11f32162b08e3b48ae382e2ed0a151035f8aea.tar.bz2
mpv-4d11f32162b08e3b48ae382e2ed0a151035f8aea.tar.xz
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD, VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT. Remove draw_osd_with_eosd(), which rendered the OSD by calling VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes a callback as argument. (This basically works like the old OSD API, except multiple OSD bitmap formats are supported and caching is possible.) Remove all mentions of "eosd". It's simply "osd" now. Make OSD size per-OSD-object, as they can be different when using vf_sub. Include display_par/video_par in resolution change detection. Fix the issue with margin borders in vo_corevideo.
Diffstat (limited to 'libvo/vo_corevideo.m')
-rw-r--r--libvo/vo_corevideo.m42
1 files changed, 27 insertions, 15 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index c3d832d589..0e841f7530 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -19,6 +19,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <assert.h>
+
#import "vo_corevideo.h"
// mplayer includes
@@ -50,6 +52,7 @@ struct priv {
unsigned int image_width;
unsigned int image_height;
struct mp_csp_details colorspace;
+ int ass_border_x, ass_border_y;
CVPixelBufferRef pixelBuffer;
CVOpenGLTextureCacheRef textureCache;
@@ -84,6 +87,8 @@ static void resize(struct vo *vo, int width, int height)
scale_x = (GLdouble)new_w / (GLdouble)p->image_width;
scale_y = (GLdouble)new_h / (GLdouble)p->image_height;
gl->Scaled(scale_x, scale_y, 1);
+ p->ass_border_x = (vo->dwidth - new_w) / 2;
+ p->ass_border_y = (vo->dheight - new_h) / 2;
}
gl->Ortho(0, p->image_width, p->image_height, 0, -1.0, 1.0);
@@ -249,7 +254,7 @@ static int query_format(struct vo *vo, uint32_t format)
struct priv *p = vo->priv;
const int flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN |
- VOCAP_NOSLICES | VFCAP_EOSD;
+ VOCAP_NOSLICES;
switch (format) {
case IMGFMT_YUY2:
p->pixelFormat = kYUVSPixelFormat;
@@ -293,6 +298,26 @@ static int preinit(struct vo *vo, const char *arg)
return 0;
}
+static void draw_osd(struct vo *vo, struct osd_state *osd)
+{
+ struct priv *p = vo->priv;
+ GL *gl = p->mpglctx->gl;
+ assert(p->osd);
+
+ struct mp_osd_res res = {
+ .w = vo->dwidth,
+ .h = vo->dheight,
+ .ml = p->ass_border_x,
+ .mr = p->ass_border_x,
+ .mt = p->ass_border_y,
+ .mb = p->ass_border_y,
+ .display_par = vo->monitor_par,
+ .video_par = vo->aspdat.par,
+ };
+
+ mpgl_osd_draw_legacy(p->osd, osd, res);
+}
+
static CFStringRef get_cv_csp_matrix(struct vo *vo)
{
struct priv *p = vo->priv;
@@ -324,19 +349,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
return draw_image(vo, data);
case VOCTRL_QUERY_FORMAT:
return query_format(vo, *(uint32_t*)data);
- case VOCTRL_DRAW_EOSD:
- mpgl_osd_draw_legacy(p->osd, data);
- return VO_TRUE;
- case VOCTRL_QUERY_EOSD_FORMAT:
- return mpgl_osd_query_format(p->osd, *(int *)data)
- ? VO_TRUE : VO_NOTIMPL;
- case VOCTRL_GET_EOSD_RES: {
- struct mp_eosd_res *r = data;
- r->w = vo->dwidth;
- r->h = vo->dheight;
- r->mt = r->mb = r->ml = r->mr = 0;
- return VO_TRUE;
- }
case VOCTRL_ONTOP:
p->mpglctx->ontop(vo);
return VO_TRUE;
@@ -377,7 +389,7 @@ const struct vo_driver video_out_corevideo = {
.preinit = preinit,
.config = config,
.control = control,
- .draw_osd = draw_osd_with_eosd,
+ .draw_osd = draw_osd,
.flip_page = flip_page,
.check_events = check_events,
.uninit = uninit,