Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members
TimeSection.cpp
00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: TimeSection.cpp (S H A R E D) * 00006 * * 00007 * * 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 /*********************************************************************** 00037 * * 00038 * REVISION HISTORY: * 00039 * * 00040 * * 00041 * * 00042 ***********************************************************************/ 00043 00044 /*********************************************************************** 00045 * Video Session Migration System, 2004 * 00046 * Author: Klaus Schoeffmann * 00047 ************************************************************************/ 00048 00049 00050 #include "TimeSection.hpp" 00051 00052 /***********************************************************************/ 00053 TimeSection::TimeSection(int nr, ulong prebuffertime) 00054 { 00055 Globals::sdebug << "\nTS: start"; 00056 this->nr = nr; 00057 this->prebufferTime = prebuffertime; 00058 measuredStarttime = 0; 00059 measuredEndtime = 0; 00060 requestedFrom = 0; 00061 clientReceived = 0; 00062 serverPlayout = 0; 00063 clientPlayout = 0; 00064 Globals::sdebug << "\nTimeSection::TimeSection():" << nr << " created with prebuffer:" << prebuffertime; 00065 } 00066 00067 /***********************************************************************/ 00068 TimeSection::~TimeSection() 00069 { 00070 Globals::sdebug << " s" << nr; 00071 } 00072 00073 /***********************************************************************/ 00074 ulong TimeSection::getCurrentMsecs() 00075 { 00076 //get current timestamp 00077 struct timeval currTime; 00078 gettimeofday(&currTime, NULL); 00079 00080 //calculate to msecs 00081 ulong currTimeMs = ((ulong)currTime.tv_sec*1000 + (ulong)currTime.tv_usec/1000); 00082 return currTimeMs; 00083 } 00084 00085 /***********************************************************************/ 00086 void TimeSection::start() 00087 { 00088 measuredStarttime = getCurrentMsecs(); 00089 Globals::sdebug << "\nTimeSection::start():" << nr << " = " << measuredStarttime; 00090 } 00091 00092 /***********************************************************************/ 00093 void TimeSection::stop() 00094 { 00095 measuredEndtime = getCurrentMsecs(); 00096 Globals::sdebug << "\nTimeSection::stop():" << nr << " = " << measuredEndtime; 00097 } 00098 00099 /***********************************************************************/ 00100 ulong TimeSection::getMeasuredStarttime() 00101 { 00102 return measuredStarttime; 00103 } 00104 00105 /***********************************************************************/ 00106 ulong TimeSection::getMeasuredEndtime() 00107 { 00108 return measuredEndtime; 00109 } 00110 00111 /***********************************************************************/ 00112 ulong TimeSection::getPrebufferTime() 00113 { 00114 return prebufferTime; 00115 } 00116 00117 /***********************************************************************/ 00118 ulong TimeSection::getRequestedFrom() 00119 { 00120 return requestedFrom; 00121 } 00122 00123 /***********************************************************************/ 00124 ulong TimeSection::getClientReceived() 00125 { 00126 return clientReceived; 00127 } 00128 00129 /***********************************************************************/ 00130 ulong TimeSection::getServerPlayout() 00131 { 00132 return serverPlayout; 00133 } 00134 00135 /***********************************************************************/ 00136 ulong TimeSection::getClientPlayout() 00137 { 00138 return clientPlayout; 00139 } 00140 00141 /***********************************************************************/ 00142 void TimeSection::setMeasuredStarttime(ulong measuredStarttime) 00143 { 00144 this->measuredStarttime = measuredStarttime; 00145 Globals::sdebug << "\nTimeSection::setMeasuredStarttime():" << nr << " = " << measuredStarttime; 00146 } 00147 00148 /***********************************************************************/ 00149 void TimeSection::setMeasuredEndtime(ulong measuredEndtime) 00150 { 00151 this->measuredEndtime = measuredEndtime; 00152 Globals::sdebug << "\nTimeSection::setMeasuredEndtime():" << nr << " = " << measuredEndtime; 00153 } 00154 00155 /***********************************************************************/ 00156 void TimeSection::setRequestedFrom(ulong requestedFrom) 00157 { 00158 this->requestedFrom = requestedFrom; 00159 Globals::sdebug << "\nTimeSection::setRequestedFrom():" << nr << " = " << requestedFrom; 00160 } 00161 00162 /***********************************************************************/ 00163 void TimeSection::setClientReceived(ulong clientReceived) 00164 { 00165 this->clientReceived = clientReceived; 00166 Globals::sdebug << "\nTimeSection::clientReceived():" << nr << " = " << clientReceived; 00167 } 00168 00169 /***********************************************************************/ 00170 void TimeSection::setServerPlayout(ulong serverPlayout) 00171 { 00172 this->serverPlayout = serverPlayout; 00173 Globals::sdebug << "\nTimeSection::serverPlayout():" << nr << " = " << serverPlayout; 00174 } 00175 00176 /***********************************************************************/ 00177 void TimeSection::setClientPlayout(ulong clientPlayout) 00178 { 00179 this->clientPlayout = clientPlayout; 00180 Globals::sdebug << "\nTimeSection::clientPlayout():" << nr << " = " << clientPlayout; 00181 }