swab() needs _XOPEN_SOURCE to be defined.
[mplayer/glamo.git] / libmpcodecs / vf.h
bloba2617ff164bdac35f51148d5f490e20a554becb9
1 #ifndef MPLAYER_VF_H
2 #define MPLAYER_VF_H
4 #include "mp_image.h"
6 struct vf_instance_s;
7 struct vf_priv_s;
9 typedef struct vf_info_s {
10 const char *info;
11 const char *name;
12 const char *author;
13 const char *comment;
14 int (*open)(struct vf_instance_s* vf,char* args);
15 // Ptr to a struct dscribing the options
16 const void* opts;
17 } vf_info_t;
19 typedef struct vf_image_context_s {
20 mp_image_t* static_images[2];
21 mp_image_t* temp_images[1];
22 mp_image_t* export_images[1];
23 int static_idx;
24 } vf_image_context_t;
26 typedef struct vf_format_context_t {
27 int have_configured;
28 int orig_width, orig_height, orig_fmt;
29 } vf_format_context_t;
31 typedef struct vf_instance_s {
32 const vf_info_t* info;
33 // funcs:
34 int (*config)(struct vf_instance_s* vf,
35 int width, int height, int d_width, int d_height,
36 unsigned int flags, unsigned int outfmt);
37 int (*control)(struct vf_instance_s* vf,
38 int request, void* data);
39 int (*query_format)(struct vf_instance_s* vf,
40 unsigned int fmt);
41 void (*get_image)(struct vf_instance_s* vf,
42 mp_image_t *mpi);
43 int (*put_image)(struct vf_instance_s* vf,
44 mp_image_t *mpi, double pts);
45 void (*start_slice)(struct vf_instance_s* vf,
46 mp_image_t *mpi);
47 void (*draw_slice)(struct vf_instance_s* vf,
48 unsigned char** src, int* stride, int w,int h, int x, int y);
49 void (*uninit)(struct vf_instance_s* vf);
51 int (*continue_buffered_image)(struct vf_instance_s* vf);
52 // caps:
53 unsigned int default_caps; // used by default query_format()
54 unsigned int default_reqs; // used by default config()
55 // data:
56 int w, h;
57 vf_image_context_t imgctx;
58 vf_format_context_t fmt;
59 struct vf_instance_s* next;
60 mp_image_t *dmpi;
61 struct vf_priv_s* priv;
62 } vf_instance_t;
64 // control codes:
65 #include "mpc_info.h"
67 typedef struct vf_seteq_s
69 const char *item;
70 int value;
71 } vf_equalizer_t;
73 #define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
74 #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
75 #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
76 #define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
77 #define VFCTRL_DRAW_OSD 7
78 #define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
79 #define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */
80 #define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
81 #define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
82 #define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
83 #define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
84 #define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
85 #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
86 #define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
87 #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
88 #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
90 #include "vfcap.h"
92 //FIXME this should be in a common header, but i dunno which
93 #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly
96 // functions:
97 void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
98 mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
100 vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
101 vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
102 vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
103 vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
105 unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
106 void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
107 void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
108 int vf_output_queued_frame(vf_instance_t *vf);
110 // default wrappers:
111 int vf_next_config(struct vf_instance_s* vf,
112 int width, int height, int d_width, int d_height,
113 unsigned int flags, unsigned int outfmt);
114 int vf_next_control(struct vf_instance_s* vf, int request, void* data);
115 void vf_extra_flip(struct vf_instance_s* vf);
116 int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt);
117 int vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi, double pts);
118 void vf_next_draw_slice (struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
120 vf_instance_t* append_filters(vf_instance_t* last);
122 void vf_uninit_filter(vf_instance_t* vf);
123 void vf_uninit_filter_chain(vf_instance_t* vf);
125 int vf_config_wrapper(struct vf_instance_s* vf,
126 int width, int height, int d_width, int d_height,
127 unsigned int flags, unsigned int outfmt);
129 #endif /* MPLAYER_VF_H */