Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

avccontroller.hh

00001 /*
00002  * PIAVE - PIAVE Is A Video Editor
00003  *
00004  * Copyright (C) 2002 Rolf Dubitzky, rolf@dubitzky.de
00005  *
00006  */
00007 
00008 /*
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023 
00024 
00030 #if ! defined( AVCCONTROLLER_HH )
00031 #define AVCCONTROLLER_HH
00032 
00033 // stdc
00034 #include <signal.h>
00035 #include <unistd.h>
00036 #include <fcntl.h>
00037 #include <sys/stat.h>
00038 #include <sys/time.h>
00039 
00040 // stdc++
00041 #include <string>
00042 
00043 // PIAVE
00044 #include "piave_base.hh"
00045 #include "storybase.hh"
00046 
00047 // IEEE1394
00048 #include <libraw1394/raw1394.h>
00049 #include <libraw1394/csr.h>
00050 #include <libdv/dv1394.h>
00051 
00052 namespace PIAVE {
00053 
00054     /*
00055      *  \class AVCController
00056      */
00057 
00058     class AVCController
00059     {
00060       public:
00061         enum ControllerState { 
00062             uninitialized, 
00063             error, 
00064             not_connected, 
00065             connected 
00066         };
00067         
00068       public:
00069         static AVCController * inst() { 
00070             if (!_singleton) _singleton = new AVCController();
00071             return _singleton; 
00072         }
00073 
00074         ControllerState  getState() const { return _controllerState; }
00075         int              getPort()   const { return _port; }
00076         int              getNPorts() const { return _nports; }
00077         quadlet_t        getCamState();
00078         std::string      getCamStateName();
00079         std::string      getTimeCode();
00080         raw1394handle_t  getRaw1394Handle() const { return _raw1394_handle; }
00081 
00082         void             setControllerState( ControllerState state ) { _controllerState = state; }
00083         void             setPort( int port ) { _port = port; }
00084 
00085         int              findAVCNode( int phyID = 0 );
00086 
00087         void             init();
00088 
00089         void             vcrStop();
00090         void             vcrPause();
00091         void             vcrPlay();
00092         void             vcrPlaySlow();
00093         void             vcrReverse();
00094         void             vcrReverseSlow();
00095         void             vcrTrickPlay( int speed );
00096         void             vcrRewind();
00097         void             vcrForward();
00098         void             vcrNext();
00099         void             vcrPrevious();
00100 
00101         void             vcrSeekTimeCode( std::string timecode );
00102         
00103       private:
00104         AVCController();
00105         ~AVCController(){};
00106 
00107         static int reset_handler( raw1394handle_t handle, unsigned int generation );
00108 
00109       private:
00110         ControllerState     _controllerState;
00111 
00112         raw1394handle_t     _raw1394_handle;
00113         int                 _nports;
00114         int                 _port;
00115         int                 _avc_node;
00116 
00117         static AVCController * _singleton;
00118 
00119     };
00120 
00121 
00122 }
00123 
00124 #endif

Generated on Tue Oct 14 20:45:36 2003 for piave by doxygen1.2.18