[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd Makefile.in cvd/videosource.h cvd_src/vi...
From: |
Ethan Eade |
Subject: |
[libcvd-members] libcvd Makefile.in cvd/videosource.h cvd_src/vi... |
Date: |
Thu, 28 Sep 2006 17:14:48 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Ethan Eade <ethaneade> 06/09/28 17:14:48
Modified files:
. : Makefile.in
Added files:
cvd : videosource.h
cvd_src : videosource.cpp
Log message:
Added video source url functionality, somewhat like what was discussed a
while ago:
Call open_video_source<T>(url) to get a VideoBuffer<T>*.
url syntax:
url := protocol ':' [ '[' options ']' ] // identifier
protocol := "files" | "file" | "v4l2" | "dc1394"
options := option [ ',' options ]
option := name [ '=' value ]
identifier and values can be quoted literals with escapes, all other
text is unquoted.
Examples:
Open a DiskBuffer2 for *.pgm in /local/capture/:
files:///local/capture/*.pgmKilled by signal 2.
files:///local/capture/*.pgm
Open a DiskBuffer2 that loops and uses a ReadAheadVideoBuffer wrapper
with
40 frame buffer, with 30 fps:
files:[read_ahead=40, fps=30, on_end=loop]///local/capture/*.pgm
Open a V4L2 device at /dev/video0:
v4l2:///dev/video0
Open a V4L2 device with fields on input 2:
v4l2:[input=2,fields]///dev/video0
Open firewire camera 1 with 3 dma bufs and default brightness/exposure
and fps:
dc1394:[dma_bufs=3]//1
Open an avi file relative to the current directory:
file://../../stuff/movie.avi
'files' protocol (DiskBuffer2): identifier is glob pattern
fps = <number>
read_ahead [= <number>] (default is 50 if specified without
value)
on_end = repeat_last | unset_pending | loop (default is
repeat_last)
'file' protocol (VideoFileBuffer): identifier is path to file
read_ahead [= <number>] (default is 50 if specified without
value)
on_end = repeat_last | unset_pending | loop (default is
repeat_last)
'v4l2' protocol (V4LBuffer): identifier is device name
size = vga | qvga | pal | ntsc | <width>x<height> (default vga)
input = <number>
interlaced | fields [= true | false | yes | no]
'dc1394' protocol (DVBuffer): identifier is camera number
fps = <number> (default 30)
dma_bufs | dma_buffers = <number> (default 3)
brightness | bright = <number> (default -1)
exposure | exp = <number> (default -1)
open_video_source can take a std::string or a std::istream.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/Makefile.in?cvsroot=libcvd&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/videosource.h?cvsroot=libcvd&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/videosource.cpp?cvsroot=libcvd&rev=1.1
Patches:
Index: Makefile.in
===================================================================
RCS file: /cvsroot/libcvd/libcvd/Makefile.in,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- Makefile.in 28 Jul 2006 14:05:40 -0000 1.48
+++ Makefile.in 28 Sep 2006 17:14:47 -0000 1.49
@@ -106,8 +106,8 @@
cvd_src/fast/address@hidden@address@hidden@.o
\
cvd_src/fast/address@hidden@address@hidden@.o
\
cvd_src/fast/address@hidden@address@hidden@.o
\
- cvd_src/timeddiskbuffer.o
-
+ cvd_src/timeddiskbuffer.o \
+ cvd_src/videosource.o
################################################################################
#
# Stuff requiring TooN
Index: cvd/videosource.h
===================================================================
RCS file: cvd/videosource.h
diff -N cvd/videosource.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ cvd/videosource.h 28 Sep 2006 17:14:47 -0000 1.1
@@ -0,0 +1,166 @@
+#ifndef VIDEOSOURCE_H
+#define VIDEOSOURCE_H
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+#include <cstdlib>
+
+#include <cvd/config.h>
+
+#include <cvd/diskbuffer2.h>
+#include <cvd/readaheadvideobuffer.h>
+
+#if CVD_HAVE_FFMPEG
+#include <cvd/videofilebuffer.h>
+#endif
+
+#if CVD_HAVE_V4L2BUFFER
+#include <cvd/Linux/v4lbuffer.h>
+#endif
+
+#if CVD_HAVE_DVBUFFER
+#include <cvd/Linux/dvbuffer.h>
+#endif
+
+namespace CVD {
+ struct ParseException : public Exceptions::All
+ {
+ ParseException(const std::string& what_) { what = what_; }
+ };
+
+ struct VideoSourceException : public Exceptions::All
+ {
+ VideoSourceException(const std::string& what_) { what = what_; }
+ };
+
+ struct VideoSource
+ {
+ std::string protocol;
+ std::string identifier;
+ typedef std::vector<std::pair<std::string,std::string> > option_list;
+ option_list options;
+ };
+
+ std::ostream& operator<<(std::ostream& out, const VideoSource& vs);
+
+ void parse(std::istream& in, VideoSource& vs);
+
+ template <class T> VideoBuffer<T>* makeDiskBuffer2(const
std::vector<std::string>& files, double fps, VideoBufferFlags::OnEndOfBuffer
eob)
+ {
+ return new DiskBuffer2<T>(files, fps, eob);
+ }
+
+ void get_files_options(const VideoSource& vs, int& fps, int& ra_frames,
VideoBufferFlags::OnEndOfBuffer& eob);
+
+#if CVD_HAVE_V4L2BUFFER
+ template <class T> VideoBuffer<T>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced)
+ {
+ throw VideoSourceException("V4LBuffer cannot handle types other than
byte, bayer, yuv422, Rgb<byte>");
+ }
+
+ template <> VideoBuffer<byte>* makeV4LBuffer(const std::string& dev, const
ImageRef& size, int input, bool interlaced);
+ template <> VideoBuffer<bayer>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced);
+ template <> VideoBuffer<yuv422>* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced);
+ template <> VideoBuffer<Rgb<byte> >* makeV4LBuffer(const std::string& dev,
const ImageRef& size, int input, bool interlaced);
+
+ void get_v4l2_options(const VideoSource& vs, ImageRef& size, int& input,
bool& interlaced);
+
+#endif
+
+
+#if CVD_HAVE_FFMPEG
+ template <class T> VideoBuffer<T>* makeVideoFileBuffer(const std::string&
file, VideoBufferFlags::OnEndOfBuffer eob)
+ {
+ throw VideoSourceException("VideoFileBuffer cannot handle types other
than byte, Rgb<byte>");
+ }
+
+ template <> VideoBuffer<byte>* makeVideoFileBuffer(const std::string&
file, VideoBufferFlags::OnEndOfBuffer eob);
+ template <> VideoBuffer<Rgb<byte> >* makeVideoFileBuffer(const
std::string& file, VideoBufferFlags::OnEndOfBuffer eob);
+
+ void get_file_options(const VideoSource& vs, int& ra_frames,
VideoBufferFlags::OnEndOfBuffer& eob);
+
+#endif
+
+#if CVD_HAVE_DVBUFFER
+ template <class T> VideoBuffer<T>* makeDVBuffer2(int cam, int dmabufs, int
bright, int exposure, int fps)
+ {
+ throw VideoSourceException("DVBuffer2 cannot handle types other than
byte, Rgb<byte>");
+ }
+
+ template <> VideoBuffer<byte>* makeDVBuffer2(int cam, int dmabufs, int
bright, int exposure, int fps);
+ template <> VideoBuffer<Rgb<byte> >* makeDVBuffer2(int cam, int dmabufs,
int bright, int exposure, int fps);
+
+ void get_dc1394_options(const VideoSource& vs, int& dma_bufs, int& bright,
int& exposure, int& fps);
+
+#endif
+
+ template <class T> VideoBuffer<T>* open_video_source(const VideoSource& vs)
+ {
+ if (vs.protocol == "files") {
+ int fps, ra_frames=0;
+ VideoBufferFlags::OnEndOfBuffer eob;
+ get_files_options(vs, fps, ra_frames, eob);
+ VideoBuffer<T>* vb = makeDiskBuffer2<T>(globlist(vs.identifier),
fps, eob);
+ if (ra_frames)
+ vb = new ReadAheadVideoBuffer<T>(*vb, ra_frames);
+ return vb;
+ }
+#if CVD_HAVE_V4L2BUFFER
+ else if (vs.protocol == "v4l2") {
+ ImageRef size;
+ int input;
+ bool interlaced;
+ get_v4l2_options(vs, size, input, interlaced);
+ return makeV4LBuffer<T>(vs.identifier, size, input, interlaced);
+ }
+#endif
+#if CVD_HAVE_DVBUFFER
+ else if (vs.protocol == "dc1394") {
+ int cam_no = atoi(vs.identifier.c_str());
+ int dma_bufs, bright, exposure, fps;
+ get_dc1394_options(vs, dma_bufs, bright, exposure, fps);
+ return makeDVBuffer2<T>(cam_no, dma_bufs, bright, exposure, fps);
+ }
+#endif
+#if CVD_HAVE_FFMPEG
+ else if (vs.protocol == "file") {
+ int ra_frames = 0;
+ VideoBufferFlags::OnEndOfBuffer eob;
+ get_file_options(vs, ra_frames, eob);
+ VideoBuffer<T>* vb = makeVideoFileBuffer<T>(vs.identifier, eob);
+ if (ra_frames)
+ vb = new ReadAheadVideoBuffer<T>(*vb, ra_frames);
+ return vb;
+ }
+#endif
+ else
+ throw VideoSourceException("undefined video source protocol: '" +
vs.protocol + "'\n\t valid protocols: "
+#if CVD_HAVE_FFMPEG
+ "file, "
+#endif
+#if CVD_HAVE_V4L2BUFFER
+ "v4l2, "
+#endif
+#if CVD_HAVE_DVBUFFER
+ "dc1394, "
+#endif
+ "files");
+ }
+
+ template <class T> VideoBuffer<T>* open_video_source(std::istream& in)
+ {
+ VideoSource vs;
+ parse(in, vs);
+ return open_video_source<T>(vs);
+ }
+
+ template <class T> VideoBuffer<T>* open_video_source(const std::string&
src)
+ {
+ std::istringstream in(src);
+ return open_video_source<T>(in);
+ }
+}
+
+#endif
Index: cvd_src/videosource.cpp
===================================================================
RCS file: cvd_src/videosource.cpp
diff -N cvd_src/videosource.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ cvd_src/videosource.cpp 28 Sep 2006 17:14:48 -0000 1.1
@@ -0,0 +1,363 @@
+#include <cvd/videosource.h>
+#include <cvd/byte.h>
+#include <cvd/colourspaces.h>
+
+namespace CVD {
+
+ std::string escape(char c)
+ {
+ static std::string escaped[256];
+ static bool init = false;
+ if (!init) {
+ for (int i=0; i<256; ++i)
+ escaped[i] = std::string(1,static_cast<char>(i));
+ escaped[(unsigned char)'\a'] = "\\a";
+ escaped[(unsigned char)'\b'] = "\\b";
+ escaped[(unsigned char)'\f'] = "\\f";
+ escaped[(unsigned char)'\n'] = "\\n";
+ escaped[(unsigned char)'\r'] = "\\r";
+ escaped[(unsigned char)'\t'] = "\\t";
+ escaped[(unsigned char)'\v'] = "\\v";
+ escaped[(unsigned char)'\\'] = "\\\\";
+ escaped[(unsigned char)'\''] = "\\'";
+ escaped[(unsigned char)'\"'] = "\\\"";
+ init = true;
+ }
+ return escaped[(unsigned char)c];
+ }
+
+ std::string unescape(const std::string& s)
+ {
+ static const char mapping[][2] = {{'a','\a'},
+ {'b','\b'},
+ {'f','\f'},
+ {'n','\n'},
+ {'r','\r'},
+ {'t','\t'},
+ {'v','\v'},
+ {'\\','\\'},
+ {'\'','\''},
+ {'"','"'},
+ {0,0}};
+ std::string ret;
+ ret.reserve(s.length());
+ for (size_t i=0; i<s.length(); ++i) {
+ if (s[i] == '\\') {
+ if (i + 1 == s.length())
+ throw ParseException("illegal '\\' terminating literal");
+ char escape = s[i+1];
+ if (isdigit(escape)) {
+ if (i + 3 >= s.length() || (s[i+2] < '0' || s[i+2] > '7')
|| (s[i+3] < '0' || s[i+3] > '7'))
+ throw ParseException("partial octal character code;
need three digits");
+ int code = (escape-'0')*64 + (s[i+2] - '0')*8 + s[i+3] -
'0';
+ if (code > 255)
+ throw ParseException("invalid octal character code;
must be in [000,377]");
+ ret += static_cast<char>(code);
+ i += 3;
+ } else if (escape == 'h') {
+ if (i+3 >= s.length() || !isxdigit(s[i+2]) ||
!isxdigit(s[i+3]))
+ throw ParseException("partial hex character code; need
two hex digits");
+ int code = (isdigit(s[i+2]) ? (s[i+2]-'0') :
(tolower(s[i+2])-'a' + 10))*16 +
+ (isdigit(s[i+3]) ? (s[i+3]-'0') : (tolower(s[i+3])-'a'
+ 10));
+ ret += static_cast<char>(code);
+ i += 3;
+ } else {
+ int j=0;
+ while (mapping[j][0] && mapping[j][0] != s[i+1])
+ ++j;
+ if (!mapping[j][0])
+ throw ParseException("unknown escape sequence");
+ ret += mapping[j][1];
+ i += 1;
+ }
+ } else
+ ret += s[i];
+ }
+ return ret;
+ }
+
+ std::ostream& operator<<(std::ostream& out, const VideoSource& vs)
+ {
+ out << vs.protocol << ":";
+ if (!vs.options.empty()) {
+ out << "[ ";
+ for (VideoSource::option_list::const_iterator it =
vs.options.begin(); it != vs.options.end(); ++it) {
+ out << it->first << "=" << it->second << ", ";
+ }
+ out << "]";
+ }
+ out << "//" << vs.identifier;
+ return out;
+ }
+
+ void match(std::istream& in, char c) {
+ if (in.peek() != c) {
+ std::ostringstream oss;
+ oss << "expected '" << c <<"', got '" << escape(in.peek()) << "'";
+ throw ParseException(oss.str());
+ }
+ in.ignore();
+ }
+
+ void skip_ws(std::istream& in) {
+ while (isspace(in.peek()))
+ in.ignore();
+ }
+
+ std::string read_quoted_literal(std::istream& in)
+ {
+ std::string value;
+ match(in, '"');
+ while (in.peek() != '"') {
+ char c = in.get();
+ value += c;
+ if (c == '\\')
+ value += in.get();
+ }
+ match(in,'"');
+ return value;
+ }
+
+ std::string read_word(std::istream& in)
+ {
+ std::string word;
+ while (isalnum(in.peek()) || in.peek()=='_')
+ word += in.get();
+ return word;
+ }
+
+ std::string read_path(std::istream& in)
+ {
+ std::string word;
+ while (isgraph(in.peek()))
+ word += in.get();
+ return word;
+ }
+
+
+ void tolower(std::string& s)
+ {
+ for (size_t i=0; i<s.length(); ++i)
+ s[i] = ::tolower(s[i]);
+ }
+
+ void parse(std::istream& in, VideoSource& vs)
+ {
+ std::string prot;
+ skip_ws(in);
+ while (isalnum(in.peek()))
+ prot += in.get();
+ if (prot.length() == 0)
+ throw ParseException("protocol must not be empty");
+ vs.protocol = prot;
+ //std::cerr << "prot" << std::endl;
+ if (in.peek() != ':')
+ throw ParseException("expected ':' after protocol");
+ in.ignore();
+ if (in.peek() == '[') {
+ in.ignore();
+ while (true) {
+ skip_ws(in);
+ std::string name = read_word(in);
+ tolower(name);
+ //std::cerr << "opt: " << name << std::endl;
+ skip_ws(in);
+
+ if (in.peek() != '=')
+ vs.options.push_back(std::make_pair(name,""));
+ else {
+ in.ignore();
+ skip_ws(in);
+ if (in.peek() == '"') {
+
vs.options.push_back(std::make_pair(name,unescape(read_quoted_literal(in))));
+ } else {
+
vs.options.push_back(std::make_pair(name,read_word(in)));
+ }
+ }
+ skip_ws(in);
+ if (in.peek() != ',')
+ break;
+ in.ignore();
+ }
+ skip_ws(in);
+ match(in, ']');
+ //std::cerr << "options" << std::endl;
+ }
+ match(in, '/');
+ match(in, '/');
+ //std::cerr << "slashes" << std::endl;
+ if (in.peek() == '"') {
+ std::string id = read_quoted_literal(in);
+ vs.identifier = unescape(id);
+ //std::cerr << "quoted id" << std::endl;
+ } else {
+ std::string id = read_path(in);
+ vs.identifier = id;
+ //std::cerr << "id" << std::endl;
+ }
+
+ }
+
+ void get_files_options(const VideoSource& vs, int& fps, int& ra_frames,
VideoBufferFlags::OnEndOfBuffer& eob)
+ {
+ fps = 30;
+ ra_frames = 0;
+ eob = VideoBufferFlags::RepeatLastFrame;
+ for (VideoSource::option_list::const_iterator it=vs.options.begin(); it
!= vs.options.end(); ++it) {
+ if (it->first == "fps") {
+ fps = atoi(it->second.c_str());
+ } else if (it->first == "read_ahead") {
+ ra_frames = 50;
+ if (it->second.length())
+ ra_frames = atoi(it->second.c_str());
+ } else if (it->first == "on_end") {
+ if (it->second == "loop")
+ eob = VideoBufferFlags::Loop;
+ else if (it->second == "unset_pending")
+ eob = VideoBufferFlags::UnsetPending;
+ else if (it->second == "repeat_last")
+ eob = VideoBufferFlags::RepeatLastFrame;
+ else
+ throw VideoSourceException("invalid end-of-buffer
behaviour: "+it->second+"\n\t valid options are repeat_last, unset_pending,
loop");
+ } else
+ throw VideoSourceException("invalid option for files protocol:
"+it->first +
+ "\n\t valid options: read_ahead,
on_end, fps");
+ }
+ }
+
+
+#if CVD_HAVE_V4L2BUFFER
+ template <> CVD::VideoBuffer<CVD::byte>* makeV4LBuffer(const std::string&
dev, const CVD::ImageRef& size, int input, bool interlaced)
+ {
+ return new CVD::V4LBuffer<CVD::byte>(dev, size, input, interlaced);
+ }
+
+ template <> CVD::VideoBuffer<CVD::bayer>* makeV4LBuffer(const std::string&
dev, const CVD::ImageRef& size, int input, bool interlaced)
+ {
+ return new CVD::V4LBuffer<CVD::bayer>(dev, size, input, interlaced);
+ }
+ template <> CVD::VideoBuffer<CVD::yuv422>* makeV4LBuffer(const
std::string& dev, const CVD::ImageRef& size, int input, bool interlaced)
+ {
+ return new CVD::V4LBuffer<CVD::yuv422>(dev, size, input, interlaced);
+ }
+ template <> CVD::VideoBuffer<CVD::Rgb<CVD::byte> >* makeV4LBuffer(const
std::string& dev, const CVD::ImageRef& size, int input, bool interlaced)
+ {
+ return new CVD::V4LBuffer<CVD::Rgb<CVD::byte> >(dev, size, input,
interlaced);
+ }
+
+ void get_v4l2_options(const VideoSource& vs, ImageRef& size, int& input,
bool& interlaced)
+ {
+ size = ImageRef(640,480);
+ input = -1;
+ interlaced = false;
+ for (VideoSource::option_list::const_iterator it=vs.options.begin(); it
!= vs.options.end(); ++it) {
+ if (it->first == "size") {
+ std::string s = it->second;
+ tolower(s);
+ if (s == "vga")
+ size = ImageRef(640,480);
+ else if (s == "qvga")
+ size = ImageRef(320,240);
+ else if (s == "pal")
+ size = ImageRef(720,576);
+ else if (s == "ntsc")
+ size = ImageRef(720,480);
+ else {
+ std::istringstream size_in(s);
+ char x;
+ if (!(size_in >> size.x >> x >> size.y))
+ throw ParseException("invalid image size specification:
'"+it->second+"'\n\t valid specs: vga, qvga, pal, ntsc, <width>x<height>");
+ }
+ } else if (it->first == "input") {
+ input = atoi(it->second.c_str());
+ } else if (it->first == "interlaced" || it->first == "fields") {
+ if (it->second.length()) {
+ std::string s = it->second;
+ tolower(s);
+ if (s == "true" || s=="yes")
+ interlaced = true;
+ else if (s == "false" || s == "no")
+ interlaced = false;
+ else
+ throw ParseException("invalid interlaced/fields setting
'"+s+"' (must be true/false or yes/no)");
+ } else
+ interlaced = true;
+ } else
+ throw VideoSourceException("invalid option for 'v4l2' protocol:
"+it->first+"\n\t valid options: size, input, interlaced, fields");
+ }
+ }
+
+#endif
+
+#if CVD_HAVE_FFMPEG
+ template <> CVD::VideoBuffer<CVD::byte>* makeVideoFileBuffer(const
std::string& file, CVD::VideoBufferFlags::OnEndOfBuffer eob)
+ {
+ CVD::VideoFileBuffer<CVD::byte>* vb = new
CVD::VideoFileBuffer<CVD::byte>(file);
+ vb->on_end_of_buffer(eob);
+ return vb;
+ }
+
+ template <> CVD::VideoBuffer<CVD::Rgb<CVD::byte> >*
makeVideoFileBuffer(const std::string& file,
CVD::VideoBufferFlags::OnEndOfBuffer eob)
+ {
+ CVD::VideoFileBuffer<CVD::Rgb<CVD::byte> >* vb = new
CVD::VideoFileBuffer<CVD::Rgb<CVD::byte> >(file);
+ vb->on_end_of_buffer(eob);
+ return vb;
+ }
+
+ void get_file_options(const VideoSource& vs, int& ra_frames,
VideoBufferFlags::OnEndOfBuffer& eob)
+ {
+ eob = VideoBufferFlags::RepeatLastFrame;
+ for (VideoSource::option_list::const_iterator it=vs.options.begin(); it
!= vs.options.end(); ++it) {
+ if (it->first == "read_ahead") {
+ ra_frames = 50;
+ if (it->second.length())
+ ra_frames = atoi(it->second.c_str());
+ } else if (it->first == "on_end") {
+ if (it->second == "loop")
+ eob = VideoBufferFlags::Loop;
+ else if (it->second == "unset_pending")
+ eob = VideoBufferFlags::UnsetPending;
+ else if (it->second == "repeat_last")
+ eob = VideoBufferFlags::RepeatLastFrame;
+ else
+ throw VideoSourceException("invalid end-of-buffer
behaviour: "+it->second+"\n\t valid options are repeat_last, unset_pending,
loop");
+ } else
+ throw VideoSourceException("invalid option for 'file' protocol:
"+it->first+"\n\t valid options: read_ahead, on_end, fps");
+ }
+ }
+
+#endif
+
+#if CVD_HAVE_DVBUFFER
+ template <> CVD::VideoBuffer<CVD::byte>* makeDVBuffer2(int cam, int
dmabufs, int bright, int exposure, int fps)
+ {
+ return new CVD::DVBuffer2<CVD::byte>(cam,dmabufs,bright,exposure,fps);
+ }
+
+ template <> CVD::VideoBuffer<CVD::Rgb<CVD::byte> >* makeDVBuffer2(int cam,
int dmabufs, int bright, int exposure, int fps)
+ {
+ return new CVD::DVBuffer2<CVD::Rgb<CVD::byte>
>(cam,dmabufs,bright,exposure,fps);
+ }
+
+ void get_dc1394_options(const VideoSource& vs, int& dma_bufs, int& bright,
int& exposure, int& fps)
+ {
+ dma_bufs = 3;
+ bright = -1;
+ exposure = -1;
+ fps = 30;
+ for (VideoSource::option_list::const_iterator it=vs.options.begin(); it
!= vs.options.end(); ++it) {
+ if (it->first == "fps")
+ fps = atoi(it->second.c_str());
+ else if (it->first == "dma_bufs" || it->first == "dma_buffers")
+ dma_bufs = atoi(it->second.c_str());
+ else if (it->first == "brightness" || it->first == "bright")
+ bright = atoi(it->second.c_str());
+ else if (it->first == "exp" || it->first == "exposure")
+ exposure = atoi(it->second.c_str());
+ else
+ throw VideoSourceException("invalid option for dc1394 protocol:
"+it->first+"\n\t valid options: dma_bufs, brightness, exposure, fps");
+ }
+ }
+#endif
+
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd Makefile.in cvd/videosource.h cvd_src/vi...,
Ethan Eade <=