Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit66eb038

Browse files
committed
more option in test
1 parentde36156 commit66eb038

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ src/*.o
33
*.cmake
44
CMakeCache.txt
55
CMakeFiles/
6+
libv4l2cpptest

‎main.cpp‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@
1313
#include<string.h>
1414
#include<errno.h>
1515
#include<stdlib.h>
16-
#include<linux/videodev2.h>
17-
#include<sys/ioctl.h>
1816
#include<signal.h>
1917

20-
#include<fstream>
21-
2218
#include"logger.h"
2319

2420
#include"V4l2Device.h"
@@ -43,22 +39,28 @@ int main(int argc, char* argv[])
4339
{
4440
int verbose=0;
4541
constchar *in_devname ="/dev/video0";
46-
int c =0;
4742
V4l2IoType ioTypeIn = IOTYPE_MMAP;
43+
int format =0;
44+
int width =0;
45+
int height =0;
46+
int fps =0;
4847

49-
while ((c =getopt (argc, argv,"hP:F:v::rw")) != -1)
48+
int c =0;
49+
while ((c =getopt (argc, argv,"hv:""G:f:r")) != -1)
5050
{
5151
switch (c)
5252
{
53-
case'v':verbose =1;if (optarg && *optarg=='v') verbose++;break;
54-
case'r':ioTypeIn = IOTYPE_READWRITE;break;
53+
case'v':verbose =1;if (optarg && *optarg=='v') verbose++;break;
54+
case'r':ioTypeIn = IOTYPE_READWRITE ;break;
55+
case'G':sscanf(optarg,"%dx%dx%d", &width, &height, &fps) ;break;
56+
case'f':format =V4l2Device::fourcc(optarg) ;break;
5557
case'h':
5658
{
57-
std::cout << argv[0] <<" [-v[v]] [-Wwidth] [-H height] source_device dest_device" << std::endl;
59+
std::cout << argv[0] <<" [-v[v]] [-G <width>x<height>x<fps>] [-f format] [device] [-r]" << std::endl;
5860
std::cout <<"\t -v : verbose" << std::endl;
5961
std::cout <<"\t -vv : very verbose" << std::endl;
6062
std::cout <<"\t -r : V4L2 capture using read interface (default use memory mapped buffers)" << std::endl;
61-
std::cout <<"\tsource_device : V4L2 capture device (default"<< in_devname <<")" << std::endl;
63+
std::cout <<"\tdevice : V4L2 capture device (default"<< in_devname <<")" << std::endl;
6264
exit(0);
6365
}
6466
}
@@ -73,7 +75,7 @@ int main(int argc, char* argv[])
7375
initLogger(verbose);
7476

7577
// init V4L2 capture interface
76-
V4L2DeviceParametersparam(in_devname,0,0,0,0, ioTypeIn, verbose);
78+
V4L2DeviceParametersparam(in_devname,format, width, height, fps, ioTypeIn, verbose);
7779
V4l2Capture* videoCapture =V4l2Capture::create(param);
7880

7981
if (videoCapture ==NULL)
@@ -84,7 +86,7 @@ int main(int argc, char* argv[])
8486
{
8587
timeval tv;
8688

87-
LOG(NOTICE) <<"Start reading from" << in_devname ;
89+
LOG(NOTICE) <<"Start reading from" << in_devname;
8890
signal(SIGINT,sighandler);
8991
while (!stop)
9092
{
@@ -102,7 +104,7 @@ int main(int argc, char* argv[])
102104
}
103105
else
104106
{
105-
LOG(DEBUG) <<"size:" << rsize;
107+
LOG(NOTICE) <<"size:" << rsize;
106108
}
107109
}
108110
elseif (ret == -1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp