libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd cvd/documentation.h cvd/videosource.h cv...


From: Edward Rosten
Subject: [libcvd-members] libcvd cvd/documentation.h cvd/videosource.h cv...
Date: Thu, 28 Aug 2008 18:23:08 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        08/08/28 18:23:08

Modified files:
        cvd            : documentation.h videosource.h 
        cvd_src        : videosource.cpp 
        progs          : calibrate.cxx 

Log message:
        Added readahead option for jpegstream in videosource.
        
        As a consequence, the video flushing has been reinstated for calibrate
        since frame_pending wotks properly from a ReadAheadBuffer on a live 
stream.
        
        Note that calibrate will hang if used with a jpegstream with no 
readahead
        set, since it will keep on flushing for ever.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/documentation.h?cvsroot=libcvd&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/videosource.h?cvsroot=libcvd&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd_src/videosource.cpp?cvsroot=libcvd&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/libcvd/progs/calibrate.cxx?cvsroot=libcvd&r1=1.7&r2=1.8

Patches:
Index: cvd/documentation.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/documentation.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- cvd/documentation.h 18 Aug 2008 23:15:05 -0000      1.20
+++ cvd/documentation.h 28 Aug 2008 18:23:07 -0000      1.21
@@ -64,9 +64,12 @@
                        - DMedia video capture
                  - OSX
                                - QuickTime video capture
+                 - All UNIX platforms
+                       - Live capture from HTTP server push JPEG cameras.
                  - All platforms
                        - AVI and MPEG file (all codecs supported by ffmpeg)
                        - list of images
+                               - Server push multipart JPEG streams.
                  - Convenient run-time selection using a URL-like syntax
     - Colorspace conversions on images and video streams
     - Various image processing tools

Index: cvd/videosource.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/videosource.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- cvd/videosource.h   28 Aug 2008 06:56:32 -0000      1.12
+++ cvd/videosource.h   28 Aug 2008 18:23:07 -0000      1.13
@@ -82,6 +82,7 @@
     {
        throw VideoSourceException("DiskBuffer2 cannot handle type yuv422");
     }
+    void get_jpegstream_options(const VideoSource& vs, int& fps);
 
 
        
@@ -173,9 +174,23 @@
 
     template <class T> VideoBuffer<T>* open_video_source(const VideoSource& vs)
     {
+       using std::auto_ptr;
        if(vs.protocol == "jpegstream")
        {
-           return makeJPEGStream<T>(vs.identifier);
+               int ra_frames=0;
+               get_jpegstream_options(vs, ra_frames);
+
+               auto_ptr<VideoBuffer<T> > 
jpeg_buffer(makeJPEGStream<T>(vs.identifier));
+
+               if(ra_frames == 0)
+                       return jpeg_buffer.release();
+               else
+               {
+                       auto_ptr<VideoBuffer<T> > b(new 
ReadAheadVideoBuffer<T>(*(jpeg_buffer.get()), ra_frames));
+                       auto_ptr<VideoBufferData> h(new 
VideoBufferDataAuto<VideoBuffer<T> >(jpeg_buffer.release()));
+                       b->extra_data = h;
+                       return b.release();
+               }
        }
 #if CVD_HAVE_GLOB
        else if (vs.protocol == "files") {
@@ -332,6 +347,11 @@
 @verbatim
 jpegstream:///tmp/video
 @endverbatim
+If the argument is provided from a ahell such as BASH, then then
+redirection can be used:
address@hidden
+jpegstream://<(wget http//my.camera/file_representing_video -O - )
address@hidden
 
 
 
@@ -365,6 +385,7 @@
       showsettings = 0 | 1 (default 0)
 
 'jpegstream' protocol (ServerPushJpegBuffer): identifier is path to file
+       read_ahead  [= <number>] (default is 50 if specified without value)
 
 @endverbatim
 

Index: cvd_src/videosource.cpp
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd_src/videosource.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cvd_src/videosource.cpp     28 Aug 2008 04:16:43 -0000      1.7
+++ cvd_src/videosource.cpp     28 Aug 2008 18:23:08 -0000      1.8
@@ -198,6 +198,22 @@
     
     }
 
+    void get_jpegstream_options(const VideoSource& vs, int& ra_frames)
+    {
+       ra_frames = 0;
+
+       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
+               throw VideoSourceException("invalid option for files protocol: 
"+it->first +
+                                          "\n\t valid options: read_ahead");
+       }
+    }
+
     void get_files_options(const VideoSource& vs, int& fps, int& ra_frames, 
VideoBufferFlags::OnEndOfBuffer& eob)
     {
        fps = 30;

Index: progs/calibrate.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/progs/calibrate.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- progs/calibrate.cxx 28 Aug 2008 07:29:16 -0000      1.7
+++ progs/calibrate.cxx 28 Aug 2008 18:23:08 -0000      1.8
@@ -729,11 +729,11 @@
        }
            
        VideoFrame<CAMERA_PIXEL>* vframe = videoBuffer->get_frame();
-       /*while(videoBuffer->frame_pending())
+       while(videoBuffer->frame_pending())
        {
            videoBuffer->put_frame(vframe);
            vframe = videoBuffer->get_frame();
-       }*/
+       }
        // leave this in, we cannot assume that vframe has a datatype that can 
be
        // directly used in the glTexImage call later on (e.g. its yuv422 on 
OSX)
        Image<byte> temp = convert_image(*vframe);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]