友善之臂视频监控方案源码学习(5) - 输入控制(8)
时间:2026-01-26
时间:2026-01-26
2. int fd;
3. char *videodevice ;
4. unsigned char *pFramebuffer;
5. unsigned char *ptframe[OUTFRMNUMB];
6. unsigned char *mem[NB_BUFFER];
7.
8. int framelock[OUTFRMNUMB];
9. pthread_mutex_t grabmutex;
10. int framesizeIn ; 11. volatile int frame_cour;
12. int bppIn;
13. int hdrwidth; 14. int hdrheight;
15. int formatIn;
16. int signalquit;
17. struct v4l2_capability cap;
18. struct v4l2_format fmt;
19. struct v4l2_buffer buf;
20. struct v4l2_requestbuffers rb;
21.
22. int grayscale;
23. uint32_t quality;
24.
25. };
主要定义了视频输入控制变量。
第六,打开视频设备
[html] view plaincopy
1.
2.
3.
4.
5.
6. /* open video device and prepare data structure */ if (init_videoIn(videoIn, dev, width, height, fps, format, 1) < 0) { IPRINT("init_VideoIn failed\n"); closelog(); exit(EXIT_FAILURE); }
init_videoIn具体实现如下:
[html] view plaincopy
1. int init_videoIn(struct vdIn *vd, char *device, int width, int height, int fps, int format, int grabmethod)