vf.h
Go to the documentation of this file.
1 /*
2  * This file is part of MPlayer.
3  *
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.
8  *
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.
13  *
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.
17  */
18 
19 #ifndef MPLAYER_VF_H
20 #define MPLAYER_VF_H
21 
22 //#include "m_option.h"
23 #include "mp_image.h"
24 
25 //extern m_obj_settings_t* vf_settings;
26 //extern const m_obj_list_t vf_obj_list;
27 
28 struct vf_instance;
29 struct vf_priv_s;
30 
31 typedef struct vf_info_s {
32  const char *info;
33  const char *name;
34  const char *author;
35  const char *comment;
36  int (*vf_open)(struct vf_instance *vf,char* args);
37  // Ptr to a struct dscribing the options
38  const void* opts;
39 } vf_info_t;
40 
41 #define NUM_NUMBERED_MPI 50
42 
43 typedef struct vf_image_context_s {
44  mp_image_t* static_images[2];
45  mp_image_t* temp_images[1];
46  mp_image_t* export_images[1];
47  mp_image_t* numbered_images[NUM_NUMBERED_MPI];
50 
51 typedef struct vf_format_context_t {
53  int orig_width, orig_height, orig_fmt;
55 
56 typedef struct vf_instance {
57  const vf_info_t* info;
58  // funcs:
59  int (*config)(struct vf_instance *vf,
60  int width, int height, int d_width, int d_height,
61  unsigned int flags, unsigned int outfmt);
62  int (*control)(struct vf_instance *vf,
63  int request, void* data);
64  int (*query_format)(struct vf_instance *vf,
65  unsigned int fmt);
66  void (*get_image)(struct vf_instance *vf,
67  mp_image_t *mpi);
68  int (*put_image)(struct vf_instance *vf,
69  mp_image_t *mpi, double pts);
70  void (*start_slice)(struct vf_instance *vf,
71  mp_image_t *mpi);
72  void (*draw_slice)(struct vf_instance *vf,
73  unsigned char** src, int* stride, int w,int h, int x, int y);
74  void (*uninit)(struct vf_instance *vf);
75 
77  // caps:
78  unsigned int default_caps; // used by default query_format()
79  unsigned int default_reqs; // used by default config()
80  // data:
81  int w, h;
84  struct vf_instance *next;
86  struct vf_priv_s* priv;
88 
89 // control codes:
90 #include "mpc_info.h"
91 
92 typedef struct vf_seteq_s
93 {
94  const char *item;
95  int value;
97 
98 #define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
99 #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
100 #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
101 #define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
102 #define VFCTRL_DRAW_OSD 7
103 #define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
104 #define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */
105 #define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
106 #define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
107 #define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
108 #define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
109 #define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
110 #define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
111 #define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
112 #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
113 #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
114 
115 #include "vfcap.h"
116 
117 //FIXME this should be in a common header, but i dunno which
118 #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly
119 
120 
121 // functions:
122 void ff_vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
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);
124 
125 vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
126 vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
128 vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
129 
130 unsigned int ff_vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
132 void ff_vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
134 
135 // default wrappers:
136 int ff_vf_next_config(struct vf_instance *vf,
137  int width, int height, int d_width, int d_height,
138  unsigned int flags, unsigned int outfmt);
139 int ff_vf_next_control(struct vf_instance *vf, int request, void* data);
140 void ff_vf_extra_flip(struct vf_instance *vf);
141 int ff_vf_next_query_format(struct vf_instance *vf, unsigned int fmt);
142 int ff_vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts);
143 void ff_vf_next_draw_slice (struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y);
144 
146 
149 
150 int ff_vf_config_wrapper(struct vf_instance *vf,
151  int width, int height, int d_width, int d_height,
152  unsigned int flags, unsigned int outfmt);
153 
154 static inline int norm_qscale(int qscale, int type)
155 {
156  switch (type) {
157  case 0: // MPEG-1
158  return qscale;
159  case 1: // MPEG-2
160  return qscale >> 1;
161  case 2: // H264
162  return qscale >> 2;
163  case 3: // VP56
164  return (63 - qscale + 2) >> 2;
165  }
166  return qscale;
167 }
168 
169 #endif /* MPLAYER_VF_H */
const char * fmt
Definition: avisynth_c.h:669
vf_instance_t * vf_open_plugin(const vf_info_t *const *filter_list, vf_instance_t *next, const char *name, char **args)
const char * name
Definition: vf.h:33
#define NUM_NUMBERED_MPI
Definition: vf.h:41
mp_image_t * ff_vf_get_image(vf_instance_t *vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h)
Definition: vf_mp.c:380
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
int stride
Definition: mace.c:144
output residual component w
int ff_vf_next_config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
Definition: vf_mp.c:584
int ff_vf_output_queued_frame(vf_instance_t *vf)
const void * opts
Definition: vf.h:38
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:334
Definition: vf.h:31
struct vf_info_s vf_info_t
void ff_vf_uninit_filter_chain(vf_instance_t *vf)
const char * comment
Definition: vf.h:35
Discrete Time axis x
Spectrum Plot time data
int ff_vf_next_control(struct vf_instance *vf, int request, void *data)
Definition: vf_mp.c:613
void ff_vf_extra_flip(struct vf_instance *vf)
const char * item
Definition: vf.h:94
Note except for filters that can have queued request_frame does not push and as a the filter_frame method will be called and do the work Legacy the filter_frame method was it was made of draw_slice(that could be called several times on distinct parts of the frame) and end_frame
struct vf_seteq_s vf_equalizer_t
int ff_vf_config_wrapper(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
void(* start_slice)(struct vf_instance *vf, mp_image_t *mpi)
Definition: vf.h:70
struct vf_image_context_s vf_image_context_t
AVS_Value args
Definition: avisynth_c.h:603
vf_instance_t * vf_open_encoder(vf_instance_t *next, const char *name, char *args)
unsigned int default_reqs
Definition: vf.h:79
struct vf_format_context_t vf_format_context_t
void ff_vf_clone_mpi_attributes(mp_image_t *dst, mp_image_t *src)
Definition: vf_mp.c:293
struct vf_instance * next
Definition: vf.h:84
vf_format_context_t fmt
Definition: vf.h:83
const char * author
Definition: vf.h:34
static int width
Definition: tests/utils.c:158
AVS_Value src
Definition: avisynth_c.h:523
typedef void(RENAME(mix_any_func_type))
int static_idx
Definition: vf.h:48
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
Definition: vf_dint.c:82
Definition: vf.h:92
unsigned int default_caps
Definition: vf.h:78
int orig_width
Definition: vf.h:53
BYTE int const BYTE int int int height
Definition: avisynth_c.h:713
static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
Definition: vf_dint.c:45
vf_instance_t * ff_append_filters(vf_instance_t *last)
int(* vf_open)(struct vf_instance *vf, char *args)
Definition: vf.h:36
const vf_info_t * info
Definition: vf.h:57
#define type
int w
Definition: vf.h:81
static void get_image(struct vf_instance *vf, mp_image_t *mpi)
Definition: vf_fspp.c:504
void ff_vf_uninit_filter(vf_instance_t *vf)
static int flags
Definition: cpu.c:23
int value
Definition: vf.h:95
vf_instance_t * vf_open_filter(vf_instance_t *next, const char *name, char **args)
void ff_vf_next_draw_slice(struct vf_instance *vf, unsigned char **src, int *stride, int w, int h, int x, int y)
Definition: vf_mp.c:304
const char * info
Definition: vf.h:32
function y
Definition: D.m:1
int ff_vf_next_put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
Definition: vf_mp.c:539
vf_image_context_t imgctx
Definition: vf.h:82
vf_instance_t * ff_vf_add_before_vo(vf_instance_t **vf, char *name, char **args)
void ff_vf_mpi_clear(mp_image_t *mpi, int x0, int y0, int w, int h)
Definition: vf_mp.c:327
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
struct vf_instance vf_instance_t
int(* continue_buffered_image)(struct vf_instance *vf)
Definition: vf.h:76
int have_configured
Definition: vf.h:52
unsigned int ff_vf_match_csp(vf_instance_t **vfp, const unsigned int *list, unsigned int preferred)
Definition: vf_mp.c:376
struct vf_priv_s * priv
Definition: vf.h:86
static int norm_qscale(int qscale, int type)
Definition: vf.h:154
int h
Definition: vf.h:81
static int query_format(struct vf_instance *vf, unsigned int fmt)
int ff_vf_next_query_format(struct vf_instance *vf, unsigned int fmt)
Definition: vf_mp.c:371
Definition: vf.h:56
mp_image_t * dmpi
Definition: vf.h:85
static int control(struct vf_instance *vf, int request, void *data)
Definition: vf_eq.c:157
void ff_vf_queue_frame(vf_instance_t *vf, int(*)(vf_instance_t *))