00001 #ifndef PLUGINVCLIENT_H 00002 #define PLUGINVCLIENT_H 00003 00004 00005 #include "maxbuffers.h" 00006 #include "pluginclient.h" 00007 #include "vframe.inc" 00008 00009 // Maximum dimensions for a temporary frame a plugin should retain between 00010 // process_buffer calls. This allows memory conservation. 00011 #define PLUGIN_MAX_W 2000 00012 #define PLUGIN_MAX_H 1000 00013 00014 00015 00016 class PluginVClient : public PluginClient 00017 { 00018 public: 00019 PluginVClient(PluginServer *server); 00020 virtual ~PluginVClient(); 00021 00022 int get_render_ptrs(); 00023 int init_realtime_parameters(); 00024 int delete_nonrealtime_parameters(); 00025 int is_video(); 00026 // Replaced by pull method 00027 /* 00028 * void plugin_process_realtime(VFrame **input, 00029 * VFrame **output, 00030 * int64_t current_position, 00031 * int64_t total_len); 00032 */ 00033 // Multichannel buffer process for backwards compatibility 00034 virtual int process_realtime(VFrame **input, 00035 VFrame **output); 00036 // Single channel buffer process for backwards compatibility and transitions 00037 virtual int process_realtime(VFrame *input, 00038 VFrame *output); 00039 00040 // Process buffer using pull method. By default this loads the input into *frame 00041 // and calls process_realtime with input and output pointing to frame. 00042 // start_position - requested position relative to frame rate. Relative 00043 // to start of EDL. End of buffer if reverse. 00044 // sample_rate - scale of start_position. 00045 // These should return 1 if error or 0 if success. 00046 virtual int process_buffer(VFrame **frame, 00047 int64_t start_position, 00048 double frame_rate); 00049 virtual int process_buffer(VFrame *frame, 00050 int64_t start_position, 00051 double frame_rate); 00052 00053 00054 // Called by plugin server to render the GUI with rendered data. 00055 void plugin_render_gui(void *data); 00056 virtual void render_gui(void *data) { }; 00057 // Called by client to cause GUI to be rendered with data. 00058 void send_render_gui(void *data); 00059 virtual int process_loop(VFrame **buffers) { return 1; }; 00060 virtual int process_loop(VFrame *buffer) { return 1; }; 00061 int plugin_process_loop(VFrame **buffers, int64_t &write_length); 00062 00063 int plugin_start_loop(int64_t start, 00064 int64_t end, 00065 int64_t buffer_size, 00066 int total_buffers); 00067 int plugin_get_parameters(); 00068 00069 // Called by non-realtime client to read frame for processing. 00070 // buffer - output frame 00071 // channel - channel of the plugin input for a multichannel plugin 00072 // start_position - start of frame in forward. end of frame in reverse. 00073 // Relative to start of EDL. 00074 int read_frame(VFrame *buffer, 00075 int channel, 00076 int64_t start_position); 00077 int read_frame(VFrame *buffer, 00078 int64_t start_position); 00079 00080 // Called by realtime plugin to read frame from previous entity 00081 // framerate - framerate start_position is relative to. Used by preceeding plugiun 00082 // to calculate output frame number. Provided so the client can get data 00083 // at a higher fidelity than provided by the EDL. 00084 // start_position - start of frame in forward. end of frame in reverse. 00085 // Relative to start of EDL. 00086 // frame_rate - frame rate position is scaled to 00087 int read_frame(VFrame *buffer, 00088 int channel, 00089 int64_t start_position, 00090 double frame_rate, 00091 int use_opengl = 0); 00092 00093 00094 // User calls this to request an opengl routine to be run synchronously. 00095 int run_opengl(); 00096 00097 // Called by Playback3D to run opengl commands synchronously. 00098 // Overridden by the user with the commands to run synchronously. 00099 virtual int handle_opengl(); 00100 00101 // Used by the opengl handlers to get the 00102 // arguments to process_buffer. 00103 // For realtime plugins, they're identical for input and output. 00104 VFrame* get_input(int channel = 0); 00105 VFrame* get_output(int channel = 0); 00106 00107 // For aggregation, this does case sensitive compares with the 00108 // the stack in the frame object. 00109 // Only possible for video because VFrame stores the effect stacks. 00110 int next_effect_is(char *title); 00111 int prev_effect_is(char *title); 00112 00113 // Called by user to allocate the temporary for the current process_buffer. 00114 // It may be deleted after the process_buffer to conserve memory. 00115 VFrame* new_temp(int w, int h, int color_model); 00116 // Called by PluginServer after process_buffer to delete the temp if it's too 00117 // large. 00118 void age_temp(); 00119 VFrame* get_temp(); 00120 00121 // Frame rate relative to EDL 00122 double get_project_framerate(); 00123 // Frame rate requested 00124 double get_framerate(); 00125 00126 int64_t local_to_edl(int64_t position); 00127 int64_t edl_to_local(int64_t position); 00128 00129 // ======================== Non realtime buffer pointers ======================= 00130 // Channels of arrays of frames that the client uses. 00131 VFrame ***video_in, ***video_out; 00132 00133 // point to the start of the buffers 00134 ArrayList<VFrame***> input_ptr_master; 00135 ArrayList<VFrame***> output_ptr_master; 00136 // Pointers to the regions for a single render. 00137 // Arrays are channels of arrays of frames. 00138 VFrame ***input_ptr_render; 00139 VFrame ***output_ptr_render; 00140 00141 // ======================== Realtime buffer pointers =========================== 00142 // These are provided by the plugin server for the opengl handler. 00143 VFrame **input; 00144 VFrame **output; 00145 00146 00147 // Frame rate of EDL 00148 double project_frame_rate; 00149 // Local parameters set by non realtime plugin about the file to be generated. 00150 // Retrieved by server to set output file format. 00151 // In realtime plugins, these are set before every process_buffer as the 00152 // requested rates. 00153 double frame_rate; 00154 int project_color_model; 00155 // Whether user wants floating point calculations. 00156 int use_float; 00157 // Whether user wants alpha calculations. 00158 int use_alpha; 00159 // Whether user wants pixel interpolation. 00160 int use_interpolation; 00161 // Aspect ratio 00162 float aspect_w; 00163 float aspect_h; 00164 00165 // Tempo 00166 VFrame *temp; 00167 }; 00168 00169 00170 00171 #endif
1.5.5