summaryrefslogtreecommitdiffstats
path: root/video/out/vo.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-01 19:24:28 +0200
committerwm4 <wm4@nowhere>2015-07-01 22:38:02 +0200
commit0739cfc20934ac7772ab71dbae7ecba4ba10fda4 (patch)
tree939c829441af634577d71fbdf99a60314aa3ab42 /video/out/vo.h
parentf166d1298545154618ee2d046bb3c433469469c2 (diff)
downloadmpv-0739cfc20934ac7772ab71dbae7ecba4ba10fda4.tar.bz2
mpv-0739cfc20934ac7772ab71dbae7ecba4ba10fda4.tar.xz
vo: change internal API for drawing frames
draw_image_timed is renamed to draw_frame. struct frame_timing is renamed to vo_frame. flip_page_timed is merged into draw_frame (the additional parameters are part of struct vo_frame). draw_frame also deprecates VOCTRL_REDRAW_FRAME, and replaces it with a method that works for both VOs which can cache the current frame, and VOs which need to redraw it anyway. This is preparation to making the interpolation and (work in progress) display sync code saner. Lots of other refactoring, and also some simplifications.
Diffstat (limited to 'video/out/vo.h')
-rw-r--r--video/out/vo.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/video/out/vo.h b/video/out/vo.h
index 3d36269d26..9e1a6db93c 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -154,29 +154,38 @@ struct vo_extra {
struct mpv_opengl_cb_context *opengl_cb_context;
};
-struct frame_timing {
+struct vo_frame {
// If > 0, realtime when frame should be shown, in mp_time_us() units.
+ // If 0, present immediately.
int64_t pts;
+ // Approximate frame duration, in us.
+ int duration;
// Realtime of estimated previous and next vsync events.
int64_t next_vsync;
int64_t prev_vsync;
// "ideal" display time within the vsync
int64_t vsync_offset;
- // The current frame to be drawn. NULL means redraw previous frame
- // (e.g. repeated frames).
- // (Equivalent to the mp_image parameter of draw_image_timed, until the
- // parameter is removed.)
- struct mp_image *frame;
+ // Set if the current frame is repeated from the previous. It's guaranteed
+ // that the current is the same as the previous one, even if the image
+ // pointer is different.
+ // The repeat flag is additionally set if the OSD does not need to be
+ // redrawn.
+ bool redraw, repeat;
+ // The frame is not in movement - e.g. redrawing while paused.
+ bool still;
+ // The current frame to be drawn.
+ // Warning: When OSD should be redrawn in --force-window --idle mode, this
+ // can be NULL. The VO should draw a black background, OSD on top.
+ struct mp_image *current;
// List of future images, starting with the next one. This does not
// care about repeated frames - it simply contains the next real frames.
- // vo_set_queue_params() sets how many frames this should include, though
- // the actual number can be lower.
- // future_frames[0] is the next frame.
- // Note that this has frames only when a new real frame is pushed. Redraw
- // calls or repeated frames do not include this.
- // Ownership of the frames belongs to the caller.
- int num_future_frames;
- struct mp_image **future_frames;
+ // vo_set_queue_params() sets how many future frames this should include.
+ // The actual number of frames delivered to the VO can be lower.
+ // frames[0] is current, frames[1] is the next frame.
+ // Note that some future frames may never be sent as current frame to the
+ // VO if frames are dropped.
+ int num_frames;
+ struct mp_image *frames[VO_MAX_FUTURE_FRAMES + 1];
};
struct vo_driver {
@@ -223,31 +232,21 @@ struct vo_driver {
* mpi belongs to the VO; the VO must free it eventually.
*
* This also should draw the OSD.
+ *
+ * Deprecated for draw_frame. A VO should have only either callback set.
*/
void (*draw_image)(struct vo *vo, struct mp_image *mpi);
- /* Like draw image, but is called before every vsync with timing
- * information
+ /* Render the given frame. Note that this is also called when repeating
+ * or redrawing frames.
*/
- void (*draw_image_timed)(struct vo *vo, struct mp_image *mpi,
- struct frame_timing *t);
+ void (*draw_frame)(struct vo *vo, struct vo_frame *frame);
/*
* Blit/Flip buffer to the screen. Must be called after each frame!
*/
void (*flip_page)(struct vo *vo);
- /*
- * Timed version of flip_page (optional).
- * pts_us is the frame presentation time, linked to mp_time_us().
- * pts_us is 0 if the frame should be presented immediately.
- * duration is estimated time in us until the next frame is shown.
- * duration is -1 if it is unknown or unset (also: disable framedrop).
- * If the VO does manual framedropping, VO_CAP_FRAMEDROP should be set.
- * Returns 1 on display, or 0 if the frame was dropped.
- */
- int (*flip_page_timed)(struct vo *vo, int64_t pts_us, int duration);
-
/* These optional callbacks can be provided if the GUI framework used by
* the VO requires entering a message loop for receiving events, does not
* provide event_fd, and does not call vo_wakeup() from a separate thread
@@ -323,8 +322,7 @@ int vo_reconfig(struct vo *vo, struct mp_image_params *p, int flags);
int vo_control(struct vo *vo, uint32_t request, void *data);
bool vo_is_ready_for_frame(struct vo *vo, int64_t next_pts);
-void vo_queue_frame(struct vo *vo, struct mp_image **images,
- int64_t pts_us, int64_t duration);
+void vo_queue_frame(struct vo *vo, struct vo_frame *frame);
void vo_wait_frame(struct vo *vo);
bool vo_still_displaying(struct vo *vo);
bool vo_has_frame(struct vo *vo);
@@ -359,4 +357,6 @@ struct mp_osd_res;
void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src,
struct mp_rect *out_dst, struct mp_osd_res *out_osd);
+struct vo_frame *vo_frame_ref(struct vo_frame *frame);
+
#endif /* MPLAYER_VIDEO_OUT_H */