mirror of https://github.com/mpv-player/mpv
cosmetics: vf.[ch]: reformat
Also a couple of smaller changes to other files.
This commit is contained in:
parent
e3f5043233
commit
991d7387b3
|
@ -22,32 +22,33 @@
|
|||
#include "mpc_info.h"
|
||||
#include "libmpdemux/stheader.h"
|
||||
|
||||
typedef mp_codec_info_t ad_info_t;
|
||||
typedef struct mp_codec_info ad_info_t;
|
||||
|
||||
/* interface of video decoder drivers */
|
||||
typedef struct ad_functions
|
||||
{
|
||||
const ad_info_t *info;
|
||||
int (*preinit)(sh_audio_t *sh);
|
||||
int (*init)(sh_audio_t *sh);
|
||||
void (*uninit)(sh_audio_t *sh);
|
||||
int (*control)(sh_audio_t *sh,int cmd,void* arg, ...);
|
||||
int (*decode_audio)(sh_audio_t *sh,unsigned char* buffer,int minlen,int maxlen);
|
||||
const ad_info_t *info;
|
||||
int (*preinit)(sh_audio_t *sh);
|
||||
int (*init)(sh_audio_t *sh);
|
||||
void (*uninit)(sh_audio_t *sh);
|
||||
int (*control)(sh_audio_t *sh,int cmd,void* arg, ...);
|
||||
int (*decode_audio)(sh_audio_t *sh, unsigned char *buffer, int minlen,
|
||||
int maxlen);
|
||||
} ad_functions_t;
|
||||
|
||||
// NULL terminated array of all drivers
|
||||
extern const ad_functions_t * const mpcodecs_ad_drivers[];
|
||||
|
||||
// fallback if ADCTRL_RESYNC not implemented: sh_audio->a_in_buffer_len=0;
|
||||
#define ADCTRL_RESYNC_STREAM 1 /* resync, called after seeking! */
|
||||
#define ADCTRL_RESYNC_STREAM 1 // resync, called after seeking
|
||||
|
||||
// fallback if ADCTRL_SKIP not implemented: ds_fill_buffer(sh_audio->ds);
|
||||
#define ADCTRL_SKIP_FRAME 2 /* skip block/frame, called while seeking! */
|
||||
#define ADCTRL_SKIP_FRAME 2 // skip block/frame, called while seeking
|
||||
|
||||
// fallback if ADCTRL_QUERY_FORMAT not implemented: sh_audio->sample_format
|
||||
#define ADCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */
|
||||
#define ADCTRL_QUERY_FORMAT 3 // test for availabilty of a format
|
||||
|
||||
// fallback: use hw mixer in libao
|
||||
#define ADCTRL_SET_VOLUME 4 /* set volume (used for mp3lib and liba52) */
|
||||
#define ADCTRL_SET_VOLUME 4 // not used at the moment
|
||||
|
||||
#endif /* MPLAYER_AD_H */
|
||||
|
|
|
@ -19,19 +19,19 @@
|
|||
#ifndef MPLAYER_MPC_INFO_H
|
||||
#define MPLAYER_MPC_INFO_H
|
||||
|
||||
typedef struct mp_codec_info_s
|
||||
struct mp_codec_info
|
||||
{
|
||||
/* codec long name ("Autodesk FLI/FLC Animation decoder" */
|
||||
const char *name;
|
||||
/* short name (same as driver name in codecs.conf) ("dshow") */
|
||||
const char *short_name;
|
||||
/* interface author/maintainer */
|
||||
const char *maintainer;
|
||||
/* codec author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
|
||||
const char *author;
|
||||
/* any additional comments */
|
||||
const char *comment;
|
||||
} mp_codec_info_t;
|
||||
/* codec long name ("Autodesk FLI/FLC Animation decoder" */
|
||||
const char *name;
|
||||
/* short name (same as driver name in codecs.conf) ("dshow") */
|
||||
const char *short_name;
|
||||
/* interface author/maintainer */
|
||||
const char *maintainer;
|
||||
/* codec author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
|
||||
const char *author;
|
||||
/* any additional comments */
|
||||
const char *comment;
|
||||
};
|
||||
|
||||
#define CONTROL_OK 1
|
||||
#define CONTROL_TRUE 1
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "mpc_info.h"
|
||||
#include "libmpdemux/stheader.h"
|
||||
|
||||
typedef mp_codec_info_t vd_info_t;
|
||||
typedef struct mp_codec_info vd_info_t;
|
||||
|
||||
struct demux_packet;
|
||||
|
||||
|
@ -33,37 +33,38 @@ typedef struct vd_functions
|
|||
const vd_info_t *info;
|
||||
int (*init)(sh_video_t *sh);
|
||||
void (*uninit)(sh_video_t *sh);
|
||||
int (*control)(sh_video_t *sh,int cmd,void* arg, ...);
|
||||
mp_image_t* (*decode)(sh_video_t *sh,void* data,int len,int flags);
|
||||
int (*control)(sh_video_t *sh, int cmd, void *arg, ...);
|
||||
mp_image_t * (*decode)(sh_video_t * sh, void *data, int len, int flags);
|
||||
struct mp_image *(*decode2)(struct sh_video *sh, struct demux_packet *pkt,
|
||||
void *data, int len, int flags,
|
||||
double *reordered_pts);
|
||||
} vd_functions_t;
|
||||
|
||||
// NULL terminated array of all drivers
|
||||
extern const vd_functions_t * const mpcodecs_vd_drivers[];
|
||||
extern const vd_functions_t *const mpcodecs_vd_drivers[];
|
||||
|
||||
#define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */
|
||||
#define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
|
||||
#define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
|
||||
#define VDCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
|
||||
#define VDCTRL_GET_EQUALIZER 7 /* get color options (brightness,contrast etc) */
|
||||
#define VDCTRL_RESYNC_STREAM 8 /* seeking */
|
||||
#define VDCTRL_QUERY_UNSEEN_FRAMES 9 /* current decoder lag */
|
||||
#define VDCTRL_QUERY_FORMAT 3 // test for availabilty of a format
|
||||
#define VDCTRL_QUERY_MAX_PP_LEVEL 4 // query max postprocessing level (if any)
|
||||
#define VDCTRL_SET_PP_LEVEL 5 // set postprocessing level
|
||||
#define VDCTRL_SET_EQUALIZER 6 // set color options (brightness,contrast etc)
|
||||
#define VDCTRL_GET_EQUALIZER 7 // get color options (brightness,contrast etc)
|
||||
#define VDCTRL_RESYNC_STREAM 8 // reset decode state after seeking
|
||||
#define VDCTRL_QUERY_UNSEEN_FRAMES 9 // current decoder lag
|
||||
|
||||
// callbacks:
|
||||
int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
|
||||
const unsigned int *outfmts,
|
||||
unsigned int preferred_outfmt);
|
||||
|
||||
static inline int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
|
||||
unsigned int preferred_outfmt)
|
||||
{
|
||||
return mpcodecs_config_vo2(sh, w, h, NULL, preferred_outfmt);
|
||||
}
|
||||
|
||||
mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
||||
void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y);
|
||||
|
||||
#define VDFLAGS_DROPFRAME 3
|
||||
mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
|
||||
int w, int h);
|
||||
void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride,
|
||||
int w, int h, int x, int y);
|
||||
|
||||
#endif /* MPLAYER_VD_H */
|
||||
|
|
840
libmpcodecs/vf.c
840
libmpcodecs/vf.c
File diff suppressed because it is too large
Load Diff
143
libmpcodecs/vf.h
143
libmpcodecs/vf.h
|
@ -23,6 +23,9 @@
|
|||
#include "mpcommon.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
#include "mpc_info.h"
|
||||
#include "vfcap.h"
|
||||
|
||||
struct MPOpts;
|
||||
struct vf_instance;
|
||||
struct vf_priv_s;
|
||||
|
@ -32,44 +35,39 @@ typedef struct vf_info {
|
|||
const char *name;
|
||||
const char *author;
|
||||
const char *comment;
|
||||
int (*vf_open)(struct vf_instance *vf,char* args);
|
||||
int (*vf_open)(struct vf_instance *vf, char *args);
|
||||
// Ptr to a struct dscribing the options
|
||||
const void* opts;
|
||||
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];
|
||||
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];
|
||||
int static_idx;
|
||||
} vf_image_context_t;
|
||||
};
|
||||
|
||||
typedef struct vf_format_context_t {
|
||||
struct vf_format_context {
|
||||
int have_configured;
|
||||
int orig_width, orig_height, orig_fmt;
|
||||
} vf_format_context_t;
|
||||
};
|
||||
|
||||
typedef struct vf_instance {
|
||||
const vf_info_t* info;
|
||||
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);
|
||||
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);
|
||||
|
@ -78,82 +76,83 @@ typedef struct vf_instance {
|
|||
unsigned int default_reqs; // used by default config()
|
||||
// data:
|
||||
int w, h;
|
||||
vf_image_context_t imgctx;
|
||||
vf_format_context_t fmt;
|
||||
struct vf_image_context imgctx;
|
||||
struct vf_format_context fmt;
|
||||
struct vf_instance *next;
|
||||
mp_image_t *dmpi;
|
||||
struct vf_priv_s* priv;
|
||||
struct vf_priv_s *priv;
|
||||
struct MPOpts *opts;
|
||||
} vf_instance_t;
|
||||
|
||||
// control codes:
|
||||
#include "mpc_info.h"
|
||||
|
||||
typedef struct vf_seteq_s
|
||||
{
|
||||
typedef struct vf_seteq {
|
||||
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_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)
|
||||
#define VFCTRL_DRAW_OSD 7
|
||||
#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
|
||||
#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 */
|
||||
#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
|
||||
#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 and vf_ass which
|
||||
* access OSD/subtitle state outside of normal OSD draw time. */
|
||||
#define VFCTRL_SET_OSD_OBJ 20
|
||||
#define VFCTRL_REDRAW_OSD 21 /* Change user-visible OSD immediately */
|
||||
#define VFCTRL_SET_YUV_COLORSPACE 22 /* arg is struct mp_csp_details* */
|
||||
#define VFCTRL_GET_YUV_COLORSPACE 23 /* arg is struct mp_csp_details* */
|
||||
|
||||
#include "vfcap.h"
|
||||
#define VFCTRL_REDRAW_OSD 21 // Change user-visible OSD immediately
|
||||
#define VFCTRL_SET_YUV_COLORSPACE 22 // arg is struct mp_csp_details*
|
||||
#define VFCTRL_GET_YUV_COLORSPACE 23 // arg is struct mp_csp_details*
|
||||
|
||||
// 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);
|
||||
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_plugin(struct MPOpts *opts,
|
||||
const vf_info_t * const *filter_list, vf_instance_t *next,
|
||||
const char *name, char **args);
|
||||
struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
|
||||
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);
|
||||
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);
|
||||
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 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
int width, int height, int d_width, int d_height,
|
||||
unsigned int flags, unsigned int outfmt);
|
||||
|
||||
static inline int norm_qscale(int qscale, int type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue