LoVideoRecorder.C

Go to the documentation of this file.
00001 /**
00002    \file  Robots/LoBot/io/LoVideoRecorder.C
00003    \brief Video recorder encapsulation for the Lobot/Robolocust project.
00004 */
00005 
00006 // //////////////////////////////////////////////////////////////////// //
00007 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00008 // by the University of Southern California (USC) and the iLab at USC.  //
00009 // See http://iLab.usc.edu for information about this project.          //
00010 // //////////////////////////////////////////////////////////////////// //
00011 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00012 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00013 // in Visual Environments, and Applications'' by Christof Koch and      //
00014 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00015 // pending; application number 09/912,225 filed July 23, 2001; see      //
00016 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00017 // //////////////////////////////////////////////////////////////////// //
00018 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00019 //                                                                      //
00020 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00021 // redistribute it and/or modify it under the terms of the GNU General  //
00022 // Public License as published by the Free Software Foundation; either  //
00023 // version 2 of the License, or (at your option) any later version.     //
00024 //                                                                      //
00025 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00026 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00027 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00028 // PURPOSE.  See the GNU General Public License for more details.       //
00029 //                                                                      //
00030 // You should have received a copy of the GNU General Public License    //
00031 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00032 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00033 // Boston, MA 02111-1307 USA.                                           //
00034 // //////////////////////////////////////////////////////////////////// //
00035 //
00036 // Primary maintainer for this file: Manu Viswanathan <mviswana at usc dot edu>
00037 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/io/LoVideoRecorder.C $
00038 // $Id: LoVideoRecorder.C 12785 2010-02-06 02:24:05Z irock $
00039 //
00040 
00041 //---------------------- ALTERNATIVE DEFINITION -------------------------
00042 
00043 // In case FFmpeg libraries are missing
00044 #ifndef INVT_HAVE_AVCODEC
00045 
00046 #include "Robots/LoBot/io/LoVideoRecorder.H"
00047 #include "Robots/LoBot/misc/LoExcept.H"
00048 
00049 namespace lobot {
00050 
00051 VideoRecorder::VideoRecorder(const std::string&, const VideoStream*)
00052    : m_source(0), m_sink()
00053 {
00054    throw missing_libs(MISSING_FFMPEG) ;
00055 }
00056 
00057 void VideoRecorder::update(){}
00058 VideoRecorder::~VideoRecorder(){}
00059 
00060 } // end of namespace encapsulating above empty definition
00061 
00062 #else
00063 
00064 //------------------------------ HEADERS --------------------------------
00065 
00066 // lobot headers
00067 #include "Robots/LoBot/io/LoVideoRecorder.H"
00068 #include "Robots/LoBot/config/LoConfigHelpers.H"
00069 
00070 //----------------------------- NAMESPACE -------------------------------
00071 
00072 namespace lobot {
00073 
00074 //-------------------------- INITIALIZATION -----------------------------
00075 
00076 // Since the recorder mostly wraps around INVT's FfmpegEncoder,
00077 // instantiation mostly involves setting up the ffmpeg encoder. Many of
00078 // the encoder's parameters are read from the config file. Hopefully
00079 // though, the hard-coded defaults specified here are good enough in case
00080 // the user has not setup the config file...
00081 VideoRecorder::
00082 VideoRecorder(const std::string& mpeg_name, const VideoStream* S)
00083    : m_source(S),
00084      m_sink(mpeg_name,
00085             video_conf("recording_codec", std::string("mpeg")),
00086             video_conf("bit_rate", 400000),
00087             video_conf("frame_rate", 25),
00088             video_conf("frame_rate_base", 1),
00089             S->frameSize(),
00090             video_conf("buffer_size", 100000))
00091 {}
00092 
00093 //-------------------------- MPEG RECORDING -----------------------------
00094 
00095 void VideoRecorder::update()
00096 {
00097    m_sink.writeRGB(m_source->readFrame()) ;
00098 }
00099 
00100 //----------------------------- CLEAN-UP --------------------------------
00101 
00102 VideoRecorder::~VideoRecorder(){}
00103 
00104 //-----------------------------------------------------------------------
00105 
00106 } // end of namespace encapsulating this file's definitions
00107 
00108 #endif // #ifndef INV_HAVE_AVCODEC
00109 
00110 /* So things look consistent in everyone's emacs... */
00111 /* Local Variables: */
00112 /* indent-tabs-mode: nil */
00113 /* End: */
Generated on Sun May 8 08:41:30 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3