[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd cvd/videosource.h cvd/Linux/v4lbuffer.h ...
From: |
Gerhard Reitmayr |
Subject: |
[libcvd-members] libcvd cvd/videosource.h cvd/Linux/v4lbuffer.h ... |
Date: |
Wed, 25 Feb 2009 16:08:20 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Gerhard Reitmayr <gerhard> 09/02/25 16:08:19
Modified files:
cvd : videosource.h
cvd/Linux : v4lbuffer.h
cvd_src : videosource.cpp
cvd_src/Linux : v4lbuffer.cc
Log message:
added vuy422 to v4lbuffer and more detailed video format output if
verbose is set
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/videosource.h?cvsroot=libcvd&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/Linux/v4lbuffer.h?cvsroot=libcvd&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/videosource.cpp?cvsroot=libcvd&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/Linux/v4lbuffer.cc?cvsroot=libcvd&r1=1.12&r2=1.13
Patches:
Index: cvd/videosource.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/videosource.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cvd/videosource.h 26 Nov 2008 22:15:42 -0000 1.15
+++ cvd/videosource.h 25 Feb 2009 16:08:19 -0000 1.16
@@ -122,12 +122,13 @@
#if CVD_INTERNAL_HAVE_V4LBUFFER
template <class T> VideoBuffer<T>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced, bool verbose)
{
- throw VideoSourceException("V4LBuffer cannot handle types other than
byte, bayer, yuv422, Rgb<byte>");
+ throw VideoSourceException("V4LBuffer cannot handle types other than
byte, bayer, yuv422, vuy422, Rgb<byte>");
}
template <> VideoBuffer<byte>* makeV4LBuffer(const std::string& dev, const
ImageRef& size, int input, bool interlaced, bool verbose);
template <> VideoBuffer<bayer>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced, bool verbose);
template <> VideoBuffer<yuv422>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced, bool verbose);
+ template <> VideoBuffer<vuy422>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced, bool verbose);
template <> VideoBuffer<Rgb<byte> >* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced, bool verbose);
template <> VideoBuffer<Rgb8>* makeV4LBuffer(const std::string& dev, const
ImageRef& size, int input, bool interlaced, bool verbose);
Index: cvd/Linux/v4lbuffer.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/Linux/v4lbuffer.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- cvd/Linux/v4lbuffer.h 2 Dec 2008 17:30:41 -0000 1.13
+++ cvd/Linux/v4lbuffer.h 25 Feb 2009 16:08:19 -0000 1.14
@@ -97,6 +97,12 @@
static const unsigned int v4l1_palette = VIDEO_PALETTE_YUV422;
};
+ template<> struct format<vuy422>
+ {
+ static const unsigned int v4l2_fmt = V4L2_PIX_FMT_UYVY;
+ static const unsigned int v4l1_palette = VIDEO_PALETTE_UYVY;
+ };
+
template<> struct format<yuv420p>
{
static const unsigned int v4l2_fmt = V4L2_PIX_FMT_YUV420;
Index: cvd_src/videosource.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/videosource.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- cvd_src/videosource.cpp 26 Nov 2008 22:15:43 -0000 1.10
+++ cvd_src/videosource.cpp 25 Feb 2009 16:08:19 -0000 1.11
@@ -331,6 +331,10 @@
{
return new CVD::V4LBuffer<CVD::yuv422>(dev, size, input, interlaced, 0,
verbose);
}
+ template <> CVD::VideoBuffer<CVD::vuy422>* makeV4LBuffer(const
std::string& dev, const CVD::ImageRef& size, int input, bool interlaced, bool
verbose)
+ {
+ return new CVD::V4LBuffer<CVD::vuy422>(dev, size, input, interlaced, 0,
verbose);
+ }
template <> CVD::VideoBuffer<CVD::Rgb<CVD::byte> >* makeV4LBuffer(const
std::string& dev, const CVD::ImageRef& size, int input, bool interlaced, bool
verbose)
{
return new CVD::V4LBuffer<CVD::Rgb<CVD::byte> >(dev, size, input,
interlaced, 0, verbose);
Index: cvd_src/Linux/v4lbuffer.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/Linux/v4lbuffer.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- cvd_src/Linux/v4lbuffer.cc 11 Jan 2009 14:20:40 -0000 1.12
+++ cvd_src/Linux/v4lbuffer.cc 25 Feb 2009 16:08:19 -0000 1.13
@@ -107,6 +107,26 @@
return v4l2_fourcc(s[0], s[1], s[2], s[3]);
}
+void print_v4l2_framerates(int fd, unsigned int fmt, unsigned int width,
unsigned int height, VPrint & log){
+ struct v4l2_frmivalenum fr;
+ fr.pixel_format = fmt;
+ fr.width = width;
+ fr.height = height;
+ for(fr.index = 0; ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &fr) == 0;
++fr.index){
+ switch(fr.type){
+ case V4L2_FRMIVAL_TYPE_DISCRETE:
+ log << "\t\t rate discrete\t" << fr.discrete.numerator << "/"
<< fr.discrete.denominator << "\n";
+ break;
+ case V4L2_FRMIVAL_TYPE_CONTINUOUS:
+ log << "\t\t rate cont\t" << fr.stepwise.min.numerator << "/"
<< fr.stepwise.min.denominator << " - " << fr.stepwise.step.numerator << "/" <<
fr.stepwise.step.denominator << " - " << fr.stepwise.max.numerator << "/" <<
fr.stepwise.max.denominator << "\n";
+ break;
+ case V4L2_FRMIVAL_TYPE_STEPWISE:
+ log << "\t\t rate step\t" << fr.stepwise.min.numerator << "/"
<< fr.stepwise.min.denominator << " - " << fr.stepwise.step.numerator << "/" <<
fr.stepwise.step.denominator << " - " << fr.stepwise.max.numerator << "/" <<
fr.stepwise.max.denominator << "\n";
+ break;
+ default: assert(false);
+ }
+ }
+}
namespace V4L { // V4L
@@ -189,13 +209,34 @@
{
actual_fmt = f.pixelformat;
}
+ if(verbose){
+ struct v4l2_frmsizeenum fs;
+ fs.pixel_format = f.pixelformat;
+ for(fs.index = 0; ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &fs) == 0;
++fs.index){
+ switch(fs.type){
+ case V4L2_FRMSIZE_TYPE_DISCRETE:
+ log << "\t\tframe size discrete\t" << fs.discrete.width <<
"x" << fs.discrete.height << "\n";
+ print_v4l2_framerates(fd, fs.pixel_format,
fs.discrete.width, fs.discrete.height, log);
+ break;
+ case V4L2_FRMSIZE_TYPE_CONTINUOUS:
+ log << "\t\tframe size cont\t" << fs.stepwise.min_width <<
"x" << fs.stepwise.min_height << " - " << fs.stepwise.step_width << "x" <<
fs.stepwise.step_height << " - " << fs.stepwise.max_width << "x" <<
fs.stepwise.max_height << "\n";
+ print_v4l2_framerates(fd, fs.pixel_format,
fs.stepwise.max_width, fs.stepwise.max_height, log);
+ break;
+ case V4L2_FRMSIZE_TYPE_STEPWISE: {
+ log << "\t\tframe size step\t" << fs.stepwise.min_width <<
"x" << fs.stepwise.min_height << " - " << fs.stepwise.step_width << "x" <<
fs.stepwise.step_height << " - " << fs.stepwise.max_width << "x" <<
fs.stepwise.max_height << "\n";
+ print_v4l2_framerates(fd, fs.pixel_format,
fs.stepwise.max_width, fs.stepwise.max_height, log);
+ } break;
+ default: assert(false);
+ }
+ }
+ }
}
if(errno != EINVAL)
throw string("VIDIOC_ENUM_FMT");
fmt = actual_fmt;
- log << "Seleced format: " << unfourcc(fmt) << "\n";
+ log << "Selected format: " << unfourcc(fmt) << "\n";
if (strcmp((const char*)caps.driver,"bttv") == 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd cvd/videosource.h cvd/Linux/v4lbuffer.h ...,
Gerhard Reitmayr <=