2010-01-30 16:57:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_VF_H
|
|
|
|
#define MPLAYER_VF_H
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2008-03-06 08:34:50 +00:00
|
|
|
#include "mp_image.h"
|
2011-01-12 13:29:31 +00:00
|
|
|
#include "mpcommon.h"
|
vf_*: fix pts values passed to the next filter
Many video filters failed to calculate or even just pass through pts
values for their output frames. Fix this, and also make the two
remaining filters that called vf_next_put_image() twice for the same
input frame (vf_softpulldown, vf_telecine) use vf_queue_frame() so
that e.g. framestepping properly sees both frames.
Changed filters: vf_bmovl, vf_detc, vf_divtc, vf_filmdint, vf_ivtc,
vf_lavc, vf_phase, vf_pullup, vf_softpulldown, vf_telecine, vf_tile,
vf_tinterlace.
2011-04-23 16:56:47 +00:00
|
|
|
#include "stdbool.h"
|
2008-03-06 08:34:50 +00:00
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
#include "mpc_info.h"
|
|
|
|
#include "vfcap.h"
|
|
|
|
|
2008-04-16 04:06:44 +00:00
|
|
|
struct MPOpts;
|
2008-04-24 02:49:44 +00:00
|
|
|
struct vf_instance;
|
2002-04-06 22:05:01 +00:00
|
|
|
struct vf_priv_s;
|
|
|
|
|
2010-10-30 04:18:49 +00:00
|
|
|
typedef struct vf_info {
|
2002-04-06 22:05:01 +00:00
|
|
|
const char *info;
|
|
|
|
const char *name;
|
|
|
|
const char *author;
|
|
|
|
const char *comment;
|
2011-11-03 13:21:53 +00:00
|
|
|
int (*vf_open)(struct vf_instance *vf, char *args);
|
2003-03-15 18:01:02 +00:00
|
|
|
// Ptr to a struct dscribing the options
|
2011-11-03 13:21:53 +00:00
|
|
|
const void *opts;
|
2002-04-06 22:05:01 +00:00
|
|
|
} vf_info_t;
|
|
|
|
|
2009-02-14 08:22:49 +00:00
|
|
|
#define NUM_NUMBERED_MPI 50
|
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
struct vf_image_context {
|
|
|
|
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];
|
2002-04-06 22:05:01 +00:00
|
|
|
int static_idx;
|
2011-11-03 13:21:53 +00:00
|
|
|
};
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
struct vf_format_context {
|
2005-03-01 20:21:58 +00:00
|
|
|
int have_configured;
|
|
|
|
int orig_width, orig_height, orig_fmt;
|
2011-11-03 13:21:53 +00:00
|
|
|
};
|
2005-03-01 20:21:58 +00:00
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
typedef struct vf_instance {
|
2011-11-03 13:21:53 +00:00
|
|
|
const vf_info_t *info;
|
2002-04-06 22:05:01 +00:00
|
|
|
// funcs:
|
2010-05-29 14:15:55 +00:00
|
|
|
int (*config)(struct vf_instance *vf,
|
2011-11-03 13:21:53 +00:00
|
|
|
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);
|
2010-05-29 14:15:55 +00:00
|
|
|
void (*uninit)(struct vf_instance *vf);
|
2006-07-06 06:58:17 +00:00
|
|
|
|
2010-05-29 14:15:55 +00:00
|
|
|
int (*continue_buffered_image)(struct vf_instance *vf);
|
2002-04-11 20:56:17 +00:00
|
|
|
// caps:
|
|
|
|
unsigned int default_caps; // used by default query_format()
|
|
|
|
unsigned int default_reqs; // used by default config()
|
2002-04-06 22:05:01 +00:00
|
|
|
// data:
|
2004-12-01 09:30:11 +00:00
|
|
|
int w, h;
|
2011-11-03 13:21:53 +00:00
|
|
|
struct vf_image_context imgctx;
|
|
|
|
struct vf_format_context fmt;
|
2010-05-29 14:15:55 +00:00
|
|
|
struct vf_instance *next;
|
2003-05-20 17:42:33 +00:00
|
|
|
mp_image_t *dmpi;
|
2011-11-03 13:21:53 +00:00
|
|
|
struct vf_priv_s *priv;
|
2008-04-16 04:06:44 +00:00
|
|
|
struct MPOpts *opts;
|
2002-04-06 22:05:01 +00:00
|
|
|
} vf_instance_t;
|
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
typedef struct vf_seteq {
|
2007-12-02 15:22:06 +00:00
|
|
|
const char *item;
|
2002-07-28 21:30:09 +00:00
|
|
|
int value;
|
|
|
|
} vf_equalizer_t;
|
|
|
|
|
2011-10-06 18:46:01 +00:00
|
|
|
struct vf_ctrl_screenshot {
|
|
|
|
// When the screenshot is complete, pass it to this callback.
|
|
|
|
void (*image_callback)(void *, mp_image_t *);
|
|
|
|
void *image_callback_ctx;
|
|
|
|
};
|
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
#define VFCTRL_QUERY_MAX_PP_LEVEL 4 // query max postprocessing level (if any)
|
|
|
|
#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 // get color options (brightness,contrast etc)
|
2002-04-15 22:41:28 +00:00
|
|
|
#define VFCTRL_DRAW_OSD 7
|
2011-11-03 13:21:53 +00:00
|
|
|
#define VFCTRL_CHANGE_RECTANGLE 9 // vf_rectangle control
|
|
|
|
#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
|
2011-11-25 21:59:23 +00:00
|
|
|
#define VFCTRL_SCREENSHOT 14 // Take screenshot, arg is vf_ctrl_screenshot
|
2011-11-03 13:21:53 +00:00
|
|
|
#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
|
2011-01-12 13:15:02 +00:00
|
|
|
/* Hack to make the OSD state object available to vf_expand and vf_ass which
|
|
|
|
* access OSD/subtitle state outside of normal OSD draw time. */
|
2008-06-23 22:53:58 +00:00
|
|
|
#define VFCTRL_SET_OSD_OBJ 20
|
2011-11-03 13:21:53 +00:00
|
|
|
#define VFCTRL_SET_YUV_COLORSPACE 22 // arg is struct mp_csp_details*
|
|
|
|
#define VFCTRL_GET_YUV_COLORSPACE 23 // arg is struct mp_csp_details*
|
2002-04-11 15:41:40 +00:00
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
// functions:
|
2011-11-03 13:21:53 +00:00
|
|
|
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);
|
2002-04-10 23:23:36 +00:00
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
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);
|
2010-01-16 18:37:13 +00:00
|
|
|
struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
|
2011-11-03 13:21:53 +00:00
|
|
|
const vf_info_t *const *filter_list, vf_instance_t *next,
|
|
|
|
const char *name, char **args, int *retcode);
|
|
|
|
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);
|
2006-07-06 06:58:17 +00:00
|
|
|
void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
|
|
|
|
int vf_output_queued_frame(vf_instance_t *vf);
|
2002-04-11 20:56:17 +00:00
|
|
|
|
2002-04-06 22:05:01 +00:00
|
|
|
// default wrappers:
|
2010-05-29 14:15:55 +00:00
|
|
|
int vf_next_config(struct vf_instance *vf,
|
2011-11-03 13:21:53 +00:00
|
|
|
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);
|
2010-05-29 14:15:55 +00:00
|
|
|
int vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
|
2011-11-03 13:21:53 +00:00
|
|
|
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);
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2008-04-25 10:58:12 +00:00
|
|
|
struct m_obj_settings;
|
2011-11-03 13:21:53 +00:00
|
|
|
vf_instance_t *append_filters(vf_instance_t *last,
|
|
|
|
struct m_obj_settings *vf_settings);
|
2002-04-06 22:05:01 +00:00
|
|
|
|
2011-11-03 13:21:53 +00:00
|
|
|
void vf_uninit_filter(vf_instance_t *vf);
|
|
|
|
void vf_uninit_filter_chain(vf_instance_t *vf);
|
2002-04-20 22:24:19 +00:00
|
|
|
|
2010-05-29 14:15:55 +00:00
|
|
|
int vf_config_wrapper(struct vf_instance *vf,
|
2011-11-03 13:21:53 +00:00
|
|
|
int width, int height, int d_width, int d_height,
|
|
|
|
unsigned int flags, unsigned int outfmt);
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2010-01-29 19:13:07 +00:00
|
|
|
static inline int norm_qscale(int qscale, int type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case 0: // MPEG-1
|
|
|
|
return qscale;
|
|
|
|
case 1: // MPEG-2
|
|
|
|
return qscale >> 1;
|
|
|
|
case 2: // H264
|
|
|
|
return qscale >> 2;
|
|
|
|
case 3: // VP56
|
|
|
|
return (63 - qscale + 2) >> 2;
|
|
|
|
}
|
|
|
|
return qscale;
|
|
|
|
}
|
|
|
|
|
vf_*: fix pts values passed to the next filter
Many video filters failed to calculate or even just pass through pts
values for their output frames. Fix this, and also make the two
remaining filters that called vf_next_put_image() twice for the same
input frame (vf_softpulldown, vf_telecine) use vf_queue_frame() so
that e.g. framestepping properly sees both frames.
Changed filters: vf_bmovl, vf_detc, vf_divtc, vf_filmdint, vf_ivtc,
vf_lavc, vf_phase, vf_pullup, vf_softpulldown, vf_telecine, vf_tile,
vf_tinterlace.
2011-04-23 16:56:47 +00:00
|
|
|
struct vf_detc_pts_buf {
|
|
|
|
double inpts_prev, outpts_prev;
|
|
|
|
double lastdelta;
|
|
|
|
};
|
|
|
|
void vf_detc_init_pts_buf(struct vf_detc_pts_buf *p);
|
|
|
|
/* Adjust pts when detelecining.
|
|
|
|
* skip_frame: do not render this frame
|
|
|
|
* reset_pattern: set to 1 if the telecine pattern has reset due to scene cut
|
|
|
|
*/
|
|
|
|
double vf_detc_adjust_pts(struct vf_detc_pts_buf *p, double pts,
|
|
|
|
bool reset_pattern, bool skip_frame);
|
|
|
|
double vf_softpulldown_adjust_pts(struct vf_detc_pts_buf *p, double pts,
|
|
|
|
bool reset_pattern, bool skip_frame,
|
|
|
|
int last_frame_duration);
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_VF_H */
|