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