Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added source for Live555 version 2011.12.23

  • Loading branch information...
commit 99fb25f08b0b393787d489f22a08f0b3098219e7 1 parent e5951c2
@weevilgenius authored
Showing with 30,498 additions and 0 deletions.
  1. +277 −0 src/live555/BasicUsageEnvironment/BasicHashTable.cpp
  2. +225 −0 src/live555/BasicUsageEnvironment/BasicTaskScheduler.cpp
  3. +242 −0 src/live555/BasicUsageEnvironment/BasicTaskScheduler0.cpp
  4. +80 −0 src/live555/BasicUsageEnvironment/BasicUsageEnvironment.cpp
  5. +88 −0 src/live555/BasicUsageEnvironment/BasicUsageEnvironment0.cpp
  6. +1 −0  src/live555/BasicUsageEnvironment/COPYING
  7. +230 −0 src/live555/BasicUsageEnvironment/DelayQueue.cpp
  8. +2 −0  src/live555/BasicUsageEnvironment/Makefile.head
  9. +33 −0 src/live555/BasicUsageEnvironment/Makefile.tail
  10. +104 −0 src/live555/BasicUsageEnvironment/include/BasicHashTable.hh
  11. +71 −0 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment.hh
  12. +113 −0 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment0.hh
  13. +10 −0 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
  14. +182 −0 src/live555/BasicUsageEnvironment/include/DelayQueue.hh
  15. +77 −0 src/live555/BasicUsageEnvironment/include/HandlerSet.hh
  16. +458 −0 src/live555/COPYING
  17. 0  src/live555/Makefile.head
  18. +26 −0 src/live555/Makefile.tail
  19. +2 −0  src/live555/README
  20. +1 −0  src/live555/UsageEnvironment/COPYING
  21. +41 −0 src/live555/UsageEnvironment/HashTable.cpp
  22. +2 −0  src/live555/UsageEnvironment/Makefile.head
  23. +27 −0 src/live555/UsageEnvironment/Makefile.tail
  24. +56 −0 src/live555/UsageEnvironment/UsageEnvironment.cpp
  25. +36 −0 src/live555/UsageEnvironment/include/Boolean.hh
  26. +72 −0 src/live555/UsageEnvironment/include/HashTable.hh
  27. +166 −0 src/live555/UsageEnvironment/include/UsageEnvironment.hh
  28. +10 −0 src/live555/UsageEnvironment/include/UsageEnvironment_version.hh
  29. +32 −0 src/live555/UsageEnvironment/include/strDup.hh
  30. +42 −0 src/live555/UsageEnvironment/strDup.cpp
  31. +108 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice.mak
  32. +324 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_common.cpp
  33. +82 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_common.hh
  34. +496 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_mixer.cpp
  35. +57 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_mixer.hh
  36. +182 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_noMixer.cpp
  37. +54 −0 src/live555/WindowsAudioInputDevice/WindowsAudioInputDevice_noMixer.hh
  38. +35 −0 src/live555/WindowsAudioInputDevice/showAudioInputPorts.cpp
  39. +17 −0 src/live555/config.aix
  40. +17 −0 src/live555/config.alpha
  41. +19 −0 src/live555/config.armeb-uclibc
  42. +18 −0 src/live555/config.armlinux
  43. +15 −0 src/live555/config.avr32-linux
  44. +18 −0 src/live555/config.bfin-linux-uclibc
  45. +18 −0 src/live555/config.bfin-uclinux
  46. +18 −0 src/live555/config.bsplinux
  47. +23 −0 src/live555/config.cris-axis-linux-gnu
  48. +17 −0 src/live555/config.cygwin
  49. +17 −0 src/live555/config.cygwin-for-vlc
  50. +17 −0 src/live555/config.freebsd
  51. +17 −0 src/live555/config.iphoneos
  52. +17 −0 src/live555/config.irix
  53. +17 −0 src/live555/config.linux
  54. +17 −0 src/live555/config.linux-64bit
  55. +17 −0 src/live555/config.linux-gdb
  56. +17 −0 src/live555/config.macosx
  57. +17 −0 src/live555/config.macosx-32bit
  58. +17 −0 src/live555/config.macosx-before-version-10.4
  59. +17 −0 src/live555/config.mingw
  60. +18 −0 src/live555/config.openbsd
  61. +23 −0 src/live555/config.qnx4
  62. +17 −0 src/live555/config.solaris-32bit
  63. +17 −0 src/live555/config.solaris-64bit
  64. +17 −0 src/live555/config.sunos
  65. +20 −0 src/live555/config.uClinux
  66. +4 −0 src/live555/configure
  67. +26 −0 src/live555/fix-makefile
  68. +46 −0 src/live555/genMakefiles
  69. +31 −0 src/live555/genWindowsMakefiles
  70. +24 −0 src/live555/genWindowsMakefiles.cmd
  71. +1 −0  src/live555/groupsock/COPYING
  72. +104 −0 src/live555/groupsock/GroupEId.cpp
  73. +637 −0 src/live555/groupsock/Groupsock.cpp
  74. +740 −0 src/live555/groupsock/GroupsockHelper.cpp
  75. +46 −0 src/live555/groupsock/IOHandlers.cpp
  76. +2 −0  src/live555/groupsock/Makefile.head
  77. +36 −0 src/live555/groupsock/Makefile.tail
  78. +312 −0 src/live555/groupsock/NetAddress.cpp
  79. +164 −0 src/live555/groupsock/NetInterface.cpp
  80. +98 −0 src/live555/groupsock/include/GroupEId.hh
  81. +203 −0 src/live555/groupsock/include/Groupsock.hh
  82. +136 −0 src/live555/groupsock/include/GroupsockHelper.hh
  83. +31 −0 src/live555/groupsock/include/IOHandlers.hh
  84. +165 −0 src/live555/groupsock/include/NetAddress.hh
  85. +107 −0 src/live555/groupsock/include/NetCommon.h
  86. +148 −0 src/live555/groupsock/include/NetInterface.hh
  87. +101 −0 src/live555/groupsock/include/TunnelEncaps.hh
  88. +10 −0 src/live555/groupsock/include/groupsock_version.hh
  89. +451 −0 src/live555/groupsock/inet.c
  90. +69 −0 src/live555/liveMedia/AACAudioMatroskaFileServerMediaSubsession.cpp
  91. +55 −0 src/live555/liveMedia/AACAudioMatroskaFileServerMediaSubsession.hh
  92. +61 −0 src/live555/liveMedia/AC3AudioFileServerMediaSubsession.cpp
  93. +59 −0 src/live555/liveMedia/AC3AudioMatroskaFileServerMediaSubsession.cpp
  94. +54 −0 src/live555/liveMedia/AC3AudioMatroskaFileServerMediaSubsession.hh
  95. +97 −0 src/live555/liveMedia/AC3AudioRTPSink.cpp
  96. +66 −0 src/live555/liveMedia/AC3AudioRTPSource.cpp
  97. +340 −0 src/live555/liveMedia/AC3AudioStreamFramer.cpp
  98. +60 −0 src/live555/liveMedia/ADTSAudioFileServerMediaSubsession.cpp
  99. +171 −0 src/live555/liveMedia/ADTSAudioFileSource.cpp
  100. +59 −0 src/live555/liveMedia/AMRAudioFileServerMediaSubsession.cpp
  101. +100 −0 src/live555/liveMedia/AMRAudioFileSink.cpp
  102. +174 −0 src/live555/liveMedia/AMRAudioFileSource.cpp
  103. +134 −0 src/live555/liveMedia/AMRAudioRTPSink.cpp
  104. +747 −0 src/live555/liveMedia/AMRAudioRTPSource.cpp
  105. +38 −0 src/live555/liveMedia/AMRAudioSource.cpp
  106. +712 −0 src/live555/liveMedia/AVIFileSink.cpp
  107. +45 −0 src/live555/liveMedia/AudioInputDevice.cpp
  108. +37 −0 src/live555/liveMedia/AudioRTPSink.cpp
  109. +113 −0 src/live555/liveMedia/Base64.cpp
  110. +100 −0 src/live555/liveMedia/BasicUDPSink.cpp
  111. +73 −0 src/live555/liveMedia/BasicUDPSource.cpp
  112. +174 −0 src/live555/liveMedia/BitVector.cpp
  113. +61 −0 src/live555/liveMedia/BitVector.hh
  114. +199 −0 src/live555/liveMedia/ByteStreamFileSource.cpp
  115. +114 −0 src/live555/liveMedia/ByteStreamMemoryBufferSource.cpp
  116. +133 −0 src/live555/liveMedia/ByteStreamMultiFileSource.cpp
  117. +1 −0  src/live555/liveMedia/COPYING
  118. +90 −0 src/live555/liveMedia/DVVideoFileServerMediaSubsession.cpp
  119. +95 −0 src/live555/liveMedia/DVVideoRTPSink.cpp
  120. +65 −0 src/live555/liveMedia/DVVideoRTPSource.cpp
  121. +216 −0 src/live555/liveMedia/DVVideoStreamFramer.cpp
  122. +349 −0 src/live555/liveMedia/DarwinInjector.cpp
  123. +153 −0 src/live555/liveMedia/DeviceSource.cpp
  124. +157 −0 src/live555/liveMedia/DigestAuthentication.cpp
  125. +137 −0 src/live555/liveMedia/EBMLNumber.cpp
  126. +129 −0 src/live555/liveMedia/EBMLNumber.hh
  127. +34 −0 src/live555/liveMedia/FileServerMediaSubsession.cpp
  128. +135 −0 src/live555/liveMedia/FileSink.cpp
  129. +30 −0 src/live555/liveMedia/FramedFileSource.cpp
  130. +51 −0 src/live555/liveMedia/FramedFilter.cpp
  131. +119 −0 src/live555/liveMedia/FramedSource.cpp
  132. +40 −0 src/live555/liveMedia/GSMAudioRTPSink.cpp
  133. +67 −0 src/live555/liveMedia/H261VideoRTPSource.cpp
  134. +64 −0 src/live555/liveMedia/H263plusVideoFileServerMediaSubsession.cpp
  135. +92 −0 src/live555/liveMedia/H263plusVideoRTPSink.cpp
  136. +106 −0 src/live555/liveMedia/H263plusVideoRTPSource.cpp
  137. +129 −0 src/live555/liveMedia/H263plusVideoStreamFramer.cpp
  138. +859 −0 src/live555/liveMedia/H263plusVideoStreamParser.cpp
  139. +127 −0 src/live555/liveMedia/H263plusVideoStreamParser.hh
  140. +119 −0 src/live555/liveMedia/H264VideoFileServerMediaSubsession.cpp
  141. +82 −0 src/live555/liveMedia/H264VideoFileSink.cpp
  142. +124 −0 src/live555/liveMedia/H264VideoMatroskaFileServerMediaSubsession.cpp
  143. +60 −0 src/live555/liveMedia/H264VideoMatroskaFileServerMediaSubsession.hh
  144. +256 −0 src/live555/liveMedia/H264VideoRTPSink.cpp
  145. +202 −0 src/live555/liveMedia/H264VideoRTPSource.cpp
  146. +87 −0 src/live555/liveMedia/H264VideoStreamDiscreteFramer.cpp
  147. +787 −0 src/live555/liveMedia/H264VideoStreamFramer.cpp
  148. +107 −0 src/live555/liveMedia/InputFile.cpp
  149. +145 −0 src/live555/liveMedia/JPEGVideoRTPSink.cpp
  150. +465 −0 src/live555/liveMedia/JPEGVideoRTPSource.cpp
  151. +45 −0 src/live555/liveMedia/JPEGVideoSource.cpp
  152. +60 −0 src/live555/liveMedia/Locale.cpp
  153. +635 −0 src/live555/liveMedia/MP3ADU.cpp
  154. +119 −0 src/live555/liveMedia/MP3ADURTPSink.cpp
  155. +80 −0 src/live555/liveMedia/MP3ADURTPSource.cpp
  156. +92 −0 src/live555/liveMedia/MP3ADUTranscoder.cpp
  157. +65 −0 src/live555/liveMedia/MP3ADUdescriptor.cpp
  158. +43 −0 src/live555/liveMedia/MP3ADUdescriptor.hh
  159. +517 −0 src/live555/liveMedia/MP3ADUinterleaving.cpp
  160. +179 −0 src/live555/liveMedia/MP3AudioFileServerMediaSubsession.cpp
  161. +56 −0 src/live555/liveMedia/MP3AudioMatroskaFileServerMediaSubsession.cpp
  162. +56 −0 src/live555/liveMedia/MP3AudioMatroskaFileServerMediaSubsession.hh
  163. +179 −0 src/live555/liveMedia/MP3FileSource.cpp
  164. +96 −0 src/live555/liveMedia/MP3HTTPSource.cpp
  165. +809 −0 src/live555/liveMedia/MP3Internals.cpp
  166. +143 −0 src/live555/liveMedia/MP3Internals.hh
  167. +976 −0 src/live555/liveMedia/MP3InternalsHuffman.cpp
  168. +82 −0 src/live555/liveMedia/MP3InternalsHuffman.hh
  169. +1,548 −0 src/live555/liveMedia/MP3InternalsHuffmanTable.cpp
  170. +457 −0 src/live555/liveMedia/MP3StreamState.cpp
  171. +93 −0 src/live555/liveMedia/MP3StreamState.hh
  172. +52 −0 src/live555/liveMedia/MP3Transcoder.cpp
  173. +63 −0 src/live555/liveMedia/MPEG1or2AudioRTPSink.cpp
  174. +62 −0 src/live555/liveMedia/MPEG1or2AudioRTPSource.cpp
  175. +210 −0 src/live555/liveMedia/MPEG1or2AudioStreamFramer.cpp
  176. +759 −0 src/live555/liveMedia/MPEG1or2Demux.cpp
  177. +88 −0 src/live555/liveMedia/MPEG1or2DemuxedElementaryStream.cpp
  178. +134 −0 src/live555/liveMedia/MPEG1or2DemuxedServerMediaSubsession.cpp
  179. +264 −0 src/live555/liveMedia/MPEG1or2FileServerDemux.cpp
  180. +69 −0 src/live555/liveMedia/MPEG1or2VideoFileServerMediaSubsession.cpp
  181. +175 −0 src/live555/liveMedia/MPEG1or2VideoRTPSink.cpp
  182. +82 −0 src/live555/liveMedia/MPEG1or2VideoRTPSource.cpp
  183. +201 −0 src/live555/liveMedia/MPEG1or2VideoStreamDiscreteFramer.cpp
  184. +478 −0 src/live555/liveMedia/MPEG1or2VideoStreamFramer.cpp
  185. +639 −0 src/live555/liveMedia/MPEG2IndexFromTransportStream.cpp
  186. +337 −0 src/live555/liveMedia/MPEG2TransportFileServerMediaSubsession.cpp
  187. +273 −0 src/live555/liveMedia/MPEG2TransportStreamFramer.cpp
  188. +258 −0 src/live555/liveMedia/MPEG2TransportStreamFromESSource.cpp
  189. +74 −0 src/live555/liveMedia/MPEG2TransportStreamFromPESSource.cpp
  190. +340 −0 src/live555/liveMedia/MPEG2TransportStreamIndexFile.cpp
  191. +431 −0 src/live555/liveMedia/MPEG2TransportStreamMultiplexor.cpp
  192. +265 −0 src/live555/liveMedia/MPEG2TransportStreamTrickModeFilter.cpp
  193. +130 −0 src/live555/liveMedia/MPEG4ESVideoRTPSink.cpp
  194. +65 −0 src/live555/liveMedia/MPEG4ESVideoRTPSource.cpp
  195. +131 −0 src/live555/liveMedia/MPEG4GenericRTPSink.cpp
  196. +234 −0 src/live555/liveMedia/MPEG4GenericRTPSource.cpp
  197. +95 −0 src/live555/liveMedia/MPEG4LATMAudioRTPSink.cpp
  198. +264 −0 src/live555/liveMedia/MPEG4LATMAudioRTPSource.cpp
  199. +125 −0 src/live555/liveMedia/MPEG4VideoFileServerMediaSubsession.cpp
