Permalink
Browse files

Add verbosity flag

  • Loading branch information...
Edward Rosten
Edward Rosten committed Jul 20, 2012
1 parent 47dd9cb commit 5f09b402b1c75ad9bb165584efab0252dc05955d
Showing with 17 additions and 13 deletions.
  1. +7 −6 cvd/videosource.h
  2. +1 −1 cvd_src/videofilebuffer.cc
  3. +5 −2 cvd_src/videosource.cpp
  4. +4 −4 cvd_src/videosource_videofilebuffer.cc
View
@@ -259,15 +259,15 @@ namespace CVD {
// video file buffer
//
- template <class T> VideoBuffer<T>* makeVideoFileBuffer(const std::string& , VideoBufferFlags::OnEndOfBuffer )
+ template <class T> VideoBuffer<T>* makeVideoFileBuffer(const std::string& , VideoBufferFlags::OnEndOfBuffer, bool)
{
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);
+ template <> VideoBuffer<byte>* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob, bool verbose);
+ template <> VideoBuffer<Rgb<byte> >* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob, bool verbose);
- void get_file_options(const VideoSource& vs, int& ra_frames, VideoBufferFlags::OnEndOfBuffer& eob);
+ void get_file_options(const VideoSource& vs, int& ra_frames, VideoBufferFlags::OnEndOfBuffer& eob, bool& verbose);
////////////////////////////////////////////////////////////////////////////////
//
@@ -383,8 +383,9 @@ namespace CVD {
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);
+ bool verbose=0;
+ get_file_options(vs, ra_frames, eob, verbose);
+ VideoBuffer<T>* vb = makeVideoFileBuffer<T>(vs.identifier, eob, verbose);
if (ra_frames)
vb = new ReadAheadVideoBuffer<T>(*vb, ra_frames);
return vb;
@@ -534,7 +534,7 @@ void RawVideoFileBufferPIMPL::seek_to(double t)
}
///Public implementation of RawVideoFileBuffer
-RawVideoFileBuffer::RawVideoFileBuffer(const std::string& file, bool is_rgb)
+RawVideoFileBuffer::RawVideoFileBuffer(const std::string& file, bool is_rgb, bool)
:p(new RawVideoFileBufferPIMPL(file, is_rgb))
{}
View
@@ -363,7 +363,7 @@ namespace CVD {
- void get_file_options(const VideoSource& vs, int& ra_frames, VideoBufferFlags::OnEndOfBuffer& eob)
+ void get_file_options(const VideoSource& vs, int& ra_frames, VideoBufferFlags::OnEndOfBuffer& eob, bool& verbose)
{
eob = VideoBufferFlags::RepeatLastFrame;
for (VideoSource::option_list::const_iterator it=vs.options.begin(); it != vs.options.end(); ++it) {
@@ -380,7 +380,10 @@ namespace CVD {
eob = VideoBufferFlags::RepeatLastFrame;
else
throw VideoSourceException("invalid end-of-buffer behaviour: "+it->second+"\n\t valid options are repeat_last, unset_pending, loop");
- } else
+ }
+ else if(it->first == "verbose")
+ verbose = true;
+ else
throw VideoSourceException("invalid option for 'file' protocol: "+it->first+"\n\t valid options: read_ahead, on_end, fps");
}
}
@@ -3,16 +3,16 @@
namespace CVD{
- template <> VideoBuffer<byte>* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob)
+ template <> VideoBuffer<byte>* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob, bool verbose)
{
- VideoFileBuffer<byte>* vb = new VideoFileBuffer<byte>(file);
+ VideoFileBuffer<byte>* vb = new VideoFileBuffer<byte>(file, verbose);
vb->on_end_of_buffer(eob);
return vb;
}
- template <> VideoBuffer<Rgb<byte> >* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob)
+ template <> VideoBuffer<Rgb<byte> >* makeVideoFileBuffer(const std::string& file, VideoBufferFlags::OnEndOfBuffer eob, bool verbose)
{
- VideoFileBuffer<Rgb<byte> >* vb = new VideoFileBuffer<Rgb<byte> >(file);
+ VideoFileBuffer<Rgb<byte> >* vb = new VideoFileBuffer<Rgb<byte> >(file, verbose);
vb->on_end_of_buffer(eob);
return vb;
}

0 comments on commit 5f09b40

Please sign in to comment.