Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / guicast / bccapture.h
blob2ffad85d5eb80a48047a093c59f15a9935127c66
1 #ifndef BCCAPTURE_H
2 #define BCCAPTURE_H
4 #include <sys/ipc.h>
5 #include <sys/shm.h>
6 #include <X11/Xlib.h>
7 #include <X11/extensions/XShm.h>
9 #include "sizes.h"
10 #include "vframe.inc"
13 class BC_Capture
15 public:
16 BC_Capture(int w, int h, char *display_path = "");
17 virtual ~BC_Capture();
19 int init_window(char *display_path);
20 // x1 and y1 are automatically adjusted if out of bounds
21 int capture_frame(VFrame *frame, int &x1, int &y1);
22 int get_w();
23 int get_h();
25 int w, h, default_depth;
26 unsigned char **row_data;
28 private:
29 int allocate_data();
30 int delete_data();
31 int get_top_w();
32 int get_top_h();
34 inline void import_RGB565_to_RGB888(unsigned char* &output, unsigned char* &input)
36 *output++ = (*input & 0xf800) >> 8;
37 *output++ = (*input & 0x7e0) >> 3;
38 *output++ = (*input & 0x1f) << 3;
40 input += 2;
41 output += 3;
44 inline void import_BGR888_to_RGB888(unsigned char* &output, unsigned char* &input)
46 *output++ = input[2];
47 *output++ = input[1];
48 *output++ = input[0];
50 input += 3;
51 output += 3;
54 inline void import_BGR8888_to_RGB888(unsigned char* &output, unsigned char* &input)
56 *output++ = input[2];
57 *output++ = input[1];
58 *output++ = input[0];
60 input += 4;
61 output += 3;
64 int use_shm;
65 int bitmap_color_model;
66 unsigned char *data;
67 XImage *ximage;
68 XShmSegmentInfo shm_info;
69 Display* display;
70 Window rootwin;
71 Visual *vis;
72 int bits_per_pixel;
73 int screen;
74 long shm_event_type;
75 int client_byte_order, server_byte_order;
78 #endif
80 // Local Variables:
81 // mode: C++
82 // c-file-style: "linux"
83 // End: