📄 bgrab.h
字号:
/* Framegrabber device structure */#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/time.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <fcntl.h>#include <linux/types.h>#include <linux/videodev.h>#include <pthread.h>#define SETTING_BRIGHTNESS 0#define SETTING_HUE 1#define SETTING_COLOUR 2#define SETTING_CONTRAST 3#define FORMAT_GREY VIDEO_PALETTE_GREY#define FORMAT_RGB565 VIDEO_PALETTE_RGB565#define FORMAT_RGB32 VIDEO_PALETTE_RGB32#define FORMAT_YUV422P VIDEO_PALETTE_YUV422P#define FORMAT_YUV420P VIDEO_PALETTE_YUV420P#define FORMAT_YUV411P VIDEO_PALETTE_YUV411P#define IMAGE_BUFFER_EMPTY 0#define IMAGE_BUFFER_FULL 1#define IMAGE_BUFFER_INUSE 2#define VIDEOMODE_AUTO VIDEO_MODE_AUTO#define VIDEOMODE_PAL VIDEO_MODE_PAL #define VIDEOMODE_NTSC VIDEO_MODE_NTSC#define VIDEOMODE_SECAM VIDEO_MODE_SECAM#ifdef __cplusplusextern "C" {#endifstatic const int error_exit_status = -1; struct fgdevice { int video_dev; int width; int height; int input; int format; struct video_mmap vid_mmap[2]; int current_grab_number; struct video_mbuf vid_mbuf; char *video_map; int grabbing_active; int have_new_frame; void *current_image; pthread_mutex_t buffer_mutex; pthread_t grab_thread; pthread_cond_t buffer_cond; int totalframecount; int image_size; int image_pixels; int framecount; int fps_update_interval; double fps; double lasttime; unsigned short *y8_to_rgb565; unsigned char *rgb565_to_y8; };/* Prototypes */int fg_open_device (struct fgdevice *fg, char *devicename);int fg_close_device (struct fgdevice *fg);int fg_print_info(struct fgdevice *fg); int fg_set_audio (struct fgdevice *fg, int vol);void fg_set_fps_interval(struct fgdevice *fg, int interval);double fg_get_fps(struct fgdevice *fg);int fg_get_setting(struct fgdevice *fg, int which_setting);int fg_set_setting(struct fgdevice *fg, int which_setting, int value);int fg_set_channel(struct fgdevice *fg, int channel);int fg_set_mode(struct fgdevice *fg, int mode);int fg_start_grab_image (struct fgdevice *fg, int width, int height, int format);int fg_stop_grab_image (struct fgdevice *fg);void * fg_get_next_image(struct fgdevice *fg);double timeGet(void);#ifdef __cplusplus}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -