r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / vdevicex11.h
blob3a546f2b266c4b0c4362118dbc63157383d18843
1 #ifndef VDEVICEX11_H
2 #define VDEVICEX11_H
4 #include "canvas.inc"
5 #include "edl.inc"
6 #include "guicast.h"
7 #include "maskauto.inc"
8 #include "maskautos.inc"
9 #include "pluginclient.inc"
10 #include "thread.h"
11 #include "vdevicebase.h"
13 // output_frame is the same one written to device
14 #define BITMAP_PRIMARY 0
15 // output_frame is a temporary converted to the device format
16 #define BITMAP_TEMP 1
18 class VDeviceX11 : public VDeviceBase
20 public:
21 VDeviceX11(VideoDevice *device, Canvas *output);
22 ~VDeviceX11();
24 int open_input();
25 int close_all();
26 int read_buffer(VFrame *frame);
27 int reset_parameters();
28 // User always gets the colormodel requested
29 void new_output_buffer(VFrame **output, int colormodel);
31 int open_output();
32 int start_playback();
33 int stop_playback();
34 int output_visible();
35 // After loading the bitmap with a picture, write it
36 int write_buffer(VFrame *result, EDL *edl);
37 // Get best colormodel for recording
38 int get_best_colormodel(Asset *asset);
41 //=========================== compositing stages ===============================
42 // For compositing with OpenGL, must clear the frame buffer
43 // before overlaying tracks.
44 void clear_output();
46 // Called by VModule::import_frame
47 void do_camera(VFrame *output,
48 VFrame *input,
49 float in_x1,
50 float in_y1,
51 float in_x2,
52 float in_y2,
53 float out_x1,
54 float out_y1,
55 float out_x2,
56 float out_y2);
58 // Called by VModule::import_frame for cases with no media.
59 void clear_input(VFrame *frame);
61 void do_fade(VFrame *output_temp, float fade);
63 // Hardware version of MaskEngine
64 void do_mask(VFrame *output_temp,
65 int64_t start_position_project,
66 MaskAutos *keyframe_set,
67 MaskAuto *keyframe,
68 MaskAuto *default_auto);
70 // The idea is to composite directly in the frame buffer if OpenGL.
71 // OpenGL can do all the blending using the frame buffer.
72 // Unfortunately if the output is lower resolution than the frame buffer, the
73 // rendered output is the resolution of the frame buffer, not the output.
74 // Also, the frame buffer has to be copied back to textures for nonstandard
75 // blending equations and blended at the framebuffer resolution.
76 // If the frame buffer is higher resolution than the
77 // output frame, like a 2560x1600 display, it could cause unnecessary slowness.
78 // Finally, there's the problem of updating the refresh frame.
79 // It requires recompositing the previous frame in software every time playback was
80 // stops, a complicated operation.
81 void overlay(VFrame *output_frame,
82 VFrame *input,
83 float in_x1,
84 float in_y1,
85 float in_x2,
86 float in_y2,
87 float out_x1,
88 float out_y1,
89 float out_x2,
90 float out_y2,
91 float alpha, // 0 - 1
92 int mode,
93 EDL *edl);
95 // For plugins, lock the canvas, enable opengl, and run a function in the
96 // plugin client in the synchronous thread. The user must override the
97 // pluginclient function.
98 void run_plugin(PluginClient *client);
100 // For multichannel plugins, copy from the temporary pbuffer to
101 // the plugin output texture.
102 // Set the output OpenGL state to TEXTURE.
103 void copy_frame(VFrame *dst, VFrame *src);
105 private:
106 // Closest colormodel the hardware can do for playback.
107 // Only used by VDeviceX11::new_output_buffer. The value from File::get_best_colormodel
108 // is passed to this to create the VFrame to which the output is rendered.
109 // For OpenGL, it creates the array of row pointers used to upload the video
110 // frame to the texture, the texture, and the PBuffer.
111 int get_best_colormodel(int colormodel);
113 // Bitmap to be written to device
114 BC_Bitmap *bitmap;
115 // Wrapper for bitmap or intermediate buffer for user to write to
116 VFrame *output_frame;
117 // Type of output_frame
118 int bitmap_type;
119 // dimensions of buffers written to window
120 int bitmap_w, bitmap_h;
121 ArrayList<int> render_strategies;
122 // Canvas for output
123 Canvas *output;
124 // Parameters the output texture conforms to, for OpenGL
125 // window_id is probably not going to be used
126 int window_id;
127 int texture_w;
128 int texture_h;
129 int color_model;
130 int color_model_selected;
131 // Transfer coordinates from the output frame to the canvas
132 // for last frame rendered.
133 // These stick the last frame to the display.
134 // Must be floats to support OpenGL
135 float output_x1, output_y1, output_x2, output_y2;
136 float canvas_x1, canvas_y1, canvas_x2, canvas_y2;
137 // Screen capture
138 BC_Capture *capture_bitmap;
139 // Set when OpenGL rendering has cleared the frame buffer before write_buffer
140 int is_cleared;
143 #endif