4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef PLUGINVCLIENT_H
24 #define PLUGINVCLIENT_H
27 #include "maxbuffers.h"
28 #include "pluginclient.h"
31 // Maximum dimensions for a temporary frame a plugin should retain between
32 // process_buffer calls. This allows memory conservation.
33 #define PLUGIN_MAX_W 2000
34 #define PLUGIN_MAX_H 1000
38 class PluginVClient : public PluginClient
41 PluginVClient(PluginServer *server);
42 virtual ~PluginVClient();
44 int get_render_ptrs();
45 int init_realtime_parameters();
46 int delete_nonrealtime_parameters();
48 // Replaced by pull method
50 * void plugin_process_realtime(VFrame **input,
52 * int64_t current_position,
55 // Multichannel buffer process for backwards compatibility
56 virtual int process_realtime(VFrame **input,
58 // Single channel buffer process for backwards compatibility and transitions
59 virtual int process_realtime(VFrame *input,
62 // Process buffer using pull method. By default this loads the input into *frame
63 // and calls process_realtime with input and output pointing to frame.
64 // start_position - requested position relative to frame rate. Relative
65 // to start of EDL. End of buffer if reverse.
66 // sample_rate - scale of start_position.
67 // These should return 1 if error or 0 if success.
68 virtual int process_buffer(VFrame **frame,
69 int64_t start_position,
71 virtual int process_buffer(VFrame *frame,
72 int64_t start_position,
76 virtual int process_loop(VFrame **buffers) { return 1; };
77 virtual int process_loop(VFrame *buffer) { return 1; };
78 int plugin_process_loop(VFrame **buffers, int64_t &write_length);
80 int plugin_start_loop(int64_t start,
84 int plugin_get_parameters();
86 // Called by non-realtime client to read frame for processing.
87 // buffer - output frame
88 // channel - channel of the plugin input for a multichannel plugin
89 // start_position - start of frame in forward. end of frame in reverse.
90 // Relative to start of EDL.
91 int read_frame(VFrame *buffer,
93 int64_t start_position);
94 int read_frame(VFrame *buffer,
95 int64_t start_position);
97 // Called by realtime plugin to read frame from previous entity
98 // framerate - framerate start_position is relative to. Used by preceeding plugiun
99 // to calculate output frame number. Provided so the client can get data
100 // at a higher fidelity than provided by the EDL.
101 // start_position - start of frame in forward. end of frame in reverse.
102 // Relative to start of EDL.
103 // frame_rate - frame rate position is scaled to
104 int read_frame(VFrame *buffer,
106 int64_t start_position,
108 int use_opengl /* = 0 */);
111 // User calls this to request an opengl routine to be run synchronously.
114 // Called by Playback3D to run opengl commands synchronously.
115 // Overridden by the user with the commands to run synchronously.
116 virtual int handle_opengl();
118 // Used by the opengl handlers to get the
119 // arguments to process_buffer.
120 // For realtime plugins, they're identical for input and output.
121 VFrame* get_input(int channel = 0);
122 VFrame* get_output(int channel = 0);
124 // For aggregation, this does case sensitive compares with the
125 // the stack in the frame object.
126 // Only possible for video because VFrame stores the effect stacks.
127 int next_effect_is(const char *title);
128 int prev_effect_is(const char *title);
130 // Called by user to allocate the temporary for the current process_buffer.
131 // It may be deleted after the process_buffer to conserve memory.
132 VFrame* new_temp(int w, int h, int color_model);
133 // Called by PluginServer after process_buffer to delete the temp if it's too
138 // Frame rate relative to EDL
139 double get_project_framerate();
140 // Frame rate requested
141 double get_framerate();
142 // Get list of system fonts
143 ArrayList<BC_FontEntry*> *get_fontlist();
145 BC_FontEntry *find_fontentry(const char *displayname, int style,
146 int mask, int preferred_style);
147 // Find font path where glyph for the character_code exists
148 int find_font_by_char(FT_ULong char_code, char *path_new, const FT_Face oldface);
150 int64_t local_to_edl(int64_t position);
151 int64_t edl_to_local(int64_t position);
152 int64_t get_startproject();
153 int64_t get_endproject();
155 // ======================== Non realtime buffer pointers =======================
156 // Channels of arrays of frames that the client uses.
157 VFrame ***video_in, ***video_out;
159 // point to the start of the buffers
160 ArrayList<VFrame***> input_ptr_master;
161 ArrayList<VFrame***> output_ptr_master;
162 // Pointers to the regions for a single render.
163 // Arrays are channels of arrays of frames.
164 VFrame ***input_ptr_render;
165 VFrame ***output_ptr_render;
167 // ======================== Realtime buffer pointers ===========================
168 // These are provided by the plugin server for the opengl handler.
174 double project_frame_rate;
175 // Local parameters set by non realtime plugin about the file to be generated.
176 // Retrieved by server to set output file format.
177 // In realtime plugins, these are set before every process_buffer as the
180 int project_color_model;
181 // Whether user wants floating point calculations.
183 // Whether user wants alpha calculations.
185 // Whether user wants pixel interpolation.
186 int use_interpolation;