📄 webcam_server.h
字号:
/*********************************************************************
* webcam_server *
* *
* (c) 2002 Donn Morrison donn@donn.dyndns.org *
* *
* code used from Gerd Knorr's xawtv (libng) *
* - and - *
* Cory Lueninghoener's gqcam *
* *
* waits for connections from a viewer and sends *
* jpeg encoded captures as a live video feed *
* *
*********************************************************************/
//#ifndef _WEBCAM_SERVER_H_INCLUDED_
//#define _WEBCAM_SERVER_H_INCLUDED_
struct image
{
int bufsize;
int width, height;
unsigned char *buf;
};
struct RGB
{
char r;
char g;
char b;
};
struct image *image_new(int width, int height);
void image_delete(struct image *img);
char *str_replace(const char *str, const char *find, const char *replace);
struct options
{
int port;
char *devfile;
int jpeg_quality;
int width;
int height;
int swap_rgb;
int flip_horiz;
int flip_vert;
int rotate;
int gamma;
struct RGB text_fg;
struct RGB text_bg;
struct RGB trans;
int text_xpos;
int text_ypos;
int palette;
};
struct status
{
int num_users;
int id_newest_img;
int bad_grabs;
};
struct caminfo
{
int dev;
pthread_t pt_grab;
struct options o;
struct imagedata *data;
struct video_capability vid_caps;
struct video_window vid_win;
struct video_picture vid_pic;
struct video_mbuf vid_mbuf;
struct video_mmap vid_v4lmmap;
unsigned char *mmap;
};
struct imagedata
{
char *jpeg_data;
int len;
};
struct connection
{
int socketfd;
//struct sockaddr_in client_addr;
struct caminfo *cam;
};
int handle_connection(struct connection *con);
char* merge(char*, int, char*);
int send_image(struct connection *con);
int create_and_listen(int port);
int open_cam(struct caminfo *cam, char *devfile);
int close_cam(struct caminfo *cam);
int set_cam_info(struct caminfo *cam);
void get_cam_info(struct caminfo *cam);
struct image *get_cam_image(struct caminfo *cam);
int grab_thread(struct caminfo *cam);
struct imagedata *peek(struct caminfo *cam);
//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -