demux_mkv: seek: fix bogus audio packet from earlier position
[mplayer.git] / libmpcodecs / vf.h
blob0d10abd6c6f9673fd62c1c416157bddccfc06a06
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_VF_H
20 #define MPLAYER_VF_H
22 #include "mp_image.h"
24 struct MPOpts;
25 struct vf_instance;
26 struct vf_priv_s;
28 typedef struct vf_info {
29 const char *info;
30 const char *name;
31 const char *author;
32 const char *comment;
33 int (*vf_open)(struct vf_instance *vf,char* args);
34 // Ptr to a struct dscribing the options
35 const void* opts;
36 } vf_info_t;
38 #define NUM_NUMBERED_MPI 50
40 typedef struct vf_image_context_s {
41 mp_image_t* static_images[2];
42 mp_image_t* temp_images[1];
43 mp_image_t* export_images[1];
44 mp_image_t* numbered_images[NUM_NUMBERED_MPI];
45 int static_idx;
46 } vf_image_context_t;
48 typedef struct vf_format_context_t {
49 int have_configured;
50 int orig_width, orig_height, orig_fmt;
51 } vf_format_context_t;
53 typedef struct vf_instance {
54 const vf_info_t* info;
55 // funcs:
56 int (*config)(struct vf_instance *vf,
57 int width, int height, int d_width, int d_height,
58 unsigned int flags, unsigned int outfmt);
59 int (*control)(struct vf_instance *vf,
60 int request, void* data);
61 int (*query_format)(struct vf_instance *vf,
62 unsigned int fmt);
63 void (*get_image)(struct vf_instance *vf,
64 mp_image_t *mpi);
65 int (*put_image)(struct vf_instance *vf,
66 mp_image_t *mpi, double pts);
67 void (*start_slice)(struct vf_instance *vf,
68 mp_image_t *mpi);
69 void (*draw_slice)(struct vf_instance *vf,
70 unsigned char** src, int* stride, int w,int h, int x, int y);
71 void (*uninit)(struct vf_instance *vf);
73 int (*continue_buffered_image)(struct vf_instance *vf);
74 // caps:
75 unsigned int default_caps; // used by default query_format()
76 unsigned int default_reqs; // used by default config()
77 // data:
78 int w, h;
79 vf_image_context_t imgctx;
80 vf_format_context_t fmt;
81 struct vf_instance *next;
82 mp_image_t *dmpi;
83 struct vf_priv_s* priv;
84 struct MPOpts *opts;
85 } vf_instance_t;
87 // control codes:
88 #include "mpc_info.h"
90 typedef struct vf_seteq_s
92 const char *item;
93 int value;
94 } vf_equalizer_t;
96 #define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
97 #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
98 #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
99 #define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
100 #define VFCTRL_DRAW_OSD 7
101 #define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
102 #define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
103 #define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
104 #define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
105 #define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
106 #define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
107 #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
108 #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
109 #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
110 /* Hack to make the OSD state object available to vf_expand which accesses
111 * the OSD state outside of normal OSD draw time. */
112 #define VFCTRL_SET_OSD_OBJ 20
113 #define VFCTRL_REDRAW_OSD 21 /* Change user-visible OSD immediately */
114 #define VFCTRL_SET_YUV_COLORSPACE 22
115 #define VFCTRL_GET_YUV_COLORSPACE 23
117 #include "vfcap.h"
119 //FIXME this should be in a common header, but i dunno which
120 #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly
123 // functions:
124 void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
125 mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
127 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);
128 struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
129 const vf_info_t * const *filter_list,
130 vf_instance_t *next, const char *name,
131 char **args, int *retcode);
132 vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args);
133 vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
134 vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args);
136 unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
137 void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
138 void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
139 int vf_output_queued_frame(vf_instance_t *vf);
141 // default wrappers:
142 int vf_next_config(struct vf_instance *vf,
143 int width, int height, int d_width, int d_height,
144 unsigned int flags, unsigned int outfmt);
145 int vf_next_control(struct vf_instance *vf, int request, void* data);
146 int vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
147 int vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts);
148 void vf_next_draw_slice (struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y);
150 struct m_obj_settings;
151 vf_instance_t* append_filters(vf_instance_t* last, struct m_obj_settings *vf_settings);
153 void vf_uninit_filter(vf_instance_t* vf);
154 void vf_uninit_filter_chain(vf_instance_t* vf);
156 int vf_config_wrapper(struct vf_instance *vf,
157 int width, int height, int d_width, int d_height,
158 unsigned int flags, unsigned int outfmt);
160 static inline int norm_qscale(int qscale, int type)
162 switch (type) {
163 case 0: // MPEG-1
164 return qscale;
165 case 1: // MPEG-2
166 return qscale >> 1;
167 case 2: // H264
168 return qscale >> 2;
169 case 3: // VP56
170 return (63 - qscale + 2) >> 2;
172 return qscale;
175 #endif /* MPLAYER_VF_H */