00001 /********** 00002 This library is free software; you can redistribute it and/or modify it under 00003 the terms of the GNU Lesser General Public License as published by the 00004 Free Software Foundation; either version 2.1 of the License, or (at your 00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 00006 00007 This library is distributed in the hope that it will be useful, but WITHOUT 00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00009 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00010 more details. 00011 00012 You should have received a copy of the GNU Lesser General Public License 00013 along with this library; if not, write to the Free Software Foundation, Inc., 00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 **********/ 00016 // "liveMedia" 00017 // Copyright (c) 1996-2010 Live Networks, Inc. All rights reserved. 00018 // Medium 00019 // C++ header 00020 00021 #ifndef _MEDIA_HH 00022 #define _MEDIA_HH 00023 00024 #ifndef _LIVEMEDIA_VERSION_HH 00025 #include "liveMedia_version.hh" 00026 #endif 00027 00028 #ifndef _BOOLEAN_HH 00029 #include "Boolean.hh" 00030 #endif 00031 00032 #ifndef _USAGE_ENVIRONMENT_HH 00033 #include "UsageEnvironment.hh" 00034 #endif 00035 00036 // Lots of files end up needing the following, so just #include them here: 00037 #ifndef _NET_COMMON_H 00038 #include "NetCommon.h" 00039 #endif 00040 #include <stdio.h> 00041 00042 // The following makes the Borland compiler happy: 00043 #ifdef __BORLANDC__ 00044 #define _strnicmp strnicmp 00045 #define fabsf(x) fabs(x) 00046 #endif 00047 00048 #define mediumNameMaxLen 30 00049 00050 class Medium { 00051 public: 00052 static Boolean lookupByName(UsageEnvironment& env, 00053 char const* mediumName, 00054 Medium*& resultMedium); 00055 static void close(UsageEnvironment& env, char const* mediumName); 00056 static void close(Medium* medium); // alternative close() method using ptrs 00057 // (has no effect if medium == NULL) 00058 00059 UsageEnvironment& envir() const {return fEnviron;} 00060 00061 char const* name() const {return fMediumName;} 00062 00063 // Test for specific types of media: 00064 virtual Boolean isSource() const; 00065 virtual Boolean isSink() const; 00066 virtual Boolean isRTCPInstance() const; 00067 virtual Boolean isRTSPClient() const; 00068 virtual Boolean isRTSPServer() const; 00069 virtual Boolean isMediaSession() const; 00070 virtual Boolean isServerMediaSession() const; 00071 virtual Boolean isDarwinInjector() const; 00072 00073 protected: 00074 Medium(UsageEnvironment& env); // abstract base class 00075 virtual ~Medium(); // instances are deleted using close() only 00076 00077 TaskToken& nextTask() { 00078 return fNextTask; 00079 } 00080 00081 private: 00082 friend class MediaLookupTable; 00083 UsageEnvironment& fEnviron; 00084 char fMediumName[mediumNameMaxLen]; 00085 TaskToken fNextTask; 00086 }; 00087 00088 // The structure pointed to by the "liveMediaPriv" UsageEnvironment field: 00089 class _Tables { 00090 public: 00091 static _Tables* getOurTables(UsageEnvironment& env, Boolean createIfNotPresent = True); 00092 // returns a pointer to an "ourTables" structure (creating it if necessary) 00093 void reclaimIfPossible(); 00094 // used to delete ourselves when we're no longer used 00095 00096 void* mediaTable; 00097 void* socketTable; 00098 00099 protected: 00100 _Tables(UsageEnvironment& env); 00101 virtual ~_Tables(); 00102 00103 private: 00104 UsageEnvironment& fEnv; 00105 }; 00106 00107 #endif
1.5.2