Sorry, we could not display the entire diff because too many files (433) changed.
View
277 src/live555/BasicUsageEnvironment/BasicHashTable.cpp
@@ -0,0 +1,277 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Hash Table implementation
+// Implementation
+
+#include "BasicHashTable.hh"
+#include "strDup.hh"
+
+#if defined(__WIN32__) || defined(_WIN32)
+#else
+#include <stddef.h>
+#endif
+#include <string.h>
+#include <stdio.h>
+
+// When there are this many entries per bucket, on average, rebuild
+// the table to increase the number of buckets
+#define REBUILD_MULTIPLIER 3
+
+BasicHashTable::BasicHashTable(int keyType)
+ : fBuckets(fStaticBuckets), fNumBuckets(SMALL_HASH_TABLE_SIZE),
+ fNumEntries(0), fRebuildSize(SMALL_HASH_TABLE_SIZE*REBUILD_MULTIPLIER),
+ fDownShift(28), fMask(0x3), fKeyType(keyType) {
+ for (unsigned i = 0; i < SMALL_HASH_TABLE_SIZE; ++i) {
+ fStaticBuckets[i] = NULL;
+ }
+}
+
+BasicHashTable::~BasicHashTable() {
+ // Free all the entries in the table:
+ for (unsigned i = 0; i < fNumBuckets; ++i) {
+ TableEntry* entry;
+ while ((entry = fBuckets[i]) != NULL) {
+ deleteEntry(i, entry);
+ }
+ }
+
+ // Also free the bucket array, if it was dynamically allocated:
+ if (fBuckets != fStaticBuckets) delete[] fBuckets;
+}
+
+void* BasicHashTable::Add(char const* key, void* value) {
+ void* oldValue;
+ unsigned index;
+ TableEntry* entry = lookupKey(key, index);
+ if (entry != NULL) {
+ // There's already an item with this key
+ oldValue = entry->value;
+ } else {
+ // There's no existing entry; create a new one:
+ entry = insertNewEntry(index, key);
+ oldValue = NULL;
+ }
+ entry->value = value;
+
+ // If the table has become too large, rebuild it with more buckets:
+ if (fNumEntries >= fRebuildSize) rebuild();
+
+ return oldValue;
+}
+
+Boolean BasicHashTable::Remove(char const* key) {
+ unsigned index;
+ TableEntry* entry = lookupKey(key, index);
+ if (entry == NULL) return False; // no such entry
+
+ deleteEntry(index, entry);
+
+ return True;
+}
+
+void* BasicHashTable::Lookup(char const* key) const {
+ unsigned index;
+ TableEntry* entry = lookupKey(key, index);
+ if (entry == NULL) return NULL; // no such entry
+
+ return entry->value;
+}
+
+unsigned BasicHashTable::numEntries() const {
+ return fNumEntries;
+}
+
+BasicHashTable::Iterator::Iterator(BasicHashTable& table)
+ : fTable(table), fNextIndex(0), fNextEntry(NULL) {
+}
+
+void* BasicHashTable::Iterator::next(char const*& key) {
+ while (fNextEntry == NULL) {
+ if (fNextIndex >= fTable.fNumBuckets) return NULL;
+
+ fNextEntry = fTable.fBuckets[fNextIndex++];
+ }
+
+ BasicHashTable::TableEntry* entry = fNextEntry;
+ fNextEntry = entry->fNext;
+
+ key = entry->key;
+ return entry->value;
+}
+
+////////// Implementation of HashTable creation functions //////////
+
+HashTable* HashTable::create(int keyType) {
+ return new BasicHashTable(keyType);
+}
+
+HashTable::Iterator* HashTable::Iterator::create(HashTable& hashTable) {
+ // "hashTable" is assumed to be a BasicHashTable
+ return new BasicHashTable::Iterator((BasicHashTable&)hashTable);
+}
+
+////////// Implementation of internal member functions //////////
+
+BasicHashTable::TableEntry* BasicHashTable
+::lookupKey(char const* key, unsigned& index) const {
+ TableEntry* entry;
+ index = hashIndexFromKey(key);
+
+ for (entry = fBuckets[index]; entry != NULL; entry = entry->fNext) {
+ if (keyMatches(key, entry->key)) break;
+ }
+
+ return entry;
+}
+
+Boolean BasicHashTable
+::keyMatches(char const* key1, char const* key2) const {
+ // The way we check the keys for a match depends upon their type:
+ if (fKeyType == STRING_HASH_KEYS) {
+ return (strcmp(key1, key2) == 0);
+ } else if (fKeyType == ONE_WORD_HASH_KEYS) {
+ return (key1 == key2);
+ } else {
+ unsigned* k1 = (unsigned*)key1;
+ unsigned* k2 = (unsigned*)key2;
+
+ for (int i = 0; i < fKeyType; ++i) {
+ if (k1[i] != k2[i]) return False; // keys differ
+ }
+ return True;
+ }
+}
+
+BasicHashTable::TableEntry* BasicHashTable
+::insertNewEntry(unsigned index, char const* key) {
+ TableEntry* entry = new TableEntry();
+ entry->fNext = fBuckets[index];
+ fBuckets[index] = entry;
+
+ ++fNumEntries;
+ assignKey(entry, key);
+
+ return entry;
+}
+
+void BasicHashTable::assignKey(TableEntry* entry, char const* key) {
+ // The way we assign the key depends upon its type:
+ if (fKeyType == STRING_HASH_KEYS) {
+ entry->key = strDup(key);
+ } else if (fKeyType == ONE_WORD_HASH_KEYS) {
+ entry->key = key;
+ } else if (fKeyType > 0) {
+ unsigned* keyFrom = (unsigned*)key;
+ unsigned* keyTo = new unsigned[fKeyType];
+ for (int i = 0; i < fKeyType; ++i) keyTo[i] = keyFrom[i];
+
+ entry->key = (char const*)keyTo;
+ }
+}
+
+void BasicHashTable::deleteEntry(unsigned index, TableEntry* entry) {
+ TableEntry** ep = &fBuckets[index];
+
+ Boolean foundIt = False;
+ while (*ep != NULL) {
+ if (*ep == entry) {
+ foundIt = True;
+ *ep = entry->fNext;
+ break;
+ }
+ ep = &((*ep)->fNext);
+ }
+
+ if (!foundIt) { // shouldn't happen
+#ifdef DEBUG
+ fprintf(stderr, "BasicHashTable[%p]::deleteEntry(%d,%p): internal error - not found (first entry %p", this, index, entry, fBuckets[index]);
+ if (fBuckets[index] != NULL) fprintf(stderr, ", next entry %p", fBuckets[index]->fNext);
+ fprintf(stderr, ")\n");
+#endif
+ }
+
+ --fNumEntries;
+ deleteKey(entry);
+ delete entry;
+}
+
+void BasicHashTable::deleteKey(TableEntry* entry) {
+ // The way we delete the key depends upon its type:
+ if (fKeyType == ONE_WORD_HASH_KEYS) {
+ entry->key = NULL;
+ } else {
+ delete[] (char*)entry->key;
+ entry->key = NULL;
+ }
+}
+
+void BasicHashTable::rebuild() {
+ // Remember the existing table size:
+ unsigned oldSize = fNumBuckets;
+ TableEntry** oldBuckets = fBuckets;
+
+ // Create the new sized table:
+ fNumBuckets *= 4;
+ fBuckets = new TableEntry*[fNumBuckets];
+ for (unsigned i = 0; i < fNumBuckets; ++i) {
+ fBuckets[i] = NULL;
+ }
+ fRebuildSize *= 4;
+ fDownShift -= 2;
+ fMask = (fMask<<2)|0x3;
+
+ // Rehash the existing entries into the new table:
+ for (TableEntry** oldChainPtr = oldBuckets; oldSize > 0;
+ --oldSize, ++oldChainPtr) {
+ for (TableEntry* hPtr = *oldChainPtr; hPtr != NULL;
+ hPtr = *oldChainPtr) {
+ *oldChainPtr = hPtr->fNext;
+
+ unsigned index = hashIndexFromKey(hPtr->key);
+
+ hPtr->fNext = fBuckets[index];
+ fBuckets[index] = hPtr;
+ }
+ }
+
+ // Free the old bucket array, if it was dynamically allocated:
+ if (oldBuckets != fStaticBuckets) delete[] oldBuckets;
+}
+
+unsigned BasicHashTable::hashIndexFromKey(char const* key) const {
+ unsigned result = 0;
+
+ if (fKeyType == STRING_HASH_KEYS) {
+ while (1) {
+ char c = *key++;
+ if (c == 0) break;
+ result += (result<<3) + (unsigned)c;
+ }
+ result &= fMask;
+ } else if (fKeyType == ONE_WORD_HASH_KEYS) {
+ result = randomIndex((uintptr_t)key);
+ } else {
+ unsigned* k = (unsigned*)key;
+ uintptr_t sum = 0;
+ for (int i = 0; i < fKeyType; ++i) {
+ sum += k[i];
+ }
+ result = randomIndex(sum);
+ }
+
+ return result;
+}
View
225 src/live555/BasicUsageEnvironment/BasicTaskScheduler.cpp
@@ -0,0 +1,225 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// Implementation
+
+
+#include "BasicUsageEnvironment.hh"
+#include "HandlerSet.hh"
+#include <stdio.h>
+#if defined(_QNX4)
+#include <sys/select.h>
+#include <unix.h>
+#endif
+
+////////// BasicTaskScheduler //////////
+
+BasicTaskScheduler* BasicTaskScheduler::createNew() {
+ return new BasicTaskScheduler();
+}
+
+#define MAX_SCHEDULER_GRANULARITY 10000 // 10 microseconds: We will return to the event loop at least this often
+static void schedulerTickTask(void* clientData) {
+ ((BasicTaskScheduler*)clientData)->scheduleDelayedTask(MAX_SCHEDULER_GRANULARITY, schedulerTickTask, clientData);
+}
+
+BasicTaskScheduler::BasicTaskScheduler()
+ : fMaxNumSockets(0) {
+ FD_ZERO(&fReadSet);
+ FD_ZERO(&fWriteSet);
+ FD_ZERO(&fExceptionSet);
+
+ schedulerTickTask(this); // ensures that we handle events frequently
+}
+
+BasicTaskScheduler::~BasicTaskScheduler() {
+}
+
+#ifndef MILLION
+#define MILLION 1000000
+#endif
+
+void BasicTaskScheduler::SingleStep(unsigned maxDelayTime) {
+ fd_set readSet = fReadSet; // make a copy for this select() call
+ fd_set writeSet = fWriteSet; // ditto
+ fd_set exceptionSet = fExceptionSet; // ditto
+
+ DelayInterval const& timeToDelay = fDelayQueue.timeToNextAlarm();
+ struct timeval tv_timeToDelay;
+ tv_timeToDelay.tv_sec = timeToDelay.seconds();
+ tv_timeToDelay.tv_usec = timeToDelay.useconds();
+ // Very large "tv_sec" values cause select() to fail.
+ // Don't make it any larger than 1 million seconds (11.5 days)
+ const long MAX_TV_SEC = MILLION;
+ if (tv_timeToDelay.tv_sec > MAX_TV_SEC) {
+ tv_timeToDelay.tv_sec = MAX_TV_SEC;
+ }
+ // Also check our "maxDelayTime" parameter (if it's > 0):
+ if (maxDelayTime > 0 &&
+ (tv_timeToDelay.tv_sec > (long)maxDelayTime/MILLION ||
+ (tv_timeToDelay.tv_sec == (long)maxDelayTime/MILLION &&
+ tv_timeToDelay.tv_usec > (long)maxDelayTime%MILLION))) {
+ tv_timeToDelay.tv_sec = maxDelayTime/MILLION;
+ tv_timeToDelay.tv_usec = maxDelayTime%MILLION;
+ }
+
+ int selectResult = select(fMaxNumSockets, &readSet, &writeSet, &exceptionSet, &tv_timeToDelay);
+ if (selectResult < 0) {
+#if defined(__WIN32__) || defined(_WIN32)
+ int err = WSAGetLastError();
+ // For some unknown reason, select() in Windoze sometimes fails with WSAEINVAL if
+ // it was called with no entries set in "readSet". If this happens, ignore it:
+ if (err == WSAEINVAL && readSet.fd_count == 0) {
+ err = EINTR;
+ // To stop this from happening again, create a dummy socket:
+ int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
+ FD_SET((unsigned)dummySocketNum, &fReadSet);
+ }
+ if (err != EINTR) {
+#else
+ if (errno != EINTR && errno != EAGAIN) {
+#endif
+ // Unexpected error - treat this as fatal:
+#if !defined(_WIN32_WCE)
+ perror("BasicTaskScheduler::SingleStep(): select() fails");
+#endif
+ internalError();
+ }
+ }
+
+ // Call the handler function for one readable socket:
+ HandlerIterator iter(*fHandlers);
+ HandlerDescriptor* handler;
+ // To ensure forward progress through the handlers, begin past the last
+ // socket number that we handled:
+ if (fLastHandledSocketNum >= 0) {
+ while ((handler = iter.next()) != NULL) {
+ if (handler->socketNum == fLastHandledSocketNum) break;
+ }
+ if (handler == NULL) {
+ fLastHandledSocketNum = -1;
+ iter.reset(); // start from the beginning instead
+ }
+ }
+ while ((handler = iter.next()) != NULL) {
+ int sock = handler->socketNum; // alias
+ int resultConditionSet = 0;
+ if (FD_ISSET(sock, &readSet) && FD_ISSET(sock, &fReadSet)/*sanity check*/) resultConditionSet |= SOCKET_READABLE;
+ if (FD_ISSET(sock, &writeSet) && FD_ISSET(sock, &fWriteSet)/*sanity check*/) resultConditionSet |= SOCKET_WRITABLE;
+ if (FD_ISSET(sock, &exceptionSet) && FD_ISSET(sock, &fExceptionSet)/*sanity check*/) resultConditionSet |= SOCKET_EXCEPTION;
+ if ((resultConditionSet&handler->conditionSet) != 0 && handler->handlerProc != NULL) {
+ fLastHandledSocketNum = sock;
+ // Note: we set "fLastHandledSocketNum" before calling the handler,
+ // in case the handler calls "doEventLoop()" reentrantly.
+ (*handler->handlerProc)(handler->clientData, resultConditionSet);
+ break;
+ }
+ }
+ if (handler == NULL && fLastHandledSocketNum >= 0) {
+ // We didn't call a handler, but we didn't get to check all of them,
+ // so try again from the beginning:
+ iter.reset();
+ while ((handler = iter.next()) != NULL) {
+ int sock = handler->socketNum; // alias
+ int resultConditionSet = 0;
+ if (FD_ISSET(sock, &readSet) && FD_ISSET(sock, &fReadSet)/*sanity check*/) resultConditionSet |= SOCKET_READABLE;
+ if (FD_ISSET(sock, &writeSet) && FD_ISSET(sock, &fWriteSet)/*sanity check*/) resultConditionSet |= SOCKET_WRITABLE;
+ if (FD_ISSET(sock, &exceptionSet) && FD_ISSET(sock, &fExceptionSet)/*sanity check*/) resultConditionSet |= SOCKET_EXCEPTION;
+ if ((resultConditionSet&handler->conditionSet) != 0 && handler->handlerProc != NULL) {
+ fLastHandledSocketNum = sock;
+ // Note: we set "fLastHandledSocketNum" before calling the handler,
+ // in case the handler calls "doEventLoop()" reentrantly.
+ (*handler->handlerProc)(handler->clientData, resultConditionSet);
+ break;
+ }
+ }
+ if (handler == NULL) fLastHandledSocketNum = -1;//because we didn't call a handler
+ }
+
+ // Also handle any newly-triggered event (Note that we do this *after* calling a socket handler,
+ // in case the triggered event handler modifies The set of readable sockets.)
+ if (fTriggersAwaitingHandling != 0) {
+ if (fTriggersAwaitingHandling == fLastUsedTriggerMask) {
+ // Common-case optimization for a single event trigger:
+ fTriggersAwaitingHandling = 0;
+ if (fTriggeredEventHandlers[fLastUsedTriggerNum] != NULL) {
+ (*fTriggeredEventHandlers[fLastUsedTriggerNum])(fTriggeredEventClientDatas[fLastUsedTriggerNum]);
+ }
+ } else {
+ // Look for an event trigger that needs handling (making sure that we make forward progress through all possible triggers):
+ unsigned i = fLastUsedTriggerNum;
+ EventTriggerId mask = fLastUsedTriggerMask;
+
+ do {
+ i = (i+1)%MAX_NUM_EVENT_TRIGGERS;
+ mask >>= 1;
+ if (mask == 0) mask = 0x80000000;
+
+ if ((fTriggersAwaitingHandling&mask) != 0) {
+ fTriggersAwaitingHandling &=~ mask;
+ if (fTriggeredEventHandlers[i] != NULL) {
+ (*fTriggeredEventHandlers[i])(fTriggeredEventClientDatas[i]);
+ }
+
+ fLastUsedTriggerMask = mask;
+ fLastUsedTriggerNum = i;
+ break;
+ }
+ } while (i != fLastUsedTriggerNum);
+ }
+ }
+
+ // Also handle any delayed event that may have come due.
+ fDelayQueue.handleAlarm();
+}
+
+void BasicTaskScheduler
+ ::setBackgroundHandling(int socketNum, int conditionSet, BackgroundHandlerProc* handlerProc, void* clientData) {
+ if (socketNum < 0) return;
+ FD_CLR((unsigned)socketNum, &fReadSet);
+ FD_CLR((unsigned)socketNum, &fWriteSet);
+ FD_CLR((unsigned)socketNum, &fExceptionSet);
+ if (conditionSet == 0) {
+ fHandlers->clearHandler(socketNum);
+ if (socketNum+1 == fMaxNumSockets) {
+ --fMaxNumSockets;
+ }
+ } else {
+ fHandlers->assignHandler(socketNum, conditionSet, handlerProc, clientData);
+ if (socketNum+1 > fMaxNumSockets) {
+ fMaxNumSockets = socketNum+1;
+ }
+ if (conditionSet&SOCKET_READABLE) FD_SET((unsigned)socketNum, &fReadSet);
+ if (conditionSet&SOCKET_WRITABLE) FD_SET((unsigned)socketNum, &fWriteSet);
+ if (conditionSet&SOCKET_EXCEPTION) FD_SET((unsigned)socketNum, &fExceptionSet);
+ }
+}
+
+void BasicTaskScheduler::moveSocketHandling(int oldSocketNum, int newSocketNum) {
+ if (oldSocketNum < 0 || newSocketNum < 0) return; // sanity check
+ if (FD_ISSET(oldSocketNum, &fReadSet)) {FD_CLR((unsigned)oldSocketNum, &fReadSet); FD_SET((unsigned)newSocketNum, &fReadSet);}
+ if (FD_ISSET(oldSocketNum, &fWriteSet)) {FD_CLR((unsigned)oldSocketNum, &fWriteSet); FD_SET((unsigned)newSocketNum, &fWriteSet);}
+ if (FD_ISSET(oldSocketNum, &fExceptionSet)) {FD_CLR((unsigned)oldSocketNum, &fExceptionSet); FD_SET((unsigned)newSocketNum, &fExceptionSet);}
+ fHandlers->moveHandler(oldSocketNum, newSocketNum);
+
+ if (oldSocketNum+1 == fMaxNumSockets) {
+ --fMaxNumSockets;
+ }
+ if (newSocketNum+1 > fMaxNumSockets) {
+ fMaxNumSockets = newSocketNum+1;
+ }
+}
View
242 src/live555/BasicUsageEnvironment/BasicTaskScheduler0.cpp
@@ -0,0 +1,242 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// Implementation
+
+#include "BasicUsageEnvironment0.hh"
+#include "HandlerSet.hh"
+
+////////// A subclass of DelayQueueEntry,
+////////// used to implement BasicTaskScheduler0::scheduleDelayedTask()
+
+class AlarmHandler: public DelayQueueEntry {
+public:
+ AlarmHandler(TaskFunc* proc, void* clientData, DelayInterval timeToDelay)
+ : DelayQueueEntry(timeToDelay), fProc(proc), fClientData(clientData) {
+ }
+
+private: // redefined virtual functions
+ virtual void handleTimeout() {
+ (*fProc)(fClientData);
+ DelayQueueEntry::handleTimeout();
+ }
+
+private:
+ TaskFunc* fProc;
+ void* fClientData;
+};
+
+
+////////// BasicTaskScheduler0 //////////
+
+BasicTaskScheduler0::BasicTaskScheduler0()
+ : fLastHandledSocketNum(-1), fTriggersAwaitingHandling(0), fLastUsedTriggerMask(1), fLastUsedTriggerNum(MAX_NUM_EVENT_TRIGGERS-1) {
+ fHandlers = new HandlerSet;
+ for (unsigned i = 0; i < MAX_NUM_EVENT_TRIGGERS; ++i) {
+ fTriggeredEventHandlers[i] = NULL;
+ fTriggeredEventClientDatas[i] = NULL;
+ }
+}
+
+BasicTaskScheduler0::~BasicTaskScheduler0() {
+ delete fHandlers;
+}
+
+TaskToken BasicTaskScheduler0::scheduleDelayedTask(int64_t microseconds,
+ TaskFunc* proc,
+ void* clientData) {
+ if (microseconds < 0) microseconds = 0;
+ DelayInterval timeToDelay((long)(microseconds/1000000), (long)(microseconds%1000000));
+ AlarmHandler* alarmHandler = new AlarmHandler(proc, clientData, timeToDelay);
+ fDelayQueue.addEntry(alarmHandler);
+
+ return (void*)(alarmHandler->token());
+}
+
+void BasicTaskScheduler0::unscheduleDelayedTask(TaskToken& prevTask) {
+ DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((intptr_t)prevTask);
+ prevTask = NULL;
+ delete alarmHandler;
+}
+
+void BasicTaskScheduler0::doEventLoop(char* watchVariable) {
+ // Repeatedly loop, handling readble sockets and timed events:
+ while (1) {
+ if (watchVariable != NULL && *watchVariable != 0) break;
+ SingleStep();
+ }
+}
+
+EventTriggerId BasicTaskScheduler0::createEventTrigger(TaskFunc* eventHandlerProc) {
+ unsigned i = fLastUsedTriggerNum;
+ EventTriggerId mask = fLastUsedTriggerMask;
+
+ do {
+ i = (i+1)%MAX_NUM_EVENT_TRIGGERS;
+ mask >>= 1;
+ if (mask == 0) mask = 0x80000000;
+
+ if (fTriggeredEventHandlers[i] == NULL) {
+ // This trigger number is free; use it:
+ fTriggeredEventHandlers[i] = eventHandlerProc;
+ fTriggeredEventClientDatas[i] = NULL; // sanity
+
+ fLastUsedTriggerMask = mask;
+ fLastUsedTriggerNum = i;
+
+ return mask;
+ }
+ } while (i != fLastUsedTriggerNum);
+
+ // All available event triggers are allocated; return 0 instead:
+ return 0;
+}
+
+void BasicTaskScheduler0::deleteEventTrigger(EventTriggerId eventTriggerId) {
+ fTriggersAwaitingHandling &=~ eventTriggerId;
+
+ if (eventTriggerId == fLastUsedTriggerMask) { // common-case optimization:
+ fTriggeredEventHandlers[fLastUsedTriggerNum] = NULL;
+ fTriggeredEventClientDatas[fLastUsedTriggerNum] = NULL;
+ } else {
+ // "eventTriggerId" should have just one bit set.
+ // However, we do the reasonable thing if the user happened to 'or' together two or more "EventTriggerId"s:
+ EventTriggerId mask = 0x80000000;
+ for (unsigned i = 0; i < MAX_NUM_EVENT_TRIGGERS; ++i) {
+ if ((eventTriggerId&mask) != 0) {
+ fTriggeredEventHandlers[i] = NULL;
+ fTriggeredEventClientDatas[i] = NULL;
+ }
+ mask >>= 1;
+ }
+ }
+}
+
+void BasicTaskScheduler0::triggerEvent(EventTriggerId eventTriggerId, void* clientData) {
+ // First, record the "clientData":
+ if (eventTriggerId == fLastUsedTriggerMask) { // common-case optimization:
+ fTriggeredEventClientDatas[fLastUsedTriggerNum] = clientData;
+ } else {
+ EventTriggerId mask = 0x80000000;
+ for (unsigned i = 0; i < MAX_NUM_EVENT_TRIGGERS; ++i) {
+ if ((eventTriggerId&mask) != 0) {
+ fTriggeredEventClientDatas[i] = clientData;
+
+ fLastUsedTriggerMask = mask;
+ fLastUsedTriggerNum = i;
+ }
+ mask >>= 1;
+ }
+ }
+
+ // Then, note this event as being ready to be handled.
+ // (Note that because this function (unlike others in the library) can be called from an external thread, we do this last, to
+ // reduce the risk of a race condition.)
+ fTriggersAwaitingHandling |= eventTriggerId;
+}
+
+
+////////// HandlerSet (etc.) implementation //////////
+
+HandlerDescriptor::HandlerDescriptor(HandlerDescriptor* nextHandler)
+ : conditionSet(0), handlerProc(NULL) {
+ // Link this descriptor into a doubly-linked list:
+ if (nextHandler == this) { // initialization
+ fNextHandler = fPrevHandler = this;
+ } else {
+ fNextHandler = nextHandler;
+ fPrevHandler = nextHandler->fPrevHandler;
+ nextHandler->fPrevHandler = this;
+ fPrevHandler->fNextHandler = this;
+ }
+}
+
+HandlerDescriptor::~HandlerDescriptor() {
+ // Unlink this descriptor from a doubly-linked list:
+ fNextHandler->fPrevHandler = fPrevHandler;
+ fPrevHandler->fNextHandler = fNextHandler;
+}
+
+HandlerSet::HandlerSet()
+ : fHandlers(&fHandlers) {
+ fHandlers.socketNum = -1; // shouldn't ever get looked at, but in case...
+}
+
+HandlerSet::~HandlerSet() {
+ // Delete each handler descriptor:
+ while (fHandlers.fNextHandler != &fHandlers) {
+ delete fHandlers.fNextHandler; // changes fHandlers->fNextHandler
+ }
+}
+
+void HandlerSet
+::assignHandler(int socketNum, int conditionSet, TaskScheduler::BackgroundHandlerProc* handlerProc, void* clientData) {
+ // First, see if there's already a handler for this socket:
+ HandlerDescriptor* handler = lookupHandler(socketNum);
+ if (handler == NULL) { // No existing handler, so create a new descr:
+ handler = new HandlerDescriptor(fHandlers.fNextHandler);
+ handler->socketNum = socketNum;
+ }
+
+ handler->conditionSet = conditionSet;
+ handler->handlerProc = handlerProc;
+ handler->clientData = clientData;
+}
+
+void HandlerSet::clearHandler(int socketNum) {
+ HandlerDescriptor* handler = lookupHandler(socketNum);
+ delete handler;
+}
+
+void HandlerSet::moveHandler(int oldSocketNum, int newSocketNum) {
+ HandlerDescriptor* handler = lookupHandler(oldSocketNum);
+ if (handler != NULL) {
+ handler->socketNum = newSocketNum;
+ }
+}
+
+HandlerDescriptor* HandlerSet::lookupHandler(int socketNum) {
+ HandlerDescriptor* handler;
+ HandlerIterator iter(*this);
+ while ((handler = iter.next()) != NULL) {
+ if (handler->socketNum == socketNum) break;
+ }
+ return handler;
+}
+
+HandlerIterator::HandlerIterator(HandlerSet& handlerSet)
+ : fOurSet(handlerSet) {
+ reset();
+}
+
+HandlerIterator::~HandlerIterator() {
+}
+
+void HandlerIterator::reset() {
+ fNextPtr = fOurSet.fHandlers.fNextHandler;
+}
+
+HandlerDescriptor* HandlerIterator::next() {
+ HandlerDescriptor* result = fNextPtr;
+ if (result == &fOurSet.fHandlers) { // no more
+ result = NULL;
+ } else {
+ fNextPtr = fNextPtr->fNextHandler;
+ }
+
+ return result;
+}
View
80 src/live555/BasicUsageEnvironment/BasicUsageEnvironment.cpp
@@ -0,0 +1,80 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// Implementation
+
+#include "BasicUsageEnvironment.hh"
+#include <stdio.h>
+
+////////// BasicUsageEnvironment //////////
+
+#if defined(__WIN32__) || defined(_WIN32)
+extern "C" int initializeWinsockIfNecessary();
+#endif
+
+BasicUsageEnvironment::BasicUsageEnvironment(TaskScheduler& taskScheduler)
+: BasicUsageEnvironment0(taskScheduler) {
+#if defined(__WIN32__) || defined(_WIN32)
+ if (!initializeWinsockIfNecessary()) {
+ setResultErrMsg("Failed to initialize 'winsock': ");
+ reportBackgroundError();
+ internalError();
+ }
+#endif
+}
+
+BasicUsageEnvironment::~BasicUsageEnvironment() {
+}
+
+BasicUsageEnvironment*
+BasicUsageEnvironment::createNew(TaskScheduler& taskScheduler) {
+ return new BasicUsageEnvironment(taskScheduler);
+}
+
+int BasicUsageEnvironment::getErrno() const {
+#if defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_WCE)
+ return WSAGetLastError();
+#else
+ return errno;
+#endif
+}
+
+UsageEnvironment& BasicUsageEnvironment::operator<<(char const* str) {
+ if (str == NULL) str = "(NULL)"; // sanity check
+ fprintf(stderr, "%s", str);
+ return *this;
+}
+
+UsageEnvironment& BasicUsageEnvironment::operator<<(int i) {
+ fprintf(stderr, "%d", i);
+ return *this;
+}
+
+UsageEnvironment& BasicUsageEnvironment::operator<<(unsigned u) {
+ fprintf(stderr, "%u", u);
+ return *this;
+}
+
+UsageEnvironment& BasicUsageEnvironment::operator<<(double d) {
+ fprintf(stderr, "%f", d);
+ return *this;
+}
+
+UsageEnvironment& BasicUsageEnvironment::operator<<(void* p) {
+ fprintf(stderr, "%p", p);
+ return *this;
+}
View
88 src/live555/BasicUsageEnvironment/BasicUsageEnvironment0.cpp
@@ -0,0 +1,88 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// Implementation
+
+#include "BasicUsageEnvironment0.hh"
+#include <stdio.h>
+
+////////// BasicUsageEnvironment //////////
+
+BasicUsageEnvironment0::BasicUsageEnvironment0(TaskScheduler& taskScheduler)
+ : UsageEnvironment(taskScheduler),
+ fBufferMaxSize(RESULT_MSG_BUFFER_MAX) {
+ reset();
+}
+
+BasicUsageEnvironment0::~BasicUsageEnvironment0() {
+}
+
+void BasicUsageEnvironment0::reset() {
+ fCurBufferSize = 0;
+ fResultMsgBuffer[fCurBufferSize] = '\0';
+}
+
+
+// Implementation of virtual functions:
+
+char const* BasicUsageEnvironment0::getResultMsg() const {
+ return fResultMsgBuffer;
+}
+
+void BasicUsageEnvironment0::setResultMsg(MsgString msg) {
+ reset();
+ appendToResultMsg(msg);
+}
+
+void BasicUsageEnvironment0::setResultMsg(MsgString msg1, MsgString msg2) {
+ setResultMsg(msg1);
+ appendToResultMsg(msg2);
+}
+
+void BasicUsageEnvironment0::setResultMsg(MsgString msg1, MsgString msg2,
+ MsgString msg3) {
+ setResultMsg(msg1, msg2);
+ appendToResultMsg(msg3);
+}
+
+void BasicUsageEnvironment0::setResultErrMsg(MsgString msg, int err) {
+ setResultMsg(msg);
+
+#ifndef _WIN32_WCE
+ appendToResultMsg(strerror(err == 0 ? getErrno() : err));
+#endif
+}
+
+void BasicUsageEnvironment0::appendToResultMsg(MsgString msg) {
+ char* curPtr = &fResultMsgBuffer[fCurBufferSize];
+ unsigned spaceAvailable = fBufferMaxSize - fCurBufferSize;
+ unsigned msgLength = strlen(msg);
+
+ // Copy only enough of "msg" as will fit:
+ if (msgLength > spaceAvailable-1) {
+ msgLength = spaceAvailable-1;
+ }
+
+ memmove(curPtr, (char*)msg, msgLength);
+ fCurBufferSize += msgLength;
+ fResultMsgBuffer[fCurBufferSize] = '\0';
+}
+
+void BasicUsageEnvironment0::reportBackgroundError() {
+ fputs(getResultMsg(), stderr);
+}
+
View
1  src/live555/BasicUsageEnvironment/COPYING
View
230 src/live555/BasicUsageEnvironment/DelayQueue.cpp
@@ -0,0 +1,230 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012, Live Networks, Inc. All rights reserved
+// Help by Carlo Bonamico to get working for Windows
+// Delay queue
+// Implementation
+
+#include "DelayQueue.hh"
+#include "GroupsockHelper.hh"
+
+static const int MILLION = 1000000;
+
+///// Timeval /////
+
+int Timeval::operator>=(const Timeval& arg2) const {
+ return seconds() > arg2.seconds()
+ || (seconds() == arg2.seconds()
+ && useconds() >= arg2.useconds());
+}
+
+void Timeval::operator+=(const DelayInterval& arg2) {
+ secs() += arg2.seconds(); usecs() += arg2.useconds();
+ if (useconds() >= MILLION) {
+ usecs() -= MILLION;
+ ++secs();
+ }
+}
+
+void Timeval::operator-=(const DelayInterval& arg2) {
+ secs() -= arg2.seconds(); usecs() -= arg2.useconds();
+ if ((int)useconds() < 0) {
+ usecs() += MILLION;
+ --secs();
+ }
+ if ((int)seconds() < 0)
+ secs() = usecs() = 0;
+
+}
+
+DelayInterval operator-(const Timeval& arg1, const Timeval& arg2) {
+ time_base_seconds secs = arg1.seconds() - arg2.seconds();
+ time_base_seconds usecs = arg1.useconds() - arg2.useconds();
+
+ if ((int)usecs < 0) {
+ usecs += MILLION;
+ --secs;
+ }
+ if ((int)secs < 0)
+ return DELAY_ZERO;
+ else
+ return DelayInterval(secs, usecs);
+}
+
+
+///// DelayInterval /////
+
+DelayInterval operator*(short arg1, const DelayInterval& arg2) {
+ time_base_seconds result_seconds = arg1*arg2.seconds();
+ time_base_seconds result_useconds = arg1*arg2.useconds();
+
+ time_base_seconds carry = result_useconds/MILLION;
+ result_useconds -= carry*MILLION;
+ result_seconds += carry;
+
+ return DelayInterval(result_seconds, result_useconds);
+}
+
+#ifndef INT_MAX
+#define INT_MAX 0x7FFFFFFF
+#endif
+const DelayInterval DELAY_ZERO(0, 0);
+const DelayInterval DELAY_SECOND(1, 0);
+const DelayInterval ETERNITY(INT_MAX, MILLION-1);
+// used internally to make the implementation work
+
+
+///// DelayQueueEntry /////
+
+intptr_t DelayQueueEntry::tokenCounter = 0;
+
+DelayQueueEntry::DelayQueueEntry(DelayInterval delay)
+ : fDeltaTimeRemaining(delay) {
+ fNext = fPrev = this;
+ fToken = ++tokenCounter;
+}
+
+DelayQueueEntry::~DelayQueueEntry() {
+}
+
+void DelayQueueEntry::handleTimeout() {
+ delete this;
+}
+
+
+///// DelayQueue /////
+
+DelayQueue::DelayQueue()
+ : DelayQueueEntry(ETERNITY) {
+ fLastSyncTime = TimeNow();
+}
+
+DelayQueue::~DelayQueue() {
+ while (fNext != this) {
+ DelayQueueEntry* entryToRemove = fNext;
+ removeEntry(entryToRemove);
+ delete entryToRemove;
+ }
+}
+
+void DelayQueue::addEntry(DelayQueueEntry* newEntry) {
+ synchronize();
+
+ DelayQueueEntry* cur = head();
+ while (newEntry->fDeltaTimeRemaining >= cur->fDeltaTimeRemaining) {
+ newEntry->fDeltaTimeRemaining -= cur->fDeltaTimeRemaining;
+ cur = cur->fNext;
+ }
+
+ cur->fDeltaTimeRemaining -= newEntry->fDeltaTimeRemaining;
+
+ // Add "newEntry" to the queue, just before "cur":
+ newEntry->fNext = cur;
+ newEntry->fPrev = cur->fPrev;
+ cur->fPrev = newEntry->fPrev->fNext = newEntry;
+}
+
+void DelayQueue::updateEntry(DelayQueueEntry* entry, DelayInterval newDelay) {
+ if (entry == NULL) return;
+
+ removeEntry(entry);
+ entry->fDeltaTimeRemaining = newDelay;
+ addEntry(entry);
+}
+
+void DelayQueue::updateEntry(intptr_t tokenToFind, DelayInterval newDelay) {
+ DelayQueueEntry* entry = findEntryByToken(tokenToFind);
+ updateEntry(entry, newDelay);
+}
+
+void DelayQueue::removeEntry(DelayQueueEntry* entry) {
+ if (entry == NULL || entry->fNext == NULL) return;
+
+ entry->fNext->fDeltaTimeRemaining += entry->fDeltaTimeRemaining;
+ entry->fPrev->fNext = entry->fNext;
+ entry->fNext->fPrev = entry->fPrev;
+ entry->fNext = entry->fPrev = NULL;
+ // in case we should try to remove it again
+}
+
+DelayQueueEntry* DelayQueue::removeEntry(intptr_t tokenToFind) {
+ DelayQueueEntry* entry = findEntryByToken(tokenToFind);
+ removeEntry(entry);
+ return entry;
+}
+
+DelayInterval const& DelayQueue::timeToNextAlarm() {
+ if (head()->fDeltaTimeRemaining == DELAY_ZERO) return DELAY_ZERO; // a common case
+
+ synchronize();
+ return head()->fDeltaTimeRemaining;
+}
+
+void DelayQueue::handleAlarm() {
+ if (head()->fDeltaTimeRemaining != DELAY_ZERO) synchronize();
+
+ if (head()->fDeltaTimeRemaining == DELAY_ZERO) {
+ // This event is due to be handled:
+ DelayQueueEntry* toRemove = head();
+ removeEntry(toRemove); // do this first, in case handler accesses queue
+
+ toRemove->handleTimeout();
+ }
+}
+
+DelayQueueEntry* DelayQueue::findEntryByToken(intptr_t tokenToFind) {
+ DelayQueueEntry* cur = head();
+ while (cur != this) {
+ if (cur->token() == tokenToFind) return cur;
+ cur = cur->fNext;
+ }
+
+ return NULL;
+}
+
+void DelayQueue::synchronize() {
+ // First, figure out how much time has elapsed since the last sync:
+ EventTime timeNow = TimeNow();
+ if (timeNow < fLastSyncTime) {
+ // The system clock has apparently gone back in time; reset our sync time and return:
+ fLastSyncTime = timeNow;
+ return;
+ }
+ DelayInterval timeSinceLastSync = timeNow - fLastSyncTime;
+ fLastSyncTime = timeNow;
+
+ // Then, adjust the delay queue for any entries whose time is up:
+ DelayQueueEntry* curEntry = head();
+ while (timeSinceLastSync >= curEntry->fDeltaTimeRemaining) {
+ timeSinceLastSync -= curEntry->fDeltaTimeRemaining;
+ curEntry->fDeltaTimeRemaining = DELAY_ZERO;
+ curEntry = curEntry->fNext;
+ }
+ curEntry->fDeltaTimeRemaining -= timeSinceLastSync;
+}
+
+
+///// EventTime /////
+
+EventTime TimeNow() {
+ struct timeval tvNow;
+
+ gettimeofday(&tvNow, NULL);
+
+ return EventTime(tvNow.tv_sec, tvNow.tv_usec);
+}
+
+const EventTime THE_END_OF_TIME(INT_MAX);
View
2  src/live555/BasicUsageEnvironment/Makefile.head
@@ -0,0 +1,2 @@
+INCLUDES = -Iinclude -I../UsageEnvironment/include -I../groupsock/include
+##### Change the following for your environment:
View
33 src/live555/BasicUsageEnvironment/Makefile.tail
@@ -0,0 +1,33 @@
+##### End of variables to change
+
+LIB = libBasicUsageEnvironment.$(LIB_SUFFIX)
+ALL = $(LIB)
+all: $(ALL)
+
+OBJS = BasicUsageEnvironment0.$(OBJ) BasicUsageEnvironment.$(OBJ) \
+ BasicTaskScheduler0.$(OBJ) BasicTaskScheduler.$(OBJ) \
+ DelayQueue.$(OBJ) BasicHashTable.$(OBJ)
+
+libBasicUsageEnvironment.$(LIB_SUFFIX): $(OBJS)
+ $(LIBRARY_LINK)$@ $(LIBRARY_LINK_OPTS) \
+ $(OBJS)
+
+.$(C).$(OBJ):
+ $(C_COMPILER) -c $(C_FLAGS) $<
+
+.$(CPP).$(OBJ):
+ $(CPLUSPLUS_COMPILER) -c $(CPLUSPLUS_FLAGS) $<
+
+BasicUsageEnvironment0.$(CPP): include/BasicUsageEnvironment0.hh
+include/BasicUsageEnvironment0.hh: include/BasicUsageEnvironment_version.hh include/DelayQueue.hh
+BasicUsageEnvironment.$(CPP): include/BasicUsageEnvironment.hh
+include/BasicUsageEnvironment.hh: include/BasicUsageEnvironment0.hh
+BasicTaskScheduler0.$(CPP): include/BasicUsageEnvironment0.hh include/HandlerSet.hh
+BasicTaskScheduler.$(CPP): include/BasicUsageEnvironment.hh include/HandlerSet.hh
+DelayQueue.$(CPP): include/DelayQueue.hh
+BasicHashTable.$(CPP): include/BasicHashTable.hh
+
+clean:
+ -rm -rf *.$(OBJ) $(ALL) core *.core *~ include/*~
+
+##### Any additional, platform-specific rules come here:
View
104 src/live555/BasicUsageEnvironment/include/BasicHashTable.hh
@@ -0,0 +1,104 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Hash Table implementation
+// C++ header
+
+#ifndef _BASIC_HASH_TABLE_HH
+#define _BASIC_HASH_TABLE_HH
+
+#ifndef _HASH_TABLE_HH
+#include "HashTable.hh"
+#endif
+#ifndef _NET_COMMON_H
+#include <NetCommon.h> // to ensure that "uintptr_t" is defined
+#endif
+
+// A simple hash table implementation, inspired by the hash table
+// implementation used in Tcl 7.6: <http://www.tcl.tk/>
+
+#define SMALL_HASH_TABLE_SIZE 4
+
+class BasicHashTable: public HashTable {
+private:
+ class TableEntry; // forward
+
+public:
+ BasicHashTable(int keyType);
+ virtual ~BasicHashTable();
+
+ // Used to iterate through the members of the table:
+ class Iterator; friend class Iterator; // to make Sun's C++ compiler happy
+ class Iterator: public HashTable::Iterator {
+ public:
+ Iterator(BasicHashTable& table);
+
+ private: // implementation of inherited pure virtual functions
+ void* next(char const*& key); // returns 0 if none
+
+ private:
+ BasicHashTable& fTable;
+ unsigned fNextIndex; // index of next bucket to be enumerated after this
+ TableEntry* fNextEntry; // next entry in the current bucket
+ };
+
+private: // implementation of inherited pure virtual functions
+ virtual void* Add(char const* key, void* value);
+ // Returns the old value if different, otherwise 0
+ virtual Boolean Remove(char const* key);
+ virtual void* Lookup(char const* key) const;
+ // Returns 0 if not found
+ virtual unsigned numEntries() const;
+
+private:
+ class TableEntry {
+ public:
+ TableEntry* fNext;
+ char const* key;
+ void* value;
+ };
+
+ TableEntry* lookupKey(char const* key, unsigned& index) const;
+ // returns entry matching "key", or NULL if none
+ Boolean keyMatches(char const* key1, char const* key2) const;
+ // used to implement "lookupKey()"
+
+ TableEntry* insertNewEntry(unsigned index, char const* key);
+ // creates a new entry, and inserts it in the table
+ void assignKey(TableEntry* entry, char const* key);
+ // used to implement "insertNewEntry()"
+
+ void deleteEntry(unsigned index, TableEntry* entry);
+ void deleteKey(TableEntry* entry);
+ // used to implement "deleteEntry()"
+
+ void rebuild(); // rebuilds the table as its size increases
+
+ unsigned hashIndexFromKey(char const* key) const;
+ // used to implement many of the routines above
+
+ unsigned randomIndex(uintptr_t i) const {
+ return (unsigned)(((i*1103515245) >> fDownShift) & fMask);
+ }
+
+private:
+ TableEntry** fBuckets; // pointer to bucket array
+ TableEntry* fStaticBuckets[SMALL_HASH_TABLE_SIZE];// used for small tables
+ unsigned fNumBuckets, fNumEntries, fRebuildSize, fDownShift, fMask;
+ int fKeyType;
+};
+
+#endif
View
71 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment.hh
@@ -0,0 +1,71 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// C++ header
+
+#ifndef _BASIC_USAGE_ENVIRONMENT_HH
+#define _BASIC_USAGE_ENVIRONMENT_HH
+
+#ifndef _BASIC_USAGE_ENVIRONMENT0_HH
+#include "BasicUsageEnvironment0.hh"
+#endif
+
+class BasicUsageEnvironment: public BasicUsageEnvironment0 {
+public:
+ static BasicUsageEnvironment* createNew(TaskScheduler& taskScheduler);
+
+ // redefined virtual functions:
+ virtual int getErrno() const;
+
+ virtual UsageEnvironment& operator<<(char const* str);
+ virtual UsageEnvironment& operator<<(int i);
+ virtual UsageEnvironment& operator<<(unsigned u);
+ virtual UsageEnvironment& operator<<(double d);
+ virtual UsageEnvironment& operator<<(void* p);
+
+protected:
+ BasicUsageEnvironment(TaskScheduler& taskScheduler);
+ // called only by "createNew()" (or subclass constructors)
+ virtual ~BasicUsageEnvironment();
+};
+
+
+class BasicTaskScheduler: public BasicTaskScheduler0 {
+public:
+ static BasicTaskScheduler* createNew();
+ virtual ~BasicTaskScheduler();
+
+protected:
+ BasicTaskScheduler();
+ // called only by "createNew()"
+
+protected:
+ // Redefined virtual functions:
+ virtual void SingleStep(unsigned maxDelayTime);
+
+ virtual void setBackgroundHandling(int socketNum, int conditionSet, BackgroundHandlerProc* handlerProc, void* clientData);
+ virtual void moveSocketHandling(int oldSocketNum, int newSocketNum);
+
+protected:
+ // To implement background operations:
+ int fMaxNumSockets;
+ fd_set fReadSet;
+ fd_set fWriteSet;
+ fd_set fExceptionSet;
+};
+
+#endif
View
113 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment0.hh
@@ -0,0 +1,113 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// C++ header
+
+#ifndef _BASIC_USAGE_ENVIRONMENT0_HH
+#define _BASIC_USAGE_ENVIRONMENT0_HH
+
+#ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
+#include "BasicUsageEnvironment_version.hh"
+#endif
+
+#ifndef _USAGE_ENVIRONMENT_HH
+#include "UsageEnvironment.hh"
+#endif
+
+#ifndef _DELAY_QUEUE_HH
+#include "DelayQueue.hh"
+#endif
+
+#define RESULT_MSG_BUFFER_MAX 1000
+
+// An abstract base class, useful for subclassing
+// (e.g., to redefine the implementation of "operator<<")
+class BasicUsageEnvironment0: public UsageEnvironment {
+public:
+ // redefined virtual functions:
+ virtual MsgString getResultMsg() const;
+
+ virtual void setResultMsg(MsgString msg);
+ virtual void setResultMsg(MsgString msg1,
+ MsgString msg2);
+ virtual void setResultMsg(MsgString msg1,
+ MsgString msg2,
+ MsgString msg3);
+ virtual void setResultErrMsg(MsgString msg, int err = 0);
+
+ virtual void appendToResultMsg(MsgString msg);
+
+ virtual void reportBackgroundError();
+
+protected:
+ BasicUsageEnvironment0(TaskScheduler& taskScheduler);
+ virtual ~BasicUsageEnvironment0();
+
+private:
+ void reset();
+
+ char fResultMsgBuffer[RESULT_MSG_BUFFER_MAX];
+ unsigned fCurBufferSize;
+ unsigned fBufferMaxSize;
+};
+
+class HandlerSet; // forward
+
+#define MAX_NUM_EVENT_TRIGGERS 32
+
+// An abstract base class, useful for subclassing
+// (e.g., to redefine the implementation of socket event handling)
+class BasicTaskScheduler0: public TaskScheduler {
+public:
+ virtual ~BasicTaskScheduler0();
+
+ virtual void SingleStep(unsigned maxDelayTime = 0) = 0;
+ // "maxDelayTime" is in microseconds. It allows a subclass to impose a limit
+ // on how long "select()" can delay, in case it wants to also do polling.
+ // 0 (the default value) means: There's no maximum; just look at the delay queue
+
+public:
+ // Redefined virtual functions:
+ virtual TaskToken scheduleDelayedTask(int64_t microseconds, TaskFunc* proc,
+ void* clientData);
+ virtual void unscheduleDelayedTask(TaskToken& prevTask);
+
+ virtual void doEventLoop(char* watchVariable);
+
+ virtual EventTriggerId createEventTrigger(TaskFunc* eventHandlerProc);
+ virtual void deleteEventTrigger(EventTriggerId eventTriggerId);
+ virtual void triggerEvent(EventTriggerId eventTriggerId, void* clientData = NULL);
+
+protected:
+ BasicTaskScheduler0();
+
+protected:
+ // To implement delayed operations:
+ DelayQueue fDelayQueue;
+
+ // To implement background reads:
+ HandlerSet* fHandlers;
+ int fLastHandledSocketNum;
+
+ // To implement event triggers:
+ EventTriggerId fTriggersAwaitingHandling, fLastUsedTriggerMask; // implemented as 32-bit bitmaps
+ TaskFunc* fTriggeredEventHandlers[MAX_NUM_EVENT_TRIGGERS];
+ void* fTriggeredEventClientDatas[MAX_NUM_EVENT_TRIGGERS];
+ unsigned fLastUsedTriggerNum; // in the range [0,MAX_NUM_EVENT_TRIGGERS)
+};
+
+#endif
View
10 src/live555/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
@@ -0,0 +1,10 @@
+// Version information for the "BasicUsageEnvironment" library
+// Copyright (c) 1996-2011 Live Networks, Inc. All rights reserved.
+
+#ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
+#define _BASICUSAGEENVIRONMENT_VERSION_HH
+
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2011.12.23"
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1324598400
+
+#endif
View
182 src/live555/BasicUsageEnvironment/include/DelayQueue.hh
@@ -0,0 +1,182 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+ // Copyright (c) 1996-2012, Live Networks, Inc. All rights reserved
+// Delay queue
+// C++ header
+
+#ifndef _DELAY_QUEUE_HH
+#define _DELAY_QUEUE_HH
+
+#ifndef _NET_COMMON_H
+#include "NetCommon.h"
+#endif
+
+#ifdef TIME_BASE
+typedef TIME_BASE time_base_seconds;
+#else
+typedef long time_base_seconds;
+#endif
+
+///// A "Timeval" can be either an absolute time, or a time interval /////
+
+class Timeval {
+public:
+ time_base_seconds seconds() const {
+ return fTv.tv_sec;
+ }
+ time_base_seconds seconds() {
+ return fTv.tv_sec;
+ }
+ time_base_seconds useconds() const {
+ return fTv.tv_usec;
+ }
+ time_base_seconds useconds() {
+ return fTv.tv_usec;
+ }
+
+ int operator>=(Timeval const& arg2) const;
+ int operator<=(Timeval const& arg2) const {
+ return arg2 >= *this;
+ }
+ int operator<(Timeval const& arg2) const {
+ return !(*this >= arg2);
+ }
+ int operator>(Timeval const& arg2) const {
+ return arg2 < *this;
+ }
+ int operator==(Timeval const& arg2) const {
+ return *this >= arg2 && arg2 >= *this;
+ }
+ int operator!=(Timeval const& arg2) const {
+ return !(*this == arg2);
+ }
+
+ void operator+=(class DelayInterval const& arg2);
+ void operator-=(class DelayInterval const& arg2);
+ // returns ZERO iff arg2 >= arg1
+
+protected:
+ Timeval(time_base_seconds seconds, time_base_seconds useconds) {
+ fTv.tv_sec = seconds; fTv.tv_usec = useconds;
+ }
+
+private:
+ time_base_seconds& secs() {
+ return (time_base_seconds&)fTv.tv_sec;
+ }
+ time_base_seconds& usecs() {
+ return (time_base_seconds&)fTv.tv_usec;
+ }
+
+ struct timeval fTv;
+};
+
+#ifndef max
+inline Timeval max(Timeval const& arg1, Timeval const& arg2) {
+ return arg1 >= arg2 ? arg1 : arg2;
+}
+#endif
+#ifndef min
+inline Timeval min(Timeval const& arg1, Timeval const& arg2) {
+ return arg1 <= arg2 ? arg1 : arg2;
+}
+#endif
+
+class DelayInterval operator-(Timeval const& arg1, Timeval const& arg2);
+// returns ZERO iff arg2 >= arg1
+
+
+///// DelayInterval /////
+
+class DelayInterval: public Timeval {
+public:
+ DelayInterval(time_base_seconds seconds, time_base_seconds useconds)
+ : Timeval(seconds, useconds) {}
+};
+
+DelayInterval operator*(short arg1, DelayInterval const& arg2);
+
+extern DelayInterval const DELAY_ZERO;
+extern DelayInterval const DELAY_SECOND;
+DelayInterval const DELAY_MINUTE = 60*DELAY_SECOND;
+DelayInterval const DELAY_HOUR = 60*DELAY_MINUTE;
+DelayInterval const DELAY_DAY = 24*DELAY_HOUR;
+
+///// EventTime /////
+
+class EventTime: public Timeval {
+public:
+ EventTime(unsigned secondsSinceEpoch = 0,
+ unsigned usecondsSinceEpoch = 0)
+ // We use the Unix standard epoch: January 1, 1970
+ : Timeval(secondsSinceEpoch, usecondsSinceEpoch) {}
+};
+
+EventTime TimeNow();
+
+extern EventTime const THE_END_OF_TIME;
+
+
+///// DelayQueueEntry /////
+
+class DelayQueueEntry {
+public:
+ virtual ~DelayQueueEntry();
+
+ intptr_t token() {
+ return fToken;
+ }
+
+protected: // abstract base class
+ DelayQueueEntry(DelayInterval delay);
+
+ virtual void handleTimeout();
+
+private:
+ friend class DelayQueue;
+ DelayQueueEntry* fNext;
+ DelayQueueEntry* fPrev;
+ DelayInterval fDeltaTimeRemaining;
+
+ intptr_t fToken;
+ static intptr_t tokenCounter;
+};
+
+///// DelayQueue /////
+
+class DelayQueue: public DelayQueueEntry {
+public:
+ DelayQueue();
+ virtual ~DelayQueue();
+
+ void addEntry(DelayQueueEntry* newEntry); // returns a token for the entry
+ void updateEntry(DelayQueueEntry* entry, DelayInterval newDelay);
+ void updateEntry(intptr_t tokenToFind, DelayInterval newDelay);
+ void removeEntry(DelayQueueEntry* entry); // but doesn't delete it
+ DelayQueueEntry* removeEntry(intptr_t tokenToFind); // but doesn't delete it
+
+ DelayInterval const& timeToNextAlarm();
+ void handleAlarm();
+
+private:
+ DelayQueueEntry* head() { return fNext; }
+ DelayQueueEntry* findEntryByToken(intptr_t token);
+ void synchronize(); // bring the 'time remaining' fields up-to-date
+
+ EventTime fLastSyncTime;
+};
+
+#endif
View
77 src/live555/BasicUsageEnvironment/include/HandlerSet.hh
@@ -0,0 +1,77 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Basic Usage Environment: for a simple, non-scripted, console application
+// C++ header
+
+#ifndef _HANDLER_SET_HH
+#define _HANDLER_SET_HH
+
+#ifndef _BOOLEAN_HH
+#include "Boolean.hh"
+#endif
+
+////////// HandlerSet (etc.) definition //////////
+
+class HandlerDescriptor {
+ HandlerDescriptor(HandlerDescriptor* nextHandler);
+ virtual ~HandlerDescriptor();
+
+public:
+ int socketNum;
+ int conditionSet;
+ TaskScheduler::BackgroundHandlerProc* handlerProc;
+ void* clientData;
+
+private:
+ // Descriptors are linked together in a doubly-linked list:
+ friend class HandlerSet;
+ friend class HandlerIterator;
+ HandlerDescriptor* fNextHandler;
+ HandlerDescriptor* fPrevHandler;
+};
+
+class HandlerSet {
+public:
+ HandlerSet();
+ virtual ~HandlerSet();
+
+ void assignHandler(int socketNum, int conditionSet, TaskScheduler::BackgroundHandlerProc* handlerProc, void* clientData);
+ void clearHandler(int socketNum);
+ void moveHandler(int oldSocketNum, int newSocketNum);
+
+private:
+ HandlerDescriptor* lookupHandler(int socketNum);
+
+private:
+ friend class HandlerIterator;
+ HandlerDescriptor fHandlers;
+};
+
+class HandlerIterator {
+public:
+ HandlerIterator(HandlerSet& handlerSet);
+ virtual ~HandlerIterator();
+
+ HandlerDescriptor* next(); // returns NULL if none
+ void reset();
+
+private:
+ HandlerSet& fOurSet;
+ HandlerDescriptor* fNextPtr;
+};
+
+#endif
View
458 src/live555/COPYING
@@ -0,0 +1,458 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
View
0  src/live555/Makefile.head
No changes.
View
26 src/live555/Makefile.tail
@@ -0,0 +1,26 @@
+##### End of variables to change
+
+LIVEMEDIA_DIR = liveMedia
+GROUPSOCK_DIR = groupsock
+USAGE_ENVIRONMENT_DIR = UsageEnvironment
+BASIC_USAGE_ENVIRONMENT_DIR = BasicUsageEnvironment
+
+TESTPROGS_DIR = testProgs
+
+MEDIA_SERVER_DIR = mediaServer
+
+all:
+ cd $(LIVEMEDIA_DIR) ; $(MAKE)
+ cd $(GROUPSOCK_DIR) ; $(MAKE)
+ cd $(USAGE_ENVIRONMENT_DIR) ; $(MAKE)
+ cd $(BASIC_USAGE_ENVIRONMENT_DIR) ; $(MAKE)
+ cd $(TESTPROGS_DIR) ; $(MAKE)
+ cd $(MEDIA_SERVER_DIR) ; $(MAKE)
+
+clean:
+ cd $(LIVEMEDIA_DIR) ; $(MAKE) clean
+ cd $(GROUPSOCK_DIR) ; $(MAKE) clean
+ cd $(USAGE_ENVIRONMENT_DIR) ; $(MAKE) clean
+ cd $(BASIC_USAGE_ENVIRONMENT_DIR) ; $(MAKE) clean
+ cd $(TESTPROGS_DIR) ; $(MAKE) clean
+ cd $(MEDIA_SERVER_DIR) ; $(MAKE) clean
View
2  src/live555/README
@@ -0,0 +1,2 @@
+For documentation and instructions for building this software,
+see <http://www.live555.com/liveMedia/>
View
1  src/live555/UsageEnvironment/COPYING
View
41 src/live555/UsageEnvironment/HashTable.cpp
@@ -0,0 +1,41 @@
+/**********
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+**********/
+// Copyright (c) 1996-2012 Live Networks, Inc. All rights reserved.
+// Generic Hash Table
+// Implementation
+
+#include "HashTable.hh"
+
+HashTable::HashTable() {
+}
+
+HashTable::~HashTable() {
+}
+
+HashTable::Iterator::Iterator() {
+}
+
+HashTable::Iterator::~Iterator() {}
+
+void* HashTable::RemoveNext() {
+ Iterator* iter = Iterator::create(*this);
+ char const* key;
+ void* removedValue = iter->next(key);
+ if (removedValue != 0) Remove(key);
+
+ delete iter;
+ return removedValue;
+}
View
2  src/live555/UsageEnvironment/Makefile.head
@@ -0,0 +1,2 @@
+INCLUDES = -Iinclude -I../groupsock/include
+##### Change the following for your environment:
View
27 src/live555/UsageEnvironment/Makefile.tail
@@ -0,0 +1,27 @@
+##### End of variables to change
+
+USAGE_ENVIRONMENT_LIB = libUsageEnvironment.$(LIB_SUFFIX)
+ALL = $(USAGE_ENVIRONMENT_LIB)
+all: $(ALL)
+
+OBJS = UsageEnvironment.$(OBJ) HashTab