0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/sub/draw_bmp.h
wm4 ea4332daf4 vo_xv: don't require frame stepping to remove OSD or subs
In order to improve performance, vo_xv didn't create a backup of the
video frame before drawing OSD and subtitles during normal playback. It
required the frontend to do frame stepping if it wanted to redraw the
OSD, but no backup of the video frame was available. (Consider the
following use case: enable the OSD permanently with --osd-level=3, then
pause during playback and do something that shows an OSD message. The
player will advance the video by one frame at the time the new OSD
message is first drawn.)

This also meant that taking a screenshot during playback with vo_xv
would include OSD and subtitles in the resulting image.

Fix this by always creating a backup before drawing OSD or subtitles.
In order to avoid having to create a full copy of the whole image frame,
introduce a complex scheme that tries to backup only the changed
regions.

It's unclear whether the additional complexity in draw_bmp.c for
backing up only the changed areas of the frame is worth it. Possibly
a simpler implementation would suffice, such as tracking only Y ranges
of changed image data, or even just copying the full frame.

vo_xv's get_screenshot() now always creates a copy in order not to
modify the currently displayed frame.
2012-11-21 19:56:59 +01:00

26 lines
828 B
C

#ifndef MPLAYER_DRAW_BMP_H
#define MPLAYER_DRAW_BMP_H
#include "sub/sub.h"
struct mp_image;
struct sub_bitmaps;
struct mp_csp_details;
struct mp_draw_sub_cache;
void mp_draw_sub_bitmaps(struct mp_draw_sub_cache **cache, struct mp_image *dst,
struct sub_bitmaps *sbs);
extern const bool mp_draw_sub_formats[SUBBITMAP_COUNT];
struct mp_draw_sub_backup;
struct mp_draw_sub_backup *mp_draw_sub_backup_new(void);
void mp_draw_sub_backup_add(struct mp_draw_sub_backup *backup,
struct mp_image *img, struct sub_bitmaps *sbs);
void mp_draw_sub_backup_reset(struct mp_draw_sub_backup *backup);
bool mp_draw_sub_backup_restore(struct mp_draw_sub_backup *backup,
struct mp_image *buffer);
#endif /* MPLAYER_DRAW_BMP_H */
// vim: ts=4 sw=4 et tw=80