00001 /*===========================================================================*/ 00002 /* 00003 * This file is part of libogg++ - a c++ library for the Ogg transport format 00004 * 00005 * Copyright (C) 2006, 2007 Elaine Tsiang YueLien 00006 * 00007 * libogg++ is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the 00019 * Free Software Foundation, Inc. 00020 * 51 Franklin Street, Fifth Floor 00021 * Boston, MA 02110-1301, USA 00022 * 00023 *===========================================================================*/ 00028 /*===========================================================================*/ 00029 #ifndef TransportToApplicationInterface 00030 #define TransportToApplicationInterface 00031 00032 #ifdef __GNUG__ 00033 #pragma interface 00034 #endif 00035 00036 namespace Ogg 00037 { 00038 class Transport; 00039 } 00040 00041 #include <Ogg/Ogg.H> 00042 #include <Ogg/Logical.H> 00043 #include <Ogg/Exception.H> 00044 00045 namespace Ogg 00046 { 00047 00049 00050 00056 class Page 00057 { 00058 public: 00059 void * 00060 data(); 00061 00062 size_t 00063 size() const; 00064 00065 bool 00066 ending() const; 00067 00068 Position 00069 granulePosition() const; 00070 00071 bool 00072 isHeader()const ; 00073 00074 long 00075 pageNo() const; 00076 00077 long 00078 serialNo() const; 00079 00080 }; 00081 00089 class Transport 00090 { 00091 private: 00092 void * impl_; 00093 00094 protected: 00096 Transport( 00097 int dummy 00098 ) 00099 : impl_(0) 00100 {} 00101 00102 public: 00103 static 00104 const unsigned char CurrentVersion = 0x00; 00105 00107 static 00108 void 00109 operator delete(void *); 00110 00111 void * 00112 impl() 00113 { 00114 return(impl_); 00115 } 00116 00118 Transport( 00119 bool encapsulating 00120 ); 00121 00128 long 00129 serialNo(long); 00130 00132 Logical * 00133 logical( 00134 long serialNo 00135 ); 00136 00149 void 00150 loop(); 00151 00157 void 00158 terminate(); 00159 00169 virtual 00170 void 00171 sendCallback( 00172 Page & 00173 ); 00174 00187 virtual 00188 size_t 00189 recvCallback( 00190 Page & 00191 ); 00192 00204 virtual 00205 bool 00206 laterThan ( 00207 const Page & p1 00208 ,const Page & p2 00209 ); 00210 00211 00213 class NoDeletion : public Exception 00214 { 00215 public: 00216 NoDeletion() throw() 00217 ; 00218 00219 NoDeletion( 00220 const NoDeletion & ex 00221 ) throw() 00222 : Exception(ex) 00223 {} 00224 00225 ~NoDeletion() throw() 00226 {} 00227 } 00228 ; 00229 00230 class PrematureEndOfOggStream : public Exception 00231 { 00232 public: 00233 PrematureEndOfOggStream() throw() 00234 ; 00235 00236 PrematureEndOfOggStream( 00237 const PrematureEndOfOggStream & ex 00238 ) throw() 00239 : Exception(ex) 00240 {} 00241 00242 ~PrematureEndOfOggStream() throw() 00243 {} 00244 } 00245 ; 00246 00247 00248 } 00249 ; 00250 00252 }; 00253 #endif