add haupauge-1657 dual usb capture support, add deinterlace to recordmonitor, asset...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / pluginaclient.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef PLUGINACLIENT_H
23 #define PLUGINACLIENT_H
24
25
26
27 #include "maxbuffers.h"
28 #include "pluginclient.h"
29 #include "samples.inc"
30
31 class PluginAClient : public PluginClient
32 {
33 public:
34         PluginAClient(PluginServer *server);
35         virtual ~PluginAClient();
36
37         int get_render_ptrs();
38         int init_realtime_parameters();
39
40         int is_audio();
41 // These should return 1 if error or 0 if success.
42 // Multichannel buffer process for backwards compatibility
43         virtual int process_realtime(int64_t size,
44                 Samples **input_ptr, Samples **output_ptr);
45 // Single channel buffer process for backwards compatibility and transitions
46         virtual int process_realtime(int64_t size,
47                 Samples *input_ptr, Samples *output_ptr);
48
49 // Process buffer using pull method.  By default this loads the input into the
50 // buffer and calls process_realtime with input and output pointing to buffer.
51 // start_position - requested position relative to sample_rate. Relative
52 //     to start of EDL.  End of buffer if reverse.
53 // sample_rate - scale of start_position.
54         virtual int process_buffer(int64_t size,
55                 Samples **buffer, int64_t start_position, int sample_rate);
56         virtual int process_buffer(int64_t size,
57                 Samples *buffer, int64_t start_position, int sample_rate);
58
59 // process render_gui frames via add_gui_frame
60         virtual void begin_process_buffer();
61         virtual void end_process_buffer();
62
63         virtual int process_loop(Samples *buffer, int64_t &write_length) { return 1; };
64         virtual int process_loop(Samples **buffers, int64_t &write_length) { return 1; };
65         int plugin_process_loop(Samples **buffers, int64_t &write_length);
66
67         int plugin_start_loop(int64_t start, int64_t end,
68                 int64_t buffer_size, int total_buffers);
69
70         int plugin_get_parameters();
71
72 // Called by non-realtime client to read audio for processing.
73 // buffer - output wave
74 // channel - channel of the plugin input for multichannel plugin
75 // start_position - start of samples in forward.  End of samples in reverse.
76 //     Relative to start of EDL.  Scaled to sample_rate.
77 // len - number of samples to read
78         int read_samples(Samples *buffer,
79                 int channel,
80                 int64_t start_position,
81                 int64_t len);
82         int read_samples(Samples *buffer,
83                 int64_t start_position,
84                 int64_t len);
85
86 // Called by realtime plugin to read audio from previous entity
87 // sample_rate - scale of start_position.  Provided so the client can get data
88 //     at a higher fidelity than provided by the EDL.
89         int read_samples(Samples *buffer,
90                 int channel, int sample_rate, int64_t start_position, int64_t len);
91
92 // Get the sample rate of the EDL
93         int get_project_samplerate();
94 // Get the requested sample rate
95         int get_samplerate();
96         Samples* get_output(int channel);
97         int64_t get_startproject();
98         int64_t get_endproject();
99
100         int64_t local_to_edl(int64_t position);
101         int64_t edl_to_local(int64_t position);
102
103 // the buffers passed to process_buffer
104         Samples **output_buffers;
105
106 // point to the start of the buffers
107         ArrayList<float**> input_ptr_master;
108         ArrayList<float**> output_ptr_master;
109 // point to the regions for a single render
110         float **input_ptr_render;
111         float **output_ptr_render;
112 // sample rate of EDL.  Used for normalizing keyframes
113         int project_sample_rate;
114 // Local parameters set by non realtime plugin about the file to be generated.
115 // Retrieved by server to set output file format.
116 // In realtime plugins, these are set before every process_buffer as the
117 // requested rates.
118         int sample_rate;
119 };
120
121
122
123 #endif