r1006: configure: Use libx264_pic instead of libx264 if available.
[cinelerra_cv/mob.git] / cinelerra / pluginvclient.h
blob454712229ed7d3906616ae69d67632312e1015c8
1 #ifndef PLUGINVCLIENT_H
2 #define PLUGINVCLIENT_H
5 #include "maxbuffers.h"
6 #include "pluginclient.h"
7 #include "vframe.inc"
9 // Maximum dimensions for a temporary frame a plugin should retain between
10 // process_buffer calls. This allows memory conservation.
11 #define PLUGIN_MAX_W 2000
12 #define PLUGIN_MAX_H 1000
16 class PluginVClient : public PluginClient
18 public:
19 PluginVClient(PluginServer *server);
20 virtual ~PluginVClient();
22 int get_render_ptrs();
23 int init_realtime_parameters();
24 int delete_nonrealtime_parameters();
25 int is_video();
26 // Replaced by pull method
28 * void plugin_process_realtime(VFrame **input,
29 * VFrame **output,
30 * int64_t current_position,
31 * int64_t total_len);
33 // Multichannel buffer process for backwards compatibility
34 virtual int process_realtime(VFrame **input,
35 VFrame **output);
36 // Single channel buffer process for backwards compatibility and transitions
37 virtual int process_realtime(VFrame *input,
38 VFrame *output);
40 // Process buffer using pull method. By default this loads the input into *frame
41 // and calls process_realtime with input and output pointing to frame.
42 // start_position - requested position relative to frame rate. Relative
43 // to start of EDL. End of buffer if reverse.
44 // sample_rate - scale of start_position.
45 // These should return 1 if error or 0 if success.
46 virtual int process_buffer(VFrame **frame,
47 int64_t start_position,
48 double frame_rate);
49 virtual int process_buffer(VFrame *frame,
50 int64_t start_position,
51 double frame_rate);
54 // Called by plugin server to render the GUI with rendered data.
55 void plugin_render_gui(void *data);
56 virtual void render_gui(void *data) { };
57 // Called by client to cause GUI to be rendered with data.
58 void send_render_gui(void *data);
59 virtual int process_loop(VFrame **buffers) { return 1; };
60 virtual int process_loop(VFrame *buffer) { return 1; };
61 int plugin_process_loop(VFrame **buffers, int64_t &write_length);
63 int plugin_start_loop(int64_t start,
64 int64_t end,
65 int64_t buffer_size,
66 int total_buffers);
67 int plugin_get_parameters();
69 // Called by non-realtime client to read frame for processing.
70 // buffer - output frame
71 // channel - channel of the plugin input for a multichannel plugin
72 // start_position - start of frame in forward. end of frame in reverse.
73 // Relative to start of EDL.
74 int read_frame(VFrame *buffer,
75 int channel,
76 int64_t start_position);
77 int read_frame(VFrame *buffer,
78 int64_t start_position);
80 // Called by realtime plugin to read frame from previous entity
81 // framerate - framerate start_position is relative to. Used by preceeding plugiun
82 // to calculate output frame number. Provided so the client can get data
83 // at a higher fidelity than provided by the EDL.
84 // start_position - start of frame in forward. end of frame in reverse.
85 // Relative to start of EDL.
86 // frame_rate - frame rate position is scaled to
87 int read_frame(VFrame *buffer,
88 int channel,
89 int64_t start_position,
90 double frame_rate,
91 int use_opengl = 0);
94 // User calls this to request an opengl routine to be run synchronously.
95 int run_opengl();
97 // Called by Playback3D to run opengl commands synchronously.
98 // Overridden by the user with the commands to run synchronously.
99 virtual int handle_opengl();
101 // Used by the opengl handlers to get the
102 // arguments to process_buffer.
103 // For realtime plugins, they're identical for input and output.
104 VFrame* get_input(int channel = 0);
105 VFrame* get_output(int channel = 0);
107 // For aggregation, this does case sensitive compares with the
108 // the stack in the frame object.
109 // Only possible for video because VFrame stores the effect stacks.
110 int next_effect_is(char *title);
111 int prev_effect_is(char *title);
113 // Called by user to allocate the temporary for the current process_buffer.
114 // It may be deleted after the process_buffer to conserve memory.
115 VFrame* new_temp(int w, int h, int color_model);
116 // Called by PluginServer after process_buffer to delete the temp if it's too
117 // large.
118 void age_temp();
119 VFrame* get_temp();
121 // Frame rate relative to EDL
122 double get_project_framerate();
123 // Frame rate requested
124 double get_framerate();
126 int64_t local_to_edl(int64_t position);
127 int64_t edl_to_local(int64_t position);
129 // ======================== Non realtime buffer pointers =======================
130 // Channels of arrays of frames that the client uses.
131 VFrame ***video_in, ***video_out;
133 // point to the start of the buffers
134 ArrayList<VFrame***> input_ptr_master;
135 ArrayList<VFrame***> output_ptr_master;
136 // Pointers to the regions for a single render.
137 // Arrays are channels of arrays of frames.
138 VFrame ***input_ptr_render;
139 VFrame ***output_ptr_render;
141 // ======================== Realtime buffer pointers ===========================
142 // These are provided by the plugin server for the opengl handler.
143 VFrame **input;
144 VFrame **output;
147 // Frame rate of EDL
148 double project_frame_rate;
149 // Local parameters set by non realtime plugin about the file to be generated.
150 // Retrieved by server to set output file format.
151 // In realtime plugins, these are set before every process_buffer as the
152 // requested rates.
153 double frame_rate;
154 int project_color_model;
155 // Whether user wants floating point calculations.
156 int use_float;
157 // Whether user wants alpha calculations.
158 int use_alpha;
159 // Whether user wants pixel interpolation.
160 int use_interpolation;
161 // Aspect ratio
162 float aspect_w;
163 float aspect_h;
165 // Tempo
166 VFrame *temp;
171 #endif