-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
tsc_display:
The tsc_display
struct handles information about the display that will be captured
struct tsc_display {
int index;
int width;
int height;
int fps;
};
tsc_frame_buffer:
The tsc_frame_buffer
struct stores information about the frame buffer used to store image.
*context
refers to supporting structs that provide extra information.
For example in the case of X11 *context
refers to shmimage struct.
*buffer
is a pointer that points to the starting location of the memory reserved for the image's pixel array.
buffer_length
is the length of the aforementioned buffer.
struct tsc_frame_buffer {
struct tsc_display display;
int buffer_id;
int pixmap;
void *buffer;
size_t buffer_length;
void *context;
};
The Base capture class is the base class referred to by all subsequent capture classes.
This contains the basic methods for capturing screens. Each capture class may implement its own methods however
it has to include the all methods from the base class.
class tsc_capture{
/* Constructor.
Initialise the capture system. */
virtual void init() = 0;
/* Get the screen capture type in use by this class. */
virtual int get_capture_type() = 0;
/* Get a list of displays that can be captured. */
virtual struct std::vector<tsc_display> get_displays() = 0;
/* Free the list of displays returned by get_displays() */
virtual void free_displays(struct tsc_display *display) = 0;
/* Allocate memory to store one frame for a specific display */
virtual struct tsc_frame_buffer *alloc_frame(int index) = 0;
/* Update the memory for a specific framebuffer */
virtual void update_frame(struct tsc_frame_buffer *buffer) = 0;
/* Free the memory used by the frame buffer. */
virtual void free_frame(struct tsc_frame_buffer *frame_buffer) = 0;
};
X11 specific struct:
Due to how the XServer handles multiple screens using offsets, a tsc_offset
struct is required to store each of the offsets for the specific screen.
struct tsc_offset{
int x_offset;
int y_offset;
};
The X11 capture class is defined as follows:
class tsc_capture_x11 : public tsc_capture {
private:
struct shmimage
{
XShmSegmentInfo shminfo ;
XImage * ximage ;
unsigned int * data ; // will point to the image's BGRA packed pixels
} ;
Display *display;
Window root;
// Information regarding the displays are stored in these vectors
std::vector<tsc_display> display_info_vec;
std::vector<tsc_frame_buffer> frame_buffer_vec;
std::vector<tsc_offset> offset_vec;
// Internal class utility methods
static void initimage( struct shmimage * image );
static void destroyimage( Display * dsp, struct shmimage * image );
static int init_xshm(Display * dsp, struct shmimage * image , int width, int height);
shmimage *init_x11(Display *dsp, int dsp_width, int dsp_height);
const void *get_frame(shmimage *src,int x_offset,int y_offset);
public:
void init();
int get_capture_type() {
return TSC_CAPTURE_X11;
}
struct std::vector<tsc_display> get_displays();
struct tsc_frame_buffer *alloc_frame(int index);
void update_frame(struct tsc_frame_buffer *frame_buffer);
void free_displays(struct tsc_display *display);
void free_frame(struct tsc_frame_buffer *frame_buffer);
};
© 2021 Telescope Project Developers
(Tim Dettmar, Vorachat Somsuay, Jirapong Pansak, Tairo Kageyama, Kittidech Ditsuwan)
This repository is licensed under the GNU Affero General Public License, Version 3 with the distribution terms specified in the license.