VideoSink.cxx
Go to the documentation of this file.00001 /* ======================================================================== 00002 * Copyright (C) 2005 Graz University of Technology 00003 * 00004 * This framework is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This framework is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this framework; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * For further information please contact Denis Kalkofen under 00019 * <kalkofen@icg.tu-graz.ac.at> or write to Denis Kalkofen, 00020 * Graz University of Technology, Inffeldgasse 16a, A8010 Graz, 00021 * Austria. 00022 * ======================================================================== 00023 * PROJECT: OpenVideo 00024 * ======================================================================== */ 00034 #include <openvideo/nodes/VideoSink.h> 00035 #include <openvideo/openVideo.h> 00036 #include <openvideo/nodes/VideoSinkSubscriber.h> 00037 00038 #ifdef ENABLE_VIDEOSINK 00039 00040 00041 using namespace openvideo; 00042 00043 #include <openvideo/State.h> 00044 #include <openvideo/Manager.h> 00045 00046 00047 VideoSink::VideoSink() 00048 { 00049 name = typeName = "VideoSink"; 00050 isStarted=false; 00051 internalFormat=0; 00052 size_subscribers=0; 00053 } 00054 00055 void 00056 VideoSink::initPixelFormats() 00057 { 00058 //format_r8g8b8 = 0, 00059 //format_b8g8r8 = 1, 00060 //format_r8g8b8x8 = 2, 00061 //format_b8g8r8x8 = 3, 00062 //format_l8 = 5, 00063 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_R8G8B8)); 00064 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_B8G8R8)); 00065 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_R8G8B8X8)); 00066 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_B8G8R8X8)); 00067 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_L8)); 00068 this->pixelFormats.push_back(PIXEL_FORMAT(FORMAT_R5G6B5)); 00069 } 00070 00071 VideoSink::~VideoSink() 00072 { 00073 00074 } 00075 00076 00077 void 00078 VideoSink::init() 00079 { 00080 // 00082 isStarted=true; 00083 state=inputs[0]->getState(); 00084 } 00085 00086 00087 void 00088 VideoSink::process() 00089 { 00090 // send update notification to subsrcibers 00091 //for(int i=0;i<size_subscribers;i++) 00092 for(int i=size_subscribers-1; i>=0;i--) 00093 subsrcibers[i]->update(state); 00094 } 00095 00096 void 00097 VideoSink::postProcess() 00098 { 00099 /*for(int i=0;i<size_subscribers;i++) 00100 { 00101 if(subsrcibers[i]->isResourceInUse()) 00102 { 00103 //wait till 00104 } 00105 }*/ 00106 } 00107 00108 void 00109 VideoSink::subscribe(VideoSinkSubscriber* aSubscriber) 00110 { 00111 subsrcibers.push_back(aSubscriber); 00112 size_subscribers++; 00113 } 00114 00115 #endif //ENABLE_VideoSink
