00001 /*************************************************************************** 00002 l1394avccamera.cpp - 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 #include "l1394_avccamera.h" 00019 #include "l1394_fcpnode.h" 00020 #include "l1394_card.h" 00021 00022 namespace L1394{ 00023 AvcCamera::AvcCamera(FcpNode* parent_node, const int subunit_value) 00024 : Camera(parent_node) 00025 { 00026 frame_mode = true; 00027 setFrameWidth(720); 00028 setFrameHeight(485); 00029 this->subunit_value = subunit_value; 00030 avc_camera_register = new AvcCameraRegister(parent_node, subunit_value); 00031 is_init = false; 00032 avc_parent = parent_node; 00033 isomode = DEVICE_ISO_RUN; 00034 videomode = DEVICE_DV; 00035 buffer = 5; 00036 framerate = DEVICE_FRAMES_DV; 00037 channel = 63; 00038 setName("AvcCamera"); 00039 } 00040 00041 AvcCamera::~AvcCamera() 00042 { 00043 delete avc_camera_register; 00044 } 00045 00046 int AvcCamera::setParameter(const int buffercount, const int channel, const Isomode isomode, const Videomode videomode, const Framerate framerate) 00047 { 00048 /*if (channel == FREE_ISO_CHANNEL) 00049 { 00050 if ( avc_parent->getParentCard()->requestIsoChannel(63) == -1) 00051 return L1394_FAILED; 00052 } 00053 else 00054 { 00055 if ( avc_parent->getParentCard()->requestIsoChannel(channel) == -1) 00056 return L1394_FAILED; 00057 }*/ 00058 00059 if (framerate != DEVICE_FRAMES_DV) 00060 { 00061 internal::SMessage::getInstance()->warningStream() << "AvcCamera > Invalid framerate. This camera supports only DV-specific framerates" << endl; 00062 } 00063 00064 if (videomode != DEVICE_DV) 00065 { 00066 internal::SMessage::getInstance()->warningStream() << "AvcCamera > Invalid videomode. This camera supports only DV" << endl; 00067 } 00068 00069 if ( !(getParentNode()->getIsoObject()) ) 00070 { 00071 internal::SMessage::getInstance()->errorStream() << "AvcCamera > Invalid ISO-object" << endl; 00072 return L1394_FAILED; 00073 } 00074 this->isomode = isomode; 00075 00076 return getParentNode()->getIsoObject()->setParameter(buffercount, channel , 1440000); 00077 } 00078 00079 bool AvcCamera::hasFramerate(const Videomode videomode,const Framerate framerate) 00080 { 00081 if ( (videomode == DEVICE_DV) && (framerate == DEVICE_FRAMES_DV) ) 00082 return true; 00083 00084 return false; 00085 } 00086 00087 int AvcCamera::start() 00088 { 00089 if(isSending()) 00090 return L1394_SUCCESS; 00091 00092 if (getParentNode()->getIsoObject()) 00093 { 00094 setSending(true); 00095 return getParentNode()->getIsoObject()->startIsoListen(); 00096 } 00097 internal::SMessage::getInstance()->errorStream() << "AvcCamera > No valid ISO object" << endl; 00098 return L1394_FAILED; 00099 } 00100 00101 int AvcCamera::stop() 00102 { 00103 if( getParentNode()->getIsoObject()->stopIsoListen() == L1394_SUCCESS ) 00104 { 00105 setSending(false); 00106 return L1394_SUCCESS; 00107 } 00108 internal::SMessage::getInstance()->errorStream() << "AvcCamera > Could not stop ISO-listen" << endl; 00109 return L1394_FAILED; 00110 } 00111 00112 } //end namespace L1394