91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 419KB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發布日期: 2021-05-12
  • 語言: C/C++
  • 標簽: Linux??

資源簡介

完整測試沒有任何問題

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?“cam.h“
#include?“mutexs.h“
#include?“convert.h“

#define REQBUFS_COUNT 4

struct?cam_buf?{
void?*start;
size_t?length;
};

struct?v4l2_requestbuffers?reqbufs;
struct?cam_buf?bufs[REQBUFS_COUNT];

int?camera_init(char?*devpath?unsigned?int?*width?unsigned?int?*height?unsigned?int?*size?unsigned?int?*ismjpeg)
{
int?i;
int?fd?=?-1;;
int?ret;
struct?v4l2_buffer?vbuf;
struct?v4l2_format?format;
struct?v4l2_capability?capability;
/*open?打開設備文件*/
if((fd?=?open(devpath?O_RDWR))?==?-1){
perror(“open:“);
return?-1;
}
/*ioctl?查看支持的驅動*/
ret?=?ioctl(fd?VIDIOC_QUERYCAP?&capability);
if?(ret?==?-1)?{
perror(“camera->init“);
return?-1;
}
/*判斷設備是否支持視頻采集*/
if(!(capability.capabilities?&?V4L2_CAP_VIDEO_CAPTURE))?{
fprintf(stderr?“camera->init:?device?can?not?support?V4L2_CAP_VIDEO_CAPTURE\n“);
close(fd);
return?-1;
}
/*判斷設備是否支持視頻流采集*/
if(!(capability.capabilities?&?V4L2_CAP_STREAMING))?{
fprintf(stderr?“camera->init:?device?can?not?support?V4L2_CAP_STREAMING\n“);
close(fd);
return?-1;
}
/*設置捕獲的視頻格式?MYJPEG*/
memset(&format?0?sizeof(format));
format.type?=?V4L2_BUF_TYPE_VIDEO_CAPTURE;
format.fmt.pix.pixelformat?=?V4L2_PIX_FMT_YUYV;
format.fmt.pix.width?=?*width;
format.fmt.pix.height?=?*height;
format.fmt.pix.field?=?V4L2_FIELD_ANY;
ret?=?ioctl(fd?VIDIOC_S_FMT?&format);
if(ret?==?-1)?{
perror(“camera?init“);
return?-1;
}?else?{
*ismjpeg?=?1;
fprintf(stdout?“camera->init:?picture?format?is?yuyv\n“);
goto?get_fmt;
}
/*設置捕獲的視頻格式?YUYV*/
memset(&format?0?sizeof(format));
format.type?=?V4L2_BUF_TYPE_VIDEO_CAPTURE; //永遠都是這個類型
format.fmt.pix.pixelformat?=?V4L2_PIX_FMT_MJPEG; //設置采集圖片的格式
format.fmt.pix.width?=?*width;
format.fmt.pix.height?=?*height;
format.fmt.pix.field?=?V4L2_FIELD_ANY; //設置圖片一行一行的采集
ret?=?ioctl(fd?VIDIOC_S_FMT?&format); //ioctl 是設置生效
if(ret?==?-1)
perror(“camera?init“);
else?{
fprintf(stdout?“camera->init:?picture?format?is?mjpeg\n“);
*ismjpeg?=?0;
goto?get_fmt;
}

get_fmt:
ret?=?ioctl(fd?VIDIOC_G_FMT?&format);
if?(ret?==?-1)?{
perror(“camera?init“);
return?-1;
}
/*向驅動申請緩存*/
memset(&reqbufs?0?sizeof(struct?v4l2_requestbuffers));
reqbufs.count =?REQBUFS_COUNT; //緩存區個數
reqbufs.type =?V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqbufs.memory =?V4L2_MEMORY_MMAP; //設置操作申請緩存的方式:映射?MMAP
ret?=?ioctl(fd?VIDIOC_REQBUFS?&reqbufs);
if?(ret?==?-1)?{
perror(“camera?init“);
close(fd);
return?-1;
}
/*循環映射并入隊*/
for?(i?=?0;?i? /*真正獲取緩存的地址大小*/
memset(&vbuf?0?sizeof(struct?v4l2_buffer));
vbuf.type?=?V4L2_BUF_TYPE_VIDEO_CAPTURE;
vbuf.memory?=?V4L2_MEMORY_MMAP;
vbuf.index?=?i;
ret?=?ioctl(fd?VIDIOC_QUERYBUF?&vbuf);
if?(ret?==?-1)?{
perror(“camera?init“);
close(fd);
return?-1;

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-06-04?11:41??Smarthome_server\
?????文件??????614400??2017-03-07?17:18??Smarthome_server\3.jpg
?????文件?????????421??2017-03-10?14:46??Smarthome_server\Makefile
?????文件?????????421??2017-03-10?14:46??Smarthome_server\Makefile~
?????目錄???????????0??2017-03-10?16:41??Smarthome_server\include\
?????文件?????????614??2016-11-30?14:29??Smarthome_server\include\cam.h
?????文件?????????614??2016-11-30?14:29??Smarthome_server\include\cam.h~
?????文件?????????358??2016-11-04?11:02??Smarthome_server\include\convert.h
?????文件?????????265??2016-10-25?14:49??Smarthome_server\include\login.h~
?????文件?????????175??2017-03-07?15:46??Smarthome_server\include\module.h
?????文件?????????175??2017-03-07?15:46??Smarthome_server\include\module.h~
?????文件?????????137??2016-11-30?13:24??Smarthome_server\include\mutexs.h
?????文件?????????137??2016-11-30?13:24??Smarthome_server\include\mutexs.h~
?????文件?????????503??2017-01-12?21:57??Smarthome_server\include\serial.h
?????文件?????????634??2016-11-30?16:37??Smarthome_server\include\srv.h~
?????文件?????????442??2017-03-07?16:42??Smarthome_server\include\tcp_server.h
?????文件?????????442??2017-03-07?16:42??Smarthome_server\include\tcp_server.h~
?????文件????????5077??2016-10-20?14:20??Smarthome_server\include\zgb.h~
?????文件?????????188??2017-03-07?17:06??Smarthome_server\include\zigbee.h
?????文件?????????188??2017-03-07?17:06??Smarthome_server\include\zigbee.h~
?????文件???????62613??2017-03-10?16:26??Smarthome_server\server
?????目錄???????????0??2017-03-10?16:41??Smarthome_server\src\
?????文件????????8275??2017-03-10?16:26??Smarthome_server\src\cam.c
?????文件????????8275??2017-03-10?16:26??Smarthome_server\src\cam.c~
?????文件????????8582??2015-11-10?13:54??Smarthome_server\src\convert.c
?????文件????????1741??2016-11-15?16:08??Smarthome_server\src\login.c~
?????文件????????1938??2017-03-10?15:39??Smarthome_server\src\main.c
?????文件????????1938??2017-03-10?15:39??Smarthome_server\src\main.c~
?????文件????????3329??2017-03-10?16:14??Smarthome_server\src\module.c
?????文件????????3329??2017-03-10?16:14??Smarthome_server\src\module.c~
?????文件????????6995??2017-01-12?22:04??Smarthome_server\src\serial.c
............此處省略6個文件信息

評論

共有 條評論