00001 /*!@file Psycho/MPlayerWrapper.H Wrapper class for playing videos in MPlayer */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: John Shen <shenjohn at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Psycho/MPlayerWrapper.H $ 00035 // $Id: MPlayerWrapper.H 12962 2010-03-06 02:13:53Z irock $ 00036 // 00037 00038 #ifndef PSYCHO_MPLAYERWRAPPER_H_DEFINED 00039 #define PSYCHO_MPLAYERWRAPPER_H_DEFINED 00040 00041 #include "nub/ref.h" 00042 #include "Component/EventLog.H" 00043 #include "Psycho/PsychoDisplay.H" 00044 #include "Component/ModelComponent.H" 00045 #include "Component/ModelManager.H" 00046 #include <vector> 00047 #include <string> 00048 #include "rutz/pipe.h" 00049 00050 /// Base class for simple input-output streaming applications 00051 class MPlayerWrapper : public ModelComponent 00052 { 00053 public: 00054 00055 MPlayerWrapper(OptionManager &mgr, 00056 const std::string &descrName="Psycho Display", 00057 const std::string &tagName="PsychoDisplay"); 00058 00059 virtual ~MPlayerWrapper(); 00060 00061 int run(const int argc, const char** argv, 00062 const char* extraArgsDescription = "", 00063 const int minExtraArgs = 0, const int maxExtraArgs = 1); 00064 00065 int runfromSDL(nub::soft_ref<PsychoDisplay> D); 00066 00067 void setSourceVideo(std::string fname); 00068 00069 void setOverDisplay(nub::soft_ref<PsychoDisplay> pd); 00070 00071 //! push an event to the log, if uselinfo is true also display to the screen 00072 void pushEvent(const std::string& msg, const bool& uselinfo = false); 00073 00074 void setEventLog(nub::soft_ref<EventLog> log) {itsEventLog = log;} 00075 protected: 00076 00077 private: 00078 MPlayerWrapper(const MPlayerWrapper&); // not implemented 00079 MPlayerWrapper& operator=(const MPlayerWrapper&); // not implemented 00080 00081 int tryRun(const int argc, const char** argv, 00082 const char* extraArgsDescription, 00083 const int minExtraArgs, const int maxExtraArgs); 00084 00085 nub::ref<rutz::exec_pipe> createMPlayerPipe(); 00086 00087 void parseStatusLine(const std::string stat_line); 00088 00089 nub::soft_ref<EventLog> itsEventLog; 00090 std::string itsFileName; 00091 bool itsPlayingVideo; 00092 00093 OModelParam<bool> itsIsFullScreen; 00094 OModelParam<std::string> itsMPlayerPath; 00095 OModelParam<bool> itsIsSound; 00096 OModelParam<std::string> itsAudioDriver; 00097 OModelParam<uint> itsCacheSize; 00098 OModelParam<double> itsCachePercent; 00099 }; 00100 00101 // ###################################################################### 00102 /* So things look consistent in everyone's emacs... */ 00103 /* Local Variables: */ 00104 /* mode: c++ */ 00105 /* indent-tabs-mode: nil */ 00106 /* End: */ 00107 00108 #endif // AUDIOPROJ_MPLAYERWRAPPER_H_DEFINED