Session.hpp

00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: Session.hpp * 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 #ifndef _SESSION_HPP_ 00045 #define _SESSION_HPP_ 00046 #ifdef ISOMP4 00047 #include "ISOMovies.h" 00048 #endif 00049 00050 #include "Protocol.hpp" 00051 #include "adaptors/GlobalTimer.hpp" 00052 #include "adaptors/SharedAdaptor.hpp" 00053 #include "ReferenceCounter.hpp" 00054 #include "cache/CostFunction.hpp" 00055 00056 // Forward declarations 00057 class TerminalCapabilities; 00058 class UserPreferences; 00059 class ContainerInfo; 00060 struct rtx_group; 00061 struct rtx_info; 00062 class DataChannel; 00063 class Adaptor; 00064 class IO; 00065 class Url; 00066 class Rtp; 00067 class RTSP; 00079 class Session: public VThread 00080 { 00081 public: 00082 enum SessionState {SESSION_ERR, SESSION_NEW, SESSION_INITIALIZED, SESSION_ACTIVE, SESSION_PAUSED, SESSION_CLOSED}; 00083 Session(); 00084 virtual ~Session(); 00085 virtual bool options(const Url* fileName, const char* remaining) = 0; 00086 virtual bool connect(const Url* fileName, const char* remaining)=0; 00087 virtual bool setup(const Url* fileName, const char* remaining)=0; 00088 virtual bool play(const Url* fileName, const char* remaining)=0; 00089 virtual bool pause(const Url* fileName, const char* remaining)=0; 00090 virtual bool getOptions(const Url* fileName, const char* remaining)=0; 00091 virtual bool setOptions(const Url* fileName, const char* remaining)=0; 00094 virtual bool tearDown(int sessionKey, bool immediate=false,const Url* fileName=NULL, const char* remaining=NULL)=0; 00097 virtual void setUrl(const Url *uri, bool makeExactMatch = true)=0; 00098 const Url* getUrl() const; 00100 bool setRtxInfoForES(u32 esId, rtx_info* rtx); 00101 00103 rtx_group* getRtxGroup(u32 esId); 00104 00105 std::list < rtx_group* >* getAllRtxGroups(); 00106 00107 const struct sockaddr_in *getDataSinkInfo() const; 00108 00111 void setDataChannel(DataChannel * dc); 00112 Adaptor* getSuggestedAdaptor(); 00113 00114 const std::list < DataChannel * >& getDataChannels() const; 00115 00118 DataChannel *getDataChannel(int esId); 00119 00120 ContainerInfo *getContainerInfo() const; 00121 00122 void setTerminalCapabilities(TerminalCapabilities* tc); 00123 00124 const TerminalCapabilities* getTerminalCapabilities() const; 00125 00126 int getControlSocket() const; 00127 00129 bool sendResponse(const char *str,int bytes); 00130 00137 int readRequest(char* str, const int MAX_BYTES); 00138 RTSP* getProtocol() {return prot;}; 00140 KnownProtocols determineProtocol(const char *request); 00141 00142 protected: 00144 DataChannel * find(int esId); 00145 00146 00147 GlobalTimer *globalTimer; 00148 ReferenceCounter *gtRefCount; 00149 SharedAdaptor *gtSharedAdapt; 00150 ResourceUsage resUsage; 00151 00152 int sessionControlChannel; 00153 SessionState state; 00154 TerminalCapabilities* termCap; 00155 UserPreferences* userPref; 00156 ContainerInfo* mp4Stream; 00158 list < rtx_group* > rtxInfo; 00162 list < DataChannel * >channels; 00163 Adaptor* suggestedAdaptor; 00164 sockaddr_in* client; 00165 u32 clientId; 00166 RTSP* prot; 00168 Url* url; 00169 char* serverID; 00170 bool canAdmitRequest; 00171 }; 00172 00173 #endif