mirror of
https://github.com/mpv-player/mpv
synced 2025-01-16 22:37:28 +01:00
350fc4f5a2
Add interfaces to allow VO drivers to add or remove frames from the video stream and to alter timestamps. Currently this functionality only works with in correct-pts mode. Use the new functionality in vo_vdpau to properly support frame-adding deinterlace modes. Frames added by the VDPAU deinterlacing code are now properly timed. Before every second frame was always shown immediately (probably next monitor refresh) after the previous one, even if you were watching things in slow motion, and framestepping didn't stop at them at all. When seeking the deinterlace algorithm is no longer fed a mix of frames from old and new positions. As a side effect of the changes a problem with resize events was also fixed. Resizing calls video_to_output_surface() to render the frame at the new resolution, but before this function also changed the list of history frames, so resizing could give an image different from the original one, and also corrupt next frames due to them seeing the wrong history. Now the function has no such side effects. There are more resize-related problems though that will be fixed in a later commit. The deint_mpi[] list of reserved frames is increased from 2 to 3 entries for reasons related to the above. Having 2 entries is enough when you initially get a new frame in draw_image() because then you'll have those two entries plus the new one for a total of 3 (the code relied on the oldest mpi implicitly staying reserved for the duration of the call even after usage count was decreased). However if you want to be able to reproduce the rendering outside draw_image(), relying on the explicitly reserved list only, then it needs to store 3 entries.
138 lines
5.1 KiB
C
138 lines
5.1 KiB
C
#ifndef MPLAYER_VF_H
|
|
#define MPLAYER_VF_H
|
|
|
|
#include "mp_image.h"
|
|
|
|
struct MPOpts;
|
|
struct vf_instance;
|
|
struct vf_priv_s;
|
|
|
|
typedef struct vf_info_s {
|
|
const char *info;
|
|
const char *name;
|
|
const char *author;
|
|
const char *comment;
|
|
int (*open)(struct vf_instance* vf,char* args);
|
|
// Ptr to a struct dscribing the options
|
|
const void* opts;
|
|
} vf_info_t;
|
|
|
|
#define NUM_NUMBERED_MPI 50
|
|
|
|
typedef struct vf_image_context_s {
|
|
mp_image_t* static_images[2];
|
|
mp_image_t* temp_images[1];
|
|
mp_image_t* export_images[1];
|
|
mp_image_t* numbered_images[NUM_NUMBERED_MPI];
|
|
int static_idx;
|
|
} vf_image_context_t;
|
|
|
|
typedef struct vf_format_context_t {
|
|
int have_configured;
|
|
int orig_width, orig_height, orig_fmt;
|
|
} vf_format_context_t;
|
|
|
|
typedef struct vf_instance {
|
|
const vf_info_t* info;
|
|
// funcs:
|
|
int (*config)(struct vf_instance* vf,
|
|
int width, int height, int d_width, int d_height,
|
|
unsigned int flags, unsigned int outfmt);
|
|
int (*control)(struct vf_instance* vf,
|
|
int request, void* data);
|
|
int (*query_format)(struct vf_instance* vf,
|
|
unsigned int fmt);
|
|
void (*get_image)(struct vf_instance* vf,
|
|
mp_image_t *mpi);
|
|
int (*put_image)(struct vf_instance* vf,
|
|
mp_image_t *mpi, double pts);
|
|
void (*start_slice)(struct vf_instance* vf,
|
|
mp_image_t *mpi);
|
|
void (*draw_slice)(struct vf_instance* vf,
|
|
unsigned char** src, int* stride, int w,int h, int x, int y);
|
|
void (*uninit)(struct vf_instance* vf);
|
|
|
|
int (*continue_buffered_image)(struct vf_instance* vf);
|
|
// caps:
|
|
unsigned int default_caps; // used by default query_format()
|
|
unsigned int default_reqs; // used by default config()
|
|
// data:
|
|
int w, h;
|
|
vf_image_context_t imgctx;
|
|
vf_format_context_t fmt;
|
|
struct vf_instance* next;
|
|
mp_image_t *dmpi;
|
|
struct vf_priv_s* priv;
|
|
struct MPOpts *opts;
|
|
} vf_instance_t;
|
|
|
|
// control codes:
|
|
#include "mpc_info.h"
|
|
|
|
typedef struct vf_seteq_s
|
|
{
|
|
const char *item;
|
|
int value;
|
|
} vf_equalizer_t;
|
|
|
|
#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
|
|
#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
|
|
#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
|
|
#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
|
|
#define VFCTRL_DRAW_OSD 7
|
|
#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
|
|
#define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */
|
|
#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
|
|
#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
|
|
#define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
|
|
#define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
|
|
#define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
|
|
#define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
|
|
#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
|
|
#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
|
|
/* Hack to make the OSD state object available to vf_expand which accesses
|
|
* the OSD state outside of normal OSD draw time. */
|
|
#define VFCTRL_SET_OSD_OBJ 20
|
|
#define VFCTRL_REDRAW_OSD 21 /* Change user-visible OSD immediately */
|
|
|
|
#include "vfcap.h"
|
|
|
|
//FIXME this should be in a common header, but i dunno which
|
|
#define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly
|
|
|
|
|
|
// functions:
|
|
void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
|
|
mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
|
|
vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
|
|
vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args);
|
|
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
|
|
vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args);
|
|
|
|
unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
|
|
void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
|
|
void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
|
|
int vf_output_queued_frame(vf_instance_t *vf);
|
|
|
|
// default wrappers:
|
|
int vf_next_config(struct vf_instance* vf,
|
|
int width, int height, int d_width, int d_height,
|
|
unsigned int flags, unsigned int outfmt);
|
|
int vf_next_control(struct vf_instance* vf, int request, void* data);
|
|
int vf_next_query_format(struct vf_instance* vf, unsigned int fmt);
|
|
int vf_next_put_image(struct vf_instance* vf,mp_image_t *mpi, double pts);
|
|
void vf_next_draw_slice (struct vf_instance* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
|
|
|
|
struct m_obj_settings;
|
|
vf_instance_t* append_filters(vf_instance_t* last, struct m_obj_settings *vf_settings);
|
|
|
|
void vf_uninit_filter(vf_instance_t* vf);
|
|
void vf_uninit_filter_chain(vf_instance_t* vf);
|
|
|
|
int vf_config_wrapper(struct vf_instance* vf,
|
|
int width, int height, int d_width, int d_height,
|
|
unsigned int flags, unsigned int outfmt);
|
|
|
|
#endif /* MPLAYER_VF_H */
|