00001 /*************************************************************************** 00002 l1394_avcvcr.h - description 00003 ------------------- 00004 begin : Fri Nov 24 2000 00005 copyright : (C) 2000-2004 by Michael Repplinger 00006 email : repplinger@cs.uni-sb.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef L1394AVCVCR_H 00019 #define L1394AVCVCR_H 00020 #include "l1394_resource.h" 00021 #include "l1394_vcr.h" 00022 #include "l1394_avcregister.h" 00023 00024 00025 namespace L1394{ 00026 /*! \class AvcVcr 00027 * \ingroup L1394_Device 00028 * \brief This class implements the interface of a vcr defined in 'AV/C Tape 00029 * Recorder/Player Subunit specification'(Version 2.1). 00030 * 00031 * The mechanism to create commands is the same as described in class Vcr. 00032 * 00033 * This class implements two Vcr interfaces. The first interface is described 00034 * in class Vcr. The second one is an implementation of the controlling mechanism 00035 * defined in 'AV/C Tape Recorder Player Subunit Specification'. The difference between 00036 * the two interfaces is the meaning of functions. For example the play() function 00037 * of the first interface start a vcr. In the second one the play(int value) method means 00038 * the Play group, where the value specify how to play, like forward, backward, nextFrame and so on. 00039 * The functions from the first interface are mapped to the functions of the second one.<BR> 00040 * 00041 * The example from class Vcr can be changed: 00042 * 00043 * \code 00044 * AvcVcr* my_vcr = session->findAvcVcr(); 00045 * if( my_vcr->fastForward()->hasFeature() ) //should normally be true. 00046 * { 00047 * int vcr_response = my_vcr->fastForward()->send(); //normal vcr interface command 00048 * int avc_vcr_respone = my_vcr->play(0x75)->send(); //avc_vcr interface to start a vcr. 00049 * switch(response) //for all response codes see method send() in class AvcRegister. 00050 * { 00051 * case ACCEPTED : cout << "Starting the Vcr" << endl; break; 00052 * case REJECTED : cout << "Couldn't start the Vcr" << endl; break; 00053 * default : cout << "Unhandled case" << endl; break; 00054 * } 00055 * } 00056 * \endcode 00057 * 00058 * If you like to use the AV/C vcr interface, you can cast the vcr, or 00059 * get explicit an AvcVcr from the Session class. 00060 * 00061 * See AV/C tape recorder/player subunit specification and tutorial for more information 00062 * 00063 *@author Michael Repplinger 00064 */ 00065 class FcpNode; 00066 class AvcVcr : public Vcr 00067 { 00068 public: 00069 /*! \name AvcVcr constructor 00070 * These functions creates an AvcVcr. 00071 */ 00072 //@{ 00073 00074 /*! \fn AvcVcr(FcpNode* parent_node, const int subunit_value) 00075 * \brief This method creates a AvcVcr. 00076 * \param FcpNode* : pointer to the parent node. 00077 * \param subunit_value : The subunit value defines the subunit-type and the subunit-id of the device. 00078 */ 00079 AvcVcr(FcpNode* parent_node, const int subunit_value); 00080 00081 /*! \fn ~AvcVcr() 00082 * \brief destructor 00083 */ 00084 virtual ~AvcVcr(); 00085 //@} 00086 00087 /*! \fn start() 00088 * \brief This method starts the Vcr and the Iso-Receive. 00089 * \return int : returns L1394_SUCCESS, if the device start. 00090 */ 00091 int start() ; 00092 00093 00094 00095 /*! \fn stop() 00096 * \brief This method stops a Vcr. 00097 * \return int : returns L1394_SUCCESS if the vcr is stopped 00098 */ 00099 virtual int stop() ; 00100 00101 /*! \fn setParameter(const int buffercount, const int channel, const Isomode isomode, const Videomode videomode, const Framerate framerate) 00102 * \brief This method set the parameter of a camera. 00103 * 00104 * An AV/C camera normally broadcasts the video data on channel 63. They has a 00105 * fixed framerate and video format. So the parameters isomode, video_mode and framerate are ignored. 00106 * 00107 * A short sample show an example to init an AvcCamera. 00108 * \code 00109 * Session *session = Session::getSession(); 00110 * AvcVcr *vcr = session->findAvcCVcr(); 00111 * vcr->setParameter() //set the default parameter (channel = 63, buffers = 4) 00112 * if (camera->init() == L1394_SUCCESS) 00113 * camera->start(); 00114 * else 00115 * cout << "Camera init failed" << endl; 00116 * \endcode 00117 * 00118 * \param isomode : only running mode 00119 * \param nbuffers : buffers for iso module (for later version. At this time the video 00120 * module isn't used to get frames from a DV device. 00121 * \param videomode : DV format 00122 * \param framerate : CAMERA_FRAMES_3_75, CAMERA_FRAMES_7_5, 00123 * CAMERA_FRAMES_15, CAMERA_FRAMES_30, CAMERA_FRAMES_60 00124 * \param channel : iso channel (a value between 1..64) 00125 * \return int : returns a int value >= 0 if init success else < 0; 00126 */ 00127 virtual int setParameter(const int buffercount = 4, const int channel = 63, const Isomode isomode = DEVICE_ISO_RUN, const Videomode videomode = DEVICE_DV, const Framerate framerate = DEVICE_FRAMES_DV); 00128 00129 00130 /*! \fn hasVideoFormat(const Videomode videomode) 00131 * \brief This method tests, if a videomode is supported by a Camera. 00132 * \return bool : true if the videomode is supported, false if not 00133 */ 00134 virtual bool hasVideoFormat(const Videomode videomode) {if (videomode == DEVICE_DV) return true; return false;} 00135 00136 00137 /*! \fn hasFramerate(const Videomode videomode, const Framerate framerate) 00138 * \brief This method tests, if a framerate, with a videomode is supported by the camera. 00139 * \param videomode : the videomode for the framerate. 00140 * \param framerate : the framerate that should be tested. 00141 * \return bool : true, if a framerate is supported, false if not 00142 */ 00143 virtual bool hasFramerate(const Videomode videomode,const Framerate framerate); 00144 00145 00146 /*! \name The standard functions of the vcr interface 00147 * This functions implements the interface of class Vcr 00148 */ 00149 //@{ 00150 00151 /*! \fn play() 00152 * \brief With this method you can access the play feature. 00153 * \return DeviceRegister* : pointer to the DeviceRegister. 00154 */ 00155 virtual int play() {return play(0x75)->send();} 00156 00157 00158 /*! \fn pause() 00159 * \brief With this method you can access the pause feature. 00160 * \return DeviceRegister* : pointer to the DeviceRegister. 00161 */ 00162 virtual int pause() {return play(0x7d)->send();} 00163 00164 /*! \fn timeCode getTimeCode() 00165 * \brief With this method you can get the actual timecode. 00166 * \return Timecode : the actual timecode. 00167 */ 00168 virtual Timecode getTimeCode() ; 00169 00170 /*! \fn transportState() 00171 * \brief With this method you can get the actual status of a vcr. 00172 * \return DeviceRegister* : pointer to the DeviceRegister. 00173 */ 00174 virtual const DeviceRegister* transportState() ; 00175 00176 /*! \fn search(const Timecode) 00177 * \brief This method stop the tape at a specific position. 00178 * \return DeviceRegister* : pointer to the DeviceRegister. 00179 */ 00180 virtual const DeviceRegister* search(const Timecode) {return device_register;} 00181 //all following ok 00182 00183 /*! \fn recordingDate(const Timecode time_begin) 00184 * \brief With this method you can access the recording date feature. 00185 * \return DeviceRegister* : pointer to the DeviceRegister. 00186 */ 00187 virtual const DeviceRegister* recordingDate(const Timecode) ; 00188 00189 /*! \fn forward() 00190 * \brief With this method you can access the forward feature. 00191 * \return DeviceRegister* : pointer to the DeviceRegister. 00192 */ 00193 virtual const DeviceRegister* forward() {return play(0x39);} 00194 00195 /*! \fn reverse() 00196 * \brief With this method you can access the reverse feature. 00197 * \return DeviceRegister* : pointer to the DeviceRegister. 00198 */ 00199 virtual const DeviceRegister* reverse() {return play(0x48);} 00200 00201 /*! \fn fastForward() 00202 * \brief With this method you can access the fastForward feature. 00203 * \return DeviceRegister* : pointer to the DeviceRegister. 00204 */ 00205 virtual const DeviceRegister* fastForward() {return wind(0x75);} 00206 00207 /*! \fn slowForward() 00208 * \brief With this method you can access the slowForward feature. 00209 * \return DeviceRegister* : pointer to the DeviceRegister. 00210 */ 00211 virtual const DeviceRegister* rewind() {return wind(0x65);} 00212 00213 /*! \fn record() 00214 * \brief With this method you can access the record feature. 00215 * \return DeviceRegister* : pointer to the DeviceRegister. 00216 */ 00217 virtual const DeviceRegister* record() {return record(0x75);} 00218 00219 /*! \fn recordingSpeed(const int speed) 00220 * \brief With this method you can access the recordingSpeed feature. 00221 * \param speed : the speed value. 00222 * \return DeviceRegister* : pointer to the DeviceRegister. 00223 */ 00224 virtual const DeviceRegister* recordingSpeed(const int speed); 00225 00226 /*! \fn nextFrame() 00227 * \brief With this method you can access the nextFrame feature. 00228 * 00229 * If you execute the command, the vcr increase one frame, from actual 00230 * position. 00231 * \return DeviceRegister* : pointer to the DeviceRegister. 00232 */ 00233 virtual const DeviceRegister* nextFrame() {return play(0x30);} 00234 00235 /*! \fn previousFrame() 00236 * \brief With this method you can access the nextFrame feature. 00237 * 00238 * If you execute the command, the vcr decrease one frame, from actual 00239 * position. 00240 * \return DeviceRegister* : pointer to the DeviceRegister. 00241 */ 00242 virtual const DeviceRegister* previousFrame() {return play(0x40);} 00243 00244 /*! \fn slowForward() 00245 * \brief With this method you can access the slowForward feature. 00246 * \return DeviceRegister* : pointer to the DeviceRegister. 00247 */ 00248 virtual const DeviceRegister* slowForward() {return play(0x3f);} 00249 00250 /*! \fn slowReverse() 00251 * \brief With this method you can access the slowReverse feature. 00252 * \return DeviceRegister* : pointer to the DeviceRegister. 00253 */ 00254 virtual const DeviceRegister* slowReverse() {return play(0x47);} 00255 //@} 00256 //end of the standard interface of a vcr. 00257 00258 /*! \name The extended functions for an AV/C vcr 00259 * This functions describe the interface of a vcr defined in AV/C Tape Recorder/ 00260 * Player Subunit Specification. 00261 */ 00262 //@{ 00263 /*! \fn analogAudioOutputMode(const int mode) 00264 * \brief With this method you can access the analog audio output mode 00265 * \param mode : int value that describe the mode (for valid values see 00266 * AV/C Tape Recorder Player Subunit Specification. 00267 * \return AvcRegister* : pointer to the AvcRegister. 00268 */ 00269 //ok 00270 const AvcRegister* analogAudioOutputMode(const int); 00271 00272 00273 /*! \fn backward(int measurement_unit, int count) 00274 * \brief access backward feature and return a pointer to the AvcRegister 00275 * \param measurement_unit : define which unit should be used (for valid values see 00276 * AV/C Tape Recorder Player Subunit Specification. 00277 * \param count : int value for the count of backward steps (valid value between 0x0..0xff) 00278 * \return AvcRegister* : pointer to the AvcRegister. 00279 */ 00280 //ok 00281 const AvcRegister* backward(const int measurement_unit, const int count); 00282 00283 00284 /*! \fn forward(const int measurement_unit,const int count) 00285 * \brief access backward feature and return a pointer to the AvcRegister 00286 * \param measurement_unit : define which unit should be used (for valid values see 00287 * AV/C Tape Recorder Player Subunit Specification. 00288 * \param count : int value for the count of forward steps (valid value between 0x0..0xff) 00289 * \return AvcRegister* : pointer to the AvcRegister. 00290 */ 00291 //ok 00292 const AvcRegister* forward(const int measurement_unit,const int count) ; 00293 00294 00295 /*! \fn editMode(const int mode) 00296 * \brief With this method you can access the analog audio output mode 00297 * \param mode : int value that describe the mode (for valid values see 00298 * AV/C Tape Recorder Player Subunit Specification. 00299 * \return AvcRegister* : pointer to the AvcRegister. 00300 */ 00301 //ok 00302 const AvcRegister* editMode(const int command) {return device_register->defaultSet(1, 0x40, command);} 00303 00304 00305 /*! \fn inputSignalMode(const int mode) 00306 * \brief With this method you can access the input signal mode 00307 * \param mode : int value that describe the mode (for valid values see 00308 * AV/C Tape Recorder Player Subunit Specification. 00309 * \return AvcRegister* : pointer to the AvcRegister. 00310 */ 00311 //ok 00312 const AvcRegister* inputSignalMode(const int command) {return device_register->defaultSet(1,0x79,command);} 00313 00314 00315 /*! \fn loadMedium(const int command) 00316 * \brief With this method you can access the load medium feature. 00317 * \param command : int value that describe the command (for valid values see 00318 * AV/C Tape Recorder Player Subunit Specification. 00319 * 00320 * For calling hasFeature command = 0xFF 00321 * \return AvcRegister* : pointer to the AvcRegister. 00322 */ 00323 //ok 00324 const AvcRegister* loadMedium(const int command) {return device_register->defaultSet(1,0xc1, command);} 00325 00326 00327 /*! \fn marker(const int set) 00328 * \brief With this method you can access the marker mode 00329 * \param set : int value 1 for set marker, 0 for unset marker. 00330 * \return AvcRegister* : pointer to the AvcRegister. 00331 */ 00332 //ok 00333 const AvcRegister* marker(const int set) {return device_register->defaultSet(1,0xca, 1); device_register->getData()->getQuadlet(1).setBit(7,set);return device_register;} 00334 00335 00336 /*! \fn mediumInfo() 00337 * \brief With this method you can access the analog audio output mode. 00338 * \return Quadlet : Quadlet with the medium info. 00339 */ 00340 //ok 00341 Quadlet mediumInfo() ; 00342 00343 00344 /*! \fn openMic(const int mode) 00345 * \brief With this method you can access the open Mic feature 00346 * \param mode : int value that describe the mode (for valid values see 00347 * AV/C Tape Recorder Player Subunit Specification. 00348 * \return AvcRegister* : pointer to the AvcRegister. 00349 */ 00350 //ok 00351 const AvcRegister* openMic(const int command) {return device_register->defaultSet(1,0x60,command);} 00352 00353 00354 /*! \fn outputSignalMode(const int command) 00355 * \brief With this method you can access the output signal mode 00356 * \param command : int value that describe the command (for valid values see 00357 * AV/C Tape Recorder Player Subunit Specification. 00358 * \return AvcRegister* : pointer to the AvcRegister. 00359 */ 00360 //ok 00361 const AvcRegister* outputSignalMode(const int command) {return device_register->defaultSet(1,0x78, command);} 00362 00363 00364 /*! \fn record(const int command) 00365 * \brief With this method you can access the record feature. 00366 * \param mode : int value that describe the mode (for valid values see 00367 * AV/C Tape Recorder Player Subunit Specification. 00368 * \return AvcRegister* : pointer to the AvcRegister. 00369 */ 00370 //ok 00371 const AvcRegister* record(const int command) {return device_register->defaultSet(1,0xc2, command);} 00372 00373 00374 /*! \fn timecode(const int command,const Timecode timecode) 00375 * \brief With this method you can access the timecode feature. 00376 * \param command : int value that describe the mode (for valid values see 00377 * AV/C Tape Recorder Player Subunit Specification. 00378 * \param timecode : the new timecode. In case of ctype STATUS, all variable of 00379 * timecode has value 0xff 00380 * \return AvcRegister* : pointer to the AvcRegister. 00381 */ 00382 //ok 00383 const AvcRegister* timecode(const int command,const Timecode timecode) ; 00384 00385 00386 /*! \fn writeMic() 00387 * \brief With this method you can access the write mic feature. 00388 * \return AvcRegister* : pointer to the AvcRegister. 00389 */ 00390 const AvcRegister* writeMic() ; //not implemented 00391 00392 00393 /*! \fn wind(const int command) 00394 * \brief With this method you can access the wind feature. 00395 * \param command : int value that describe the subfunction(for valid values see 00396 * AV/C Tape Recorder Player Subunit Specification. 00397 * \return AvcRegister* : pointer to the AvcRegister. 00398 */ 00399 //ok 00400 const AvcRegister* wind(const int command) ; 00401 00402 00403 /*! \fn play(const int command) 00404 * \brief With this method you can access the play feature. 00405 * \param command : int value that describe the subfunction(for valid values see 00406 * AV/C Tape Recorder Player Subunit Specification. 00407 * \return AvcRegister* : pointer to the AvcRegister. 00408 */ 00409 //ok 00410 const AvcRegister* play(const int value) {return device_register->defaultSet(1,0xc3,value);} 00411 00412 00413 /*! \fn search(const int command,const Timecode timecode) 00414 * \brief With this method you can access the analog audio output mode 00415 * \param command : int value that describe the submethod (for valid values see 00416 * AV/C Tape Recorder Player Subunit Specification. 00417 * \param timecode : the new timecode. In case of ctype STATUS, all variable of 00418 * timecode has value 0xff 00419 * \return AvcRegister* : pointer to the AvcRegister. 00420 */ 00421 const AvcRegister* search(const int,const Timecode) ; 00422 00423 00424 00425 /*! \fn preset(const int reset,const int id,const u_int32_t value) 00426 * \brief With this method you can access the analog audio output mode 00427 * for valid values see AV/C Tape Recorder Player Subunit Specification. 00428 * \return AvcRegister* : pointer to the AvcRegister. 00429 */ 00430 const AvcRegister* preset(const int reset,const int id,const u_int32_t parameter_value) ; 00431 //@} 00432 00433 00434 private: 00435 AvcRegister* device_register; 00436 int subunit_value; 00437 bool frame_mode; 00438 const FcpNode* avc_parent; 00439 }; 00440 } 00441 #endif