[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/progs video_play_source.cc
From: |
Edward Rosten |
Subject: |
[libcvd-members] libcvd/progs video_play_source.cc |
Date: |
Tue, 25 Nov 2008 12:06:34 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Edward Rosten <edrosten> 08/11/25 12:06:34
Modified files:
progs : video_play_source.cc
Log message:
Added -mono option
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/progs/video_play_source.cc?cvsroot=libcvd&r1=1.1&r2=1.2
Patches:
Index: video_play_source.cc
===================================================================
RCS file: /cvsroot/libcvd/libcvd/progs/video_play_source.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- video_play_source.cc 28 Aug 2008 06:56:32 -0000 1.1
+++ video_play_source.cc 25 Nov 2008 12:06:34 -0000 1.2
@@ -38,26 +38,44 @@
using namespace std;
using namespace CVD;
-int main(int argc, char* argv[])
+template<class C> void play(string s)
{
- if(argc != 2)
- {
- cerr << "Error: specify the video source\n";
- return 1;
- }
- try
- {
- VideoBuffer<Rgb<byte> > *buffer = open_video_source<Rgb<byte>
>(argv[1]);
+ VideoBuffer<C> *buffer = open_video_source<C>(s);
VideoDisplay display(buffer->size());
while(buffer->frame_pending())
{
- VideoFrame<Rgb<byte> >* frame = buffer->get_frame();
+ VideoFrame<C>* frame = buffer->get_frame();
glDrawPixels(*frame);
buffer->put_frame(frame);
glFlush();
}
+}
+
+int main(int argc, char* argv[])
+{
+ bool mono=0;
+
+ int arg=1;
+
+ if(argc-1 >=1 && argv[arg] == string("-mono"))
+ {
+ arg++;
+ mono=1;
+ }
+
+ if(arg != argc-1)
+ {
+ cerr << "Error: specify the video source\n";
+ return 1;
+ }
+ try
+ {
+ if(mono)
+ play<byte>(argv[arg]);
+ else
+ play<Rgb<byte> >(argv[arg]);
}
catch(CVD::Exceptions::All& e)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd/progs video_play_source.cc,
Edward Rosten <=