vo_opengl: shrink the hwdec overlay API

Just remove one callback, and fold the functionality into the other one.
RPI will still not compile, so the hwdec_rpi.c changes are untested.
This commit is contained in:
wm4 2017-08-09 20:57:37 +02:00
parent de6d3f8ca1
commit 9c5dcf9398
3 changed files with 20 additions and 25 deletions

View File

@ -71,13 +71,11 @@ struct gl_hwdec_driver {
// 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,
struct mp_rect *src, struct mp_rect *dst);
// 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.
int (*overlay_frame)(struct gl_hwdec *hw, struct mp_image *hw_image,
struct mp_rect *src, struct mp_rect *dst, bool newframe);
};
struct gl_hwdec *gl_hwdec_load_api(struct mp_log *log, GL *gl,

View File

@ -244,17 +244,6 @@ static int enable_renderer(struct gl_hwdec *hw)
return 0;
}
static void overlay_adjust(struct gl_hwdec *hw,
struct mp_rect *src, struct mp_rect *dst)
{
struct priv *p = hw->priv;
p->src = *src;
p->dst = *dst;
update_overlay(hw, false);
}
static int reinit(struct gl_hwdec *hw, struct mp_image_params *params)
{
struct priv *p = hw->priv;
@ -306,10 +295,20 @@ static struct mp_image *upload(struct gl_hwdec *hw, struct mp_image *hw_image)
return new_ref;
}
static int overlay_frame(struct gl_hwdec *hw, struct mp_image *hw_image)
static int overlay_frame(struct gl_hwdec *hw, struct mp_image *hw_image,
struct mp_rect *src, struct mp_rect *dst, bool newframe)
{
struct priv *p = hw->priv;
if (hw_image && p->current_frame && !newframe) {
if (!mp_rect_equals(&p->src, src) ||mp_rect_equals(&p->dst, dst)) {
p->src = *src;
p->dst = *dst;
update_overlay(hw, false);
}
return;
}
mp_image_unrefp(&p->current_frame);
if (!hw_image) {

View File

@ -973,7 +973,7 @@ static void unref_current_image(struct gl_video *p)
static void unmap_overlay(struct gl_video *p)
{
if (p->hwdec_active && p->hwdec->driver->overlay_frame)
p->hwdec->driver->overlay_frame(p->hwdec, NULL);
p->hwdec->driver->overlay_frame(p->hwdec, NULL, NULL, NULL, true);
}
static void uninit_video(struct gl_video *p)
@ -3013,8 +3013,9 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame,
p->ra->fns->clear(p->ra, target.tex, color, &p->dst_rect);
}
if (frame->frame_id != p->image.id || !frame->current)
p->hwdec->driver->overlay_frame(p->hwdec, frame->current);
p->hwdec->driver->overlay_frame(p->hwdec, frame->current,
&p->src_rect, &p->dst_rect,
frame->frame_id != p->image.id);
if (frame->current)
p->osd_pts = frame->current->pts;
@ -3133,9 +3134,6 @@ void gl_video_resize(struct gl_video *p,
if (p->osd)
mpgl_osd_resize(p->osd, p->osd_rect, p->image_params.stereo_out);
if (p->hwdec && p->hwdec->driver->overlay_adjust)
p->hwdec->driver->overlay_adjust(p->hwdec, src, dst);
}
static void frame_perf_data(struct pass_info pass[], struct mp_frame_perf *out)