yading@10
|
1 /*
|
yading@10
|
2 * This file is part of MPlayer.
|
yading@10
|
3 *
|
yading@10
|
4 * MPlayer is free software; you can redistribute it and/or modify
|
yading@10
|
5 * it under the terms of the GNU General Public License as published by
|
yading@10
|
6 * the Free Software Foundation; either version 2 of the License, or
|
yading@10
|
7 * (at your option) any later version.
|
yading@10
|
8 *
|
yading@10
|
9 * MPlayer is distributed in the hope that it will be useful,
|
yading@10
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
yading@10
|
12 * GNU General Public License for more details.
|
yading@10
|
13 *
|
yading@10
|
14 * You should have received a copy of the GNU General Public License along
|
yading@10
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
yading@10
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
yading@10
|
17 */
|
yading@10
|
18
|
yading@10
|
19 #ifndef MPLAYER_VF_H
|
yading@10
|
20 #define MPLAYER_VF_H
|
yading@10
|
21
|
yading@10
|
22 //#include "m_option.h"
|
yading@10
|
23 #include "mp_image.h"
|
yading@10
|
24
|
yading@10
|
25 //extern m_obj_settings_t* vf_settings;
|
yading@10
|
26 //extern const m_obj_list_t vf_obj_list;
|
yading@10
|
27
|
yading@10
|
28 struct vf_instance;
|
yading@10
|
29 struct vf_priv_s;
|
yading@10
|
30
|
yading@10
|
31 typedef struct vf_info_s {
|
yading@10
|
32 const char *info;
|
yading@10
|
33 const char *name;
|
yading@10
|
34 const char *author;
|
yading@10
|
35 const char *comment;
|
yading@10
|
36 int (*vf_open)(struct vf_instance *vf,char* args);
|
yading@10
|
37 // Ptr to a struct dscribing the options
|
yading@10
|
38 const void* opts;
|
yading@10
|
39 } vf_info_t;
|
yading@10
|
40
|
yading@10
|
41 #define NUM_NUMBERED_MPI 50
|
yading@10
|
42
|
yading@10
|
43 typedef struct vf_image_context_s {
|
yading@10
|
44 mp_image_t* static_images[2];
|
yading@10
|
45 mp_image_t* temp_images[1];
|
yading@10
|
46 mp_image_t* export_images[1];
|
yading@10
|
47 mp_image_t* numbered_images[NUM_NUMBERED_MPI];
|
yading@10
|
48 int static_idx;
|
yading@10
|
49 } vf_image_context_t;
|
yading@10
|
50
|
yading@10
|
51 typedef struct vf_format_context_t {
|
yading@10
|
52 int have_configured;
|
yading@10
|
53 int orig_width, orig_height, orig_fmt;
|
yading@10
|
54 } vf_format_context_t;
|
yading@10
|
55
|
yading@10
|
56 typedef struct vf_instance {
|
yading@10
|
57 const vf_info_t* info;
|
yading@10
|
58 // funcs:
|
yading@10
|
59 int (*config)(struct vf_instance *vf,
|
yading@10
|
60 int width, int height, int d_width, int d_height,
|
yading@10
|
61 unsigned int flags, unsigned int outfmt);
|
yading@10
|
62 int (*control)(struct vf_instance *vf,
|
yading@10
|
63 int request, void* data);
|
yading@10
|
64 int (*query_format)(struct vf_instance *vf,
|
yading@10
|
65 unsigned int fmt);
|
yading@10
|
66 void (*get_image)(struct vf_instance *vf,
|
yading@10
|
67 mp_image_t *mpi);
|
yading@10
|
68 int (*put_image)(struct vf_instance *vf,
|
yading@10
|
69 mp_image_t *mpi, double pts);
|
yading@10
|
70 void (*start_slice)(struct vf_instance *vf,
|
yading@10
|
71 mp_image_t *mpi);
|
yading@10
|
72 void (*draw_slice)(struct vf_instance *vf,
|
yading@10
|
73 unsigned char** src, int* stride, int w,int h, int x, int y);
|
yading@10
|
74 void (*uninit)(struct vf_instance *vf);
|
yading@10
|
75
|
yading@10
|
76 int (*continue_buffered_image)(struct vf_instance *vf);
|
yading@10
|
77 // caps:
|
yading@10
|
78 unsigned int default_caps; // used by default query_format()
|
yading@10
|
79 unsigned int default_reqs; // used by default config()
|
yading@10
|
80 // data:
|
yading@10
|
81 int w, h;
|
yading@10
|
82 vf_image_context_t imgctx;
|
yading@10
|
83 vf_format_context_t fmt;
|
yading@10
|
84 struct vf_instance *next;
|
yading@10
|
85 mp_image_t *dmpi;
|
yading@10
|
86 struct vf_priv_s* priv;
|
yading@10
|
87 } vf_instance_t;
|
yading@10
|
88
|
yading@10
|
89 // control codes:
|
yading@10
|
90 #include "mpc_info.h"
|
yading@10
|
91
|
yading@10
|
92 typedef struct vf_seteq_s
|
yading@10
|
93 {
|
yading@10
|
94 const char *item;
|
yading@10
|
95 int value;
|
yading@10
|
96 } vf_equalizer_t;
|
yading@10
|
97
|
yading@10
|
98 #define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
|
yading@10
|
99 #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
|
yading@10
|
100 #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
|
yading@10
|
101 #define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
|
yading@10
|
102 #define VFCTRL_DRAW_OSD 7
|
yading@10
|
103 #define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
|
yading@10
|
104 #define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */
|
yading@10
|
105 #define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
|
yading@10
|
106 #define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
|
yading@10
|
107 #define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
|
yading@10
|
108 #define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
|
yading@10
|
109 #define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
|
yading@10
|
110 #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
|
yading@10
|
111 #define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
|
yading@10
|
112 #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
|
yading@10
|
113 #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
|
yading@10
|
114
|
yading@10
|
115 #include "vfcap.h"
|
yading@10
|
116
|
yading@10
|
117 //FIXME this should be in a common header, but i dunno which
|
yading@10
|
118 #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly
|
yading@10
|
119
|
yading@10
|
120
|
yading@10
|
121 // functions:
|
yading@10
|
122 void ff_vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
|
yading@10
|
123 mp_image_t* ff_vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
|
yading@10
|
124
|
yading@10
|
125 vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
|
yading@10
|
126 vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
|
yading@10
|
127 vf_instance_t* ff_vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
|
yading@10
|
128 vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
|
yading@10
|
129
|
yading@10
|
130 unsigned int ff_vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
|
yading@10
|
131 void ff_vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
|
yading@10
|
132 void ff_vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
|
yading@10
|
133 int ff_vf_output_queued_frame(vf_instance_t *vf);
|
yading@10
|
134
|
yading@10
|
135 // default wrappers:
|
yading@10
|
136 int ff_vf_next_config(struct vf_instance *vf,
|
yading@10
|
137 int width, int height, int d_width, int d_height,
|
yading@10
|
138 unsigned int flags, unsigned int outfmt);
|
yading@10
|
139 int ff_vf_next_control(struct vf_instance *vf, int request, void* data);
|
yading@10
|
140 void ff_vf_extra_flip(struct vf_instance *vf);
|
yading@10
|
141 int ff_vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
|
yading@10
|
142 int ff_vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts);
|
yading@10
|
143 void ff_vf_next_draw_slice (struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y);
|
yading@10
|
144
|
yading@10
|
145 vf_instance_t* ff_append_filters(vf_instance_t* last);
|
yading@10
|
146
|
yading@10
|
147 void ff_vf_uninit_filter(vf_instance_t* vf);
|
yading@10
|
148 void ff_vf_uninit_filter_chain(vf_instance_t* vf);
|
yading@10
|
149
|
yading@10
|
150 int ff_vf_config_wrapper(struct vf_instance *vf,
|
yading@10
|
151 int width, int height, int d_width, int d_height,
|
yading@10
|
152 unsigned int flags, unsigned int outfmt);
|
yading@10
|
153
|
yading@10
|
154 static inline int norm_qscale(int qscale, int type)
|
yading@10
|
155 {
|
yading@10
|
156 switch (type) {
|
yading@10
|
157 case 0: // MPEG-1
|
yading@10
|
158 return qscale;
|
yading@10
|
159 case 1: // MPEG-2
|
yading@10
|
160 return qscale >> 1;
|
yading@10
|
161 case 2: // H264
|
yading@10
|
162 return qscale >> 2;
|
yading@10
|
163 case 3: // VP56
|
yading@10
|
164 return (63 - qscale + 2) >> 2;
|
yading@10
|
165 }
|
yading@10
|
166 return qscale;
|
yading@10
|
167 }
|
yading@10
|
168
|
yading@10
|
169 #endif /* MPLAYER_VF_H */
|