Changes of Revision 9
[-] | Changed | live.spec |
x 1
2 Name: live 3 -Summary: live.com librarys 4 -Summary(de): live.com Bibliothek 5 +Summary: LIVE.com librarys 6 +Summary(de): LIVE.com Bibliothek 7 License: GPL 8 Group: Development/Libraries 9 URL: http://www.live555.com/liveMedia/ 10 -Version: 2008.09.02 11 +Version: 2008.12.20 12 Release: 1 13 14 -Source0: live.2008.09.02.tar.bz2 15 +Source0: live.2008.12.20.tar.bz2 16 Source1: live-CHANGELOG 17 18 Patch0: live-config.patch 19 |
||
[+] | Changed | live-CHANGELOG ^ |
@@ -1,3 +1,43 @@ +2008.12.20: +- Removed - from "MultiFramedRTPSource.cpp" - the historical sanity check for bizarrely delayed packets. + Accepting such bizarro packets causes problems in the code; it's best not to accept them at all. +- Added to "FramedFilter" a new public function "detachInputSource()" that sets the filter's input source + to NULL. This is useful if you want to close the filter independently of closing its input source. + (Thanks to Alex Cichowski for this suggestion.) +- Modified the header file for "MultiFramedRTPSink" to make its implementation of the "stopPlaying()" virtual + function public. (Thanks to Guy Bonneau for this suggestion.) +- Changed "MediaSession::initiate()" to make the port number selection mechanism (for unicast streams) more robust. + (Thanks to Pierre Ynard for this suggestion.0 + +2008.11.13: +- Fixed an obscure bug in "BasicTaskScheduler::SingleStep()" in which the call to "handleAlarm()" would + (on rare occasions) modify the set of read handlers in such a way as to be inconsistent with the result of + the earlier call to "select()". We fixed the bug by moving the call to "handleAlarm()" after the socket + handler call. (Thanks to Sigismondo Boschi for tracking down this bug.) +- Fixed a bug in "parseRTSPRequestString()" that could cause a crash when parsing certain weird, non-compliant + requests. (Thanks to Sebastien Escudier for reporting this.) + +2008.11.04: +- Fixed a bug in "RTPInterface" that was sometimes causing sockets not to be reclaimed properly by a + RTSP server when streaming RTP/RTCP-over-TCP. (Thanks to Ralf Globisch for tracking this down.) +- Changed the RTSP 'start time' parameter from "float" to "double", to allow for + accurate 'start times' that are very large - e.g., Unix 'epoch' times. + (Thanks to Morgan Toervolt for the suggestion and patch.) +- Made some simplifications to the 'reception stats' code in "RTPSource". + (Thanks to Guy Bonneau for this suggestion.) +- Fixed a minor bug in "QuickTimeFileSink". (Thanks to Pramod Bhagwat.) + +2008.10.07: +- Added an optional "timeout" parameter (in seconds) to the 'connecting' RTSP + client commands. (Thanks to Sebastien Escudier for this patch.) +- Increased the size of a "DummySink"s buffer in "MPEG1or2FileServerDemux", to make + it large enough for any PES packet. +- Fixed a minor memory leak in the "createNew()" functions for + "AVIFileSink" and "QuickTimeFileSink" if the output fid did not get created. + (Thanks to Mehmet Ozgul for noting this.) +- Fixed a couple of spelling erros, removed some unnecessary whitespace, + and updated the address of the FSF in the LGPL preamble (thanks to Erik Hovland). + 2008.09.02: - Fixed a minor bug in "RTSPServer". (Thanks to Renato Mauro.) - Minor improvements fo "FileSink" and "MP3FileSource". (Thanks to Pramod Bhagwat.) | ||
[+] | Deleted | live.2007.11.01.tar.bz2/liveMedia/foo.patch ^ |
@@ -1,33 +0,0 @@ -diff -U7 -p -r1.1 OnDemandServerMediaSubsession.cpp ---- OnDemandServerMediaSubsession.cpp 29 May 2007 11:35:10 -0000 1.1 -+++ OnDemandServerMediaSubsession.cpp 7 Jun 2007 10:17:31 -0000 -@@ -295,24 +295,25 @@ void OnDemandServerMediaSubsession::setS - if (streamState != NULL && streamState->mediaSource() != NULL) { - setStreamSourceScale(streamState->mediaSource(), scale); - } - } - - void OnDemandServerMediaSubsession::deleteStream(unsigned clientSessionId, - void*& streamToken) { -+ StreamState* streamState = (StreamState*)streamToken; -+ - // Look up (and remove) the destinations for this client session: - Destinations* destinations - = (Destinations*)(fDestinationsHashTable->Lookup((char const*)clientSessionId)); - if (destinations != NULL) { - fDestinationsHashTable->Remove((char const*)clientSessionId); -- } - -- // Stop streaming to these destinations: -- StreamState* streamState = (StreamState*)streamToken; -- if (streamState != NULL) streamState->endPlaying(destinations); -+ // Stop streaming to these destinations: -+ if (streamState != NULL) streamState->endPlaying(destinations); -+ } - - // Delete the "StreamState" structure if it's no longer being used: - if (streamState != NULL && streamState->referenceCount() >= 0) { - if (streamState->referenceCount() > 0) --streamState->referenceCount(); - if (streamState->referenceCount() == 0) { - delete streamState; - if (fLastStreamToken == streamToken) fLastStreamToken = NULL; | ||
Deleted | live.2007.12.27.tar.bz2 ^ | |
Deleted | live.2008.01.18.tar.bz2 ^ | |
Deleted | live.2008.07.25.tar.bz2 ^ | |
Deleted | live.2008.09.02.tar.bz2 ^ | |
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/BasicHashTable.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Hash Table implementation // Implementation @@ -108,7 +108,7 @@ BasicHashTable::TableEntry* entry = fNextEntry; fNextEntry = entry->fNext; - + key = entry->key; return entry->value; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/BasicTaskScheduler.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // Implementation @@ -47,7 +47,7 @@ void BasicTaskScheduler::SingleStep(unsigned maxDelayTime) { fd_set readSet = fReadSet; // make a copy for this select() call - + DelayInterval const& timeToDelay = fDelayQueue.timeToNextAlarm(); struct timeval tv_timeToDelay; tv_timeToDelay.tv_sec = timeToDelay.seconds(); @@ -66,7 +66,7 @@ tv_timeToDelay.tv_sec = maxDelayTime/MILLION; tv_timeToDelay.tv_usec = maxDelayTime%MILLION; } - + int selectResult = select(fMaxNumSockets, &readSet, NULL, NULL, &tv_timeToDelay); if (selectResult < 0) { @@ -91,10 +91,7 @@ exit(0); } } - - // Handle any delayed event that may have come due: - fDelayQueue.handleAlarm(); - + // Call the handler function for one readable socket: HandlerIterator iter(*fReadHandlers); HandlerDescriptor* handler; @@ -137,6 +134,10 @@ } if (handler == NULL) fLastHandledSocketNum = -1;//because we didn't call a handler } + + // Also handle any delayed event that may have come due. (Note that we do this *after* calling a socket + // handler, in case the delayed event handler modifies the set of readable socket.) + fDelayQueue.handleAlarm(); } void BasicTaskScheduler::turnOnBackgroundReadHandling(int socketNum, | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/BasicTaskScheduler0.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // Implementation @@ -28,13 +28,13 @@ 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; @@ -60,7 +60,7 @@ AlarmHandler* alarmHandler = new AlarmHandler(proc, clientData, timeToDelay); fDelayQueue.addEntry(alarmHandler); - return (void*)(alarmHandler->token()); + return (void*)(alarmHandler->token()); } void BasicTaskScheduler0::unscheduleDelayedTask(TaskToken& prevTask) { @@ -124,7 +124,7 @@ handler = new HandlerDescriptor(fHandlers.fNextHandler); handler->socketNum = socketNum; } - + handler->handlerProc = handlerProc; handler->clientData = clientData; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/BasicUsageEnvironment.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/BasicUsageEnvironment0.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/DelayQueue.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // Help by Carlo Bonamico to get working for Windows // Delay queue // Implementation @@ -52,7 +52,7 @@ 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 (usecs < 0) { usecs += MILLION; --secs; @@ -69,11 +69,11 @@ 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); } @@ -123,9 +123,9 @@ 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; @@ -134,7 +134,7 @@ void DelayQueue::updateEntry(DelayQueueEntry* entry, DelayInterval newDelay) { if (entry == NULL) return; - + removeEntry(entry); entry->fDeltaTimeRemaining = newDelay; addEntry(entry); @@ -147,7 +147,7 @@ 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; @@ -175,7 +175,7 @@ // This event is due to be handled: DelayQueueEntry* toRemove = head(); removeEntry(toRemove); // do this first, in case handler accesses queue - + toRemove->handleTimeout(); } } @@ -195,7 +195,7 @@ EventTime timeNow = TimeNow(); 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) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/BasicHashTable.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Hash Table implementation // C++ header @@ -25,7 +25,7 @@ #endif // A simple hash table implementation, inspired by the hash table -// implementation used in Tcl 7.6: <http://www.tcl.tk/> +// implementation used in Tcl 7.6: <http://www.tcl.tk/> #define SMALL_HASH_TABLE_SIZE 4 @@ -36,22 +36,22 @@ 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 @@ -59,7 +59,7 @@ virtual void* Lookup(char const* key) const; // Returns 0 if not found virtual unsigned numEntries() const; - + private: class TableEntry { public: | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/BasicUsageEnvironment.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // C++ header @@ -27,7 +27,7 @@ class BasicUsageEnvironment: public BasicUsageEnvironment0 { public: static BasicUsageEnvironment* createNew(TaskScheduler& taskScheduler); - + // redefined virtual functions: virtual int getErrno() const; @@ -61,7 +61,7 @@ BackgroundHandlerProc* handlerProc, void* clientData); virtual void turnOffBackgroundReadHandling(int socketNum); - + protected: // To implement background reads: int fMaxNumSockets; | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/BasicUsageEnvironment0.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // C++ header @@ -40,7 +40,7 @@ public: // redefined virtual functions: virtual MsgString getResultMsg() const; - + virtual void setResultMsg(MsgString msg); virtual void setResultMsg(MsgString msg1, MsgString msg2); @@ -48,18 +48,18 @@ MsgString msg2, MsgString msg3); virtual void setResultErrMsg(MsgString msg); - + 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; @@ -77,13 +77,13 @@ // "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); protected: | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh ^ |
@@ -1,10 +1,10 @@ // Version information for the "BasicUsageEnvironment" library -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH #define _BASICUSAGEENVIRONMENT_VERSION_HH -#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2007.10.31" -#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1193788800 +#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING "2008.12.19" +#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT 1229644800 #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/DelayQueue.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ - // Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved + // Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // Delay queue // C++ header @@ -46,7 +46,7 @@ time_base_seconds useconds() { return fTv.tv_usec; } - + int operator>=(Timeval const& arg2) const; int operator<=(Timeval const& arg2) const { return arg2 >= *this; @@ -63,16 +63,16 @@ 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; @@ -80,7 +80,7 @@ time_base_seconds& usecs() { return (time_base_seconds&)fTv.tv_usec; } - + struct timeval fTv; }; @@ -145,9 +145,9 @@ protected: // abstract base class DelayQueueEntry(DelayInterval delay); - + virtual void handleTimeout(); - + private: friend class DelayQueue; DelayQueueEntry* fNext; @@ -164,13 +164,13 @@ public: DelayQueue(); virtual ~DelayQueue(); - + void addEntry(DelayQueueEntry* newEntry); // returns a token for the entry void updateEntry(DelayQueueEntry* entry, DelayInterval newDelay); void updateEntry(long tokenToFind, DelayInterval newDelay); void removeEntry(DelayQueueEntry* entry); // but doesn't delete it DelayQueueEntry* removeEntry(long tokenToFind); // but doesn't delete it - + DelayInterval const& timeToNextAlarm(); void handleAlarm(); @@ -178,7 +178,7 @@ DelayQueueEntry* head() { return fNext; } DelayQueueEntry* findEntryByToken(long token); void synchronize(); // bring the 'time remaining' fields up-to-date - + EventTime fLastSyncTime; }; | ||
[+] | Changed | live.2008.12.20.tar.bz2/BasicUsageEnvironment/include/HandlerSet.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Basic Usage Environment: for a simple, non-scripted, console application // C++ header @@ -53,7 +53,7 @@ friend class HandlerIterator; HandlerDescriptor fHandlers; }; - + class HandlerIterator { public: HandlerIterator(HandlerSet& handlerSet); | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/HashTable.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2003 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Generic Hash Table // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/UsageEnvironment.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Usage Environment // Implementation @@ -36,7 +36,7 @@ TaskScheduler::~TaskScheduler() { } - + void TaskScheduler::rescheduleDelayedTask(TaskToken& task, int64_t microseconds, TaskFunc* proc, void* clientData) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/include/Boolean.hh ^ |
@@ -11,7 +11,7 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ #ifndef _BOOLEAN_HH #define _BOOLEAN_HH | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/include/HashTable.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2003 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Generic Hash Table // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/include/UsageEnvironment.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Usage Environment // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/include/UsageEnvironment_version.hh ^ |
@@ -1,10 +1,10 @@ // Version information for the "UsageEnvironment" library -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. #ifndef _USAGEENVIRONMENT_VERSION_HH #define _USAGEENVIRONMENT_VERSION_HH -#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2007.10.31" -#define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1193788800 +#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING "2008.12.19" +#define USAGEENVIRONMENT_LIBRARY_VERSION_INT 1229644800 #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/include/strDup.hh ^ |
@@ -11,13 +11,13 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ #ifndef _STRDUP_HH #define _STRDUP_HH -// Copyright (c) 1996-2003 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A C++ equivalent to the standard C routine "strdup()". // This generates a char* that can be deleted using "delete[]" // Header | ||
[+] | Changed | live.2008.12.20.tar.bz2/UsageEnvironment/strDup.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2003 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A C++ equivalent to the standard C routine "strdup()". // This generates a char* that can be deleted using "delete[]" // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_common.cpp ^ |
@@ -11,7 +11,7 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // Copyright (c) 2001-2004 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device @@ -79,13 +79,13 @@ short* samplePtr = (short*)(curHdr->lpData); unsigned numSamples = blockSize/2; totNumSamples += numSamples; - + while (numSamples-- > 0) { short sample = *samplePtr++; if (sample < 0) sample = -sample; levelTotal += (unsigned short)sample; } - + if (curHdr == readTail) break; curHdr = curHdr->lpNext; } @@ -109,7 +109,7 @@ handleClosure(this); return; } - + // Try again after a short delay: unsigned const uSecondsToDelay = fGranularityInMS*1000; fTotalPollingDelay += uSecondsToDelay; @@ -126,7 +126,7 @@ return; } fDurationInMicroseconds = 1000000/fSamplingFrequency; - + // Call our own 'after getting' function. Because we sometimes get here // after returning from a delay, we can call this directly, without risking // infinite recursion @@ -145,7 +145,7 @@ Boolean WindowsAudioInputDevice_common::openWavInPort(int index, unsigned numChannels, unsigned samplingFrequency, unsigned granularityInMS) { uSecsPerByte = (8*1e6)/(_bitsPerSample*numChannels*samplingFrequency); - + // Configure the port, based on the specified parameters: WAVEFORMATEX wfx; wfx.wFormatTag = WAVE_FORMAT_PCM; @@ -155,16 +155,16 @@ wfx.nBlockAlign = (numChannels*_bitsPerSample)/8; wfx.nAvgBytesPerSec = samplingFrequency*wfx.nBlockAlign; wfx.cbSize = 0; - + blockSize = (wfx.nAvgBytesPerSec*granularityInMS)/1000; - + // Use a 10-second input buffer, to allow for CPU competition from video, etc., // and also for some audio cards that buffer as much as 5 seconds of audio. unsigned const bufferSeconds = 10; numBlocks = (bufferSeconds*1000)/granularityInMS; - + if (!waveIn_open(index, wfx)) return False; - + // Set this process's priority high. I'm not sure how much this is really needed, // but the "rat" code does this: SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); @@ -173,23 +173,23 @@ Boolean WindowsAudioInputDevice_common::waveIn_open(unsigned uid, WAVEFORMATEX& wfx) { if (shWaveIn != NULL) return True; // already open - + do { waveIn_reset(); if (waveInOpen(&shWaveIn, uid, &wfx, (DWORD)waveInCallback, 0, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) break; - + // Allocate read buffers, and headers: readData = new unsigned char[numBlocks*blockSize]; if (readData == NULL) break; - + readHdrs = new WAVEHDR[numBlocks]; if (readHdrs == NULL) break; readHead = readTail = NULL; - + readTimes = new struct timeval[numBlocks]; if (readTimes == NULL) break; - + // Initialize headers: for (unsigned i = 0; i < numBlocks; ++i) { readHdrs[i].lpData = (char*)&readData[i*blockSize]; @@ -198,44 +198,44 @@ if (waveInPrepareHeader(shWaveIn, &readHdrs[i], sizeof (WAVEHDR)) != MMSYSERR_NOERROR) break; if (waveInAddBuffer(shWaveIn, &readHdrs[i], sizeof (WAVEHDR)) != MMSYSERR_NOERROR) break; } - + if (waveInStart(shWaveIn) != MMSYSERR_NOERROR) break; - + hAudioReady = CreateEvent(NULL, TRUE, FALSE, "waveIn Audio Ready"); return True; } while (0); - + waveIn_reset(); return False; } void WindowsAudioInputDevice_common::waveIn_close() { if (shWaveIn == NULL) return; // already closed - + waveInStop(shWaveIn); waveInReset(shWaveIn); - + for (unsigned i = 0; i < numBlocks; ++i) { if (readHdrs[i].dwFlags & WHDR_PREPARED) { waveInUnprepareHeader(shWaveIn, &readHdrs[i], sizeof (WAVEHDR)); } } - + waveInClose(shWaveIn); waveIn_reset(); } void WindowsAudioInputDevice_common::waveIn_reset() { shWaveIn = NULL; - + delete[] readData; readData = NULL; bytesUsedAtReadHead = 0; - + delete[] readHdrs; readHdrs = NULL; readHead = readTail = NULL; - + delete[] readTimes; readTimes = NULL; - + hAudioReady = NULL; } @@ -244,7 +244,7 @@ if (readHead != NULL) { int hdrIndex = readHead - readHdrs; creationTime = readTimes[hdrIndex]; - + // Adjust this time to allow for any data that's already been read from this buffer: if (bytesUsedAtReadHead > 0) { creationTime.tv_usec += (unsigned)(uSecsPerByte*bytesUsedAtReadHead); @@ -252,7 +252,7 @@ creationTime.tv_usec %= 1000000; } } - + // Then, read from each available buffer, until we have the data that we want: unsigned numBytesRead = 0; while (readHead != NULL && numBytesRead < numBytesWanted) { @@ -265,31 +265,31 @@ releaseHeadBuffer(); } } - + return numBytesRead; } void WindowsAudioInputDevice_common::releaseHeadBuffer() { WAVEHDR* toRelease = readHead; if (readHead == NULL) return; - + readHead = readHead->lpNext; if (readHead == NULL) readTail = NULL; - - toRelease->lpNext = NULL; - toRelease->dwBytesRecorded = 0; + + toRelease->lpNext = NULL; + toRelease->dwBytesRecorded = 0; toRelease->dwFlags &= ~WHDR_DONE; - waveInAddBuffer(shWaveIn, toRelease, sizeof (WAVEHDR)); + waveInAddBuffer(shWaveIn, toRelease, sizeof (WAVEHDR)); bytesUsedAtReadHead = 0; } void WindowsAudioInputDevice_common::waveInProc(WAVEHDR* hdr) { unsigned hdrIndex = hdr - readHdrs; - + // Record the time that the data arrived: int dontCare; gettimeofday(&readTimes[hdrIndex], &dontCare); - + // Add the block to the tail of the queue: hdr->lpNext = NULL; if (readTail != NULL) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_common.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2005 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device // Base class for both library versions: // One that uses Windows' built-in software mixer; another that doesn't. @@ -30,7 +30,7 @@ public: static Boolean openWavInPort(int index, unsigned numChannels, unsigned samplingFrequency, unsigned granularityInMS); static void waveIn_close(); - static void waveInProc(WAVEHDR* hdr); // Windows audio callback function + static void waveInProc(WAVEHDR* hdr); // Windows audio callback function protected: WindowsAudioInputDevice_common(UsageEnvironment& env, int inputPortNumber, | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_mixer.cpp ^ |
@@ -11,7 +11,7 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // Copyright (c) 2001-2004 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device @@ -33,13 +33,13 @@ public: Mixer(); virtual ~Mixer(); - + void open(unsigned numChannels, unsigned samplingFrequency, unsigned granularityInMS); void open(); // open with default parameters void getPortsInfo(); Boolean enableInputPort(unsigned portIndex, char const*& errReason, MMRESULT& errCode); void close(); - + unsigned index; HMIXER hMixer; // valid when open DWORD dwRecLineID; // valid when open @@ -64,17 +64,17 @@ samplingFrequency, granularityInMS, success); if (!success) {delete newSource; newSource = NULL;} - + return newSource; } AudioPortNames* AudioInputDevice::getPortNames() { WindowsAudioInputDevice::initializeIfNecessary(); - + AudioPortNames* portNames = new AudioPortNames; portNames->numPorts = WindowsAudioInputDevice::numInputPortsTotal; portNames->portName = new char*[WindowsAudioInputDevice::numInputPortsTotal]; - + // If there's more than one mixer, print only the port name. // If there's two or more mixers, also include the mixer name // (to disambiguate port names that may be the same name in different mixers) @@ -86,11 +86,11 @@ } else { portNameFmt = "%s (%s)"; } - + unsigned curPortNum = 0; for (unsigned i = 0; i < WindowsAudioInputDevice::numMixers; ++i) { Mixer& mixer = WindowsAudioInputDevice::ourMixers[i]; - + if (WindowsAudioInputDevice::numMixers <= 1) { mixerNameBuffer[0] = '\0'; } else { @@ -105,13 +105,13 @@ } #endif } - + for (unsigned j = 0; j < mixer.numPorts; ++j) { sprintf(portNameBuffer, portNameFmt, mixer.ports[j].name, mixerNameBuffer); portNames->portName[curPortNum++] = strDup(portNameBuffer); } } - + return portNames; } @@ -133,7 +133,7 @@ WindowsAudioInputDevice::~WindowsAudioInputDevice() { if (fCurMixerId >= 0) ourMixers[fCurMixerId].close(); - + delete[] ourMixers; ourMixers = NULL; numMixers = numInputPortsTotal = 0; } @@ -142,7 +142,7 @@ if (ourMixers != NULL) return; // we've already been initialized numMixers = mixerGetNumDevs(); ourMixers = new Mixer[numMixers]; - + // Initialize each mixer: numInputPortsTotal = 0; for (unsigned i = 0; i < numMixers; ++i) { @@ -153,9 +153,9 @@ // This device has a valid mixer. Get information about its ports: mixer.getPortsInfo(); mixer.close(); - + if (mixer.numPorts == 0) continue; - + numInputPortsTotal += mixer.numPorts; } else { mixer.ports = NULL; @@ -166,12 +166,12 @@ Boolean WindowsAudioInputDevice::setInputPort(int portIndex) { initializeIfNecessary(); - + if (portIndex < 0 || portIndex >= (int)numInputPortsTotal) { // bad index envir().setResultMsg("Bad input port index\n"); return False; } - + // Find the mixer and port that corresponds to "portIndex": int newMixerId, portWithinMixer, portIndexCount = 0; for (newMixerId = 0; newMixerId < (int)numMixers; ++newMixerId) { @@ -182,7 +182,7 @@ break; } } - + // Check that this mixer is allowed: if (allowedDeviceNames != NULL) { int i; @@ -198,8 +198,8 @@ return False; } } - - if (newMixerId != fCurMixerId) { + + if (newMixerId != fCurMixerId) { // The mixer has changed, so close the old one and open the new one: if (fCurMixerId >= 0) ourMixers[fCurMixerId].close(); fCurMixerId = newMixerId; @@ -243,17 +243,17 @@ do { MIXERCAPS mc; if (mixerGetDevCaps(index, &mc, sizeof mc) != MMSYSERR_NOERROR) break; - + // Copy the mixer name: strncpy(name, mc.szPname, MAXPNAMELEN); - + // Find the correct line for this mixer: unsigned i, uWavIn; unsigned nWavIn = waveInGetNumDevs(); for (i = 0; i < nWavIn; ++i) { WAVEINCAPS wic; if (waveInGetDevCaps(i, &wic, sizeof wic) != MMSYSERR_NOERROR) continue; - + MIXERLINE ml; ml.cbStruct = sizeof ml; ml.Target.dwType = MIXERLINE_TARGETTYPE_WAVEIN; @@ -261,7 +261,7 @@ ml.Target.vDriverVersion = wic.vDriverVersion; ml.Target.wMid = wic.wMid; ml.Target.wPid = wic.wPid; - + if (mixerGetLineInfo((HMIXEROBJ)index, &ml, MIXER_GETLINEINFOF_TARGETTYPE/*|MIXER_OBJECTF_MIXER*/) == MMSYSERR_NOERROR) { // this is the right line uWavIn = i; @@ -270,23 +270,23 @@ } } if (i >= nWavIn) break; // error: we couldn't find the right line - + if (mixerOpen(&newHMixer, index, (unsigned long)NULL, (unsigned long)NULL, MIXER_OBJECTF_MIXER) != MMSYSERR_NOERROR) break; if (newHMixer == NULL) break; - + // Sanity check: re-call "mixerGetDevCaps()" using the mixer device handle: if (mixerGetDevCaps((UINT)newHMixer, &mc, sizeof mc) != MMSYSERR_NOERROR) break; - if (mc.cDestinations < 1) break; // error: this mixer has no destinations - + if (mc.cDestinations < 1) break; // error: this mixer has no destinations + if (!WindowsAudioInputDevice_common::openWavInPort(uWavIn, numChannels, samplingFrequency, granularityInMS)) break; hMixer = newHMixer; return; } while (0); - + // An error occurred: - close(); -} + close(); +} void Mixer::open() { open(1, 8000, 20); @@ -295,7 +295,7 @@ void Mixer::getPortsInfo() { MIXERCAPS mc; mixerGetDevCaps((UINT)hMixer, &mc, sizeof mc); - + MIXERLINE mlt; unsigned i; for (i = 0; i < mc.cDestinations; ++i) { @@ -306,7 +306,7 @@ if (mlt.dwLineID == dwRecLineID) break; // this is the destination we're interested in } ports = new AudioInputPort[mlt.cConnections]; - + numPorts = mlt.cConnections; for (i = 0; i < numPorts; ++i) { MIXERLINE mlc; @@ -317,7 +317,7 @@ ports[i].dwComponentType = mlc.dwComponentType; strncpy(ports[i].name, mlc.szName, MIXER_LONG_NAME_CHARS); } - + // Make the microphone the first port in the list: for (i = 1; i < numPorts; ++i) { #ifdef OLD_MICROPHONE_TESTING_CODE @@ -336,7 +336,7 @@ Boolean Mixer::enableInputPort(unsigned portIndex, char const*& errReason, MMRESULT& errCode) { errReason = NULL; // unless there's an error AudioInputPort& port = ports[portIndex]; - + MIXERCONTROL mc; mc.cMultipleItems = 1; // in case it doesn't get set below MIXERLINECONTROLS mlc; @@ -351,7 +351,7 @@ return False; } #endif - + MIXERLINE ml; memset(&ml, 0, sizeof (MIXERLINE)); ml.cbStruct = sizeof (MIXERLINE); @@ -360,10 +360,10 @@ errReason = "mixerGetLineInfo()1"; return False; } - + char portname[MIXER_LONG_NAME_CHARS+1]; strncpy(portname, ml.szName, MIXER_LONG_NAME_CHARS); - + memset(&ml, 0, sizeof (MIXERLINE)); ml.cbStruct = sizeof (MIXERLINE); ml.dwLineID = dwRecLineID; @@ -371,7 +371,7 @@ errReason = "mixerGetLineInfo()2"; return False; } - + // Get Mixer/MUX control information (need control id to set and get control details) mlc.cbStruct = sizeof mlc; mlc.dwLineID = ml.dwLineID; @@ -385,7 +385,7 @@ mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MIXER; // Multiple Select mixerGetLineControls((HMIXEROBJ)hMixer, &mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE/*|MIXER_OBJECTF_HMIXER*/); } - + unsigned matchLine = 0; if (mc.cMultipleItems > 1) { // Before getting control, we need to know which line to grab. @@ -394,10 +394,10 @@ mcd.cbStruct = sizeof mcd; mcd.cChannels = ml.cChannels; mcd.cMultipleItems = mc.cMultipleItems; - MIXERCONTROLDETAILS_LISTTEXT* mcdlText = new MIXERCONTROLDETAILS_LISTTEXT[mc.cMultipleItems]; + MIXERCONTROLDETAILS_LISTTEXT* mcdlText = new MIXERCONTROLDETAILS_LISTTEXT[mc.cMultipleItems]; mcd.cbDetails = sizeof (MIXERCONTROLDETAILS_LISTTEXT); mcd.paDetails = mcdlText; - + if (mc.dwControlID != 0xDEADBEEF) { // we know the control id for real mcd.dwControlID = mc.dwControlID; if ((errCode = mixerGetControlDetails((HMIXEROBJ)hMixer, &mcd, MIXER_GETCONTROLDETAILSF_LISTTEXT/*|MIXER_OBJECTF_HMIXER*/)) != MMSYSERR_NOERROR) { @@ -417,7 +417,7 @@ return False; } } - + for (unsigned i = 0; i < mcd.cMultipleItems; ++i) { if (strcmp(mcdlText[i].szName, portname) == 0) { matchLine = i; @@ -426,34 +426,34 @@ } delete[] mcdlText; } - + // Now get control itself: MIXERCONTROLDETAILS mcd; mcd.cbStruct = sizeof mcd; mcd.dwControlID = mc.dwControlID; mcd.cChannels = ml.cChannels; mcd.cMultipleItems = mc.cMultipleItems; - MIXERCONTROLDETAILS_BOOLEAN* mcdbState = new MIXERCONTROLDETAILS_BOOLEAN[mc.cMultipleItems]; + MIXERCONTROLDETAILS_BOOLEAN* mcdbState = new MIXERCONTROLDETAILS_BOOLEAN[mc.cMultipleItems]; mcd.paDetails = mcdbState; mcd.cbDetails = sizeof (MIXERCONTROLDETAILS_BOOLEAN); - + if ((errCode = mixerGetControlDetails((HMIXEROBJ)hMixer, &mcd, MIXER_GETCONTROLDETAILSF_VALUE/*|MIXER_OBJECTF_HMIXER*/)) != MMSYSERR_NOERROR) { delete[] mcdbState; errReason = "mixerGetControlDetails()3"; return False; } - + for (unsigned j = 0; j < mcd.cMultipleItems; ++j) { mcdbState[j].fValue = (j == matchLine); } - + if ((errCode = mixerSetControlDetails((HMIXEROBJ)hMixer, &mcd, MIXER_OBJECTF_HMIXER)) != MMSYSERR_NOERROR) { delete[] mcdbState; errReason = "mixerSetControlDetails()"; return False; } delete[] mcdbState; - + return True; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_mixer.hh ^ |
@@ -11,16 +11,16 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2005 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device // This version uses Windows' built-in software mixer. // C++ header // // To use this, call "AudioInputDevice::createNew()". // You can also call "AudioInputDevice::getPortNames()" to get a list -// of port names. +// of port names. #ifndef _WINDOWS_AUDIO_INPUT_DEVICE_MIXER_HH #define _WINDOWS_AUDIO_INPUT_DEVICE_MIXER_HH | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_noMixer.cpp ^ |
@@ -11,7 +11,7 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // Copyright (c) 2001-2004 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device @@ -49,23 +49,23 @@ samplingFrequency, granularityInMS, success); if (!success) {delete newSource; newSource = NULL;} - + return newSource; } AudioPortNames* AudioInputDevice::getPortNames() { WindowsAudioInputDevice::initializeIfNecessary(); - + AudioPortNames* portNames = new AudioPortNames; portNames->numPorts = WindowsAudioInputDevice::numAudioInputPorts; portNames->portName = new char*[WindowsAudioInputDevice::numAudioInputPorts]; - + for (unsigned i = 0; i < WindowsAudioInputDevice::numAudioInputPorts; ++i) { AudioInputPort& audioInputPort = WindowsAudioInputDevice::ourAudioInputPorts[i]; - + portNames->portName[i] = strDup(audioInputPort.name); } - + return portNames; } @@ -86,7 +86,7 @@ WindowsAudioInputDevice::~WindowsAudioInputDevice() { if (fCurPortIndex >= 0) ourAudioInputPorts[fCurPortIndex].close(); - + delete[] ourAudioInputPorts; ourAudioInputPorts = NULL; numAudioInputPorts = 0; } @@ -95,7 +95,7 @@ if (ourAudioInputPorts != NULL) return; // we've already been initialized numAudioInputPorts = waveInGetNumDevs(); ourAudioInputPorts = new AudioInputPort[numAudioInputPorts]; - + // Initialize each audio input port for (unsigned i = 0; i < numAudioInputPorts; ++i) { AudioInputPort& port = ourAudioInputPorts[i]; @@ -107,7 +107,7 @@ Boolean WindowsAudioInputDevice::setInputPort(int portIndex) { initializeIfNecessary(); - + if (portIndex < 0 || portIndex >= (int)numAudioInputPorts) { // bad index envir().setResultMsg("Bad input port index\n"); return False; @@ -128,8 +128,8 @@ return False; } } - - if (portIndex != fCurPortIndex) { + + if (portIndex != fCurPortIndex) { // The port has changed, so close the old one and open the new one: if (fCurPortIndex >= 0) ourAudioInputPorts[fCurPortIndex].close();; fCurPortIndex = portIndex; @@ -160,10 +160,10 @@ return; } while (0); - + // An error occurred: - close(); -} + close(); +} void AudioInputPort::open() { open(1, 8000, 20); | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/WindowsAudioInputDevice_noMixer.hh ^ |
@@ -11,16 +11,16 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2005 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Windows implementation of a generic audio input device // This version does not use Windows' built-in software mixer. // C++ header // // To use this, call "AudioInputDevice::createNew()". // You can also call "AudioInputDevice::getPortNames()" to get a list -// of port names. +// of port names. #ifndef _WINDOWS_AUDIO_INPUT_DEVICE_NOMIXER_HH #define _WINDOWS_AUDIO_INPUT_DEVICE_NOMIXER_HH | ||
[+] | Changed | live.2008.12.20.tar.bz2/WindowsAudioInputDevice/showAudioInputPorts.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2003, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A program that prints out this computer's audio input ports #include "AudioInputDevice.hh" | ||
[+] | Added | live.2008.12.20.tar.bz2/config.armeb-uclibc ^ |
@@ -0,0 +1,19 @@ +CROSS_COMPILE= armeb-linux-uclibc- +COMPILE_OPTS = $(INCLUDES) -I. -Os -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D +LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 +C = c +C_COMPILER = $(CROSS_COMPILE)gcc +C_FLAGS = $(COMPILE_OPTS) +CPP = cpp +CPLUSPLUS_COMPILER = $(CROSS_COMPILE)g++ +CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 +OBJ = o +LINK = $(CROSS_COMPILE)gcc -o +LINK_OPTS = -L. +CONSOLE_LINK_OPTS = $(LINK_OPTS) +LIBRARY_LINK = $(CROSS_COMPILE)ld -o +LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic +LIB_SUFFIX = a +LIBS_FOR_CONSOLE_APPLICATION = +LIBS_FOR_GUI_APPLICATION = +EXE = | ||
[+] | Added | live.2008.12.20.tar.bz2/config.bfin-linux-uclibc ^ |
@@ -0,0 +1,18 @@ +CROSS_COMPILER = bfin-linux-uclibc- +COMPILE_OPTS = $(INCLUDES) -I. -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -DUCLINUX -D_FILE_OFFSET_BITS=64 +C = c +C_COMPILER = $(CROSS_COMPILER)gcc +C_FLAGS = $(COMPILE_OPTS) -Wall +CPP = cpp +CPLUSPLUS_COMPILER = $(CROSS_COMPILER)g++ +CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall +OBJ = o +LINK = $(CROSS_COMPILER)g++ -o +LINK_OPTS = -L. +CONSOLE_LINK_OPTS = $(LINK_OPTS) +LIBRARY_LINK = $(CROSS_COMPILER)ld -o +LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic -m elf32bfinfd +LIB_SUFFIX = a +LIBS_FOR_CONSOLE_APPLICATION = +LIBS_FOR_GUI_APPLICATION = +EXE = | ||
[+] | Changed | live.2008.12.20.tar.bz2/config.bfin-uclinux ^ |
(renamed to config.bfin-uclinux) | ||
[+] | Changed | live.2008.12.20.tar.bz2/config.bfin-uclinux ^ |
(renamed to config.bfin-uclinux) | ||
[+] | Added | live.2008.12.20.tar.bz2/config.cygwin-for-vlc ^ |
@@ -0,0 +1,17 @@ +COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=socklen_t +C = c +C_COMPILER = gcc +C_FLAGS = $(COMPILE_OPTS) -DUSE_OUR_BZERO=1 -D_WIN32 -mno-cygwin +CPP = cpp +CPLUSPLUS_COMPILER = c++ +CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 -D_WIN32 -Wno-deprecated -mno-cygwin +OBJ = o +LINK = c++ -o +LINK_OPTS = -L. +CONSOLE_LINK_OPTS = $(LINK_OPTS) +LIBRARY_LINK = ld -o +LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic +LIB_SUFFIX = a +LIBS_FOR_CONSOLE_APPLICATION = +LIBS_FOR_GUI_APPLICATION = +EXE = | ||
[+] | Changed | live.2008.12.20.tar.bz2/config.macosx ^ |
@@ -1,4 +1,4 @@ -COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 +COMPILE_OPTS = $(INCLUDES) -I. $(EXTRA_LDFLAGS) -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 C = c C_COMPILER = cc C_FLAGS = $(COMPILE_OPTS) | ||
[+] | Changed | live.2008.12.20.tar.bz2/config.mingw ^ |
@@ -1,15 +1,15 @@ COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=int C = c -C_COMPILER = gcc +C_COMPILER = $(CC) C_FLAGS = $(COMPILE_OPTS) -DUSE_OUR_BZERO=1 -D__MINGW32__ CPP = cpp -CPLUSPLUS_COMPILER = c++ +CPLUSPLUS_COMPILER = $(CXX) CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -D__MINGW32__ -Wall -Wno-deprecated OBJ = o -LINK = c++ -o +LINK = $(CXX) -o LINK_OPTS = -L. CONSOLE_LINK_OPTS = $(LINK_OPTS) -LIBRARY_LINK = ld -o +LIBRARY_LINK = $(LD) -o LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic LIB_SUFFIX = a LIBS_FOR_CONSOLE_APPLICATION = -lws2_32 | ||
[+] | Changed | live.2008.12.20.tar.bz2/genWindowsMakefiles.cmd ^ |
@@ -4,28 +4,21 @@ for %%I in (%0) do cd "%%~pI" cd liveMedia del /Q liveMedia.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > liveMedia.mak cd ../groupsock del /Q groupsock.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > groupsock.mak cd ../UsageEnvironment del /Q UsageEnvironment.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > UsageEnvironment.mak cd ../BasicUsageEnvironment del /Q BasicUsageEnvironment.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > BasicUsageEnvironment.mak cd ../testProgs del /Q testProgs.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > testProgs.mak cd ../mediaServer del /Q mediaServer.mak -del /Q Makefile type Makefile.head ..\win32config Makefile.tail > mediaServer.mak - ENDLOCAL | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/GroupEId.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-1997, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // "Group Endpoint Id" // Implementation @@ -60,7 +60,7 @@ Scope::~Scope() { clean(); } - + unsigned Scope::publicKeySize() const { return fPublicKey == NULL ? 0 : strlen(fPublicKey); } | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/Groupsock.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // 'Group sockets' // Implementation @@ -62,7 +62,7 @@ if (!writeSocket(env(), socketNum(), destAddr, port, ttl, buffer, bufferSize)) return False; - + if (sourcePortNum() == 0) { // Now that we've sent a packet, we can find out what the // kernel chose as our ephemeral source port number: @@ -74,7 +74,7 @@ return False; } } - + return True; } @@ -120,15 +120,15 @@ << env.getResultMsg() << "\n"; } } - + // Make sure we can get our source address: - if (ourSourceAddressForMulticast(env) == 0) { + if (ourIPAddress(env) == 0) { if (DebugLevel >= 0) { // this is a fatal error env << "Unable to determine our source address: " << env.getResultMsg() << "\n"; } } - + if (DebugLevel >= 2) env << *this << ": created\n"; } @@ -157,7 +157,7 @@ } } } - + if (DebugLevel >= 2) env << *this << ": created\n"; } @@ -170,7 +170,7 @@ } else { socketLeaveGroup(env(), socketNum(), groupAddress().s_addr); } - + delete fDests; if (DebugLevel >= 2) env() << *this << ": deleting\n"; @@ -267,17 +267,17 @@ if (!writeSuccess) break; statsOutgoing.countPacket(bufferSize); statsGroupOutgoing.countPacket(bufferSize); - + // Then, forward to our members: int numMembers = 0; if (!members().IsEmpty()) { numMembers = outputToAllMembersExcept(interfaceNotToFwdBackTo, ttlToSend, buffer, bufferSize, - ourSourceAddressForMulticast(env)); + ourIPAddress(env)); if (numMembers < 0) break; } - + if (DebugLevel >= 3) { env << *this << ": wrote " << bufferSize << " bytes, ttl " << (unsigned)ttlToSend; @@ -288,7 +288,7 @@ } return True; } while (0); - + if (DebugLevel >= 0) { // this is a fatal error env.setResultMsg("Groupsock write failed: ", env.getResultMsg()); } @@ -300,9 +300,9 @@ struct sockaddr_in& fromAddress) { // Read data from the socket, and relay it across any attached tunnels //##### later make this code more general - independent of tunnels - + bytesRead = 0; - + int maxBytesToRead = bufferMaxSize - TunnelEncapsulationTrailerMaxSize; int numBytes = readSocket(env(), socketNum(), buffer, maxBytesToRead, fromAddress); @@ -313,18 +313,18 @@ } return False; } - + // If we're a SSM group, make sure the source address matches: if (isSSM() && fromAddress.sin_addr.s_addr != sourceFilterAddress().s_addr) { return True; } - + // We'll handle this data. // Also write it (with the encapsulation trailer) to each member, // unless the packet was originally sent by us to begin with. bytesRead = numBytes; - + int numMembers = 0; if (!wasLoopedBackFromUs(env(), fromAddress)) { statsIncoming.countPacket(numBytes); @@ -346,14 +346,14 @@ } env() << "\n"; } - + return True; } Boolean Groupsock::wasLoopedBackFromUs(UsageEnvironment& env, struct sockaddr_in& fromAddress) { if (fromAddress.sin_addr.s_addr - == ourSourceAddressForMulticast(env)) { + == ourIPAddress(env)) { if (fromAddress.sin_port == sourcePortNum()) { #ifdef DEBUG_LOOPBACK_CHECKING if (DebugLevel >= 3) { @@ -363,7 +363,7 @@ return True; } } - + return False; } @@ -373,7 +373,7 @@ netAddressBits sourceAddr) { // Don't forward TTL-0 packets if (ttlToFwd == 0) return 0; - + DirectedNetInterfaceSet::Iterator iter(members()); unsigned numMembers = 0; DirectedNetInterface* interf; @@ -381,7 +381,7 @@ // Check whether we've asked to exclude this interface: if (interf == exceptInterface) continue; - + // Check that the packet's source address makes it OK to // be relayed across this interface: UsageEnvironment& saveEnv = env(); @@ -394,7 +394,7 @@ continue; } } - + if (numMembers == 0) { // We know that we're going to forward to at least one // member, so fill in the tunnel encapsulation trailer. @@ -402,7 +402,7 @@ TunnelEncapsulationTrailer* trailerInPacket = (TunnelEncapsulationTrailer*)&data[size]; TunnelEncapsulationTrailer* trailer; - + Boolean misaligned = ((unsigned long)trailerInPacket & 3) != 0; unsigned trailerOffset; u_int8_t tunnelCmd; @@ -422,29 +422,29 @@ trailer = trailerInPacket; } trailer += trailerOffset; - + if (fDests != NULL) { trailer->address() = fDests->fGroupEId.groupAddress().s_addr; trailer->port() = fDests->fPort; // structure copy, outputs in network order } trailer->ttl() = ttlToFwd; trailer->command() = tunnelCmd; - + if (isSSM()) { trailer->auxAddress() = sourceFilterAddress().s_addr; } - + if (misaligned) { memmove(trailerInPacket, trailer-trailerOffset, trailerSize); } - + size += trailerSize; } - + interf->write(data, size); ++numMembers; } - + return numMembers; } @@ -477,18 +477,18 @@ static Boolean unsetGroupsockBySocket(Groupsock const* groupsock) { do { if (groupsock == NULL) break; - + int sock = groupsock->socketNum(); // Make sure "sock" is in bounds: if (sock < 0) break; - + HashTable* sockets = getSocketTable(groupsock->env()); if (sockets == NULL) break; - + Groupsock* gs = (Groupsock*)sockets->Lookup((char*)(long)sock); if (gs == NULL || gs != groupsock) break; sockets->Remove((char*)(long)sock); - + if (sockets->IsEmpty()) { // We can also delete the table (to reclaim space): delete sockets; @@ -497,7 +497,7 @@ return True; } while (0); - + return False; } @@ -511,10 +511,10 @@ env.setResultMsg(buf); break; } - + HashTable* sockets = getSocketTable(env); if (sockets == NULL) break; - + // Make sure we're not replacing an existing Groupsock // That shouldn't happen Boolean alreadyExists @@ -527,11 +527,11 @@ env.setResultMsg(buf); break; } - + sockets->Add((char*)(long)sock, groupsock); return True; } while (0); - + return False; } @@ -539,13 +539,13 @@ do { // Make sure the "sock" parameter is in bounds: if (sock < 0) break; - + HashTable* sockets = getSocketTable(env); if (sockets == NULL) break; - + return (Groupsock*)sockets->Lookup((char*)(long)sock); } while (0); - + return NULL; } @@ -564,7 +564,7 @@ isNew = True; } } while (0); - + return groupsock; } @@ -584,7 +584,7 @@ isNew = True; } } while (0); - + return groupsock; } @@ -626,14 +626,14 @@ sourceFilterAddr.s_addr = sourceFilterAddress; groupsock = new Groupsock(env, groupAddr, sourceFilterAddr, port); } - + if (groupsock == NULL || groupsock->socketNum() < 0) break; - + if (!setGroupsockBySocket(env, groupsock->socketNum(), groupsock)) break; - + fTable.Add(groupAddress, sourceFilterAddress, port, (void*)groupsock); } while (0); - + return groupsock; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/GroupsockHelper.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Helper routines to implement 'group sockets' // Implementation @@ -60,20 +60,20 @@ socketErr(env, "Failed to initialize 'winsock': "); return -1; } - + int newSocket = socket(AF_INET, SOCK_DGRAM, 0); if (newSocket < 0) { socketErr(env, "unable to create datagram socket: "); return newSocket; } - + if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuseFlag, sizeof reuseFlag) < 0) { socketErr(env, "setsockopt(SO_REUSEADDR) error: "); closeSocket(newSocket); return -1; } - + #if defined(__WIN32__) || defined(_WIN32) // Windoze doesn't properly handle SO_REUSEPORT or IP_MULTICAST_LOOP #else @@ -85,7 +85,7 @@ return -1; } #endif - + #ifdef IP_MULTICAST_LOOP const u_int8_t loop = (u_int8_t)setLoopback; if (setsockopt(newSocket, IPPROTO_IP, IP_MULTICAST_LOOP, @@ -96,7 +96,7 @@ } #endif #endif - + // Note: Windoze requires binding, even if the port number is 0 netAddressBits addr = INADDR_ANY; #if defined(__WIN32__) || defined(_WIN32) @@ -117,12 +117,12 @@ #else } #endif - + // Set the sending interface for multicasts, if it's not the default: if (SendingInterfaceAddr != INADDR_ANY) { struct in_addr addr; addr.s_addr = SendingInterfaceAddr; - + if (setsockopt(newSocket, IPPROTO_IP, IP_MULTICAST_IF, (const char*)&addr, sizeof addr) < 0) { socketErr(env, "error setting outgoing multicast interface: "); @@ -130,7 +130,7 @@ return -1; } } - + return newSocket; } @@ -153,20 +153,20 @@ socketErr(env, "Failed to initialize 'winsock': "); return -1; } - + int newSocket = socket(AF_INET, SOCK_STREAM, 0); if (newSocket < 0) { socketErr(env, "unable to create stream socket: "); return newSocket; } - + if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuseFlag, sizeof reuseFlag) < 0) { socketErr(env, "setsockopt(SO_REUSEADDR) error: "); closeSocket(newSocket); return -1; } - + // SO_REUSEPORT doesn't really make sense for TCP sockets, so we // normally don't set them. However, if you really want to do this // #define REUSE_FOR_TCP @@ -225,7 +225,7 @@ if (socket < 0) break; FD_SET((unsigned) socket, &rd_set); const unsigned numFds = socket+1; - + result = select(numFds, &rd_set, NULL, NULL, timeout); if (timeout != NULL && result == 0) { break; // this is OK - timeout occurred @@ -237,7 +237,7 @@ socketErr(env, "select() error: "); break; } - + if (!FD_ISSET(socket, &rd_set)) { socketErr(env, "select() error - !FD_ISSET"); break; @@ -264,7 +264,7 @@ } else if (result <= 0) { break; } - + SOCKLEN_T addressSize = sizeof fromAddress; bytesRead = recvfrom(socket, (char*)buffer, bufferSize, 0, (struct sockaddr*)&fromAddress, @@ -294,7 +294,7 @@ break; } } while (0); - + return bytesRead; } @@ -305,7 +305,7 @@ struct timeval* timeout) { /* read EXACTLY bufferSize bytes from the socket into the buffer. fromaddress is address of last read. - return the number of bytes acually read when an error occurs + return the number of bytes actually read when an error occurs */ int bsize = bufferSize; int bytesRead = 0; @@ -442,7 +442,7 @@ } #endif } - + return True; } @@ -507,7 +507,7 @@ socketErr(env, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP) error: "); return False; } - + return True; } @@ -524,7 +524,7 @@ (const char*)&imr, sizeof (struct ip_mreq_source)) < 0) { return False; } - + return True; } @@ -532,7 +532,7 @@ sockaddr_in test; test.sin_port = 0; SOCKLEN_T len = sizeof test; if (getsockname(socket, (struct sockaddr*)&test, &len) < 0) return False; - + resultPortNum = ntohs(test.sin_port); return True; } @@ -549,7 +549,7 @@ return False; } } - + port = Port(portNum); return True; } @@ -564,16 +564,16 @@ Boolean loopbackWorks = 1; -netAddressBits ourSourceAddressForMulticast(UsageEnvironment& env) { +netAddressBits ourIPAddress(UsageEnvironment& env) { static netAddressBits ourAddress = 0; int sock = -1; struct in_addr testAddr; - + if (ourAddress == 0) { // We need to find our source address struct sockaddr_in fromAddr; fromAddr.sin_addr.s_addr = 0; - + // Get our address by sending a (0-TTL) multicast packet, // receiving it, and looking at the source address used. // (This is kinda bogus, but it provides the best guarantee @@ -583,18 +583,18 @@ testAddr.s_addr = our_inet_addr("228.67.43.91"); // arbitrary Port testPort(15947); // ditto - + sock = setupDatagramSocket(env, testPort); if (sock < 0) break; - + if (!socketJoinGroup(env, sock, testAddr.s_addr)) break; - + unsigned char testString[] = "hostIdTest"; unsigned testStringLength = sizeof testString; - + if (!writeSocket(env, sock, testAddr, testPort, 0, testString, testStringLength)) break; - + unsigned char readBuffer[20]; struct timeval timeout; timeout.tv_sec = 5; @@ -624,7 +624,7 @@ env.setResultErrMsg("initial gethostname() failed"); break; } - + #if defined(VXWORKS) #include <hostLib.h> if (ERROR == (ourAddress = hostGetByName( hostname ))) break; @@ -641,7 +641,7 @@ for (unsigned i = 0; ; ++i) { char* addrPtr = hstent->h_addr_list[i]; if (addrPtr == NULL) break; - + netAddressBits a = *(netAddressBits*)addrPtr; if (!badAddress(a)) { addr = a; @@ -655,7 +655,7 @@ break; } } while (0); - + // Make sure we have a good address: netAddressBits from = fromAddr.sin_addr.s_addr; if (badAddress(from)) { @@ -666,15 +666,15 @@ env.setResultMsg(tmp); from = 0; } - + ourAddress = from; #endif - + if (sock >= 0) { socketLeaveGroup(env, sock, testAddr.s_addr); closeSocket(sock); } - + // Use our newly-discovered IP address, and the current time, // to initialize the random number generator's seed: struct timeval timeNow; @@ -687,7 +687,7 @@ netAddressBits chooseRandomIPv4SSMAddress(UsageEnvironment& env) { // First, a hack to ensure that our random number generator is seeded: - (void) ourSourceAddressForMulticast(env); + (void) ourIPAddress(env); // Choose a random address in the range [232.0.1.0, 232.255.255.255) // i.e., [0xE8000100, 0xE8FFFFFF) @@ -700,7 +700,7 @@ char const* timestampString() { struct timeval tvNow; gettimeofday(&tvNow, NULL); - + #if !defined(_WIN32_WCE) static char timeString[9]; // holds hh:mm:ss plus trailing '\0' char const* ctimeResult = ctime((time_t*)&tvNow.tv_sec); @@ -717,7 +717,7 @@ static char timeString[50]; sprintf(timeString, "%lu.%06ld", tvNow.tv_sec, tvNow.tv_usec); #endif - + return (char const*)&timeString; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/IOHandlers.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1998 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // IO event handlers // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/NetAddress.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1998 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Network Addresses // Implementation @@ -90,14 +90,14 @@ if (addr != INADDR_NONE) { // yes it was an IP address string //##### host = gethostbyaddr((char*)&addr, sizeof (netAddressBits), AF_INET); host = NULL; // don't bother calling gethostbyaddr(); we only want 1 addr - + if (host == NULL) { // For some unknown reason, gethostbyaddr() failed, so just // return a 1-element list with the address we were given: fNumAddresses = 1; fAddressArray = new NetAddress*[fNumAddresses]; if (fAddressArray == NULL) return; - + fAddressArray[0] = new NetAddress((u_int8_t*)&addr, sizeof (netAddressBits)); return; @@ -126,11 +126,11 @@ ++fNumAddresses; ++hAddrPtr1; } - + // Next, set up the list: fAddressArray = new NetAddress*[fNumAddresses]; if (fAddressArray == NULL) return; - + for (unsigned i = 0; i < fNumAddresses; ++i) { fAddressArray[i] = new NetAddress(hAddrPtr[i], host->h_length); | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/NetInterface.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1998 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Network Interfaces // Implementation @@ -130,14 +130,14 @@ if (sock == NULL) { // we need to create one: sock = CreateNew(env, port); if (sock == NULL || sock->socketNum() < 0) break; - + fTable->Add((char*)(long)(port.num()), (void*)sock); isNew = True; } - + return sock; } while (0); - + delete sock; return NULL; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/GroupEId.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "multikit" Multicast Application Shell -// Copyright (c) 1996-1997, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // "Group Endpoint Id" // C++ header @@ -64,7 +64,7 @@ portNumBits portNum, unsigned numSuccessiveGroupAddrs = 1); // used for a 'source-specific multicast' group - GroupEId(); // used only as a temp constructor prior to initialization + GroupEId(); // used only as a temp constructor prior to initialization struct in_addr const& groupAddress() const { return fGroupAddress; } struct in_addr const& sourceFilterAddress() const { return fSourceFilterAddress; } @@ -75,7 +75,7 @@ // could be >1 for hier encoding return fNumSuccessiveGroupAddrs; } - + portNumBits portNum() const { return fPortNum; } const Scope& scope() const { return fScope; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/Groupsock.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1998 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // 'Group sockets' // C++ header @@ -40,7 +40,7 @@ public: OutputSocket(UsageEnvironment& env); virtual ~OutputSocket(); - + Boolean write(netAddressBits address, Port port, u_int8_t ttl, unsigned char* buffer, unsigned bufferSize); @@ -107,21 +107,21 @@ struct in_addr const& sourceFilterAddress() const { return fIncomingGroupEId.sourceFilterAddress(); } - + Boolean isSSM() const { return fIncomingGroupEId.isSSM(); } - + u_int8_t ttl() const { return fTTL; } - + void multicastSendOnly(); // send, but don't receive any multicast packets Boolean output(UsageEnvironment& env, u_int8_t ttl, unsigned char* buffer, unsigned bufferSize, DirectedNetInterface* interfaceNotToFwdBackTo = NULL); - + DirectedNetInterfaceSet& members() { return fMembers; } - + Boolean deleteIfNoMembers; Boolean isSlave; // for tunneling @@ -133,21 +133,21 @@ NetInterfaceTrafficStats statsGroupOutgoing; // *not* static NetInterfaceTrafficStats statsGroupRelayedIncoming; // *not* static NetInterfaceTrafficStats statsGroupRelayedOutgoing; // *not* static - + Boolean wasLoopedBackFromUs(UsageEnvironment& env, struct sockaddr_in& fromAddress); - + public: // redefined virtual functions virtual Boolean handleRead(unsigned char* buffer, unsigned bufferMaxSize, unsigned& bytesRead, struct sockaddr_in& fromAddress); - + private: int outputToAllMembersExcept(DirectedNetInterface* exceptInterface, u_int8_t ttlToFwd, unsigned char* data, unsigned size, netAddressBits sourceAddr); - + private: GroupEId fIncomingGroupEId; destRecord* fDests; @@ -182,19 +182,19 @@ class Iterator { public: Iterator(GroupsockLookupTable& groupsocks); - + Groupsock* next(); // NULL iff none - + private: AddressPortLookupTable::Iterator fIter; }; - + private: Groupsock* AddNew(UsageEnvironment& env, netAddressBits groupAddress, netAddressBits sourceFilterAddress, Port port, u_int8_t ttl); - + private: friend class Iterator; AddressPortLookupTable fTable; | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/GroupsockHelper.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Helper routines to implement 'group sockets' // C++ header @@ -75,7 +75,7 @@ Boolean getSourcePort(UsageEnvironment& env, int socket, Port& port); -netAddressBits ourSourceAddressForMulticast(UsageEnvironment& env); // in network order +netAddressBits ourIPAddress(UsageEnvironment& env); // in network order // IP addresses of our sending and receiving interfaces. (By default, these // are INADDR_ANY (i.e., 0), specifying the default interface.) @@ -93,7 +93,7 @@ #define SET_SOCKADDR_SIN_LEN(var) var.sin_len = sizeof var #else #define SET_SOCKADDR_SIN_LEN(var) -#endif +#endif #define MAKE_SOCKADDR_IN(var,adr,prt) /*adr,prt must be in network order*/\ struct sockaddr_in var;\ | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/IOHandlers.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1997 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // IO event handlers // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/NetAddress.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Network Addresses // C++ header @@ -86,7 +86,7 @@ friend class Iterator; unsigned fNumAddresses; - NetAddress** fAddressArray; + NetAddress** fAddressArray; }; typedef u_int16_t portNumBits; | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/NetCommon.h ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ /* "groupsock" interface - * Copyright (c) 1996-2003 Live Networks, Inc. All rights reserved. + * Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. * Common include files, typically used for networking */ | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/NetInterface.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Network Interfaces // C++ header @@ -28,10 +28,10 @@ class NetInterface { public: virtual ~NetInterface(); - + static UsageEnvironment* DefaultUsageEnvironment; // if non-NULL, used for each new interfaces - + protected: NetInterface(); // virtual base class }; @@ -39,12 +39,12 @@ class DirectedNetInterface: public NetInterface { public: virtual ~DirectedNetInterface(); - + virtual Boolean write(unsigned char* data, unsigned numBytes) = 0; - + virtual Boolean SourceAddrOKForRelaying(UsageEnvironment& env, unsigned addr) = 0; - + protected: DirectedNetInterface(); // virtual base class }; @@ -53,25 +53,25 @@ public: DirectedNetInterfaceSet(); virtual ~DirectedNetInterfaceSet(); - + DirectedNetInterface* Add(DirectedNetInterface const* interf); // Returns the old value if different, otherwise 0 Boolean Remove(DirectedNetInterface const* interf); - + Boolean IsEmpty() { return fTable->IsEmpty(); } - + // Used to iterate through the interfaces in the set class Iterator { public: Iterator(DirectedNetInterfaceSet& interfaces); virtual ~Iterator(); - + DirectedNetInterface* next(); // NULL iff none - + private: HashTable::Iterator* fIter; }; - + private: friend class Iterator; HashTable* fTable; @@ -80,26 +80,26 @@ class Socket: public NetInterface { public: virtual ~Socket(); - + virtual Boolean handleRead(unsigned char* buffer, unsigned bufferMaxSize, unsigned& bytesRead, struct sockaddr_in& fromAddress) = 0; // Returns False on error; resultData == NULL if data ignored - + int socketNum() const { return fSocketNum; } - + Port port() const { return fPort; } - + UsageEnvironment& env() const { return fEnv; } - + static int DebugLevel; - + protected: Socket(UsageEnvironment& env, Port port, Boolean setLoopback = True); // virtual base class - + Boolean changePort(Port newPort); // will also cause socketNum() to change private: @@ -116,15 +116,15 @@ class SocketLookupTable { public: virtual ~SocketLookupTable(); - + Socket* Fetch(UsageEnvironment& env, Port port, Boolean& isNew); // Creates a new Socket if none already exists Boolean Remove(Socket const* sock); - + protected: SocketLookupTable(); // abstract base class virtual Socket* CreateNew(UsageEnvironment& env, Port port) = 0; - + private: HashTable* fTable; }; @@ -134,14 +134,14 @@ class NetInterfaceTrafficStats { public: NetInterfaceTrafficStats(); - + void countPacket(unsigned packetSize); - + float totNumPackets() const {return fTotNumPackets;} float totNumBytes() const {return fTotNumBytes;} - + Boolean haveSeenTraffic() const; - + private: float fTotNumPackets; float fTotNumBytes; | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/TunnelEncaps.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "mTunnel" multicast access service -// Copyright (c) 1996-1998 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Encapsulation trailer for tunnels // C++ header @@ -42,9 +42,9 @@ public: Cookie& srcCookie() - { return *(Cookie*)byteOffset(0); } + { return *(Cookie*)byteOffset(0); } Cookie& dstCookie() - { return *(Cookie*)byteOffset(2); } + { return *(Cookie*)byteOffset(2); } u_int32_t& address() { return *(u_int32_t*)byteOffset(4); } Port& port() | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/include/groupsock_version.hh ^ |
@@ -1,10 +1,10 @@ // Version information for the "groupsock" library -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. #ifndef _GROUPSOCK_VERSION_HH #define _GROUPSOCK_VERSION_HH -#define GROUPSOCK_LIBRARY_VERSION_STRING "2007.10.31" -#define GROUPSOCK_LIBRARY_VERSION_INT 1193788800 +#define GROUPSOCK_LIBRARY_VERSION_STRING "2008.12.19" +#define GROUPSOCK_LIBRARY_VERSION_INT 1229644800 #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/groupsock/inet.c ^ |
@@ -93,7 +93,8 @@ } #endif -#ifdef USE_SYSTEM_RANDOM +#ifndef USE_OUR_RANDOM +/* Use the system-supplied "random()" and "srandom()" functions */ #include <stdlib.h> long our_random() { #if defined(__WIN32__) || defined(_WIN32) @@ -104,12 +105,15 @@ } void our_srandom(unsigned int x) { #if defined(__WIN32__) || defined(_WIN32) - return srand(x); + srand(x); #else - return srandom(x); + srandom(x); #endif } + #else + +/* Use our own implementation of the "random()" and "srandom()" functions */ /* * random.c: * | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AC3AudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for AC3 audio // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AC3AudioRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AC3 Audio RTP Sources // Implementation @@ -71,7 +71,7 @@ resultSpecialHeaderSize = 2; return True; -} +} char const* AC3AudioRTPSource::MIMEtype() const { return "audio/AC3"; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AC3AudioStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an AC3 audio elementary stream into frames // Implementation @@ -167,7 +167,7 @@ // We were able to acquire a frame from the input. // It has already been copied to the reader's space. fFrameSize = acquiredFrameSize; - + // Also set the presentation time, and increment it for next time, // based on the length of this frame: fPresentationTime = fNextFramePresentationTime; @@ -253,7 +253,7 @@ } else { // Discard all of the data that was just read: totNumValidBytes() = totNumValidBytes() - size; - + return False; } } @@ -270,7 +270,7 @@ try { saveParserState(); - + // We expect an AC3 audio header (first 2 bytes == 0x0B77) at the start: while (1) { unsigned next4Bytes = test4Bytes(); @@ -280,10 +280,10 @@ } fCurrentFrame.hdr0 = get4Bytes(); fCurrentFrame.hdr1 = test4Bytes(); - + fCurrentFrame.setParamsFromHeader(); fHaveParsedAFrame = True; - + // Copy the frame to the requested destination: unsigned frameSize = fCurrentFrame.frameSize; if (frameSize > fMaxSize) { @@ -299,7 +299,7 @@ fTo[3] = fCurrentFrame.hdr0; getBytes(&fTo[4], frameSize-4); skipBytes(numTruncatedBytes); - + return frameSize; } catch (int /*e*/) { #ifdef DEBUG @@ -316,7 +316,7 @@ fSavedFrameFlag = 0; fUsingSource->getNextFrame(fSavedFrame, maxAC3FrameSize, - afterGettingSavedFrame, this, + afterGettingSavedFrame, this, onSavedFrameClosure, this); fUsingSource->envir().taskScheduler().doEventLoop(&fSavedFrameFlag); } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/ADTSAudioFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an AAC audio file in ADTS format // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/ADTSAudioFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AAC audio files in ADTS format // Implementation @@ -42,13 +42,13 @@ // to get the audio stream's parameters: unsigned char fixedHeader[4]; // it's actually 3.5 bytes long if (fread(fixedHeader, 1, sizeof fixedHeader, fid) < sizeof fixedHeader) break; - + // Check the 'syncword': if (!(fixedHeader[0] == 0xFF && (fixedHeader[1]&0xF0) == 0xF0)) { env.setResultMsg("Bad 'syncword' at start of ADTS file"); break; } - + // Get and check the 'profile': u_int8_t profile = (fixedHeader[2]&0xC0)>>6; // 2 bits if (profile == 3) { @@ -69,7 +69,11 @@ // If we get here, the frame header was OK. // Reset the fid to the beginning of the file: +#ifndef _WIN32_WCE rewind(fid); +#else + fseek(fid, SEEK_SET,0); +#endif #ifdef DEBUG fprintf(stderr, "Read first frame: profile %d, " "sampling_frequency_index %d => samplingFrequency %d, " | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an AMR audio file. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioFileSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AMR Audio File sinks // Implementation @@ -26,7 +26,7 @@ AMRAudioFileSink ::AMRAudioFileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize, - char const* perFrameFileNamePrefix) + char const* perFrameFileNamePrefix) : FileSink(env, fid, bufferSize, perFrameFileNamePrefix), fHaveWrittenHeader(False) { } @@ -69,7 +69,7 @@ if (!fHaveWrittenHeader && fPerFrameFileNameBuffer == NULL) { // Output the appropriate AMR header to the start of the file. - // This header is defined in RFC 3267, section 5. + // This header is defined in RFC 3267, section 5. // (However, we don't do this if we're creating one file per frame.) char headerBuffer[100]; sprintf(headerBuffer, "#!AMR%s%s\n", | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AMR audio files (as defined in RFC 3267, section 5) // Implementation @@ -43,7 +43,7 @@ if (fread(buf, 1, 6, fid) < 6) break; if (strncmp(buf, "#!AMR", 5) != 0) break; // bad magic # unsigned bytesRead = 6; - + // The next bytes must be "\n", "-WB\n", "_MC1.0\n", or "-WB_MC1.0\n" if (buf[5] == '-') { // The next bytes must be "WB\n" or "WB_MC1.0\n" @@ -145,8 +145,8 @@ break; } } - } - + } + // Next, read the frame-block into the buffer provided: fFrameSize *= fNumChannels; // because multiple channels make up a frame-block if (fFrameSize > fMaxSize) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for AMR audio (RFC 3267) // Implementation @@ -119,7 +119,7 @@ unsigned AMRAudioRTPSink::specialHeaderSize() const { // For now, because we're packing only one frame per packet, // there's just a 1-byte payload header, plus a 1-byte TOC ##### - return 2; + return 2; } char const* AMRAudioRTPSink::auxSDPLine() { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AMR Audio RTP Sources (RFC 3267) // Implementation @@ -60,7 +60,7 @@ virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: Boolean fIsWideband, fIsOctetAligned, fIsInterleaved, fCRCsArePresent; @@ -82,7 +82,7 @@ AMRDeinterleaver(UsageEnvironment& env, Boolean isWideband, unsigned numChannels, unsigned maxInterleaveGroupSize, RawAMRRTPSource* inputSource); - // called only by "createNew()" + // called only by "createNew()" virtual ~AMRDeinterleaver(); @@ -90,7 +90,7 @@ unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds); - void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime); + void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime); private: // Redefined virtual functions: @@ -101,7 +101,7 @@ RawAMRRTPSource* fInputSource; class AMRDeinterleavingBuffer* fDeinterleavingBuffer; Boolean fNeedAFrame; - + }; @@ -141,7 +141,7 @@ env << "AMRAudioRTPSource::createNew(): 'Bandwidth-efficient mode' was specified, along with interleaving, 'robust sorting order', and/or CRCs, so we assume 'octet-aligned mode' instead.\n"; isOctetAligned = True; } - } + } Boolean isInterleaved; unsigned maxInterleaveGroupSize; // in frames (not frame-blocks) @@ -312,7 +312,7 @@ #endif return True; -} +} char const* RawAMRRTPSource::MIMEtype() const { return fIsWideband ? "audio/AMR-WB" : "audio/AMR"; @@ -396,7 +396,7 @@ Boolean retrieveFrame(unsigned char* to, unsigned maxSize, unsigned& resultFrameSize, unsigned& resultNumTruncatedBytes, u_int8_t& resultFrameHeader, - struct timeval& resultPresentationTime, + struct timeval& resultPresentationTime, Boolean& resultIsSynchronized); unsigned char* inputBuffer() { return fInputBuffer; } @@ -460,7 +460,7 @@ // First, try getting a frame from the deinterleaving buffer: if (fDeinterleavingBuffer->retrieveFrame(fTo, fMaxSize, fFrameSize, fNumTruncatedBytes, - fLastFrameHeader, fPresentationTime, + fLastFrameHeader, fPresentationTime, fInputSource->isSynchronized())) { // Success! @@ -501,7 +501,7 @@ void AMRDeinterleaver ::afterGettingFrame1(unsigned frameSize, struct timeval presentationTime) { RawAMRRTPSource* source = (RawAMRRTPSource*)fInputSource; - + // First, put the frame into our deinterleaving buffer: fDeinterleavingBuffer->deliverIncomingFrame(frameSize, source, presentationTime); @@ -546,7 +546,7 @@ exit(1); } - --frameIndex; // because it was incremented by the source when this frame was read + --frameIndex; // because it was incremented by the source when this frame was read u_int8_t frameHeader; if (frameIndex >= source->TOCSize()) { // sanity check frameHeader = FT_NO_DATA<<3; @@ -578,7 +578,7 @@ fIncomingBankId ^= 1; unsigned char tmp = fIncomingBinMax; fIncomingBinMax = fOutgoingBinMax; - fOutgoingBinMax = tmp; + fOutgoingBinMax = tmp; fNextOutgoingBin = 0; } @@ -728,7 +728,7 @@ #endif fromBV.skipBits(frameSizeBits); toCount += frameSizeBytes; - } + } #ifdef DEBUG if (fromBV.numBitsRemaining() > 7) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AMRAudioSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AMR audio sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AVIFileSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A sink that generates an AVI file from a composite media session // Implementation @@ -42,7 +42,7 @@ unsigned char* dataEnd() { return &fData[fBytesInUse]; } unsigned bytesInUse() const { return fBytesInUse; } unsigned bytesAvailable() const { return fBufferSize - fBytesInUse; } - + void setPresentationTime(struct timeval const& presentationTime) { fPresentationTime = presentationTime; } @@ -98,15 +98,18 @@ AVIFileSink::AVIFileSink(UsageEnvironment& env, MediaSession& inputSession, - FILE* outFid, + char const* outputFileName, unsigned bufferSize, unsigned short movieWidth, unsigned short movieHeight, unsigned movieFPS, Boolean packetLossCompensate) - : Medium(env), fInputSession(inputSession), fOutFid(outFid), + : Medium(env), fInputSession(inputSession), fBufferSize(bufferSize), fPacketLossCompensate(packetLossCompensate), fAreCurrentlyBeingPlayed(False), fNumSubsessions(0), fNumBytesWritten(0), fHaveCompletedOutputFile(False), fMovieWidth(movieWidth), fMovieHeight(movieHeight), fMovieFPS(movieFPS) { + fOutFid = OpenOutputFile(env, outputFileName); + if (fOutFid == NULL) return; + // Set up I/O state for each input subsession: MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; @@ -151,11 +154,14 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { AVISubsessionIOState* ioState - = (AVISubsessionIOState*)(subsession->miscPtr); + = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; delete ioState; } + + // Finally, close our output file: + CloseOutputFile(fOutFid); } AVIFileSink* AVIFileSink @@ -164,16 +170,15 @@ unsigned bufferSize, unsigned short movieWidth, unsigned short movieHeight, unsigned movieFPS, Boolean packetLossCompensate) { - do { - FILE* fid = OpenOutputFile(env, outputFileName); - if (fid == NULL) break; - - return new AVIFileSink(env, inputSession, fid, bufferSize, - movieWidth, movieHeight, movieFPS, - packetLossCompensate); - } while (0); + AVIFileSink* newSink = + new AVIFileSink(env, inputSession, outputFileName, bufferSize, + movieWidth, movieHeight, movieFPS, packetLossCompensate); + if (newSink == NULL || newSink->fOutFid == NULL) { + Medium::close(newSink); + return NULL; + } - return NULL; + return newSink; } Boolean AVIFileSink::startPlaying(afterPlayingFunc* afterFunc, @@ -194,7 +199,7 @@ Boolean AVIFileSink::continuePlaying() { // Run through each of our input session's 'subsessions', // asking for a frame from each one: - Boolean haveActiveSubsessions = False; + Boolean haveActiveSubsessions = False; MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { @@ -204,7 +209,7 @@ if (subsessionSource->isCurrentlyAwaitingData()) continue; AVISubsessionIOState* ioState - = (AVISubsessionIOState*)(subsession->miscPtr); + = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; haveActiveSubsessions = True; @@ -243,7 +248,7 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { AVISubsessionIOState* ioState - = (AVISubsessionIOState*)(subsession->miscPtr); + = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; if (ioState->fOurSourceIsActive) return; // this source hasn't closed @@ -290,7 +295,7 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { AVISubsessionIOState* ioState - = (AVISubsessionIOState*)(subsession->miscPtr); + = (AVISubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; maxBytesPerSecond += ioState->fMaxBytesPerSecond; @@ -465,7 +470,7 @@ } // Write the data into the file: - fOurSink.fNumBytesWritten += fOurSink.addWord(fAVISubsessionTag); + fOurSink.fNumBytesWritten += fOurSink.addWord(fAVISubsessionTag); fOurSink.fNumBytesWritten += fOurSink.addWord(frameSize); fwrite(frameSource, 1, frameSize, fOurSink.fOutFid); fOurSink.fNumBytesWritten += frameSize; @@ -551,7 +556,7 @@ addFileHeader(RIFF,AVI); size += addFileHeader_hdrl(); - size += addFileHeader_movi(); + size += addFileHeader_movi(); fRIFFSizePosition = headerSizePosn; fRIFFSizeValue = size-ignoredSize; addFileHeaderEnd; @@ -584,7 +589,7 @@ // Then add another JUNK entry ++fJunkNumber; - size += addFileHeader_JUNK(); + size += addFileHeader_JUNK(); addFileHeaderEnd; #define AVIF_HASINDEX 0x00000010 // Index at end of file? @@ -612,10 +617,10 @@ addFileHeaderEnd; addFileHeader(LIST,strl); - size += addFileHeader_strh(); - size += addFileHeader_strf(); + size += addFileHeader_strh(); + size += addFileHeader_strf(); fJunkNumber = 0; - size += addFileHeader_JUNK(); + size += addFileHeader_JUNK(); addFileHeaderEnd; addFileHeader1(strh); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AudioInputDevice.cpp ^ |
@@ -11,7 +11,7 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // Copyright (c) 2001-2003 Live Networks, Inc. All rights reserved. // Generic audio input device (such as a microphone, or an input sound card) | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/AudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTP sink for audio codecs (abstract base class) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/Base64.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Base64 encoding and decoding // implementation @@ -56,7 +56,7 @@ outTmp[i] = base64DecodeTable[(unsigned char)inTmp[i]]; if ((outTmp[i]&0x80) != 0) outTmp[i] = 0; // pretend the input was 'A' } - + out[k++] = (outTmp[0]<<2) | (outTmp[1]>>4); out[k++] = (outTmp[1]<<4) | (outTmp[2]>>2); out[k++] = (outTmp[2]<<6) | outTmp[3]; @@ -85,7 +85,7 @@ Boolean havePadding2 = origLength == numOrig24BitValues*3 + 2; unsigned const numResultBytes = 4*(numOrig24BitValues + havePadding); char* result = new char[numResultBytes+1]; // allow for trailing '\0' - + // Map each full group of 3 input bytes into 4 output base-64 characters: unsigned i; for (i = 0; i < numOrig24BitValues; ++i) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/BasicUDPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple UDP sink (i.e., without RTP or other headers added); one frame per packet // Implementation @@ -30,7 +30,7 @@ unsigned maxPayloadSize) : MediaSink(env), fGS(gs), fMaxPayloadSize(maxPayloadSize) { - fOutputBuffer = new unsigned char[fMaxPayloadSize]; + fOutputBuffer = new unsigned char[fMaxPayloadSize]; } BasicUDPSink::~BasicUDPSink() { @@ -79,7 +79,7 @@ fNextSendTime.tv_usec += durationInMicroseconds; fNextSendTime.tv_sec += fNextSendTime.tv_usec/1000000; fNextSendTime.tv_usec %= 1000000; - + struct timeval timeNow; gettimeofday(&timeNow, NULL); int uSecondsToGo; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/BasicUDPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple UDP source, where every UDP payload is a complete frame // Implementation @@ -45,7 +45,7 @@ void BasicUDPSource::doGetNextFrame() { if (!fHaveStartedReading) { // Await incoming packets: - envir().taskScheduler().turnOnBackgroundReadHandling(fInputGS->socketNum(), + envir().taskScheduler().turnOnBackgroundReadHandling(fInputGS->socketNum(), (TaskScheduler::BackgroundHandlerProc*)&incomingPacketHandler, this); fHaveStartedReading = True; } @@ -67,7 +67,7 @@ // Read the packet into our desired destination: struct sockaddr_in fromAddress; if (!fInputGS->handleRead(fTo, fMaxSize, fFrameSize, fromAddress)) return; - + // Tell our client that we have new data: afterGetting(this); // we're preceded by a net read; no infinite recursion } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/BitVector.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Bit Vector data structure // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/BitVector.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Bit Vector data structure // C++ header @@ -41,7 +41,7 @@ unsigned curBitIndex() const { return fCurBitIndex; } unsigned totNumBits() const { return fTotNumBits; } - unsigned numBitsRemaining() const { return fTotNumBits - fCurBitIndex; } + unsigned numBitsRemaining() const { return fTotNumBits - fCurBitIndex; } private: unsigned char* fBaseBytePtr; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/ByteStreamFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A file source that is a plain byte stream (rather than frames) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/ByteStreamMultiFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source that consists of multiple byte-stream files, read sequentially // Implementation @@ -86,7 +86,7 @@ fPreferredFrameSize, fPlayTimePerFrame); if (source == NULL) break; fHaveStartedNewFile = True; - } + } // (Attempt to) read from the current source. source->getNextFrame(fTo, fMaxSize, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/DarwinInjector.cpp ^ |
@@ -11,14 +11,14 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An object that redirects one or more RTP/RTCP streams - forming a single // multimedia session - into a 'Darwin Streaming Server' (for subsequent // reflection to potentially arbitrarily many remote RTSP clients). -// Implementation. +// Implementation #include "DarwinInjector.hh" #include <GroupsockHelper.hh> @@ -27,7 +27,7 @@ class SubstreamDescriptor { public: - SubstreamDescriptor(RTPSink* rtpSink, RTCPInstance* rtcpInstance); + SubstreamDescriptor(RTPSink* rtpSink, RTCPInstance* rtcpInstance, unsigned trackId); ~SubstreamDescriptor(); SubstreamDescriptor*& next() { return fNext; } @@ -72,10 +72,15 @@ : Medium(env), fApplicationName(strDup(applicationName)), fVerbosityLevel(verbosityLevel), fRTSPClient(NULL), fSubstreamSDPSizes(0), - fHeadSubstream(NULL), fTailSubstream(NULL) { -} + fHeadSubstream(NULL), fTailSubstream(NULL), fSession(NULL), fLastTrackId(0) { +} DarwinInjector::~DarwinInjector() { + if (fSession != NULL) { // close down and delete the session + fRTSPClient->teardownMediaSession(*fSession); + Medium::close(fSession); + } + delete fHeadSubstream; delete[] (char*)fApplicationName; Medium::close(fRTSPClient); @@ -84,7 +89,7 @@ void DarwinInjector::addStream(RTPSink* rtpSink, RTCPInstance* rtcpInstance) { if (rtpSink == NULL) return; // "rtpSink" should be non-NULL - SubstreamDescriptor* newDescriptor = new SubstreamDescriptor(rtpSink, rtcpInstance); + SubstreamDescriptor* newDescriptor = new SubstreamDescriptor(rtpSink, rtcpInstance, ++fLastTrackId); if (fHeadSubstream == NULL) { fHeadSubstream = fTailSubstream = newDescriptor; } else { @@ -107,7 +112,6 @@ char const* sessionCopyright) { char* sdp = NULL; char* url = NULL; - MediaSession* session = NULL; Boolean success = False; // until we learn otherwise do { @@ -190,11 +194,11 @@ // Tell the remote server to start receiving the stream from us. // (To do this, we first create a "MediaSession" object from the SDP description.) - session = MediaSession::createNew(envir(), sdp); - if (session == NULL) break; + fSession = MediaSession::createNew(envir(), sdp); + if (fSession == NULL) break; ss = fHeadSubstream; - MediaSubsessionIterator iter(*session); + MediaSubsessionIterator iter(*fSession); MediaSubsession* subsession; ss = fHeadSubstream; unsigned streamChannelId = 0; @@ -219,7 +223,7 @@ if (subsession != NULL) break; // an error occurred above // Tell the RTSP server to start: - if (!fRTSPClient->playMediaSession(*session)) break; + if (!fRTSPClient->playMediaSession(*fSession)) break; // Finally, make sure that the output TCP buffer is a reasonable size: increaseSendBufferTo(envir(), fRTSPClient->socketNum(), 100*1024); @@ -228,8 +232,7 @@ } while (0); delete[] sdp; - delete[] url; - Medium::close(session); + delete[] url; return success; } @@ -240,10 +243,8 @@ ////////// SubstreamDescriptor implementation ////////// -static unsigned lastTrackId = 0; - SubstreamDescriptor::SubstreamDescriptor(RTPSink* rtpSink, - RTCPInstance* rtcpInstance) + RTCPInstance* rtcpInstance, unsigned trackId) : fNext(NULL), fRTPSink(rtpSink), fRTCPInstance(rtcpInstance) { // Create the SDP description for this substream char const* mediaType = fRTPSink->sdpMediaType(); @@ -277,7 +278,7 @@ char const* auxSDPLine = fRTPSink->auxSDPLine(); if (auxSDPLine == NULL) auxSDPLine = ""; unsigned auxSDPLineSize = strlen(auxSDPLine); - + char const* const sdpFmt = "m=%s 0 RTP/AVP %u\r\n" "%s" // "a=rtpmap:" line (if present) @@ -294,9 +295,10 @@ rtpPayloadType, // m= <fmt list> rtpmapLine, // a=rtpmap:... (if present) auxSDPLine, // optional extra SDP line - ++lastTrackId); // a=control:<track-id> + trackId); // a=control:<track-id> fSDPLines = strDup(sdpLines); delete[] sdpLines; + delete[] rtpmapLine; } SubstreamDescriptor::~SubstreamDescriptor() { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/DeviceSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A template for a MediaSource encapsulating an audio/video input device // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/DigestAuthentication.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class used for digest authentication. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/FileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a file. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/FileSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // File sinks // Implementation @@ -29,7 +29,7 @@ ////////// FileSink ////////// FileSink::FileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize, - char const* perFrameFileNamePrefix) + char const* perFrameFileNamePrefix) : MediaSink(env), fOutFid(fid), fBufferSize(bufferSize) { fBuffer = new unsigned char[bufferSize]; if (perFrameFileNamePrefix != NULL) { @@ -43,7 +43,7 @@ FileSink::~FileSink() { delete[] fPerFrameFileNameBuffer; - delete[] fPerFrameFileNamePrefix; + delete[] fPerFrameFileNamePrefix; delete[] fBuffer; if (fOutFid != NULL) fclose(fOutFid); } @@ -86,7 +86,7 @@ unsigned /*durationInMicroseconds*/) { FileSink* sink = (FileSink*)clientData; sink->afterGettingFrame1(frameSize, presentationTime); -} +} void FileSink::addData(unsigned char* data, unsigned dataSize, struct timeval presentationTime) { @@ -125,7 +125,7 @@ stopPlaying(); return; } - + if (fPerFrameFileNameBuffer != NULL) { if (fOutFid != NULL) { fclose(fOutFid); fOutFid = NULL; } } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/FramedFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed File Sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/FramedFilter.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed Filters // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/FramedSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed Sources // Implementation @@ -77,33 +77,6 @@ doGetNextFrame(); } -// ##### The following is for backwards-compatibility; remove it eventually: -#ifdef BACKWARDS_COMPATIBLE_WITH_OLD_AFTER_GETTING_FUNC -static void bwCompatHackAfterGetting(void* clientData, unsigned frameSize, - unsigned /*numTruncatedBytes*/, - struct timeval presentationTime, - unsigned /*durationInMicroseconds*/) { - FramedSource* source = (FramedSource*)clientData; - FramedSource::bwCompatAfterGettingFunc* clientAfterGettingFunc - = source->fSavedBWCompatAfterGettingFunc; - void* afterGettingClientData = source->fSavedBWCompatAfterGettingClientData; - if (clientAfterGettingFunc != NULL) { - (*clientAfterGettingFunc)(afterGettingClientData, frameSize, presentationTime); - } -} -void FramedSource::getNextFrame(unsigned char* to, unsigned maxSize, - bwCompatAfterGettingFunc* afterGettingFunc, - void* afterGettingClientData, - onCloseFunc* onCloseFunc, - void* onCloseClientData) { - fSavedBWCompatAfterGettingFunc = afterGettingFunc; - fSavedBWCompatAfterGettingClientData = afterGettingClientData; - // Call the regular (new) "getNextFrame()": - getNextFrame(to, maxSize, bwCompatHackAfterGetting, this, - onCloseFunc, onCloseClientData); -} -#endif -// ##### End of code for backwards-compatibility. void FramedSource::afterGetting(FramedSource* source) { source->fIsCurrentlyAwaitingData = False; @@ -143,4 +116,4 @@ unsigned FramedSource::maxFrameSize() const { // By default, this source has no maximum frame size. return 0; -} +} | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/GSMAudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for GSM audio // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H261VideoRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.261 Video RTP Sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoFileServerMediaSubsession.cpp ^ |
@@ -11,131 +11,54 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a H263 video file. // Implementation // Author: Bernhard Feiten. // Based on MPEG4VideoFileServerMediaSubsession +// Updated by Ross FInlayson (December 2007) #include "H263plusVideoFileServerMediaSubsession.hh" #include "H263plusVideoRTPSink.hh" #include "ByteStreamFileSource.hh" -#include "H263plusVideoStreamFramer.hh" +#include "H263plusVideoStreamFramer.hh" -//////////////////////////////////////////////////////////////////////////////// H263plusVideoFileServerMediaSubsession* -H263plusVideoFileServerMediaSubsession::createNew( - UsageEnvironment& env, - char const* fileName, - Boolean reuseFirstSource) { +H263plusVideoFileServerMediaSubsession::createNew(UsageEnvironment& env, + char const* fileName, + Boolean reuseFirstSource) { return new H263plusVideoFileServerMediaSubsession(env, fileName, reuseFirstSource); } -//////////////////////////////////////////////////////////////////////////////// -H263plusVideoFileServerMediaSubsession::H263plusVideoFileServerMediaSubsession( - UsageEnvironment& env, - char const* fileName, - Boolean reuseFirstSource) - : FileServerMediaSubsession(env, fileName, reuseFirstSource), - fDoneFlag(0) -{ +H263plusVideoFileServerMediaSubsession +::H263plusVideoFileServerMediaSubsession(UsageEnvironment& env, + char const* fileName, + Boolean reuseFirstSource) + : FileServerMediaSubsession(env, fileName, reuseFirstSource) { } -//////////////////////////////////////////////////////////////////////////////// -H263plusVideoFileServerMediaSubsession::~H263plusVideoFileServerMediaSubsession() -{ +H263plusVideoFileServerMediaSubsession::~H263plusVideoFileServerMediaSubsession() { } -//////////////////////////////////////////////////////////////////////////////// -#if 0 -static void afterPlayingDummy(void* clientData) { - H263plusVideoFileServerMediaSubsession* subsess - = (H263plusVideoFileServerMediaSubsession*)clientData; - // Signal the event loop that we're done: - subsess->setDoneFlag(); -} -#endif - -static void checkForAuxSDPLine(void* clientData) { - H263plusVideoFileServerMediaSubsession* subsess - = (H263plusVideoFileServerMediaSubsession*)clientData; - subsess->checkForAuxSDPLine1(); -} - -void H263plusVideoFileServerMediaSubsession::checkForAuxSDPLine1() { - if (fDummyRTPSink->auxSDPLine() != NULL) { - // Signal the event loop that we're done: - setDoneFlag(); - } else { - // try again after a brief delay: - int uSecsToDelay = 100000; // 100 ms - nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecsToDelay, - (TaskFunc*)checkForAuxSDPLine, this); - } -} - -char const* H263plusVideoFileServerMediaSubsession::getAuxSDPLine( - RTPSink* rtpSink, - FramedSource* inputSource) -{ - // Note: For MPEG-4 video files, the 'config' information isn't known - // until we start reading the file. This means that "rtpSink"s - // "auxSDPLine()" will be NULL initially, and we need to start reading - // data from our file until this changes. - // Is this true also for H263 ?? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // asumption: no aux line needed for H263 - -// fDummyRTPSink = rtpSink; - - // Start reading the file: -// fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this); - - // Check whether the sink's 'auxSDPLine()' is ready: -// checkForAuxSDPLine(this); - -// envir().taskScheduler().doEventLoop(&fDoneFlag); - -// char const* auxSDPLine = fDummyRTPSink->auxSDPLine(); -// return auxSDPLine; - return NULL; -} - -//////////////////////////////////////////////////////////////////////////////// -FramedSource* H263plusVideoFileServerMediaSubsession::createNewStreamSource( - unsigned /*clientSessionId*/, - unsigned& estBitrate) -{ +FramedSource* H263plusVideoFileServerMediaSubsession +::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) { estBitrate = 500; // kbps, estimate ?? // Create the video source: - ByteStreamFileSource* fileSource - = ByteStreamFileSource::createNew(envir(), fFileName); - if (fileSource == NULL) return NULL; - fFileSize = fileSource->fileSize(); - - // Create a framer for the Video Elementary Stream: - return H263plusVideoStreamFramer::createNew(envir(), fileSource); + ByteStreamFileSource* fileSource = ByteStreamFileSource::createNew(envir(), fFileName); + if (fileSource == NULL) return NULL; + fFileSize = fileSource->fileSize(); + + // Create a framer for the Video Elementary Stream: + return H263plusVideoStreamFramer::createNew(envir(), fileSource); } -/////////////////////////////////////////////////////////////////////////////// -RTPSink* H263plusVideoFileServerMediaSubsession::createNewRTPSink( - Groupsock* rtpGroupsock, - unsigned char rtpPayloadTypeIfDynamic, - FramedSource* /*inputSource*/) -{ - unsigned char payloadFormatCode; - - if (false) // some more logic is needed if h263 is dynamic PT - payloadFormatCode = rtpPayloadTypeIfDynamic; - else - payloadFormatCode = 34; - - return H263plusVideoRTPSink::createNew(envir(), rtpGroupsock, payloadFormatCode); +RTPSink* H263plusVideoFileServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock, + unsigned char rtpPayloadTypeIfDynamic, + FramedSource* /*inputSource*/) { + return H263plusVideoRTPSink::createNew(envir(), rtpGroupsock, rtpPayloadTypeIfDynamic); } - - - | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoRTPSink.cpp ^ |
@@ -11,11 +11,11 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. -// RTP sink for H.263+ video (RFC 2429) +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. +// RTP sink for H.263+ video (RFC 4629) // Implementation #include "H263plusVideoRTPSink.hh" | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.263+ Video RTP Sources // Implementation @@ -34,7 +34,7 @@ unsigned rtpTimestampFrequency) : MultiFramedRTPSource(env, RTPgs, rtpPayloadFormat, rtpTimestampFrequency), - fNumSpecialHeaders(0), fSpecialHeaderBytesLength(0) { + fNumSpecialHeaders(0), fSpecialHeaderBytesLength(0) { } H263plusVideoRTPSource::~H263plusVideoRTPSource() { @@ -62,7 +62,7 @@ ++expectedHeaderSize; if (packetSize < expectedHeaderSize) return False; } - + if (PLEN > 0) { // There's an extra picture header at the end: expectedHeaderSize += PLEN; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoStreamFramer.cpp ^ |
@@ -11,13 +11,13 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Author Bernhard Feiten // A filter that breaks up an H.263plus video stream into frames. -// +// #include "H263plusVideoStreamFramer.hh" #include "H263plusVideoStreamParser.hh" @@ -46,7 +46,7 @@ FramedSource* inputSource, Boolean createParser) : FramedFilter(env, inputSource), - fFrameRate(0.0), // until we learn otherwise + fFrameRate(0.0), // until we learn otherwise fPictureEndMarker(False) { // Use the current wallclock time as the base 'presentation time': @@ -94,12 +94,12 @@ /////////////////////////////////////////////////////////////////////////////// void H263plusVideoStreamFramer::continueReadProcessing() { - unsigned acquiredFrameSize; - + unsigned acquiredFrameSize; + u_int64_t frameDuration; // in ms - acquiredFrameSize = fParser->parse(frameDuration); -// Calculate some average bitrate information (to be adapted) + acquiredFrameSize = fParser->parse(frameDuration); +// Calculate some average bitrate information (to be adapted) // avgBitrate = (totalBytes * 8 * H263_TIMESCALE) / totalDuration; if (acquiredFrameSize > 0) { @@ -110,10 +110,10 @@ fFrameRate = frameDuration == 0 ? 0.0 : 1000./(long)frameDuration; - // Compute "fPresentationTime" + // Compute "fPresentationTime" if (acquiredFrameSize == 5) // first frame fPresentationTime = fPresentationTimeBase; - else + else fPresentationTime.tv_usec += (long) frameDuration*1000; while (fPresentationTime.tv_usec >= 1000000) { @@ -121,7 +121,7 @@ ++fPresentationTime.tv_sec; } - // Compute "fDurationInMicroseconds" + // Compute "fDurationInMicroseconds" fDurationInMicroseconds = (unsigned int) frameDuration*1000;; // Call our own 'after getting' function. Because we're not a 'leaf' | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoStreamParser.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Author Bernhard Feiten // A filter that breaks up an H.263plus video stream into frames. // Based on MPEG4IP/mp4creator/h263.c @@ -104,10 +104,10 @@ // Parse 1 frame // For the first time, only the first frame's header is returned. // The second time the full first frame is returned - frameSize = parseH263Frame(); + frameSize = parseH263Frame(); currentDuration = 0; - if ((frameSize > 0)){ + if ((frameSize > 0)){ // We were able to acquire a frame from the input. // Parse the returned frame header (if any) @@ -129,6 +129,8 @@ // if (h263Bitrates) //GetMaxBitrate(&fMaxBitrateCtx, frameSize, prevTrDifference); //prevTrDifference = trDifference; + + setParseState(); // Needed for the parsing process in StreamParser } } catch (int /*e*/) { #ifdef DEBUG @@ -137,14 +139,12 @@ frameSize=0; } - setParseState(); // Needed for the parsing process in StreamParser - return frameSize; } /////////////////////////////////////////////////////////////////////////////// -// parseH263Frame derived from LoadNextH263Object of MPEG4IP +// parseH263Frame derived from LoadNextH263Object of MPEG4IP // - service routine that reads a single frame from the input file. // It shall fill the input buffer with data up until - and including - the // next start code and shall report back both the number of bytes read and a @@ -169,11 +169,11 @@ u_int8_t * bufferIndex = fTo; // The buffer end which will allow the loop to leave place for // the additionalBytesNeeded - u_int8_t * bufferEnd = fTo + fMaxSize - ADDITIONAL_BYTES_NEEDED - 1; + u_int8_t * bufferEnd = fTo + fMaxSize - ADDITIONAL_BYTES_NEEDED - 1; memcpy(fTo, fNextHeader, H263_REQUIRE_HEADER_SIZE_BYTES); bufferIndex += H263_REQUIRE_HEADER_SIZE_BYTES; - + // The state table and the following loop implements a state machine enabling // us to read bytes from the file until (and inclusing) the requested | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H263plusVideoStreamParser.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an H263 video stream into frames. // derived from MPEG4IP h263.c // Author Benhard Feiten @@ -77,8 +77,8 @@ virtual ~H263plusVideoStreamParser(); void registerReadInterest(unsigned char* to, unsigned maxSize); - - unsigned parse(u_int64_t & currentDuration); // returns the size of the frame that was acquired, or 0 if none + + unsigned parse(u_int64_t & currentDuration); // returns the size of the frame that was acquired, or 0 if none unsigned numTruncatedBytes() const { return fNumTruncatedBytes; } // The number of truncated bytes (if any) @@ -92,7 +92,7 @@ private: - int parseH263Frame( ); + int parseH263Frame( ); bool ParseShortHeader(u_int8_t *headerBuffer, H263INFO *outputInfoStruct); void GetMaxBitrate( MaxBitrate_CTX *ctx, u_int32_t frameSize, u_int8_t frameTRDiff); u_int64_t CalculateDuration(u_int8_t trDiff); @@ -117,7 +117,7 @@ H263INFO fCurrentInfo; // Holds information about the current frame MaxBitrate_CTX fMaxBitrateCtx; // Context for the GetMaxBitrate function char fStates[3][256]; - u_int8_t fNextHeader[H263_REQUIRE_HEADER_SIZE_BYTES]; + u_int8_t fNextHeader[H263_REQUIRE_HEADER_SIZE_BYTES]; u_int32_t fnextTR; // The next frame's presentation time in TR units u_int64_t fcurrentPT; // The current frame's presentation time in milli-seconds | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H264VideoFileSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.264 Video File sinks // Implementation @@ -25,7 +25,7 @@ H264VideoFileSink ::H264VideoFileSink(UsageEnvironment& env, FILE* fid, unsigned bufferSize, - char const* perFrameFileNamePrefix) + char const* perFrameFileNamePrefix) : FileSink(env, fid, bufferSize, perFrameFileNamePrefix) { } @@ -64,7 +64,7 @@ struct timeval presentationTime) { unsigned char start_code[4] = {0x00, 0x00, 0x00, 0x01}; addData(start_code, 4, presentationTime); - + // Call the parent class to complete the normal file write with the input data: FileSink::afterGettingFrame1(frameSize, presentationTime); } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H264VideoRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for H.264 video (RFC 3984) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H264VideoRTPSource.cpp ^ |
@@ -11,12 +11,12 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.264 Video RTP Sources -// Implementation +// Implementation #include "H264VideoRTPSource.hh" #include "Base64.hh" @@ -67,11 +67,11 @@ unsigned& resultSpecialHeaderSize) { unsigned char* headerStart = packet->data(); unsigned packetSize = packet->dataSize(); - + // The header has a minimum size of 0, since the NAL header is used // as a payload header unsigned expectedHeaderSize = 0; - + // Check if the type field is 28 (FU-A) or 29 (FU-B) fCurPacketNALUnitType = (headerStart[0]&0x1F); switch (fCurPacketNALUnitType) { @@ -92,7 +92,7 @@ expectedHeaderSize = 1; if (packetSize < expectedHeaderSize) return False; - headerStart[1] = (headerStart[0]&0xE0)+(headerStart[1]&0x1F); + headerStart[1] = (headerStart[0]&0xE0)+(headerStart[1]&0x1F); fCurrentPacketBeginsFrame = True; } else { // If the startbit is not set, both the FU indicator and header @@ -110,7 +110,7 @@ break; } } - + resultSpecialHeaderSize = expectedHeaderSize; return True; } @@ -138,7 +138,7 @@ *s = '\0'; } } - + // Allocate and fill in the result array: SPropRecord* resultArray = new SPropRecord[numSPropRecords]; s = inStr; @@ -190,7 +190,7 @@ default: { // Common case: We use the entire packet data: return dataSize; - } + } } return (resultNALUSize <= dataSize) ? resultNALUSize : dataSize; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/H264VideoStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Any source that feeds into a "H264VideoRTPSink" must be of this class. // This is a virtual base class; subclasses must implement the // "currentNALUnitEndsAccessUnit()" virtual function. | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/HTTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // HTTP sinks // Implementation @@ -37,9 +37,9 @@ HTTPSink* newSink = new HTTPSink(env, ourSocket); if (newSink == NULL) break; - + appendPortNum(env, ourPort); - + return newSink; } while (0); @@ -56,7 +56,7 @@ // Make sure we have a big send buffer: if (!increaseSendBufferTo(env, ourSocket, 50*1024)) break; - + if (listen(ourSocket, 1) < 0) { // we allow only one connection env.setResultErrMsg("listen() failed: "); break; @@ -68,7 +68,7 @@ } return ourSocket; - } while (0); + } while (0); if (ourSocket != -1) ::closeSocket(ourSocket); return -1; @@ -123,11 +123,11 @@ sprintf(okResponse, responseFmt, fSource->MIMEtype()); #else snprintf(okResponse, sizeof okResponse, responseFmt, fSource->MIMEtype()); -#endif +#endif send(fClientSocket, okResponse, strlen(okResponse), 0); } } - + fSource->getNextFrame(fBuffer, sizeof fBuffer, afterGettingFrame, this, ourOnSourceClosure, this); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/InputFile.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines for opening/closing named input files // Implementation @@ -38,7 +38,7 @@ #if defined(__WIN32__) || defined(_WIN32) _setmode(_fileno(stdin), _O_BINARY); // convert to binary mode #endif - } else { + } else { fid = fopen(fileName, "rb"); if (fid == NULL) { env.setResultMsg("unable to open file \"",fileName, "\""); @@ -61,7 +61,7 @@ if (fileName == NULL) { #endif if (fid != NULL && SeekFile64(fid, 0, SEEK_END) >= 0) { - fileSize = TellFile64(fid); + fileSize = (u_int64_t)TellFile64(fid); if (fileSize == (u_int64_t)-1) fileSize = 0; // TellFile64() failed SeekFile64(fid, 0, SEEK_SET); } @@ -78,7 +78,7 @@ return fileSize; } -u_int64_t SeekFile64(FILE *fid, int64_t offset, int whence) { +int64_t SeekFile64(FILE *fid, int64_t offset, int whence) { clearerr(fid); fflush(fid); #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE) @@ -92,7 +92,7 @@ #endif } -u_int64_t TellFile64(FILE *fid) { +int64_t TellFile64(FILE *fid) { clearerr(fid); fflush(fid); #if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE) | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/JPEGVideoRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for JPEG video (RFC 2435) // Implementation @@ -52,7 +52,7 @@ struct timeval frameTimestamp, unsigned numRemainingBytes) { // Our source is known to be a JPEGVideoSource - JPEGVideoSource* source = (JPEGVideoSource*)fSource; + JPEGVideoSource* source = (JPEGVideoSource*)fSource; if (source == NULL) return; // sanity check u_int8_t mainJPEGHeader[8]; // the special header @@ -73,7 +73,7 @@ u_int16_t length; u_int8_t const* quantizationTables = source->quantizationTables(precision, length); - + unsigned const quantizationHeaderSize = 4 + length; u_int8_t* quantizationHeader = new u_int8_t[quantizationHeaderSize]; @@ -105,7 +105,8 @@ unsigned JPEGVideoRTPSink::specialHeaderSize() const { // Our source is known to be a JPEGVideoSource - JPEGVideoSource* source = (JPEGVideoSource*)fSource; + JPEGVideoSource* source = (JPEGVideoSource*)fSource; + if (source == NULL) return 0; // sanity check unsigned headerSize = 8; // by default | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/JPEGVideoRTPSource.cpp ^ |
@@ -11,19 +11,12 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. - +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // JPEG Video (RFC 2435) RTP Sources // Implementation -// 09 26 2002 - Initial Implementation : Giom -// Copyright (c) 1990-2002 Morgan Multimedia All rights reserved. - -// 02/2003: Cleaned up to add the synthesized JPEG header to the start -// of each incoming frame. -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. #include "JPEGVideoRTPSource.hh" @@ -55,18 +48,21 @@ JPEGVideoRTPSource* JPEGVideoRTPSource::createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, - unsigned rtpTimestampFrequency) { + unsigned rtpTimestampFrequency, + unsigned defaultWidth, unsigned defaultHeight) { return new JPEGVideoRTPSource(env, RTPgs, rtpPayloadFormat, - rtpTimestampFrequency); + rtpTimestampFrequency, defaultWidth, defaultHeight); } JPEGVideoRTPSource::JPEGVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, - unsigned rtpTimestampFrequency) + unsigned rtpTimestampFrequency, + unsigned defaultWidth, unsigned defaultHeight) : MultiFramedRTPSource(env, RTPgs, rtpPayloadFormat, rtpTimestampFrequency, - new JPEGBufferedPacketFactory) { + new JPEGBufferedPacketFactory), + fDefaultWidth(defaultWidth), fDefaultHeight(defaultHeight) { } JPEGVideoRTPSource::~JPEGVideoRTPSource() { @@ -187,7 +183,7 @@ // MARKER_SOI: *ptr++ = 0xFF; *ptr++ = MARKER_SOI; - + // MARKER_APP_FIRST: *ptr++ = 0xFF; *ptr++ = MARKER_APP_FIRST; *ptr++ = 0x00; *ptr++ = 0x10; // size of chunk @@ -197,14 +193,14 @@ *ptr++ = 0x00; *ptr++ = 0x01; // Horizontal pixel aspect ratio *ptr++ = 0x00; *ptr++ = 0x01; // Vertical pixel aspect ratio *ptr++ = 0x00; *ptr++ = 0x00; // no thumbnail - + // MARKER_DRI: if (dri > 0) { *ptr++ = 0xFF; *ptr++ = MARKER_DRI; *ptr++ = 0x00; *ptr++ = 0x04; // size of chunk *ptr++ = (BYTE)(dri >> 8); *ptr++ = (BYTE)(dri); // restart interval } - + // MARKER_DQT (luma): unsigned tableSize = numQtables == 1 ? qtlen : qtlen/2; *ptr++ = 0xFF; *ptr++ = MARKER_DQT; @@ -213,7 +209,7 @@ memcpy(ptr, qtables, tableSize); qtables += tableSize; ptr += tableSize; - + if (numQtables > 1) { unsigned tableSize = qtlen - qtlen/2; // MARKER_DQT (chroma): @@ -224,7 +220,7 @@ qtables += tableSize; ptr += tableSize; } - + // MARKER_SOF0: *ptr++ = 0xFF; *ptr++ = MARKER_SOF0; *ptr++ = 0x00; *ptr++ = 0x11; // size of chunk @@ -243,7 +239,7 @@ *ptr++ = 0x03; // id of component *ptr++ = 0x11; // sampling ratio (h,v) *ptr++ = 0x01; // quant table id - + createHuffmanHeader(ptr, lum_dc_codelens, sizeof lum_dc_codelens, lum_dc_symbols, sizeof lum_dc_symbols, 0, 0); createHuffmanHeader(ptr, lum_ac_codelens, sizeof lum_ac_codelens, @@ -340,8 +336,13 @@ unsigned type = Type & 1; unsigned Q = (unsigned)headerStart[5]; unsigned width = (unsigned)headerStart[6] * 8; - if (width == 0) width = 256*8; // special case unsigned height = (unsigned)headerStart[7] * 8; + if ((width == 0 || height == 0) && fDefaultWidth != 0 && fDefaultHeight != 0) { + // Use the default width and height parameters instead: + width = fDefaultWidth; + height = fDefaultHeight; + } + if (width == 0) width = 256*8; // special case if (height == 0) height = 256*8; // special case if (Type > 63) { @@ -386,11 +387,9 @@ if (packetSize < resultSpecialHeaderSize + Length) return False; - if (qtables) delete [] qtables; - qtlen = Length; qtables = &headerStart[resultSpecialHeaderSize]; - + resultSpecialHeaderSize += Length; } } @@ -427,7 +426,7 @@ = fCurrentPacketCompletesFrame = packet->rtpMarkerBit(); return True; -} +} char const* JPEGVideoRTPSource::MIMEtype() const { return "video/JPEG"; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/JPEGVideoSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // JPEG video sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/Locale.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Support for temporarily setting the locale (e.g., to POSIX) for (e.g.) parsing or printing // floating-point numbers in protocol headers, or calling toupper()/tolower() on human-input strings. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADU.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // 'ADU' MP3 streams (for improved loss-tolerance) // Implementation @@ -89,7 +89,7 @@ struct timeval presentationTime, unsigned durationInMicroseconds); - Boolean sqAfterGettingCommon(Segment& seg, unsigned numBytesRead); + Boolean sqAfterGettingCommon(Segment& seg, unsigned numBytesRead); Boolean isEmptyOrFull() {return headIndex() == nextFreeIndex();} unsigned fHeadIndex, fNextFreeIndex, fTotalDataSize; @@ -358,7 +358,7 @@ Segment* seg = &(fSegments->headSegment()); int const endOfHeadFrame = (int) seg->dataHere(); unsigned frameOffset = 0; - + while (1) { int endOfData = frameOffset - seg->backpointer + seg->aduSize; if (endOfData >= endOfHeadFrame) { @@ -366,14 +366,14 @@ needToEnqueue = False; break; } - + frameOffset += seg->dataHere(); index = SegmentQueue::nextIndex(index); if (index == fSegments->nextFreeIndex()) break; seg = &(fSegments->s[index]); } } - + return needToEnqueue; } @@ -385,11 +385,11 @@ // of the previous ADU, then we need to insert one or more // empty, 'dummy' ADUs ahead of it. (This situation should occur // only if an intermediate ADU was lost.) - + unsigned tailIndex = SegmentQueue::prevIndex(fSegments->nextFreeIndex()); Segment* tailSeg = &(fSegments->s[tailIndex]); - + while (1) { unsigned prevADUend; // relative to the start of the new ADU if (fSegments->headIndex() != tailIndex) { @@ -406,7 +406,7 @@ } else { prevADUend = 0; } - + if (tailSeg->backpointer > prevADUend) { // We need to insert a dummy ADU in front of the tail #ifdef DEBUG @@ -430,20 +430,20 @@ fprintf(stderr, "a->m:outputting frame for %d<-%d (fs %d, dh %d), (descriptorSize: %d)\n", seg->aduSize, seg->backpointer, seg->frameSize, seg->dataHere(), seg->descriptorSize); #endif unsigned char* toPtr = fTo; - + // output header and side info: fFrameSize = seg->frameSize; fPresentationTime = seg->presentationTime; fDurationInMicroseconds = seg->durationInMicroseconds; memmove(toPtr, seg->dataStart(), seg->headerSize + seg->sideInfoSize); toPtr += seg->headerSize + seg->sideInfoSize; - + // zero out the rest of the frame, in case ADU data doesn't fill it all in - unsigned bytesToZero = seg->dataHere(); + unsigned bytesToZero = seg->dataHere(); for (unsigned i = 0; i < bytesToZero; ++i) { toPtr[i] = '\0'; } - + // Fill in the frame with appropriate ADU data from this and // subsequent ADUs: unsigned frameOffset = 0; @@ -453,12 +453,12 @@ while (toOffset < endOfHeadFrame) { int startOfData = frameOffset - seg->backpointer; if (startOfData > (int)endOfHeadFrame) break; // no more ADUs needed - + int endOfData = startOfData + seg->aduSize; if (endOfData > (int)endOfHeadFrame) { endOfData = endOfHeadFrame; } - + unsigned fromOffset; if (startOfData <= (int)toOffset) { fromOffset = toOffset - startOfData; @@ -466,7 +466,7 @@ if (endOfData < startOfData) endOfData = startOfData; } else { fromOffset = 0; - + // we may need some padding bytes beforehand unsigned bytesToZero = startOfData - toOffset; #ifdef DEBUG @@ -474,7 +474,7 @@ #endif toOffset += bytesToZero; } - + unsigned char* fromPtr = &seg->dataStart()[seg->headerSize + seg->sideInfoSize + fromOffset]; unsigned bytesUsedHere = endOfData - startOfData; @@ -483,13 +483,13 @@ #endif memmove(toPtr + toOffset, fromPtr, bytesUsedHere); toOffset += bytesUsedHere; - + frameOffset += seg->dataHere(); index = SegmentQueue::nextIndex(index); if (index == fSegments->nextFreeIndex()) break; seg = &(fSegments->s[index]); } - + fSegments->dequeue(); return True; @@ -505,7 +505,7 @@ } return (unsigned)result; -} +} ////////// SegmentQueue ////////// @@ -516,9 +516,9 @@ FramedSource::handleClosure(usingSource); return; } - + fUsingSource = usingSource; - + Segment& seg = nextFreeSegment(); inputSource->getNextFrame(seg.buf, sizeof seg.buf, sqAfterGettingSegment, this, @@ -549,7 +549,7 @@ // Common code called after a new segment is enqueued Boolean SegmentQueue::sqAfterGettingCommon(Segment& seg, - unsigned numBytesRead) { + unsigned numBytesRead) { unsigned char* fromPtr = seg.buf; if (fIncludeADUdescriptors) { @@ -570,7 +570,7 @@ seg.backpointer, seg.aduSize)) { return False; } - + // If we've just read an ADU (rather than a regular MP3 frame), then use the // entire "numBytesRead" data for the 'aduSize', so that we include any // 'ancillary data' that may be present at the end of the ADU: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADURTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for 'ADUized' MP3 frames ("mpa-robust") // Implementation @@ -107,7 +107,7 @@ // Normally there's no special header. // (The "ADU descriptor" is already present in the data.) unsigned specialHeaderSize = 0; - + // However, if we're about to output the second (or subsequent) fragment // of a fragmented ADU, then we need to insert a new ADU descriptor at // the front of the packet: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADURTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP source for 'ADUized' MP3 frames ("mpa-robust") // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADUTranscoder.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Transcoder for ADUized MP3 frames // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADUdescriptor.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Descriptor preceding frames of 'ADU' MP3 streams (for improved loss-tolerance) // Implementation @@ -59,7 +59,7 @@ return ((firstByte&0x3F)<<8) | secondByte; } else { // This is a 1-byte descriptor - return (firstByte&0x3F); + return (firstByte&0x3F); } } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADUdescriptor.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Descriptor preceding frames of 'ADU' MP3 streams (for improved loss-tolerance) // C++ header @@ -28,7 +28,7 @@ // Operations for generating a new descriptor static unsigned computeSize(unsigned remainingFrameSize) { return remainingFrameSize >= 64 ? 2 : 1; - } + } static unsigned generateDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize); // returns descriptor size; increments "toPtr" afterwards static void generateTwoByteDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3ADUinterleaving.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Interleaving of MP3 ADUs // Implementation @@ -54,12 +54,12 @@ FramedSource* inputSource; if (!FramedSource::lookupByName(env, inputSourceName, inputSource)) return NULL; - + if (strcmp(inputSource->MIMEtype(), "audio/MPA-ROBUST") != 0) { env.setResultMsg(inputSourceName, " is not an MP3 ADU source"); return NULL; } - + return inputSource; } @@ -188,7 +188,7 @@ public: DeinterleavingFrames(); virtual ~DeinterleavingFrames(); - + Boolean haveReleaseableFrame(); void getIncomingFrameParams(unsigned char*& dataPtr, unsigned& bytesAvailable); @@ -222,6 +222,7 @@ } MP3ADUdeinterleaver::~MP3ADUdeinterleaver() { + delete fFrames; } MP3ADUdeinterleaver* MP3ADUdeinterleaver::createNew(UsageEnvironment& env, @@ -241,7 +242,7 @@ } else { #ifdef TEST_LOSS NOTE: This code no longer works, because it uses synchronous reads, - which are no longer supported. + which are no longer supported. static unsigned const framesPerPacket = 3; static unsigned const frameCount = 0; static Boolean packetIsLost; @@ -286,7 +287,7 @@ icc, ii); // Compare these to the values we saw last: - if (icc != fICClastSeen || ii == fIIlastSeen) { + if (icc != fICClastSeen || ii == fIIlastSeen) { // We've started a new interleave cycle // (or interleaving was not used). Release all // pending ADU frames to the ADU->MP3 conversion step: @@ -465,7 +466,7 @@ desc.frameDataSize = frameSize; desc.presentationTime = presentationTime; desc.durationInMicroseconds = durationInMicroseconds; - + // Advance over the ADU descriptor, to get to the MPEG 'syncword': unsigned char* ptr = desc.frameData; (void)ADUdescriptor::getRemainingFrameSize(ptr); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3AudioFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MP3 audio file. // (Actually, any MPEG-1 or MPEG-2 audio file should work.) @@ -48,7 +48,7 @@ } void MP3AudioFileServerMediaSubsession -::seekStreamSource(FramedSource* inputSource, float seekNPT) { +::seekStreamSource(FramedSource* inputSource, double seekNPT) { MP3FileSource* mp3Source; if (fGenerateADUs) { // "inputSource" is a filter; use its input source instead. | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3FileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 File Sources // Implementation @@ -68,7 +68,7 @@ fStreamState->setPresentationTimeScale(scale); } -void MP3FileSource::seekWithinFile(float seekNPT) { +void MP3FileSource::seekWithinFile(double seekNPT) { fStreamState->seekWithinFile(seekNPT); } @@ -106,7 +106,7 @@ fPresentationTime = fFirstFramePresentationTime; fHaveJustInitialized = False; } - + if (!fStreamState->readFrame(fTo, fMaxSize, fFrameSize, fDurationInMicroseconds)) { char tmp[200]; sprintf(tmp, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3HTTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 HTTP Sources // Implementation @@ -47,7 +47,7 @@ // Make sure we have a big receive buffer: if (!increaseReceiveBufferTo(env, ourSocket, 100*1024)) break; - + // Try to make the new socket into a FILE*: unsigned streamLength = 0; //##### FILE* fid = NULL; @@ -65,7 +65,7 @@ newSource = new MP3HTTPSource(env, fid); if (newSource == NULL) break; - + newSource->assignStream(fid, streamLength); // Write the HTTP 'GET' command: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3Internals.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 internal implementation details // Implementation @@ -48,7 +48,7 @@ int shortDiff[13]; }; -static struct bandInfoStruct const bandInfo[7] = { +static struct bandInfoStruct const bandInfo[7] = { /* MPEG 1.0 */ { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, @@ -91,7 +91,7 @@ unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */ unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */ -#define MPG_MD_MONO 3 +#define MPG_MD_MONO 3 ////////// MP3FrameParams ////////// @@ -162,19 +162,19 @@ isMPEG2 = 1; isMPEG2_5 = 1; } - + layer = 4-((hdr>>17)&3); if (layer == 4) layer = 3; // layer==4 is not allowed bitrateIndex = ((hdr>>12)&0xf); - + if (isMPEG2_5) { samplingFreqIndex = ((hdr>>10)&0x3) + 6; } else { samplingFreqIndex = ((hdr>>10)&0x3) + (isMPEG2*3); } - + hasCRC = ((hdr>>16)&0x1)^0x1; - + padding = ((hdr>>9)&0x1); extension = ((hdr>>8)&0x1); mode = ((hdr>>6)&0x3); @@ -182,9 +182,9 @@ copyright = ((hdr>>3)&0x1); original = ((hdr>>2)&0x1); emphasis = hdr & 0x3; - + stereo = (mode == MPG_MD_MONO) ? 1 : 2; - + if (((hdr>>10)&0x3) == 0x3) { #ifdef DEBUG_ERRORS fprintf(stderr,"Stream error - hdr: 0x%08x\n", hdr); @@ -202,7 +202,7 @@ unsigned MP3FrameParams::computeSideInfoSize() { unsigned size; - + if (isMPEG2) { size = isStereo ? 17 : 9; } else { @@ -277,7 +277,7 @@ fprintf(stderr, "updateSideInfoSizes (allowed: %d): %d->%d, %d->%d\n", allowedNumBits, p23L0+p23L0Trunc, p23L0, p23L1+p23L1Trunc, p23L1); #endif - // The truncations computed above are still estimates. We need to + // The truncations computed above are still estimates. We need to // adjust them so that the new fields will continue to end on // Huffman-encoded sample boundaries: updateSideInfoForHuffman(sideInfo, isMPEG2, mainDataPtr, @@ -358,7 +358,7 @@ si.main_data_begin = fr.getBits(9); if (stereo == 1) si.private_bits = fr.getBits(5); - else + else si.private_bits = fr.getBits(3); for (ch=0; ch<stereo; ch++) { @@ -402,11 +402,11 @@ fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); } #endif - /* region_count/start parameters are implicit in this case. */ + /* region_count/start parameters are implicit in this case. */ gr_info.region1start = 36>>1; gr_info.region2start = 576>>1; } - else + else { int i,r0c,r1c; for (i=0; i<3; i++) { @@ -441,7 +441,7 @@ si.main_data_begin = fr.getBits(8); if (stereo == 1) si.private_bits = fr.get1Bit(); - else + else si.private_bits = fr.getBits(2); for (ch=0; ch<stereo; ch++) { @@ -481,7 +481,7 @@ fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); } #endif - /* region_count/start parameters are implicit in this case. */ + /* region_count/start parameters are implicit in this case. */ /* check this again! */ if (gr_info.block_type == 2) gr_info.region1start = 36>>1; @@ -490,7 +490,7 @@ } gr_info.region2start = 576>>1; } - else + else { int i,r0c,r1c; for (i=0; i<3; i++) { @@ -537,17 +537,17 @@ MP3SideInfo const& si, Boolean isStereo) { int ch, gr, i; int stereo = isStereo ? 2 : 1; - + bv.putBits(si.main_data_begin,9); if (stereo == 1) bv.putBits(si.private_bits, 5); else bv.putBits(si.private_bits, 3); - + for (ch=0; ch<stereo; ch++) { bv.putBits(si.ch[ch].gr[1].scfsi, 4); } - + for (gr=0; gr<2; gr++) { for (ch=0; ch<stereo; ch++) { MP3SideInfo::gr_info_s_t const& gr_info = si.ch[ch].gr[gr]; @@ -570,8 +570,8 @@ bv.putBits(gr_info.table_select[i], 5); bv.putBits(gr_info.region0_count, 4); bv.putBits(gr_info.region1_count, 3); - } - + } + bv.put1Bit(gr_info.preflag); bv.put1Bit(gr_info.scalefac_scale); bv.put1Bit(gr_info.count1table_select); @@ -583,16 +583,16 @@ MP3SideInfo const& si, Boolean isStereo) { int ch, i; int stereo = isStereo ? 2 : 1; - + bv.putBits(si.main_data_begin,8); if (stereo == 1) bv.put1Bit(si.private_bits); else bv.putBits(si.private_bits, 2); - + for (ch=0; ch<stereo; ch++) { MP3SideInfo::gr_info_s_t const& gr_info = si.ch[ch].gr[0]; - + bv.putBits(gr_info.part2_3_length, 12); bv.putBits(gr_info.big_values, 9); bv.putBits(gr_info.global_gain, 8); @@ -611,8 +611,8 @@ bv.putBits(gr_info.table_select[i], 5); bv.putBits(gr_info.region0_count, 4); bv.putBits(gr_info.region1_count, 3); - } - + } + bv.put1Bit(gr_info.scalefac_scale); bv.put1Bit(gr_info.count1table_select); } @@ -670,7 +670,7 @@ // "bitrate" was larger than any possible, so return the largest possible: return 14; -} +} static void outputHeader(unsigned char* toPtr, unsigned hdr) { toPtr[0] = (unsigned char)(hdr>>24); @@ -688,7 +688,7 @@ unsigned backpointerSize = availableBytesForBackpointer; if (backpointerSize > maxBackpointerSize) { - backpointerSize = maxBackpointerSize; + backpointerSize = maxBackpointerSize; } // Store the new backpointer now: @@ -780,22 +780,22 @@ // 'main data', using the new lengths unsigned toBitOffset = 0; unsigned fromBitOffset = 0; - + /* rebuild portion 0a: */ memmove(toPtr, fromPtr, (part23Length0a+7)/8); toBitOffset += part23Length0a; fromBitOffset += part23Length0a + part23Length0aTruncation; - + /* rebuild portion 0b: */ shiftBits(toPtr, toBitOffset, fromPtr, fromBitOffset, part23Length0b); toBitOffset += part23Length0b; fromBitOffset += part23Length0b + part23Length0bTruncation; - + /* rebuild portion 1a: */ shiftBits(toPtr, toBitOffset, fromPtr, fromBitOffset, part23Length1a); toBitOffset += part23Length1a; fromBitOffset += part23Length1a + part23Length1aTruncation; - + /* rebuild portion 1b: */ shiftBits(toPtr, toBitOffset, fromPtr, fromBitOffset, part23Length1b); toBitOffset += part23Length1b; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3Internals.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 internal implementation details // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3InternalsHuffman.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 internal implementation details (Huffman encoding) // Implementation @@ -175,15 +175,15 @@ part23Length0bTruncation += adjustment; /* Assign the bits we just shaved to granule 1 */ p23L1 += adjustment; - + if (part23Length0aTruncation > 0) { /* Change the granule's 'big_values' field to reflect the truncation */ gr->big_values = i; } - } - + } + /* Process granule 1 (MPEG-1 only) */ - + if (isMPEG2) { part23Length1a = part23Length1b = 0; part23Length1aTruncation = part23Length1bTruncation = 0; @@ -294,7 +294,7 @@ if (adjustment > part23Length1b) adjustment = part23Length1b; /*sanity*/ part23Length1b -= adjustment; part23Length1bTruncation += adjustment; - + if (part23Length1aTruncation > 0) { /* Change the granule's 'big_values' field to reflect the truncation */ gr->big_values = i; @@ -341,14 +341,14 @@ struct huffcodetab { char tablename[3]; /*string, containing table_description */ - unsigned int xlen; /*max. x-index+ */ + unsigned int xlen; /*max. x-index+ */ unsigned int ylen; /*max. y-index+ */ unsigned int linbits; /*number of linbits */ unsigned int linmax; /*max number to be stored in linbits */ int ref; /*a positive value indicates a reference*/ HUFFBITS *table; /*pointer to array[xlen][ylen] */ unsigned char *hlen; /*pointer to array[xlen][ylen] */ - unsigned char(*val)[2];/*decoder tree */ + unsigned char(*val)[2];/*decoder tree */ unsigned int treelen; /*length of decoder tree */ }; @@ -357,7 +357,7 @@ /* 32,33 count1-tables */ /* read the huffman decoder table */ -static int read_decoder_table(unsigned char* fi) { +static int read_decoder_table(unsigned char* fi) { int n,i,nn,t; unsigned int v0,v1; char command[100],line[100]; @@ -365,11 +365,11 @@ rsf_ht[n].table = NULL; rsf_ht[n].hlen = NULL; - /* .table number treelen xlen ylen linbits */ + /* .table number treelen xlen ylen linbits */ do { rsf_getline(line,99,&fi); } while ((line[0] == '#') || (line[0] < ' ')); - + sscanf(line,"%s %s %u %u %u %u",command,rsf_ht[n].tablename, &rsf_ht[n].treelen, &rsf_ht[n].xlen, &rsf_ht[n].ylen, &rsf_ht[n].linbits); if (strcmp(command,".end")==0) @@ -381,14 +381,14 @@ return -1; } rsf_ht[n].linmax = (1<<rsf_ht[n].linbits)-1; - + sscanf(rsf_ht[n].tablename,"%u",&nn); if (nn != n) { #ifdef DEBUG fprintf(stderr,"wrong table number %u\n",n); #endif return(-2); - } + } do { rsf_getline(line,99,&fi); } while ((line[0] == '#') || (line[0] < ' ')); @@ -408,10 +408,10 @@ while ((line[0] == '#') || (line[0] < ' ') ) { rsf_getline(line,99,&fi); } - } + } else if (strcmp(command,".treedata")==0) { rsf_ht[n].ref = -1; - rsf_ht[n].val = (unsigned char (*)[2]) + rsf_ht[n].val = (unsigned char (*)[2]) new unsigned char[2*(rsf_ht[n].treelen)]; if ((rsf_ht[n].val == NULL) && ( rsf_ht[n].treelen != 0 )){ #ifdef DEBUG @@ -463,14 +463,14 @@ {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} } , { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0} , { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} } -}; +}; static unsigned rsf_get_scale_factors_1(MP3SideInfo::gr_info_s_t *gr_info) { int numbits; int num0 = slen[0][gr_info->scalefac_compress]; int num1 = slen[1][gr_info->scalefac_compress]; - if (gr_info->block_type == 2) + if (gr_info->block_type == 2) { numbits = (num0 + num1) * 18; @@ -478,7 +478,7 @@ numbits -= num0; /* num0 * 17 + num1 * 18 */ } } - else + else { int scfsi = gr_info->scfsi; @@ -535,7 +535,7 @@ gr_info->preflag = (slen>>15) & 0x1; - n = 0; + n = 0; if( gr_info->block_type == 2 ) { n++; if(gr_info->mixed_block_flag) @@ -602,7 +602,7 @@ hei.reg2Start = bv.curBitIndex(); } } - + hei.allBitOffsets[i] = bv.curBitIndex(); rsf_huffman_decoder(bv, h, &x, &y, &v, &w); if (hei.decodedValues != NULL) { @@ -612,7 +612,7 @@ } } hei.bigvalStart = bv.curBitIndex(); - + /* Read count1 area. */ h = &rsf_ht[gr->count1table_select+32]; while (bv.curBitIndex() < bv.totNumBits() && i < SSLIMIT*SBLIMIT) { @@ -658,21 +658,21 @@ error = 0; break; - } + } if (bv.get1Bit()) { - while (h->val[point][1] >= MXOFF) point += h->val[point][1]; + while (h->val[point][1] >= MXOFF) point += h->val[point][1]; point += h->val[point][1]; } else { - while (h->val[point][0] >= MXOFF) point += h->val[point][0]; + while (h->val[point][0] >= MXOFF) point += h->val[point][0]; point += h->val[point][0]; } level >>= 1; } while (level || (point < h->treelen) ); ///// } while (level || (point < rsf_ht->treelen) ); - + /* Check for error. */ - + if (error) { /* set x and y to a medium value as a simple concealment */ printf("Illegal Huffman code in data.\n"); *x = ((h->xlen-1) << 1); @@ -697,23 +697,23 @@ if (*y) if (bv.get1Bit() == 1) *y = -*y; } - + /* Process sign and escape encodings for dual tables. */ - + else { if (h->linbits) - if ((h->xlen-1) == (unsigned)*x) + if ((h->xlen-1) == (unsigned)*x) *x += bv.getBits(h->linbits); if (*x) if (bv.get1Bit() == 1) *x = -*x; - if (h->linbits) + if (h->linbits) if ((h->ylen-1) == (unsigned)*y) *y += bv.getBits(h->linbits); if (*y) if (bv.get1Bit() == 1) *y = -*y; } - - return error; + + return error; } #ifdef DO_HUFFMAN_ENCODING @@ -764,14 +764,14 @@ /* in region 2 */ h = &rsf_ht[gr->table_select[2]]; } - + x = getNextSample(fromPtr); y = getNextSample(fromPtr); v = getNextSample(fromPtr); w = getNextSample(fromPtr); rsf_huffman_encoder(bv, h, x, y, v, w); } - + // Encode count1 area: h = &rsf_ht[gr->count1table_select+32]; while (bv.curBitIndex() < bv.totNumBits() && i < SSLIMIT*SBLIMIT) { @@ -803,16 +803,16 @@ return False; } } - + if (numBitsTestedSoFar++ == bitsLength) { // We don't yet have enough bits for this prefix return False; } if (bits&mask) { - while (h->val[point][1] >= MXOFF) point += h->val[point][1]; + while (h->val[point][1] >= MXOFF) point += h->val[point][1]; point += h->val[point][1]; } else { - while (h->val[point][0] >= MXOFF) point += h->val[point][0]; + while (h->val[point][0] >= MXOFF) point += h->val[point][0]; point += h->val[point][0]; } mask <<= 1; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3InternalsHuffman.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 internal implementation details (Huffman encoding) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3InternalsHuffmanTable.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 internal implementation details (Huffman encoding) // Table | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3StreamState.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class encapsulating the state of a MP3 stream // Implementation @@ -66,7 +66,7 @@ // result is numSamples/freq unsigned const uSeconds - = ((numSamples*2*MILLION)/freq + 1)/2; // rounds to nearest integer + = ((numSamples*2*MILLION)/freq + 1)/2; // rounds to nearest integer struct timeval result; result.tv_sec = uSeconds/MILLION; @@ -86,7 +86,7 @@ return numFramesInFile*(pt.tv_sec + pt.tv_usec/(float)MILLION); } -void MP3StreamState::seekWithinFile(float seekNPT) { +void MP3StreamState::seekWithinFile(double seekNPT) { if (fFidIsReallyASocket) return; // it's not seekable float fileDuration = filePlayTime(); @@ -95,7 +95,7 @@ } else if (seekNPT > fileDuration) { seekNPT = fileDuration; } - float seekFraction = seekNPT/fileDuration; + float seekFraction = (float)seekNPT/fileDuration; unsigned seekByteNumber; if (fHasXingTOC) { @@ -226,7 +226,7 @@ unsigned char hbuf[8]; unsigned l; int i; int attempt = 0; - + #ifdef DEBUGGING_INPUT /* use this debugging code to generate a copy of the input stream */ FILE* fout; @@ -238,15 +238,15 @@ fclose(fout); exit(0); #endif - + read_again: if (readFromStream(hbuf, 4) != 4) return False; - + fr().hdr = ((unsigned long) hbuf[0] << 24) | ((unsigned long) hbuf[1] << 16) | ((unsigned long) hbuf[2] << 8) | (unsigned long) hbuf[3]; - + #ifdef DEBUG_PARSE fprintf(stderr, "fr().hdr: 0x%08x\n", fr().hdr); #endif @@ -314,7 +314,7 @@ fprintf(stderr,"Giving up searching valid MPEG header\n"); #endif return False; - + #ifdef DEBUG_ERRORS fprintf(stderr,"Illegal Audio-MPEG-Header 0x%08lx at offset 0x%lx.\n", fr().hdr,tell_stream(str)-4); @@ -330,13 +330,13 @@ if (readFromStream(&hbuf[3],1) != 1) { return False; } - + /* This is faster than combining fr().hdr from scratch */ fr().hdr = ((fr().hdr << 8) | hbuf[3]) & 0xffffffff; - + if (!fr().oldHdr) goto init_resync; /* "considered harmful", eh? */ - + } while ((fr().hdr & HDRCMPMASK) != (fr().oldHdr & HDRCMPMASK) && (fr().hdr & HDRCMPMASK) != (fr().firstHdr & HDRCMPMASK)); #ifdef DEBUG_ERRORS @@ -346,19 +346,19 @@ if (!fr().firstHdr) { fr().firstHdr = fr().hdr; } - + fr().setParamsFromHeader(); fr().setBytePointer(fr().frameBytes, fr().frameSize); - + fr().oldHdr = fr().hdr; - + if (fr().isFreeFormat) { #ifdef DEBUG_ERRORS fprintf(stderr,"Free format not supported.\n"); #endif return False; } - + #ifdef MP3_ONLY if (fr().layer != 3) { #ifdef DEBUG_ERRORS @@ -368,13 +368,13 @@ } #endif } - + if ((l = readFromStream(fr().frameBytes, fr().frameSize)) != fr().frameSize) { if (l == 0) return False; memset(fr().frameBytes+1, 0, fr().frameSize-1); } - + return True; } @@ -467,7 +467,7 @@ } if (flags&XING_TOC_FLAG) { - // Fill in the Xing 'table of contents': + // Fill in the Xing 'table of contents': if (bytesAvailable < XING_TOC_LENGTH) return; fHasXingTOC = True; for (unsigned j = 0; j < XING_TOC_LENGTH; ++j) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3StreamState.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class encapsulating the state of a MP3 stream // C++ header @@ -58,7 +58,7 @@ float filePlayTime() const; // in seconds void setPresentationTimeScale(unsigned scale) { fPresentationTimeScale = scale; } - void seekWithinFile(float seekNPT); + void seekWithinFile(double seekNPT); void checkForXingHeader(); // hack for Xing VBR files | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MP3Transcoder.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 Transcoder // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2AudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG audio (RFC 2250) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2AudioRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-1 or MPEG-2 Audio RTP Sources // Implementation @@ -54,7 +54,7 @@ resultSpecialHeaderSize = 4; return True; -} +} char const* MPEG1or2AudioRTPSource::MIMEtype() const { return "audio/MPEG"; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2AudioStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG (1,2) audio elementary stream into frames // Implementation @@ -136,7 +136,7 @@ // We were able to acquire a frame from the input. // It has already been copied to the reader's space. fFrameSize = acquiredFrameSize; - + // Also set the presentation time, and increment it for next time, // based on the length of this frame: fPresentationTime = fNextFramePresentationTime; @@ -179,15 +179,15 @@ unsigned MPEG1or2AudioStreamParser::parse(unsigned& numTruncatedBytes) { try { saveParserState(); - + // We expect a MPEG audio header (first 11 bits set to 1) at the start: while (((fCurrentFrame.hdr = test4Bytes())&0xFFE00000) != 0xFFE00000) { skipBytes(1); saveParserState(); } - + fCurrentFrame.setParamsFromHeader(); - + // Copy the frame to the requested destination: unsigned frameSize = fCurrentFrame.frameSize + 4; // include header if (frameSize > fMaxSize) { @@ -199,7 +199,7 @@ getBytes(fTo, frameSize); skipBytes(numTruncatedBytes); - + return frameSize; } catch (int /*e*/) { #ifdef DEBUG | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2Demux.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Demultiplexer for a MPEG 1 or 2 Program Stream // Implementation @@ -30,7 +30,7 @@ PARSING_PACK_HEADER, PARSING_SYSTEM_HEADER, PARSING_PES_PACKET -}; +}; class MPEGProgramStreamParser: public StreamParser { public: @@ -92,7 +92,7 @@ fOutput[i].isPotentiallyReadable = False; fOutput[i].isCurrentlyActive = False; fOutput[i].isCurrentlyAwaitingData = False; - } + } } MPEG1or2Demux::~MPEG1or2Demux() { @@ -157,14 +157,14 @@ FramedSource::onCloseFunc* onCloseFunc, void* onCloseClientData) { struct OutputDescriptor& out = fOutput[streamIdTag]; - + // Make sure this stream is not already being read: if (out.isCurrentlyAwaitingData) { envir() << "MPEG1or2Demux::registerReadInterest(): attempt to read stream id " << (void*)streamIdTag << " more than once!\n"; exit(1); } - + out.to = to; out.maxSize = maxSize; out.fAfterGettingFunc = afterGettingFunc; out.afterGettingClientData = afterGettingClientData; @@ -229,7 +229,7 @@ if (acquiredStreamIdTag != 0) { // We were able to acquire a frame from the input. - struct OutputDescriptor& newOut = fOutput[acquiredStreamIdTag]; + struct OutputDescriptor& newOut = fOutput[acquiredStreamIdTag]; newOut.isCurrentlyAwaitingData = False; // indicates that we can be read again // (This needs to be set before the 'after getting' call below, @@ -311,7 +311,7 @@ out.savedDataTotalSize = 0; out.isPotentiallyReadable = out.isCurrentlyActive = out.isCurrentlyAwaitingData = False; - } + } for (i = 0; i < numPending; ++i) { (*savedPending[i].fOnCloseFunc)(savedPending[i].onCloseClientData); } @@ -411,9 +411,9 @@ skipBytes(1); } } - + // The size of the pack header differs depending on whether it's - // MPEG-1 or MPEG-2. The next byte tells us this: + // MPEG-1 or MPEG-2. The next byte tells us this: unsigned char nextByte = get1Byte(); MPEG1or2Demux::SCR& scr = fUsingSource->fLastSeenSCR; // alias if ((nextByte&0xF0) == 0x20) { // MPEG-1 @@ -460,10 +460,10 @@ << (void*)nextByte << " following pack_start_code\n"; } - + // Check for a System Header next: setParseState(PARSING_SYSTEM_HEADER); -} +} void MPEGProgramStreamParser::parseSystemHeader() { #ifdef DEBUG @@ -475,14 +475,14 @@ setParseState(PARSING_PES_PACKET); return; } - + #ifdef DEBUG fprintf(stderr, "saw system_header_start_code\n"); fflush(stderr); #endif skipBytes(4); // we've already seen the system_header_start_code - + unsigned short remaining_header_length = get2Bytes(); - + // According to the MPEG-1 and MPEG-2 specs, "remaining_header_length" should be // at least 6 bytes. Check this now: if (remaining_header_length < 6) { @@ -490,7 +490,7 @@ << remaining_header_length << " < 6\n"; } skipBytes(remaining_header_length); - + // Check for a PES Packet next: setParseState(PARSING_PES_PACKET); } @@ -517,7 +517,7 @@ } } -#define READER_NOT_READY 2 +#define READER_NOT_READY 2 unsigned char MPEGProgramStreamParser::parsePESPacket() { #ifdef DEBUG @@ -529,7 +529,7 @@ setParseState(PARSING_PACK_HEADER); return 0; } - + #ifdef DEBUG fprintf(stderr, "saw packet_start_code_prefix\n"); fflush(stderr); #endif @@ -561,7 +561,7 @@ static unsigned frameCount = 1; fprintf(stderr, "%d, saw %s stream: 0x%02x\n", frameCount, streamTypeStr, streamNum); fflush(stderr); #endif - + unsigned short PES_packet_length = get2Bytes(); #ifdef DEBUG fprintf(stderr, "PES_packet_length: %d\n", PES_packet_length); fflush(stderr); @@ -572,7 +572,7 @@ if (fUsingSource->fOutput[RAW_PES].isPotentiallyReadable) { // Hack: We've been asked to return raw PES packets, for every stream: stream_id = RAW_PES; - } + } unsigned savedParserOffset = curOffset(); #ifdef DEBUG_TIMESTAMPS unsigned char pts_highBit = 0; @@ -691,12 +691,12 @@ } else { PES_packet_length -= bytesSkipped; #ifdef DEBUG - unsigned next4Bytes = test4Bytes(); + unsigned next4Bytes = test4Bytes(); #endif // Check whether our using source is interested in this stream type. // If so, deliver the frame to him: - MPEG1or2Demux::OutputDescriptor_t& out = fUsingSource->fOutput[stream_id]; + MPEG1or2Demux::OutputDescriptor_t& out = fUsingSource->fOutput[stream_id]; if (out.isCurrentlyAwaitingData) { unsigned numBytesToCopy; if (PES_packet_length > out.maxSize) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2DemuxedElementaryStream.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A MPEG 1 or 2 Elementary Stream, demultiplexed from a Program Stream // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2DemuxedServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-1 or 2 demuxer. // Implementation @@ -94,7 +94,7 @@ } void MPEG1or2DemuxedServerMediaSubsession -::seekStreamSource(FramedSource* inputSource, float seekNPT) { +::seekStreamSource(FramedSource* inputSource, double seekNPT) { float const dur = duration(); unsigned const size = fOurDemux.fileSize(); unsigned absBytePosition = dur == 0.0 ? 0 : (unsigned)((seekNPT/dur)*size); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2FileServerDemux.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A server demultiplexer for a MPEG 1 or 2 Program Stream // Implementation @@ -142,7 +142,7 @@ if (!getMPEG1or2TimeCode(dataSource, *baseDemux, True, firstTimeCode)) break; // Then, read the last time code from the file. - // (Before doing this, flush the demux's input buffers, + // (Before doing this, flush the demux's input buffers, // and seek towards the end of the file, for efficiency.) baseDemux->flushInput(); unsigned const startByteFromEnd = 100000; @@ -163,6 +163,8 @@ return duration; } +#define DUMMY_SINK_BUFFER_SIZE (6+65535) /* large enough for a PES packet */ + class DummySink: public MediaSink { public: DummySink(MPEG1or2Demux& demux, Boolean returnFirstSeenCode); @@ -184,7 +186,7 @@ private: MPEG1or2Demux& fOurDemux; Boolean fReturnFirstSeenCode; - unsigned char fBuf[10000]; + unsigned char fBuf[DUMMY_SINK_BUFFER_SIZE]; }; static void afterPlayingDummySink(DummySink* sink); // forward @@ -201,7 +203,7 @@ sink.startPlaying(*dataSource, (MediaSink::afterPlayingFunc*)afterPlayingDummySink, &sink); env.taskScheduler().doEventLoop(&sink.watchVariable); - + timeCode = computeSCRTimeCode(parentDemux.lastSeenSCR()); return parentDemux.lastSeenSCR().isValid; } @@ -246,7 +248,7 @@ } static void afterPlayingDummySink(DummySink* sink) { - // Return from the "doEventLoop()" call: + // Return from the "doEventLoop()" call: sink->watchVariable = ~0; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-1 or 2 Elementary Stream video file. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoHTTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A HTTP Sink specifically for MPEG Video // Implementation @@ -31,9 +31,9 @@ MPEG1or2VideoHTTPSink* newSink = new MPEG1or2VideoHTTPSink(env, ourSocket); if (newSink == NULL) break; - + appendPortNum(env, ourPort); - + return newSink; } while (0); @@ -65,7 +65,7 @@ = (framePtr[0]<<24)|(framePtr[1]<<16)|(framePtr[2]<<8)|framePtr[3]; if (first4Bytes == VIDEO_SEQUENCE_HEADER_START_CODE) { - fHaveSeenFirstVSH = True; + fHaveSeenFirstVSH = True; return True; } else { return False; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG video (RFC 2250) // Implementation @@ -51,7 +51,7 @@ // complete picture) can appear at other than the first position in a packet // in all situations, EXCEPT when it follows the end of (i.e., the last slice // of) a picture. I.e., the headers at the beginning of a picture must - // appear at the start of a RTP packet. + // appear at the start of a RTP packet. if (!fPreviousFrameWasSlice) return True; // A slice is already packed into this packet. We allow this new 'frame' @@ -72,7 +72,7 @@ unsigned numRemainingBytes) { Boolean thisFrameIsASlice = False; // until we learn otherwise if (isFirstFrameInPacket()) { - fSequenceHeaderPresent = fPacketBeginsSlice = fPacketEndsSlice = False; + fSequenceHeaderPresent = fPacketBeginsSlice = fPacketEndsSlice = False; } if (fragmentationOffset == 0) { @@ -94,7 +94,7 @@ unsigned char byte8 = numBytesInFrame == 8 ? 0 : frameStart[8]; fPictureState.temporal_reference = (next4Bytes&0xFFC00000)>>(32-10); - fPictureState.picture_coding_type = (next4Bytes&0x00380000)>>(32-(10+3)); + fPictureState.picture_coding_type = (next4Bytes&0x00380000)>>(32-(10+3)); unsigned char FBV, BFC, FFV, FFC; FBV = BFC = FFV = FFC = 0; @@ -141,7 +141,7 @@ // in the packet. That's OK, because this situation happens infrequently, // and we want the video-specific header to reflect the most up-to-date // information (in particular, from a Picture Header) anyway. - unsigned videoSpecificHeader = + unsigned videoSpecificHeader = // T == 0 (fPictureState.temporal_reference<<16) | // AN == N == 0 | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-1 or MPEG-2 Video RTP Sources // Implementation @@ -56,7 +56,7 @@ resultSpecialHeaderSize = 4; return True; -} +} Boolean MPEG1or2VideoRTPSource ::packetIsUsableInJitterCalculation(unsigned char* packet, @@ -74,7 +74,7 @@ } else { // a P, B, D, or other unknown frame type return False; } -} +} char const* MPEG1or2VideoRTPSource::MIMEtype() const { return "video/MPEG"; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoStreamDiscreteFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simplified version of "MPEG1or2VideoStreamFramer" that takes only // complete, discrete frames (rather than an arbitrary byte stream) as input. // This avoids the parsing and data copying overhead of the full @@ -32,7 +32,7 @@ return new MPEG1or2VideoStreamDiscreteFramer(env, inputSource, iFramesOnly, vshPeriod); } - + MPEG1or2VideoStreamDiscreteFramer ::MPEG1or2VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource, @@ -45,10 +45,10 @@ fLastNonBFramePresentationTime.tv_sec = 0; fLastNonBFramePresentationTime.tv_usec = 0; } - + MPEG1or2VideoStreamDiscreteFramer::~MPEG1or2VideoStreamDiscreteFramer() { } - + void MPEG1or2VideoStreamDiscreteFramer::doGetNextFrame() { // Arrange to read data (which should be a complete MPEG-1 or 2 video frame) // from our data source, directly into the client's input buffer. @@ -57,7 +57,7 @@ afterGettingFrame, this, FramedSource::handleClosure, this); } - + void MPEG1or2VideoStreamDiscreteFramer ::afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, @@ -145,7 +145,7 @@ } } - if (nextCode == 0x00 /*PICTURE_START_CODE*/ && i+2 < frameSize) { + if (nextCode == 0x00 /*PICTURE_START_CODE*/ && i+2 < frameSize) { // Get the 'temporal_reference' and 'picture_coding_type' from the // following 2 bytes: ++i; @@ -191,7 +191,7 @@ // ##### Later: // - do "iFramesOnly" if requested - + // Complete delivery to the client: fFrameSize = frameSize; fNumTruncatedBytes = numTruncatedBytes; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG1or2VideoStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG 1 or 2 video elementary stream into // frames for: Video_Sequence_Header, GOP_Header, Picture_Header // Implementation @@ -33,7 +33,7 @@ PARSING_GOP_HEADER_SEEN_CODE, PARSING_PICTURE_HEADER, PARSING_SLICE -}; +}; #define VSH_MAX_SIZE 1000 @@ -68,7 +68,7 @@ unsigned short fCurPicTemporalReference; // used to compute slice timestamp unsigned char fCurrentSliceNumber; // set when parsing a slice - + // A saved copy of the most recently seen 'video_sequence_header', // in case we need to insert it into the stream periodically: unsigned char fSavedVSHBuffer[VSH_MAX_SIZE]; @@ -283,7 +283,7 @@ do { saveToNextCode(next4Bytes); } while (next4Bytes != GROUP_START_CODE && next4Bytes != PICTURE_START_CODE); - + setParseState((next4Bytes == GROUP_START_CODE) ? PARSING_GOP_HEADER_SEEN_CODE : PARSING_PICTURE_HEADER); @@ -355,7 +355,7 @@ // Compute this frame's timestamp: usingSource()->computePresentationTime(0); - + setParseState(PARSING_PICTURE_HEADER); return curFrameSize(); @@ -397,7 +397,7 @@ saveToNextCode(next4Bytes); } while (!isSliceStartCode(next4Bytes)); } - + setParseState(PARSING_SLICE); fCurrentSliceNumber = next4Bytes&0xFF; @@ -410,7 +410,7 @@ if (fSkippingCurrentPicture) { return parse(); // try again, until we get a non-skipped frame - } else { + } else { return curFrameSize(); } } @@ -429,7 +429,7 @@ // Copy all bytes that we see, up until we reach a code of some sort: saveToNextCode(next4Bytes); } - + // The next thing to parse depends on the code that we just saw: if (isSliceStartCode(next4Bytes)) { // common case setParseState(PARSING_SLICE); @@ -472,7 +472,7 @@ if (fSkippingCurrentPicture) { return parse(); // try again, until we get a non-skipped frame - } else { + } else { return curFrameSize(); } } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2IndexFromTransportStream.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that produces a sequence of I-frame indices from a MPEG-2 Transport Stream // Implementation @@ -36,23 +36,23 @@ IndexRecord(u_int8_t startOffset, u_int8_t size, unsigned long transportPacketNumber, float pcr); virtual ~IndexRecord(); - + RecordType& recordType() { return fRecordType; } void setFirstFlag() { fRecordType = (RecordType)(((u_int8_t)fRecordType) | 0x80); } u_int8_t startOffset() const { return fStartOffset; } u_int8_t& size() { return fSize; } float pcr() const { return fPCR; } unsigned long transportPacketNumber() const { return fTransportPacketNumber; } - + IndexRecord* next() const { return fNext; } void addAfter(IndexRecord* prev); void unlink(); - + private: // Index records are maintained in a doubly-linked list: IndexRecord* fNext; IndexRecord* fPrev; - + RecordType fRecordType; u_int8_t fStartOffset; // within the Transport Stream packet u_int8_t fSize; // in bytes, following "fStartOffset". @@ -75,7 +75,7 @@ << recordTypeStr[r.recordType()&0x7F] << ":" << (unsigned)r.transportPacketNumber() << ":" << r.startOffset() << "(" << r.size() << ")@" << r.pcr() << "]"; -} +} #endif @@ -120,13 +120,13 @@ // Begin by trying to deliver an index record (for an already-parsed frame) // to the client: if (deliverIndexRecord()) return; - + // No more index records are left to deliver, so try to parse a new frame: if (parseFrame()) { // success - try again doGetNextFrame(); return; } - + // We need to read some more Transport Stream packets. Check whether we have room: if (fParseBufferSize - fParseBufferDataEnd < TRANSPORT_PACKET_SIZE) { // There's no room left. Compact the buffer, and check again: @@ -138,7 +138,7 @@ return; } } - + // Arrange to read a new Transport Stream packet: fInputSource->getNextFrame(fInputBuffer, sizeof fInputBuffer, afterGettingFrame, this, @@ -169,14 +169,14 @@ handleInputClosure1(); return; } - + ++fInputTransportPacketCounter; - + // Figure out how much of this Transport Packet contains PES data: u_int8_t adaptation_field_control = (fInputBuffer[3]&0x30)>>4; u_int8_t totalHeaderSize = adaptation_field_control == 1 ? 4 : 5 + fInputBuffer[4]; - + // Check for a PCR: if (totalHeaderSize > 5 && (fInputBuffer[5]&0x10) != 0) { // There's a PCR: @@ -187,14 +187,14 @@ if ((fInputBuffer[10]&0x80) != 0) pcr += 1/90000.0f; // add in low-bit (if set) unsigned short pcrExt = ((fInputBuffer[10]&0x01)<<8) | fInputBuffer[11]; pcr += pcrExt/27000000.0f; - + if (!fHaveSeenFirstPCR) { fFirstPCR = pcr; fHaveSeenFirstPCR = True; } fLastPCR = pcr; } - + // Get the PID from the packet, and check for special tables: the PAT and PMT: u_int16_t PID = ((fInputBuffer[1]&0x1F)<<8) | fInputBuffer[2]; if (PID == PAT_PID) { @@ -213,7 +213,7 @@ return; } fLastContinuityCounter = continuity_counter; - + // Also, if this is the start of a PES packet, then skip over the PES header: Boolean payload_unit_start_indicator = (fInputBuffer[1]&0x40) != 0; //fprintf(stderr, "PUSI: %d\n", payload_unit_start_indicator);//##### @@ -229,16 +229,16 @@ return; } } - + // The remaining data is Video Elementary Stream data. Add it to our parse buffer: unsigned vesSize = TRANSPORT_PACKET_SIZE - totalHeaderSize; memmove(&fParseBuffer[fParseBufferDataEnd], &fInputBuffer[totalHeaderSize], vesSize); fParseBufferDataEnd += vesSize; - + // And add a new index record noting where it came from: addToTail(new IndexRecord(totalHeaderSize, vesSize, fInputTransportPacketCounter, fLastPCR - fFirstPCR)); - + // Try again: doGetNextFrame(); } @@ -266,7 +266,7 @@ fParseBuffer[fParseBufferDataEnd++] = 0; fParseBuffer[fParseBufferDataEnd++] = 1; fParseBuffer[fParseBufferDataEnd++] = PICTURE_START_CODE; - + // Try again: doGetNextFrame(); } else { @@ -278,7 +278,7 @@ void MPEG2IFrameIndexFromTransportStream ::analyzePAT(unsigned char* pkt, unsigned size) { // Get the PMT_PID (we assume that's there just 1 program): - if (size < 16) return; // table too small + if (size < 16) return; // table too small u_int16_t program_number = (pkt[9]<<8) | pkt[10]; if (program_number != 0) { fPMT_PID = ((pkt[11]&0x1F)<<8) | pkt[12]; @@ -320,10 +320,10 @@ Boolean MPEG2IFrameIndexFromTransportStream::deliverIndexRecord() { IndexRecord* head = fHeadIndexRecord; if (head == NULL) return False; - + // Check whether the head record has been parsed yet: if (head->recordType() == RECORD_UNPARSED) return False; - + // Remove the head record (the one whose data we'll be delivering): IndexRecord* next = head->next(); head->unlink(); @@ -332,13 +332,13 @@ } else { fHeadIndexRecord = next; } - + if (head->recordType() == RECORD_JUNK) { // Don't actually deliver the data to the client: delete head; return True; } - + // Deliver data from the head record: #ifdef DEBUG envir() << "delivering: " << *head << "\n"; @@ -365,10 +365,10 @@ fTo[10] = (unsigned char)(tpn>>24); fFrameSize = 11; } - + // Free the (former) head record (as we're now done with it): delete head; - + // Complete delivery to the client: afterGetting(this); return True; @@ -380,7 +380,7 @@ // to "fParseBufferDataEnd". We now parse through this data, looking for // a complete 'frame' (where a 'frame', in this case, means // a Video Sequence Header, GOP Header, Picture Header, or Slice). - + // Inspect the frame's initial 4-byte code, to make sure it starts with a system code: if (fParseBufferDataEnd-fParseBufferFrameStart < 4) return False; // not enough data unsigned numInitialBadBytes = 0; @@ -393,14 +393,14 @@ } unsigned char nextCode; if (!parseToNextCode(nextCode)) return False; - + numInitialBadBytes = fParseBufferParseEnd - fParseBufferFrameStart; //fprintf(stderr, "#####numInitialBadBytes: 0x%x\n", numInitialBadBytes); fParseBufferFrameStart = fParseBufferParseEnd; fParseBufferParseEnd += 4; // skip over the code that we just saw p = &fParseBuffer[fParseBufferFrameStart]; } - + unsigned char curCode = p[3]; RecordType curRecordType; unsigned char nextCode; @@ -438,7 +438,7 @@ break; } } - + if (curRecordType == RECORD_PIC_NON_IFRAME) { if (curCode == VOP_START_CODE) { // MPEG-4 //fprintf(stderr, "#####parseFrame()1(4): 0x%x, 0x%x\n", curCode, fParseBuffer[fParseBufferFrameStart+4]&0xC0); @@ -454,7 +454,7 @@ } } } - + // There is now a parsed 'frame', from "fParseBufferFrameStart" // to "fParseBufferParseEnd". Tag the corresponding index records to note this: unsigned frameSize = fParseBufferParseEnd - fParseBufferFrameStart + numInitialBadBytes; @@ -471,7 +471,7 @@ } if (r == fHeadIndexRecord) r->setFirstFlag(); // indicates that this is the first record for this frame - + if (r->size() > frameSize) { // This record contains extra data that's not part of the frame. // Shorten this record, and move the extra data to a new record @@ -482,7 +482,7 @@ #ifdef DEBUG envir() << "tagged record (modified): " << *r << "\n"; #endif - + IndexRecord* newRecord = new IndexRecord(newOffset, newSize, r->transportPacketNumber(), r->pcr()); newRecord->addAfter(r); @@ -501,12 +501,12 @@ envir() << "!!!!!Internal consistency error!!!!!\n"; return False; } - } - + } + // Finally, update our parse state (to skip over the now-parsed data): fParseBufferFrameStart = fParseBufferParseEnd; fParseBufferParseEnd += 4; // to skip over the next code (that we found) - + return True; } @@ -524,7 +524,7 @@ return True; } else p += 3; } - + fParseBufferParseEnd = p - &fParseBuffer[0]; // where we've gotten to return False; // no luck this time } @@ -532,7 +532,7 @@ void MPEG2IFrameIndexFromTransportStream::compactParseBuffer() { #ifdef DEBUG envir() << "Compacting parse buffer: [" << fParseBufferFrameStart - << "," << fParseBufferParseEnd << "," << fParseBufferDataEnd << "]"; + << "," << fParseBufferParseEnd << "," << fParseBufferDataEnd << "]"; #endif memmove(&fParseBuffer[0], &fParseBuffer[fParseBufferFrameStart], fParseBufferDataEnd - fParseBufferFrameStart); @@ -541,7 +541,7 @@ fParseBufferFrameStart = 0; #ifdef DEBUG envir() << "-> [" << fParseBufferFrameStart - << "," << fParseBufferParseEnd << "," << fParseBufferDataEnd << "]\n"; + << "," << fParseBufferParseEnd << "," << fParseBufferDataEnd << "]\n"; #endif } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-2 Transport Stream file. // Implementation @@ -40,7 +40,7 @@ ClientTrickPlayState(MPEG2TransportStreamIndexFile* indexFile); // Functions to bring "fNPT", "fTSRecordNum" and "fIxRecordNum" in sync: - void updateStateFromNPT(float npt); + void updateStateFromNPT(double npt); void updateStateOnScaleChange(); void updateStateOnPlayChange(Boolean reverseToPreviousVSH); @@ -151,7 +151,7 @@ } void MPEG2TransportFileServerMediaSubsession -::seekStream(unsigned clientSessionId, void* streamToken, float seekNPT) { +::seekStream(unsigned clientSessionId, void* streamToken, double seekNPT) { if (fIndexFile != NULL) { // we support 'trick play' ClientTrickPlayState* client = lookupClient(clientSessionId); if (client != NULL) { @@ -259,8 +259,8 @@ fTSRecordNum(0), fIxRecordNum(0) { } -void ClientTrickPlayState::updateStateFromNPT(float npt) { - fNPT = npt; +void ClientTrickPlayState::updateStateFromNPT(double npt) { + fNPT = (float)npt; // Map "fNPT" to the corresponding Transport Stream and Index record numbers: unsigned long tsRecordNum, ixRecordNum; fIndexFile->lookupTSPacketNumFromNPT(fNPT, tsRecordNum, ixRecordNum); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that passes through (unchanged) chunks that contain an integral number // of MPEG-2 Transport Stream packets, but returning (in "fDurationInMicroseconds") // an updated estimate of the time gap between chunks. @@ -32,6 +32,7 @@ // times that we expect receivers to play the incoming packets). // (must be <= 1) #define MAX_PLAYOUT_BUFFER_DURATION 0.1 // (seconds) +#define PCR_PERIOD_VARIATION_RATIO 0.5 ////////// PIDStatus ////////// @@ -58,7 +59,7 @@ MPEG2TransportStreamFramer ::MPEG2TransportStreamFramer(UsageEnvironment& env, FramedSource* inputSource) : FramedFilter(env, inputSource), - fTSPacketCount(0), fTSPacketDurationEstimate(0.0) { + fTSPacketCount(0), fTSPacketDurationEstimate(0.0), fTSPCRCount(0) { fPIDStatusTable = HashTable::create(ONE_WORD_HASH_KEYS); } @@ -85,6 +86,7 @@ void MPEG2TransportStreamFramer::doStopGettingFrames() { FramedFilter::doStopGettingFrames(); fTSPacketCount = 0; + fTSPCRCount = 0; clearPIDStatusTable(); } @@ -172,6 +174,7 @@ if (pcrFlag == 0) return; // no PCR // There's a PCR. Get it, and the PID: + ++fTSPCRCount; u_int32_t pcrBaseHigh = (pkt[6]<<24)|(pkt[7]<<16)|(pkt[8]<<8)|pkt[9]; double clock = pcrBaseHigh/45000.0; if ((pkt[10]&0x80) != 0) clock += 1/90000.0; // add in low-bit (if set) @@ -182,6 +185,7 @@ // Check whether we already have a record of a PCR for this PID: PIDStatus* pidStatus = (PIDStatus*)(fPIDStatusTable->Lookup((char*)pid)); + if (pidStatus == NULL) { // We're seeing this PID's PCR for the first time: pidStatus = new PIDStatus(clock, timeNow); @@ -193,6 +197,15 @@ // We've seen this PID's PCR before; update our per-packet duration estimate: double durationPerPacket = (clock - pidStatus->lastClock)/(fTSPacketCount - pidStatus->lastPacketNum); + + // Hack (suggested by "Romain"): Don't update our estimate if this PCR appeared unusually quickly. + // (This can produce more accurate estimates for wildly VBR streams.) + double meanPCRPeriod = 0.0; + if (fTSPCRCount > 0) { + meanPCRPeriod=(double)fTSPacketCount/fTSPCRCount; + if (fTSPacketCount - pidStatus->lastPacketNum < meanPCRPeriod*PCR_PERIOD_VARIATION_RATIO) return; + } + if (fTSPacketDurationEstimate == 0.0) { // we've just started fTSPacketDurationEstimate = durationPerPacket; } else if (discontinuity_indicator == 0 && durationPerPacket >= 0.0) { @@ -216,7 +229,7 @@ pidStatus->firstRealTime = timeNow; } #ifdef DEBUG_PCR - fprintf(stderr, "PID 0x%x, PCR 0x%08x+%d:%03x == %f @ %f (diffs %f @ %f), pkt #%lu, discon %d => this duration %f, new estimate %f\n", pid, pcrBaseHigh, pkt[10]>>7, pcrExt, clock, timeNow, clock - pidStatus->firstClock, timeNow - pidStatus->firstRealTime, fTSPacketCount, discontinuity_indicator != 0, durationPerPacket, fTSPacketDurationEstimate); + fprintf(stderr, "PID 0x%x, PCR 0x%08x+%d:%03x == %f @ %f (diffs %f @ %f), pkt #%lu, discon %d => this duration %f, new estimate %f, mean PCR period=%f\n", pid, pcrBaseHigh, pkt[10]>>7, pcrExt, clock, timeNow, clock - pidStatus->firstClock, timeNow - pidStatus->firstRealTime, fTSPacketCount, discontinuity_indicator != 0, durationPerPacket, fTSPacketDurationEstimate, meanPCRPeriod ); #endif } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamFromESSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter for converting one or more MPEG Elementary Streams // to a MPEG-2 Transport Stream // Implementation @@ -156,7 +156,7 @@ FramedSource* inputSource, u_int8_t streamId, int mpegVersion, InputESSourceRecord* next) - : fNext(next), fParent(parent), fInputSource(inputSource), + : fNext(next), fParent(parent), fInputSource(inputSource), fStreamId(streamId), fMPEGVersion(mpegVersion) { fInputBuffer = new unsigned char[INPUT_BUFFER_SIZE]; reset(); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamFromPESSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter for converting a stream of MPEG PES packets to a MPEG-2 Transport Stream // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamIndexFile.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class that encapsulates MPEG-2 Transport Stream 'index files'/ // These index files are used to implement 'trick play' operations // (seek-by-time, fast forward, reverse play) on Transport Stream files. @@ -68,14 +68,14 @@ tsPacketNumber = indexRecordNumber = 0; return; } - + // If "npt" is the same as the one that we last looked up, return its cached result: if (npt == fCachedPCR) { tsPacketNumber = fCachedTSPacketNumber; - indexRecordNumber = fCachedIndexRecordNumber; + indexRecordNumber = fCachedIndexRecordNumber; return; } - + // Search for the pair of neighboring index records whose PCR values span "npt". // Use the 'regula-falsi' method. Boolean success = False; @@ -87,7 +87,7 @@ pcrRight = pcrFromBuf(); if (npt > pcrRight) npt = pcrRight; // handle "npt" too large by seeking to the last frame of the file - + while (ixRight-ixLeft > 1 && pcrLeft < npt && npt <= pcrRight) { unsigned long ixNew = ixLeft + (unsigned long)(((npt-pcrLeft)/(pcrRight-pcrLeft))*(ixRight-ixLeft)); @@ -106,12 +106,12 @@ } } if (ixRight-ixLeft > 1 || npt <= pcrLeft || npt > pcrRight) break; // bad PCR values in index file? - + ixFound = ixRight; // "Rewind' until we reach the start of a Video Sequence or GOP header: success = rewindToVSH(ixFound); } while (0); - + if (success && readIndexRecord(ixFound)) { // Return (and cache) information from record "ixFound": npt = fCachedPCR = pcrFromBuf(); @@ -133,14 +133,14 @@ indexRecordNumber = 0; return; } - + // If "tsPacketNumber" is the same as the one that we last looked up, return its cached result: if (tsPacketNumber == fCachedTSPacketNumber) { pcr = fCachedPCR; - indexRecordNumber = fCachedIndexRecordNumber; + indexRecordNumber = fCachedIndexRecordNumber; return; } - + // Search for the pair of neighboring index records whose TS packet #s span "tsPacketNumber". // Use the 'regula-falsi' method. Boolean success = False; @@ -152,7 +152,7 @@ tsRight = tsPacketNumFromBuf(); if (tsPacketNumber > tsRight) tsPacketNumber = tsRight; // handle "tsPacketNumber" too large by seeking to the last frame of the file - + while (ixRight-ixLeft > 1 && tsLeft < tsPacketNumber && tsPacketNumber <= tsRight) { unsigned long ixNew = ixLeft + (unsigned long)(((tsPacketNumber-tsLeft)/(tsRight-tsLeft))*(ixRight-ixLeft)); @@ -171,7 +171,7 @@ } } if (ixRight-ixLeft > 1 || tsPacketNumber <= tsLeft || tsPacketNumber > tsRight) break; // bad PCR values in index file? - + ixFound = ixRight; if (reverseToPreviousVSH) { // "Rewind' until we reach the start of a Video Sequence or GOP header: @@ -180,7 +180,7 @@ success = True; } } while (0); - + if (success && readIndexRecord(ixFound)) { // Return (and cache) information from record "ixFound": pcr = fCachedPCR = pcrFromBuf(); @@ -200,7 +200,7 @@ unsigned long& transportPacketNum, u_int8_t& offset, u_int8_t& size, float& pcr, u_int8_t& recordType) { if (!readIndexRecord(indexRecordNum)) return False; - + transportPacketNum = tsPacketNumFromBuf(); offset = offsetFromBuf(); size = sizeFromBuf(); @@ -211,7 +211,7 @@ float MPEG2TransportStreamIndexFile::getPlayingDuration() { if (fNumIndexRecords == 0 || !readOneIndexRecord(fNumIndexRecords-1)) return 0.0f; - + return pcrFromBuf(); } @@ -221,15 +221,15 @@ fCurrentIndexRecordNum = 0; } } - + return fFid != NULL; } Boolean MPEG2TransportStreamIndexFile::seekToIndexRecord(unsigned long indexRecordNumber) { if (!openFid()) return False; - + if (indexRecordNumber == fCurrentIndexRecordNum) return True; // we're already there - + if (SeekFile64(fFid, (int64_t)(indexRecordNumber*INDEX_RECORD_SIZE), SEEK_SET) != 0) return False; fCurrentIndexRecordNum = indexRecordNumber; return True; @@ -240,17 +240,17 @@ if (!seekToIndexRecord(indexRecordNum)) break; if (fread(fBuf, INDEX_RECORD_SIZE, 1, fFid) != 1) break; ++fCurrentIndexRecordNum; - + return True; } while (0); - + return False; // an error occurred } Boolean MPEG2TransportStreamIndexFile::readOneIndexRecord(unsigned long indexRecordNum) { Boolean result = readIndexRecord(indexRecordNum); closeFid(); - + return result; } @@ -273,17 +273,17 @@ Boolean MPEG2TransportStreamIndexFile::rewindToVSH(unsigned long&ixFound) { Boolean success = False; - + while (ixFound > 0) { if (!readIndexRecord(ixFound)) break; - + u_int8_t recordType = recordTypeFromBuf(); if ((recordType&0x80) != 0 && (recordType&0x7F) <= 2/*GOP*/) { if ((recordType&0x7F) == 2) { // This is a GOP. Hack: If the preceding record is for a Video Sequence Header, // then use it instead: unsigned long newIxFound = ixFound; - + while (--newIxFound > 0) { if (!readIndexRecord(newIxFound)) break; recordType = recordTypeFromBuf(); @@ -301,6 +301,6 @@ --ixFound; } if (ixFound == 0) success = True; // use record 0 anyway - + return success; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamMultiplexor.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class for generating MPEG-2 Transport Stream from one or more input // Elementary Stream data sources // Implementation @@ -101,26 +101,30 @@ fInputBufferSize = 0; // then, ignore the buffer } else { fCurrentPID = stream_id; - + // Set the stream's type: u_int8_t& streamType = fPIDState[fCurrentPID].streamType; // alias - + if (streamType == 0) { // Instead, set the stream's type to default values, based on whether // the stream is audio or video, and whether it's MPEG-1 or MPEG-2: if ((stream_id&0xF0) == 0xE0) { // video - streamType = mpegVersion == 1 ? 1 : 2; - if (fPCR_PID == 0) fPCR_PID = fCurrentPID; // use this stream's SCR for PCR + streamType = mpegVersion == 1 ? 1 : mpegVersion == 2 ? 2 : 0x10; } else if ((stream_id&0xE0) == 0xC0) { // audio - streamType = mpegVersion == 1 ? 3 : 4; - if (!fHaveVideoStreams && fPCR_PID == 0) fPCR_PID = fCurrentPID; // use this stream's SCR for PCR + streamType = mpegVersion == 1 ? 3 : mpegVersion == 2 ? 4 : 0xF; } else if (stream_id == 0xBD) { // private_stream1 (usually AC-3) - streamType = 0x06; // for DVB; for ATSC, use 0x81 + streamType = 0x06; // for DVB; for ATSC, use 0x81 } else { // something else, e.g., AC-3 uses private_stream1 (0xBD) - streamType = 0x81; // private + streamType = 0x81; // private + } + } + + if (fPCR_PID == 0) { // set it to this stream, if it's appropriate: + if ((!fHaveVideoStreams && (streamType == 3 || streamType == 4 || streamType == 0xF))/* audio stream */ || + (streamType == 1 || streamType == 2 || streamType == 0x10)/* video stream */) { + fPCR_PID = fCurrentPID; // use this stream's SCR for PCR } } - if (fCurrentPID == fPCR_PID) { // Record the input's current SCR timestamp, for use as our PCR: fPCR = scr; @@ -175,7 +179,7 @@ } // ASSERT: numHeaderBytes+numPCRBytes+numPaddingBytes+numDataBytes // == TRANSPORT_PACKET_SIZE - + // Fill in the header of the Transport Stream packet: unsigned char* header = fTo; *header++ = 0x47; // sync_byte @@ -213,7 +217,7 @@ } } } - + // Add any padding bytes: for (unsigned i = 0; i < numPaddingBytes; ++i) *header++ = 0xFF; @@ -247,18 +251,18 @@ *pat++ = OUR_PROGRAM_NUMBER>>8; *pat++ = OUR_PROGRAM_NUMBER; // program_number *pat++ = 0xE0|(OUR_PROGRAM_MAP_PID>>8); // reserved; program_map_PID (high) *pat++ = OUR_PROGRAM_MAP_PID; // program_map_PID (low) - + // Compute the CRC from the bytes we currently have (not including "pointer_field"): u_int32_t crc = calculateCRC(patBuffer+1, pat - (patBuffer+1)); *pat++ = crc>>24; *pat++ = crc>>16; *pat++ = crc>>8; *pat++ = crc; - + // Fill in the rest of the packet with padding bytes: while (pat < &patBuffer[patSize]) *pat++ = 0xFF; // Deliver the packet: unsigned startPosition = 0; deliverDataToClient(PAT_PID, patBuffer, patSize, startPosition); - + // Finally, remove the new buffer: delete[] patBuffer; } @@ -286,7 +290,7 @@ *pmt++ = 0xF0; // reserved; program_info_length (high) *pmt++ = 0; // program_info_length (low) for (int pid = 0; pid < PID_TABLE_SIZE; ++pid) { - if (fPIDState[pid].streamType != 0) { + if (fPIDState[pid].streamType != 0) { // This PID gets recorded in the table *pmt++ = fPIDState[pid].streamType; *pmt++ = 0xE0; // reserved; elementary_pid (high) @@ -297,18 +301,18 @@ } unsigned section_length = pmt - (section_lengthPtr+1) + 4 /*for CRC*/; *section_lengthPtr = section_length; - + // Compute the CRC from the bytes we currently have (not including "pointer_field"): u_int32_t crc = calculateCRC(pmtBuffer+1, pmt - (pmtBuffer+1)); *pmt++ = crc>>24; *pmt++ = crc>>16; *pmt++ = crc>>8; *pmt++ = crc; - + // Fill in the rest of the packet with padding bytes: while (pmt < &pmtBuffer[pmtSize]) *pmt++ = 0xFF; // Deliver the packet: unsigned startPosition = 0; deliverDataToClient(OUR_PROGRAM_MAP_PID, pmtBuffer, pmtSize, startPosition); - + // Finally, remove the new buffer: delete[] pmtBuffer; } @@ -321,7 +325,7 @@ if ((u_int16_t)frameSize > 6+program_stream_map_length) { frameSize = 6+program_stream_map_length; } - + u_int8_t versionByte = fInputBuffer[6]; if ((versionByte&0x80) == 0) return; // "current_next_indicator" is not set fCurrentInputProgramMapVersion = versionByte&0x1F; @@ -335,7 +339,7 @@ frameSize -= 4; // sizeof CRC_32 if (frameSize > offset + elementary_stream_map_length) { frameSize = offset + elementary_stream_map_length; - } + } while (offset + 4 <= frameSize) { u_int8_t stream_type = fInputBuffer[offset]; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG2TransportStreamTrickModeFilter.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that converts a MPEG Transport Stream file - with corresponding index file // - to a corresponding Video Elementary Stream. It also uses a "scale" parameter // to implement 'trick mode' (fast forward or reverse play, using I-frames) on @@ -68,7 +68,7 @@ afterGetting(this); return; } - + while (1) { // Get the next record from our index file. // This tells us the type of frame this data is, which Transport Stream packet @@ -96,7 +96,7 @@ // fprintf(stderr, "#####read index record %ld: ts %ld: %c, PCR %f\n", fNextIndexRecordNum, fDesiredTSPacketNum, isIFrameStart(recordType) ? 'I' : isNonIFrameStart(recordType) ? 'j' : 'x', recordPCR); fNextIndexRecordNum += (fState == DELIVERING_SAVED_FRAME) ? 1 : fDirection; - + // Handle this index record, depending on the record type and our current state: switch (fState) { case SKIPPING_FRAME: @@ -146,7 +146,7 @@ fState = SKIPPING_FRAME; } } else { - // Not the start of a frame, but deliver it, if it's needed: + // Not the start of a frame, but deliver it, if it's needed: if (fState == SAVING_AND_DELIVERING_FRAME) { // fprintf(stderr, "\tdelivering\n");//##### fDesiredDataPCR = recordPCR; // use this frame's PCR @@ -196,7 +196,7 @@ fPresentationTime.tv_usec = (unsigned long)((deliveryPCR - fPresentationTime.tv_sec)*1000000.0f); // fprintf(stderr, "#####DGNF9\n"); - + afterGetting(this); } else { // Arrange to read the Transport Packet that we want: @@ -206,11 +206,11 @@ void MPEG2TransportStreamTrickModeFilter::seekToTransportPacket(unsigned long tsPacketNum) { if (tsPacketNum == fNextTSPacketNum) return; // we're already there - + ByteStreamFileSource* tsFile = (ByteStreamFileSource*)fInputSource; u_int64_t tsPacketNum64 = (u_int64_t)tsPacketNum; tsFile->seekToByteAbsolute(tsPacketNum64*TRANSPORT_PACKET_SIZE); - + fNextTSPacketNum = tsPacketNum; } @@ -236,10 +236,10 @@ onSourceClosure1(); return; } - + fCurrentTSPacketNum = fNextTSPacketNum; // i.e., the one that we just read - ++fNextTSPacketNum; - + ++fNextTSPacketNum; + // Attempt deliver again: attemptDeliveryToClient(); } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4ESVideoRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG-4 Elementary Stream video (RFC 3016) // Implementation @@ -122,7 +122,7 @@ endPtr += 2; } sprintf(endPtr, "\r\n"); - + delete[] fAuxSDPLine; fAuxSDPLine = strDup(fmtp); delete[] fmtp; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4ESVideoRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP4V-ES video RTP stream sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4GenericRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sinks // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4GenericRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sources // Implementation @@ -126,7 +126,7 @@ if (fSizeLength > 0) { // The packet begins with a "AU Header Section". Parse it, to - // determine the "AU-header"s for each frame present in this packet: + // determine the "AU-header"s for each frame present in this packet: resultSpecialHeaderSize += 2; if (packetSize < resultSpecialHeaderSize) return False; @@ -223,7 +223,7 @@ result = samplingFrequencyFromIndex[samplingFrequencyIndex]; break; } - + // Index == 15 means that the actual frequency is next (24 bits): if (configSize < 5) break; result = ((config[1]&0x7F)<<17) | (config[2]<<9) | (config[3]<<1) | (config[4]>>7); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4LATMAudioRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG-4 audio, using LATM multiplexing (RFC 3016) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4LATMAudioRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-4 audio, using LATM multiplexing // Implementation @@ -153,7 +153,7 @@ // There's a second nibble, but it's malformed return False; } - + resultByte = (firstNibble<<4)|secondNibble; return True; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4VideoFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-4 video file. // Implementation @@ -80,15 +80,15 @@ // "auxSDPLine()" will be NULL initially, and we need to start reading // data from our file until this changes. fDummyRTPSink = rtpSink; - + // Start reading the file: fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this); - + // Check whether the sink's 'auxSDPLine()' is ready: checkForAuxSDPLine(this); - + envir().taskScheduler().doEventLoop(&fDoneFlag); - + char const* auxSDPLine = fDummyRTPSink->auxSDPLine(); return auxSDPLine; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4VideoStreamDiscreteFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simplified version of "MPEG4VideoStreamFramer" that takes only complete, // discrete frames (rather than an arbitrary byte stream) as input. // This avoids the parsing and data copying overhead of the full @@ -143,7 +143,7 @@ mask >>= 1; } } - + // If this is a "B" frame, then we have to tweak "presentationTime": if (vop_coding_type == 2/*B*/ && (fLastNonBFramePresentationTime.tv_usec > 0 || | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEG4VideoStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG-4 video elementary stream into // frames for: // - Visual Object Sequence (VS) Header + Visual Object (VO) Header @@ -38,7 +38,7 @@ PARSING_GROUP_OF_VIDEO_OBJECT_PLANE, PARSING_VIDEO_OBJECT_PLANE, PARSING_VISUAL_OBJECT_SEQUENCE_END_CODE -}; +}; class MPEG4VideoStreamParser: public MPEGVideoStreamParser { public: @@ -72,13 +72,13 @@ private: MPEGParseState fCurrentParseState; - unsigned fNumBitsSeenSoFar; // used by the getNextFrameBit*() routines + unsigned fNumBitsSeenSoFar; // used by the getNextFrameBit*() routines u_int32_t vop_time_increment_resolution; unsigned fNumVTIRBits; // # of bits needed to count to "vop_time_increment_resolution" u_int8_t fixed_vop_rate; unsigned fixed_vop_time_increment; // used if 'fixed_vop_rate' is set - unsigned fSecondsSinceLastTimeCode, fTotalTicksSinceLastTimeCode, fPrevNewTotalTicks; + unsigned fSecondsSinceLastTimeCode, fTotalTicksSinceLastTimeCode, fPrevNewTotalTicks; unsigned fPrevPictureCountDelta; Boolean fJustSawTimeCode; }; @@ -129,7 +129,7 @@ // Copy the old, then the new, config bytes there: memmove(configNew, fNewConfigBytes, fNumNewConfigBytes); memmove(&configNew[fNumNewConfigBytes], newConfigBytes, numNewBytes); - + delete[] fNewConfigBytes; fNewConfigBytes = configNew; fNumNewConfigBytes += numNewBytes; } @@ -257,7 +257,7 @@ while (next4Bytes != VISUAL_OBJECT_START_CODE) { saveToNextCode(next4Bytes); } - + setParseState(PARSING_VISUAL_OBJECT); // Compute this frame's presentation time: @@ -300,7 +300,7 @@ if (visual_object_type != 1) { usingSource()->envir() << "MPEG4VideoStreamParser::parseVisualObject(): Warning: We don't handle visual_object_type " << visual_object_type << "\n"; } - + // Now, copy all bytes that we see, up until we reach // a video_object_start_code u_int32_t next4Bytes = get4Bytes(); @@ -443,7 +443,7 @@ saveToNextCode(next4Bytes); } while (next4Bytes != GROUP_VOP_START_CODE && next4Bytes != VOP_START_CODE); - + analyzeVOLHeader(); setParseState((next4Bytes == GROUP_VOP_START_CODE) @@ -470,7 +470,7 @@ // Next, extract the (18-bit) time code from the next 3 bytes: u_int8_t next3Bytes[3]; getBytes(next3Bytes, 3); - saveByte(next3Bytes[0]);saveByte(next3Bytes[1]);saveByte(next3Bytes[2]); + saveByte(next3Bytes[0]);saveByte(next3Bytes[1]);saveByte(next3Bytes[2]); unsigned time_code = (next3Bytes[0]<<10)|(next3Bytes[1]<<2)|(next3Bytes[2]>>6); unsigned time_code_hours = (time_code&0x0003E000)>>13; @@ -489,7 +489,7 @@ while (next4Bytes != VOP_START_CODE) { saveToNextCode(next4Bytes); } - + // Compute this frame's presentation time: usingSource()->computePresentationTime(fTotalTicksSinceLastTimeCode); @@ -552,10 +552,10 @@ #ifdef DEBUG fprintf(stderr, "vop_coding_type: %d(%c), modulo_time_base: %d, vop_time_increment: %d\n", vop_coding_type, "IPBS"[vop_coding_type], modulo_time_base, vop_time_increment); #endif - + // Now, copy all bytes that we see, up until we reach a code of some sort: saveToNextCode(next4Bytes); - + // Update our counters based on the frame timing information that we saw: if (fixed_vop_time_increment > 0) { // This is a 'fixed_vop_rate' stream. Use 'fixed_vop_time_increment': @@ -606,9 +606,9 @@ } } fJustSawTimeCode = False; // for next time - + // The next thing to parse depends on the code that we just saw, - // but we are assumed to have ended the current picture: + // but we are assumed to have ended the current picture: usingSource()->fPictureEndMarker = True; // HACK ##### switch (next4Bytes) { case VISUAL_OBJECT_SEQUENCE_END_CODE: { | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEGVideoStreamFramer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG video elementary stream into // headers and frames // Implementation @@ -99,8 +99,8 @@ #ifdef DEBUG if (firstPT.tv_sec == 0 && firstPT.tv_usec == 0) firstPT = fPresentationTime; struct timeval diffPT; - diffPT.tv_sec = fPresentationTime.tv_sec - firstPT.tv_sec; - diffPT.tv_usec = fPresentationTime.tv_usec - firstPT.tv_usec; + diffPT.tv_sec = fPresentationTime.tv_sec - firstPT.tv_sec; + diffPT.tv_usec = fPresentationTime.tv_usec - firstPT.tv_usec; if (fPresentationTime.tv_usec < firstPT.tv_usec) { --diffPT.tv_sec; diffPT.tv_usec += 1000000; @@ -157,7 +157,7 @@ // It has already been copied to the reader's space. fFrameSize = acquiredFrameSize; fNumTruncatedBytes = fParser->numTruncatedBytes(); - + // "fPresentationTime" should have already been computed. // Compute "fDurationInMicroseconds" now: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEGVideoStreamParser.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An abstract parser for MPEG video streams // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MPEGVideoStreamParser.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An abstract parser for MPEG video streams // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/Makefile.tail ^ |
@@ -235,7 +235,7 @@ include/RTSPOverHTTPServer.hh: include/Media.hh RTSPClient.$(CPP): include/RTSPClient.hh include/RTSPCommon.hh include/Base64.hh include/Locale.hh our_md5.h include/RTSPClient.hh: include/MediaSession.hh include/DigestAuthentication.hh -RTSPCommon.$(CPP): include/RTSPCommon.hh +RTSPCommon.$(CPP): include/RTSPCommon.hh include/Locale.hh SIPClient.$(CPP): include/SIPClient.hh include/SIPClient.hh: include/MediaSession.hh include/DigestAuthentication.hh MediaSession.$(CPP): include/liveMedia.hh include/Locale.hh | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/Media.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Media // Implementation @@ -33,7 +33,7 @@ void remove(char const* name); void generateNewName(char* mediumName, unsigned maxLen); - + protected: MediaLookupTable(UsageEnvironment& env); virtual ~MediaLookupTable(); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MediaSession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A data structure that represents a session that consists of // potentially multiple (audio and/or video) sub-sessions // Implementation @@ -62,8 +62,9 @@ MediaSession::MediaSession(UsageEnvironment& env) : Medium(env), fSubsessionsHead(NULL), fSubsessionsTail(NULL), - fConnectionEndpointName(NULL), fMaxPlayEndTime(0.0f), - fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL) { + fConnectionEndpointName(NULL), fMaxPlayStartTime(0.0f), fMaxPlayEndTime(0.0f), + fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL), + fControlPath(NULL) { #ifdef SUPPORT_REAL_RTSP RealInitSDPAttributes(this); #endif @@ -89,6 +90,7 @@ delete[] fMediaSessionType; delete[] fSessionName; delete[] fSessionDescription; + delete[] fControlPath; #ifdef SUPPORT_REAL_RTSP RealReclaimSDPAttributes(this); #endif @@ -106,17 +108,18 @@ char const* nextSDPLine; while (1) { if (!parseSDPLine(sdpLine, nextSDPLine)) return False; - //##### We should really check for: + //##### We should really check for: // - "a=control:" attributes (to set the URL for aggregate control) // - the correct SDP version (v=0) if (sdpLine[0] == 'm') break; sdpLine = nextSDPLine; - if (sdpLine == NULL) break; // there are no m= lines at all + if (sdpLine == NULL) break; // there are no m= lines at all // Check for various special SDP lines that we understand: if (parseSDPLine_s(sdpLine)) continue; if (parseSDPLine_i(sdpLine)) continue; if (parseSDPLine_c(sdpLine)) continue; + if (parseSDPAttribute_control(sdpLine)) continue; if (parseSDPAttribute_range(sdpLine)) continue; if (parseSDPAttribute_type(sdpLine)) continue; if (parseSDPAttribute_source_filter(sdpLine)) continue; @@ -124,7 +127,7 @@ if (RealParseSDPAttributes(this, sdpLine)) continue; #endif } - + while (sdpLine != NULL) { // We have a "m=" line, representing a new sub-session: MediaSubsession* subsession = new MediaSubsession(*this); @@ -296,7 +299,7 @@ // Check for "s=<session name>" line char* buffer = strDupSize(sdpLine); Boolean parseSuccess = False; - + if (sscanf(sdpLine, "s=%[^\r\n]", buffer) == 1) { delete[] fSessionName; fSessionName = strDup(buffer); parseSuccess = True; @@ -310,7 +313,7 @@ // Check for "i=<session description>" line char* buffer = strDupSize(sdpLine); Boolean parseSuccess = False; - + if (sscanf(sdpLine, "i=%[^\r\n]", buffer) == 1) { delete[] fSessionDescription; fSessionDescription = strDup(buffer); parseSuccess = True; @@ -318,7 +321,7 @@ delete[] buffer; return parseSuccess; -} +} Boolean MediaSession::parseSDPLine_c(char const* sdpLine) { // Check for "c=IN IP4 <connection-endpoint>" @@ -349,8 +352,22 @@ return parseSuccess; } -static Boolean parseRangeAttribute(char const* sdpLine, float& endTime) { - return sscanf(sdpLine, "a=range: npt = %*g - %g", &endTime) == 1; +static Boolean parseRangeAttribute(char const* sdpLine, double& startTime, double& endTime) { + return sscanf(sdpLine, "a=range: npt = %lg - %lg", &startTime, &endTime) == 2; +} + +Boolean MediaSession::parseSDPAttribute_control(char const* sdpLine) { + // Check for a "a=control:<control-path>" line: + Boolean parseSuccess = False; + + char* controlPath = strDupSize(sdpLine); // ensures we have enough space + if (sscanf(sdpLine, "a=control: %s", controlPath) == 1) { + parseSuccess = True; + delete[] fControlPath; fControlPath = strDup(controlPath); + } + delete[] controlPath; + + return parseSuccess; } Boolean MediaSession::parseSDPAttribute_range(char const* sdpLine) { @@ -358,9 +375,13 @@ // (Later handle other kinds of "a=range" attributes also???#####) Boolean parseSuccess = False; - float playEndTime; - if (parseRangeAttribute(sdpLine, playEndTime)) { + double playStartTime; + double playEndTime; + if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) { parseSuccess = True; + if (playStartTime > fMaxPlayStartTime) { + fMaxPlayStartTime = playStartTime; + } if (playEndTime > fMaxPlayEndTime) { fMaxPlayEndTime = playEndTime; } @@ -375,7 +396,7 @@ // Note: At present, we don't check that <something> really matches // one of our multicast addresses. We also don't support more than // one <source> ##### - Boolean result = False; // until we succeed + Boolean result = False; // until we succeed char* sourceName = strDupSize(sdpLine); // ensures we have enough space do { if (sscanf(sdpLine, "a=source-filter: incl IN IP4 %*s %s", @@ -527,12 +548,13 @@ fSizelength(0), fStreamstateindication(0), fStreamtype(0), fCpresent(False), fRandomaccessindication(False), fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL), - fPlayEndTime(0.0), - fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f), + fPlayStartTime(0.0), fPlayEndTime(0.0), + fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f), fNPT_PTS_Offset(0.0f), fRTPSocket(NULL), fRTCPSocket(NULL), fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL) { + rtpInfo.seqNum = 0; rtpInfo.timestamp = 0; rtpInfo.infoIsNew = False; #ifdef SUPPORT_REAL_RTSP - RealInitSDPAttributes(this); + RealInitSDPAttributes(this); #endif } @@ -549,7 +571,13 @@ #endif } -float MediaSubsession::playEndTime() const { +double MediaSubsession::playStartTime() const { + if (fPlayStartTime > 0) return fPlayStartTime; + + return fParent.playStartTime(); +} + +double MediaSubsession::playEndTime() const { if (fPlayEndTime > 0) return fPlayEndTime; return fParent.playEndTime(); @@ -557,7 +585,7 @@ Boolean MediaSubsession::initiate(int useSpecialRTPoffset) { if (fReadSource != NULL) return True; // has already been initiated - + do { if (fCodecName == NULL) { env().setResultMsg("Codec is unspecified"); @@ -571,6 +599,7 @@ struct in_addr tempAddr; tempAddr.s_addr = connectionEndpointAddress(); // This could get changed later, as a result of a RTSP "SETUP" + unsigned short firstRTPPortNum = fClientPortNum&~1; while (1) { unsigned short rtpPortNum = fClientPortNum&~1; if (isSSM()) { @@ -599,7 +628,8 @@ // Try again: delete oldGroupsock; oldGroupsock = fRTPSocket; - fClientPortNum = 0; + if (firstRTPPortNum > 0) break; // Because we were told what port number to use, we can't choose another ourself + fClientPortNum += 2; // so that the OS doesn't choose the same port number again } delete oldGroupsock; if (!success) break; @@ -671,12 +701,12 @@ = MP3ADURTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, fRTPTimestampFrequency); if (fRTPSource == NULL) break; - + // Add a filter that deinterleaves the ADUs after depacketizing them: MP3ADUdeinterleaver* deinterleaver = MP3ADUdeinterleaver::createNew(env(), fRTPSource); if (deinterleaver == NULL) break; - + // Add another filter that converts these ADUs to MP3 frames: fReadSource = MP3FromADUSource::createNew(env(), deinterleaver); } else if (strcmp(fCodecName, "X-MP3-DRAFT-00") == 0) { @@ -687,7 +717,7 @@ fRTPTimestampFrequency, "audio/MPA-ROBUST" /*hack*/); if (fRTPSource == NULL) break; - + // Add a filter that converts these ADUs to MP3 frames: fReadSource = MP3FromADUSource::createNew(env(), fRTPSource, False /*no ADU header*/); @@ -745,7 +775,9 @@ fReadSource = fRTPSource = JPEGVideoRTPSource::createNew(env(), fRTPSocket, fRTPPayloadFormat, - fRTPTimestampFrequency); + fRTPTimestampFrequency, + videoWidth(), + videoHeight()); } else if (strcmp(fCodecName, "X-QT") == 0 || strcmp(fCodecName, "X-QUICKTIME") == 0) { // Generic QuickTime streams, as defined in @@ -792,7 +824,7 @@ env().setResultMsg("RTP payload format unknown or not supported"); break; } - + if (createSimpleRTPSource) { char* mimeType = new char[strlen(mediumName()) + strlen(codecName()) + 2] ; @@ -810,7 +842,7 @@ env().setResultMsg("Failed to create read source"); break; } - + // Finally, create our RTCP instance. (It starts running automatically) if (fRTPSource != NULL) { unsigned totSessionBandwidth = 500; // HACK - later get from SDP##### @@ -858,7 +890,7 @@ return True; } -unsigned MediaSubsession::connectionEndpointAddress() const { +netAddressBits MediaSubsession::connectionEndpointAddress() const { do { // Get the endpoint name from with us, or our parent session: char const* endpointString = connectionEndpointName(); @@ -871,17 +903,17 @@ NetAddressList addresses(endpointString); if (addresses.numAddresses() == 0) break; - return *(unsigned*)(addresses.firstAddress()->data()); + return *(netAddressBits*)(addresses.firstAddress()->data()); } while (0); // No address known: return 0; } -void MediaSubsession::setDestinations(unsigned defaultDestAddress) { +void MediaSubsession::setDestinations(netAddressBits defaultDestAddress) { // Get the destination address from the connection endpoint name // (This will be 0 if it's not known, in which case we use the default) - unsigned destAddress = connectionEndpointAddress(); + netAddressBits destAddress = connectionEndpointAddress(); if (destAddress == 0) destAddress = defaultDestAddress; struct in_addr destAddr; destAddr.s_addr = destAddress; @@ -900,6 +932,41 @@ } } +double MediaSubsession::getNormalPlayTime(struct timeval const& presentationTime) { + // First, check whether our "RTPSource" object has already been synchronized using RTCP. + // If it hasn't, then - as a special case - we need to use the RTP timestamp to compute the NPT. + if (rtpSource() == NULL || rtpSource()->timestampFrequency() == 0) return 0.0; // no RTP source, or bad freq! + + if (!rtpSource()->hasBeenSynchronizedUsingRTCP()) { + if (!rtpInfo.infoIsNew) return 0.0; // the "rtpInfo" structure has not been filled in + u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp; + double nptOffset = (timestampOffset/(double)(rtpSource()->timestampFrequency()))*scale(); + double npt = playStartTime() + nptOffset; + + return npt; + } else { + // Common case: We have been synchronized using RTCP. This means that the "presentationTime" parameter + // will be accurate, and so we should use this to compute the NPT. + double ptsDouble = (double)(presentationTime.tv_sec + presentationTime.tv_usec/1000000.0); + + if (rtpInfo.infoIsNew) { + // This is the first time we've been called with a synchronized presentation time since the "rtpInfo" + // structure was last filled in. Use this "presentationTime" to compute "fNPT_PTS_Offset": + u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp; + double nptOffset = (timestampOffset/(double)(rtpSource()->timestampFrequency()))*scale(); + double npt = playStartTime() + nptOffset; + fNPT_PTS_Offset = npt - ptsDouble*scale(); + rtpInfo.infoIsNew = False; // for next time + + return npt; + } else { + // Use the precomputed "fNPT_PTS_Offset" to compute the NPT from the PTS: + if (fNPT_PTS_Offset == 0.0) return 0.0; // error: The "rtpInfo" structure was apparently never filled in + return (double)(ptsDouble*scale() + fNPT_PTS_Offset); + } + } +} + Boolean MediaSubsession::parseSDPLine_c(char const* sdpLine) { // Check for "c=IN IP4 <connection-endpoint>" // or "c=IN IP4 <connection-endpoint>/<ttl+numAddresses>" @@ -969,9 +1036,16 @@ // (Later handle other kinds of "a=range" attributes also???#####) Boolean parseSuccess = False; - float playEndTime; - if (parseRangeAttribute(sdpLine, playEndTime)) { + double playStartTime; + double playEndTime; + if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) { parseSuccess = True; + if (playStartTime > fPlayStartTime) { + fPlayStartTime = playStartTime; + if (playStartTime > fParent.playStartTime()) { + fParent.playStartTime() = playStartTime; + } + } if (playEndTime > fPlayEndTime) { fPlayEndTime = playEndTime; if (playEndTime > fParent.playEndTime()) { @@ -987,7 +1061,7 @@ // Check for a "a=fmtp:" line: // TEMP: We check only for a handful of expected parameter names ##### // Later: (i) check that payload format number matches; ##### - // (ii) look for other parameters also (generalize?) ##### + // (ii) look for other parameters also (generalize?) ##### do { if (strncmp(sdpLine, "a=fmtp:", 7) != 0) break; sdpLine += 7; while (isdigit(*sdpLine)) ++sdpLine; @@ -1051,7 +1125,7 @@ delete[] fMode; fMode = strDup(valueStr); } else if (sscanf(sdpLine, " sprop-parameter-sets = %[^; \t\r\n]", valueStr) == 1) { // Note: We used "sdpLine" here, because the value is case-sensitive. - delete[] fSpropParameterSets; fSpropParameterSets = strDup(valueStr); + delete[] fSpropParameterSets; fSpropParameterSets = strDup(valueStr); } else { // Some of the above parameters are Boolean. Check whether the parameter // names appear alone, without a "= 1" at the end: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MediaSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Media Sinks // Implementation @@ -200,7 +200,7 @@ resetOverflowData(); } -void OutPacketBuffer::adjustPacketStart(unsigned numBytes) { +void OutPacketBuffer::adjustPacketStart(unsigned numBytes) { fPacketStart += numBytes; if (fOverflowDataOffset >= numBytes) { fOverflowDataOffset -= numBytes; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MediaSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Media Sources // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MultiFramedRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for a common kind of payload format: Those which pack multiple, // complete codec frames (as many as possible) into each RTP packet. // Implementation @@ -31,7 +31,7 @@ delete fOutBuf; fOutBuf = new OutPacketBuffer(preferredPacketSize, maxPacketSize); - fOurMaxPacketSize = maxPacketSize; // save value, in case subclasses need it + fOurMaxPacketSize = maxPacketSize; // save value, in case subclasses need it } MultiFramedRTPSink::MultiFramedRTPSink(UsageEnvironment& env, @@ -322,8 +322,8 @@ // (iv) one frame per packet is allowed: if (fOutBuf->isPreferredSize() || fOutBuf->wouldOverflow(numFrameBytesToUse) - || (fPreviousFrameEndedFragmentation && - !allowOtherFramesAfterLastFragment()) + || (fPreviousFrameEndedFragmentation && + !allowOtherFramesAfterLastFragment()) || !frameCanAppearAfterPacketStart(fOutBuf->curPtr() - frameSize, frameSize) ) { // The packet is ready to be sent now | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/MultiFramedRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP source for a common kind of payload format: Those that pack multiple, // complete codec frames (as many as possible) into each RTP packet. // Implementation @@ -174,7 +174,7 @@ fPresentationTime, fCurPacketHasBeenSynchronizedUsingRTCP, fCurPacketMarkerBit); fFrameSize += frameSize; - + if (!nextPacket->hasUsableData()) { // We're completely done with this packet now fReorderingBuffer->releaseUsedPacket(nextPacket); @@ -229,22 +229,22 @@ // don't wait for 'lost' packets to arrive out-of-order later if ((our_random()%10) == 0) break; // simulate 10% packet loss #endif - + // Check for the 12-byte RTP header: if (bPacket->dataSize() < 12) break; unsigned rtpHdr = ntohl(*(unsigned*)(bPacket->data())); ADVANCE(4); Boolean rtpMarkerBit = (rtpHdr&0x00800000) >> 23; unsigned rtpTimestamp = ntohl(*(unsigned*)(bPacket->data()));ADVANCE(4); unsigned rtpSSRC = ntohl(*(unsigned*)(bPacket->data())); ADVANCE(4); - + // Check the RTP version number (it should be 2): if ((rtpHdr&0xC0000000) != 0x80000000) break; - + // Skip over any CSRC identifiers in the header: unsigned cc = (rtpHdr>>24)&0xF; if (bPacket->dataSize() < cc) break; ADVANCE(cc*4); - + // Check for (& ignore) any RTP header extension if (rtpHdr&0x10000000) { if (bPacket->dataSize() < 4) break; @@ -253,7 +253,7 @@ if (bPacket->dataSize() < remExtSize) break; ADVANCE(remExtSize); } - + // Discard any padding bytes: if (rtpHdr&0x20000000) { if (bPacket->dataSize() == 0) break; @@ -261,13 +261,13 @@ = (unsigned)(bPacket->data())[bPacket->dataSize()-1]; if (bPacket->dataSize() < numPaddingBytes) break; bPacket->removePadding(numPaddingBytes); - } + } // Check the Payload Type. if ((unsigned char)((rtpHdr&0x007F0000)>>16) != source->rtpPayloadFormat()) { break; } - + // The rest of the packet is the usable data. Record and save it: source->fLastReceivedSSRC = rtpSSRC; unsigned short rtpSeqNo = (unsigned short)(rtpHdr&0xFFFF); @@ -281,7 +281,7 @@ source->timestampFrequency(), usableInJitterCalculation, presentationTime, hasBeenSyncedUsingRTCP, bPacket->dataSize()); - + // Fill in the rest of the packet descriptor, and store it: struct timeval timeNow; gettimeofday(&timeNow, NULL); @@ -317,6 +317,7 @@ void BufferedPacket::reset() { fHead = fTail = 0; fUseCount = 0; + fIsFirstPacket = False; // by default } // The following function has been deprecated: @@ -336,11 +337,11 @@ // of more than one frame, on the assumption that the client doesn't // care. (This is more efficient than delivering a frame at a time) - // For backwards-compatibilty with existing uses of (the now deprecated) + // For backwards-compatibility with existing uses of (the now deprecated) // "nextEnclosedFrameSize()", call that function to implement this one: frameSize = nextEnclosedFrameSize(framePtr, dataSize); - frameDurationInMicroseconds = 0; // by default. Subclasses should correct this. + frameDurationInMicroseconds = 0; // by default. Subclasses should correct this. } Boolean BufferedPacket::fillInData(RTPInterface& rtpInterface) { @@ -381,7 +382,7 @@ void BufferedPacket::appendData(unsigned char* newData, unsigned numBytes) { if (numBytes > fPacketSize-fTail) numBytes = fPacketSize - fTail; - memmove(&fBuf[fTail], newData, numBytes); + memmove(&fBuf[fTail], newData, numBytes); fTail += numBytes; } @@ -464,7 +465,7 @@ fSavedPacket = fPacketFactory->createNewPacket(ourSource); fSavedPacketFree = True; } - + if (fSavedPacketFree == True) { fSavedPacketFree = False; return fSavedPacket; @@ -478,19 +479,14 @@ if (!fHaveSeenFirstPacket) { fNextExpectedSeqNo = rtpSeqNo; // initialization + bPacket->isFirstPacket() = True; fHaveSeenFirstPacket = True; } // Ignore this packet if its sequence number is less than the one // that we're looking for (in this case, it's been excessively delayed). - // (But (sanity check) if the new packet's sequence number is a *lot* - // less, then accept it anyway.) - unsigned short const seqNoThreshold = 100; - if (seqNumLT(rtpSeqNo, fNextExpectedSeqNo) - && seqNumLT(fNextExpectedSeqNo, rtpSeqNo+seqNoThreshold)) { - return False; - } - + if (seqNumLT(rtpSeqNo, fNextExpectedSeqNo)) return False; + // Figure out where the new packet will be stored in the queue: BufferedPacket* beforePtr = NULL; BufferedPacket* afterPtr = fHeadPacket; @@ -500,11 +496,11 @@ // This is a duplicate packet - ignore it return False; } - + beforePtr = afterPtr; afterPtr = afterPtr->nextPacket(); } - + // Link our new packet between "beforePtr" and "afterPtr": bPacket->nextPacket() = afterPtr; if (beforePtr == NULL) { @@ -535,7 +531,8 @@ // of the queue: // ASSERT: fHeadPacket->rtpSeqNo() >= fNextExpectedSeqNo if (fHeadPacket->rtpSeqNo() == fNextExpectedSeqNo) { - packetLossPreceded = False; + packetLossPreceded = fHeadPacket->isFirstPacket(); + // (The very first packet is treated as if there was packet loss beforehand.) return fHeadPacket; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/OnDemandServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand. // Implementation @@ -76,7 +76,7 @@ // We need to construct a set of SDP lines that describe this // subsession (as a unicast stream). To do so, we first create // dummy (unused) source and "RTPSink" objects, - // whose parameters we use for the SDP lines: + // whose parameters we use for the SDP lines: unsigned estBitrate; // unused FramedSource* inputSource = createNewStreamSource(0, estBitrate); if (inputSource == NULL) return NULL; // file not found @@ -217,12 +217,12 @@ break; // success } - + unsigned char rtpPayloadType = 96 + trackNumber()-1; // if dynamic rtpSink = createNewRTPSink(rtpGroupsock, rtpPayloadType, mediaSource); udpSink = NULL; } - + // Turn off the destinations for each groupsock. They'll get set later // (unless TCP is used instead): if (rtpGroupsock != NULL) rtpGroupsock->removeAllDestinations(); @@ -234,7 +234,7 @@ streamBitrate, mediaSource, rtpGroupsock, rtcpGroupsock); } - + // Record these destinations as being for this client session id: Destinations* destinations; if (tcpSocketNum < 0) { // UDP @@ -251,7 +251,7 @@ void* rtcpRRHandlerClientData, unsigned short& rtpSeqNum, unsigned& rtpTimestamp) { - StreamState* streamState = (StreamState*)streamToken; + StreamState* streamState = (StreamState*)streamToken; Destinations* destinations = (Destinations*)(fDestinationsHashTable->Lookup((char const*)clientSessionId)); if (streamState != NULL) { @@ -270,17 +270,17 @@ // the same source: if (fReuseFirstSource) return; - StreamState* streamState = (StreamState*)streamToken; + StreamState* streamState = (StreamState*)streamToken; if (streamState != NULL) streamState->pause(); } void OnDemandServerMediaSubsession::seekStream(unsigned /*clientSessionId*/, - void* streamToken, float seekNPT) { + void* streamToken, double seekNPT) { // Seeking isn't allowed if multiple clients are receiving data from // the same source: if (fReuseFirstSource) return; - StreamState* streamState = (StreamState*)streamToken; + StreamState* streamState = (StreamState*)streamToken; if (streamState != NULL && streamState->mediaSource() != NULL) { seekStreamSource(streamState->mediaSource(), seekNPT); } @@ -292,7 +292,7 @@ // from the same source: if (fReuseFirstSource) return; - StreamState* streamState = (StreamState*)streamToken; + StreamState* streamState = (StreamState*)streamToken; if (streamState != NULL && streamState->mediaSource() != NULL) { setStreamSourceScale(streamState->mediaSource(), scale); } @@ -300,7 +300,7 @@ void OnDemandServerMediaSubsession::deleteStream(unsigned clientSessionId, void*& streamToken) { - StreamState* streamState = (StreamState*)streamToken; + StreamState* streamState = (StreamState*)streamToken; // Look up (and remove) the destinations for this client session: Destinations* destinations @@ -313,11 +313,11 @@ } // Delete the "StreamState" structure if it's no longer being used: - if (streamState != NULL && streamState->referenceCount() >= 0) { + if (streamState != NULL) { if (streamState->referenceCount() > 0) --streamState->referenceCount(); if (streamState->referenceCount() == 0) { delete streamState; - if (fLastStreamToken == streamToken) fLastStreamToken = NULL; + if (fLastStreamToken == streamToken) fLastStreamToken = NULL; streamToken = NULL; } } @@ -333,7 +333,7 @@ } void OnDemandServerMediaSubsession::seekStreamSource(FramedSource* /*inputSource*/, - float /*seekNPT*/) { + double /*seekNPT*/) { // Default implementation: Do nothing } @@ -358,7 +358,7 @@ char const* rangeLine = rangeSDPLine(); char const* auxSDPLine = getAuxSDPLine(rtpSink, inputSource); if (auxSDPLine == NULL) auxSDPLine = ""; - + char const* const sdpFmt = "m=%s %u RTP/AVP %d\r\n" "c=IN IP4 %s\r\n" @@ -384,7 +384,7 @@ auxSDPLine, // optional extra SDP line trackId()); // a=control:<track-id> delete[] (char*)rangeLine; delete[] rtpmapLine; delete[] ipAddressStr; - + fSDPLines = strDup(sdpLines); delete[] sdpLines; } @@ -416,7 +416,7 @@ fRTPSink(rtpSink), fUDPSink(udpSink), fStreamDuration(master.duration()), fTotalBW(totalBW), fRTCPInstance(NULL) /* created later */, fMediaSource(mediaSource), fRTPgs(rtpGS), fRTCPgs(rtcpGS) { -} +} StreamState::~StreamState() { reclaim(); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/OutputFile.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines for opening/closing named output files // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/PassiveServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that represents an existing // 'RTPSink', rather than one that creates new 'RTPSink's on demand. // Implementation @@ -29,7 +29,7 @@ RTCPInstance* rtcpInstance) { return new PassiveServerMediaSubsession(rtpSink, rtcpInstance); } - + PassiveServerMediaSubsession ::PassiveServerMediaSubsession(RTPSink& rtpSink, RTCPInstance* rtcpInstance) : ServerMediaSubsession(rtpSink.envir()), @@ -51,12 +51,12 @@ char const* rangeLine = rangeSDPLine(); char const* auxSDPLine = fRTPSink.auxSDPLine(); if (auxSDPLine == NULL) auxSDPLine = ""; - + char* const ipAddressStr = strDup(our_inet_ntoa(ipAddress)); - + char const* const sdpFmt = "m=%s %d RTP/AVP %d\r\n" - "c=IN IP4 %s/%d\r\n" + "c=IN IP4 %s/%d\r\n" "%s" "%s" "%s" @@ -69,7 +69,7 @@ + strlen(auxSDPLine) + strlen(trackId()); char* sdpLines = new char[sdpFmtSize]; - sprintf(sdpLines, sdpFmt, + sprintf(sdpLines, sdpFmt, mediaType, // m= <media> portNum, // m= <port> rtpPayloadType, // m= <fmt list> @@ -80,7 +80,7 @@ auxSDPLine, // optional extra SDP line trackId()); // a=control:<track-id> delete[] ipAddressStr; delete[] (char*)rangeLine; delete[] rtpmapLine; - + fSDPLines = strDup(sdpLines); delete[] sdpLines; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/QCELPAudioRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Qualcomm "PureVoice" (aka. "QCELP") Audio RTP Sources // Implementation @@ -52,7 +52,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; virtual Boolean hasBeenSynchronizedUsingRTCP(); @@ -69,7 +69,7 @@ private: QCELPDeinterleaver(UsageEnvironment& env, RawQCELPRTPSource* inputSource); - // called only by "createNew()" + // called only by "createNew()" virtual ~QCELPDeinterleaver(); @@ -77,7 +77,7 @@ unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds); - void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime); + void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime); private: // Redefined virtual functions: @@ -192,7 +192,7 @@ resultSpecialHeaderSize = 1; return True; -} +} char const* RawQCELPRTPSource::MIMEtype() const { return "audio/QCELP"; @@ -361,13 +361,13 @@ void QCELPDeinterleaver ::afterGettingFrame1(unsigned frameSize, struct timeval presentationTime) { RawQCELPRTPSource* source = (RawQCELPRTPSource*)fInputSource; - + // First, put the frame into our deinterleaving buffer: fDeinterleavingBuffer ->deliverIncomingFrame(frameSize, source->interleaveL(), source->interleaveN(), source->frameIndex(), source->curPacketRTPSeqNum(), - presentationTime); + presentationTime); // Then, try delivering a frame to the client (if he wants one): if (fNeedAFrame) doGetNextFrame(); @@ -423,7 +423,7 @@ fIncomingBankId ^= 1; unsigned char tmp = fIncomingBinMax; fIncomingBinMax = fOutgoingBinMax; - fOutgoingBinMax = tmp; + fOutgoingBinMax = tmp; fNextOutgoingBin = 0; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/QuickTimeFileSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A sink that generates a QuickTime file from a composite media session // Implementation @@ -62,7 +62,7 @@ reset(); fData = new unsigned char[bufferSize]; } - virtual ~SubsessionBuffer() { delete fData; } + virtual ~SubsessionBuffer() { delete[] fData; } void reset() { fBytesInUse = 0; } void addBytes(unsigned numBytes) { fBytesInUse += numBytes; } @@ -70,7 +70,7 @@ unsigned char* dataEnd() { return &fData[fBytesInUse]; } unsigned bytesInUse() const { return fBytesInUse; } unsigned bytesAvailable() const { return fBufferSize - fBytesInUse; } - + void setPresentationTime(struct timeval const& presentationTime) { fPresentationTime = presentationTime; } @@ -205,7 +205,7 @@ QuickTimeFileSink::QuickTimeFileSink(UsageEnvironment& env, MediaSession& inputSession, - FILE* outFid, + char const* outputFileName, unsigned bufferSize, unsigned short movieWidth, unsigned short movieHeight, @@ -214,7 +214,7 @@ Boolean syncStreams, Boolean generateHintTracks, Boolean generateMP4Format) - : Medium(env), fInputSession(inputSession), fOutFid(outFid), + : Medium(env), fInputSession(inputSession), fBufferSize(bufferSize), fPacketLossCompensate(packetLossCompensate), fSyncStreams(syncStreams), fGenerateMP4Format(generateMP4Format), fAreCurrentlyBeingPlayed(False), @@ -223,6 +223,9 @@ fHaveCompletedOutputFile(False), fMovieWidth(movieWidth), fMovieHeight(movieHeight), fMovieFPS(movieFPS), fMaxTrackDurationM(0) { + fOutFid = OpenOutputFile(env, outputFileName); + if (fOutFid == NULL) return; + fNewestSyncTime.tv_sec = fNewestSyncTime.tv_usec = 0; fFirstDataTime.tv_sec = fFirstDataTime.tv_usec = (unsigned)(~0); @@ -301,12 +304,15 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { SubsessionIOState* ioState - = (SubsessionIOState*)(subsession->miscPtr); + = (SubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; delete ioState->fHintTrackForUs; // if any delete ioState; } + + // Finally, close our output file: + CloseOutputFile(fOutFid); } QuickTimeFileSink* @@ -321,17 +327,15 @@ Boolean syncStreams, Boolean generateHintTracks, Boolean generateMP4Format) { - do { - FILE* fid = OpenOutputFile(env, outputFileName); - if (fid == NULL) break; - - return new QuickTimeFileSink(env, inputSession, fid, bufferSize, - movieWidth, movieHeight, movieFPS, - packetLossCompensate, syncStreams, - generateHintTracks, generateMP4Format); - } while (0); + QuickTimeFileSink* newSink = + new QuickTimeFileSink(env, inputSession, outputFileName, bufferSize, movieWidth, movieHeight, movieFPS, + packetLossCompensate, syncStreams, generateHintTracks, generateMP4Format); + if (newSink == NULL || newSink->fOutFid == NULL) { + Medium::close(newSink); + return NULL; + } - return NULL; + return newSink; } Boolean QuickTimeFileSink::startPlaying(afterPlayingFunc* afterFunc, @@ -352,7 +356,7 @@ Boolean QuickTimeFileSink::continuePlaying() { // Run through each of our input session's 'subsessions', // asking for a frame from each one: - Boolean haveActiveSubsessions = False; + Boolean haveActiveSubsessions = False; MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { @@ -362,7 +366,7 @@ if (subsessionSource->isCurrentlyAwaitingData()) continue; SubsessionIOState* ioState - = (SubsessionIOState*)(subsession->miscPtr); + = (SubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; haveActiveSubsessions = True; @@ -406,7 +410,7 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { SubsessionIOState* ioState - = (SubsessionIOState*)(subsession->miscPtr); + = (SubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; if (ioState->fOurSourceIsActive) return; // this source hasn't closed @@ -459,7 +463,7 @@ MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { SubsessionIOState* ioState - = (SubsessionIOState*)(subsession->miscPtr); + = (SubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; ChunkDescriptor* const headChunk = ioState->fHeadChunk; @@ -473,7 +477,7 @@ iter.reset(); while ((subsession = iter.next()) != NULL) { SubsessionIOState* ioState - = (SubsessionIOState*)(subsession->miscPtr); + = (SubsessionIOState*)(subsession->miscPtr); if (ioState == NULL) continue; ioState->setFinalQTstate(); @@ -529,7 +533,6 @@ char const* noCodecWarning1 = "Warning: We don't implement a QuickTime "; char const* noCodecWarning2 = " Media Data Type for the \""; char const* noCodecWarning3 = "\" track, so we'll insert a dummy \"????\" Media Data Atom instead. A separate, codec-specific editing pass will be needed before this track can be played.\n"; - Boolean supportPartiallyOnly = False; do { fQTEnableTrack = True; // enable this track in the movie by default @@ -622,13 +625,12 @@ break; } - if (supportPartiallyOnly) { - envir() << "Warning: We don't have sufficient codec-specific information (e.g., sample sizes) to fully generate the \"" - << fOurSubsession.mediumName() << "/" - << fOurSubsession.codecName() - << "\" track, so we'll disable this track in the movie. A separate, codec-specific editing pass will be needed before this track can be played\n"; - fQTEnableTrack = False; // disable this track in the movie - } +#ifdef QT_SUPPORT_PARTIALLY_ONLY + envir() << "Warning: We don't have sufficient codec-specific information (e.g., sample sizes) to fully generate the \"" + << fOurSubsession.mediumName() << "/" << fOurSubsession.codecName() + << "\" track, so we'll disable this track in the movie. A separate, codec-specific editing pass will be needed before this track can be played\n"; + fQTEnableTrack = False; // disable this track in the movie +#endif return True; } while (0); @@ -636,7 +638,7 @@ envir() << ", so a track for the \"" << fOurSubsession.mediumName() << "/" << fOurSubsession.codecName() << "\" subsession will not be included in the output QuickTime file\n"; - return False; + return False; } void SubsessionIOState::setFinalQTstate() { @@ -826,7 +828,7 @@ // If there has been a previous frame, then output a 'hint sample' for it. // (We use the current frame's presentation time to compute the previous // hint sample's duration.) - RTPSource* const rs = fOurSubsession.rtpSource(); // abbrev + RTPSource* const rs = fOurSubsession.rtpSource(); // abbrev struct timeval const& ppt = fPrevFrameState.presentationTime; //abbrev if (ppt.tv_sec != 0 || ppt.tv_usec != 0) { double duration = (presentationTime.tv_sec - ppt.tv_sec) @@ -965,7 +967,7 @@ fQTTotNumSamples += useFrame1(hintSampleSize, ppt, hintSampleDuration, hintSampleDestFileOffset); } - + // Remember this frame for next time: fPrevFrameState.frameSize = frameSize; fPrevFrameState.presentationTime = presentationTime; @@ -1036,7 +1038,7 @@ return numSamples; } - + void SubsessionIOState::onSourceClosure() { fOurSourceIsActive = False; fOurSink.onSourceClosure1(); @@ -1063,7 +1065,7 @@ } } } - + // Check again whether all subsessions have been synced: if (s.fNumSyncedSubsessions < s.fNumSubsessions) return False; @@ -1233,7 +1235,7 @@ MediaSubsessionIterator iter(fInputSession); MediaSubsession* subsession; while ((subsession = iter.next()) != NULL) { - fCurrentIOState = (SubsessionIOState*)(subsession->miscPtr); + fCurrentIOState = (SubsessionIOState*)(subsession->miscPtr); if (fCurrentIOState == NULL) continue; if (strcmp(subsession->mediumName(), "audio") != 0) continue; @@ -1247,7 +1249,7 @@ } iter.reset(); while ((subsession = iter.next()) != NULL) { - fCurrentIOState = (SubsessionIOState*)(subsession->miscPtr); + fCurrentIOState = (SubsessionIOState*)(subsession->miscPtr); if (fCurrentIOState == NULL) continue; if (strcmp(subsession->mediumName(), "audio") == 0) continue; @@ -1372,7 +1374,7 @@ // Run through our chunks, looking at their presentation times. // From these, figure out the edits that need to be made to keep // the track media data in sync with the presentation times. - + double const syncThreshold = 0.1; // 100 ms // don't allow the track to get out of sync by more than this @@ -1390,7 +1392,7 @@ + (chunkStartTime.tv_usec - editStartTime.tv_usec)/1000000.0; trackDurationOfEdit = (currentTrackPosition-editTrackPosition) / (double)(fCurrentIOState->fQTTimeScale); - + double outOfSync = movieDurationOfEdit - trackDurationOfEdit; if (outOfSync > syncThreshold) { @@ -1710,6 +1712,7 @@ for (unsigned i = 0; i < configSize; ++i) { size += addByte(config[i]); } + delete[] config; if (strcmp(subsession.mediumName(), "audio") == 0) { // MPEG-4 audio @@ -1773,10 +1776,12 @@ size += addHalfWord(0xffff); // Color table id size += addAtom_avcC(); addAtomEnd; - + addAtom(avcC); // Begin by Base-64 decoding the "sprop" parameter sets strings: char* psets = strDup(fCurrentIOState->fOurSubsession.fmtp_spropparametersets()); + if (psets == NULL) return 0; + size_t comma_pos = strcspn(psets, ","); psets[comma_pos] = '\0'; char* sps_b64 = psets; @@ -2019,14 +2024,14 @@ addAtomEnd; addAtom(hnti); - size += addAtom_sdp(); + size += addAtom_sdp(); addAtomEnd; unsigned QuickTimeFileSink::addAtom_sdp() { unsigned initFilePosn = ftell(fOutFid); unsigned size = addAtomHeader("sdp "); - // Add this subsession's SDP lines: + // Add this subsession's SDP lines: char const* sdpLines = fCurrentIOState->fOurSubsession.savedSDPLines(); // We need to change any "a=control:trackID=" values to be this // track's actual track id: @@ -2039,12 +2044,12 @@ if (*p3 == '\0') { // We found the end of the search string, at p2. int beforeTrackNumPosn = p2-sdpLines; - // Look for the subsequent track number, and skip over it: + // Look for the subsequent track number, and skip over it: int trackNumLength; if (sscanf(p2, " %*d%n", &trackNumLength) < 0) break; int afterTrackNumPosn = beforeTrackNumPosn + trackNumLength; - - // Replace the old track number with the correct one: + + // Replace the old track number with the correct one: int i; for (i = 0; i < beforeTrackNumPosn; ++i) newSDPLines[i] = sdpLines[i]; sprintf(&newSDPLines[i], "%d", fCurrentIOState->fTrackID); @@ -2086,7 +2091,7 @@ size += addAtom_tmax(); size += addAtom_pmax(); size += addAtom_dmax(); - size += addAtom_payt(); + size += addAtom_payt(); addAtomEnd; addAtom(totl); @@ -2148,10 +2153,10 @@ addAtomEnd; addAtom(payt); - MediaSubsession& ourSubsession = fCurrentIOState->fOurSubsession; + MediaSubsession& ourSubsession = fCurrentIOState->fOurSubsession; RTPSource* rtpSource = ourSubsession.rtpSource(); size += addByte(rtpSource->rtpPayloadFormat()); - + // Also, add a 'rtpmap' string: <mime-subtype>/<rtp-frequency> unsigned rtpmapStringLength = strlen(ourSubsession.codecName()) + 20; char* rtpmapString = new char[rtpmapStringLength]; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/QuickTimeGenericRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sources containing generic QuickTime stream data, as defined in // <http://developer.apple.com/quicktime/icefloe/dispatch026.html> // Implementation @@ -120,7 +120,7 @@ #endif unsigned payloadDescriptionLength = (headerStart[2]<<8)|headerStart[3]; headerStart += 4; - + #ifdef DEBUG fprintf(stderr, "\tK: %d, F: %d, A: %d, Z: %d, payloadDescriptionLength: %d\n", K, F, A, Z, payloadDescriptionLength); #endif @@ -131,7 +131,7 @@ expectedHeaderSize += 3; expectedHeaderSize -= expectedHeaderSize%4; // adds padding if (packetSize < expectedHeaderSize) return False; - unsigned char padding = expectedHeaderSize - nonPaddedSize; + unsigned char padding = expectedHeaderSize - nonPaddedSize; #ifdef DEBUG unsigned mediaType = (headerStart[0]<<24)|(headerStart[1]<<16) @@ -193,7 +193,7 @@ unsigned ssInfoLength = (headerStart[2]<<8)|headerStart[3]; headerStart += 4; - + #ifdef DEBUG fprintf(stderr, "\tssInfoLength: %d\n", ssInfoLength); #endif @@ -204,7 +204,7 @@ expectedHeaderSize += 3; expectedHeaderSize -= expectedHeaderSize%4; // adds padding if (packetSize < expectedHeaderSize) return False; - unsigned char padding = expectedHeaderSize - nonPaddedSize; + unsigned char padding = expectedHeaderSize - nonPaddedSize; ssInfoLength -= 4; while (ssInfoLength > 3) { @@ -264,7 +264,7 @@ // later, extract and use the "timestamp" field ##### framePtr += 8; dataSize -= 8; - + return sampleLength < dataSize ? sampleLength : dataSize; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTCP.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTCP // Implementation @@ -142,7 +142,7 @@ } if (isSSMSource) RTCPgs->multicastSendOnly(); // don't receive multicast - + double timeNow = dTimeNow(); fPrevReportTime = fNextReportTime = timeNow; @@ -161,7 +161,7 @@ TaskScheduler::BackgroundHandlerProc* handler = (TaskScheduler::BackgroundHandlerProc*)&incomingReportHandler; fRTCPInterface.startNetworkReading(handler); - + // Send our first report. fTypeOfEvent = EVENT_REPORT; onExpire(this); @@ -296,6 +296,9 @@ void RTCPInstance::addStreamSocket(int sockNum, unsigned char streamChannelId) { + // First, turn off background read handling for the default (UDP) socket: + fRTCPInterface.stopNetworkReading(); + // Add the RTCP-over-TCP interface: fRTCPInterface.setStreamSocket(sockNum, streamChannelId); @@ -349,7 +352,7 @@ // NOTE: Denial-of-service attacks are possible here. // Users of this software may wish to add their own, // application-specific mechanism for 'authenticating' the - // validity of this packet before relecting it. + // validity of this packet before reflecting it. fRTCPInterface.sendPacket(pkt, packetSize); fHaveJustSentPacket = True; fLastPacketSentSize = packetSize; @@ -468,7 +471,7 @@ fromAddr = tcpReadStreamSocketNum; fromPortNum = tcpReadStreamChannelId; } - Port fromPort(fromPortNum); + Port fromPort(fromPortNum); RRHandlerRecord* rrHandler = (RRHandlerRecord*)(fSpecificRRHandlerTable->Lookup(fromAddr, (~0), fromPort)); if (rrHandler != NULL) { @@ -499,7 +502,7 @@ || (fSink != NULL && fSink->transmissionStatsDB().lookup(reportSenderSSRC) != NULL))) { fByeHandlerTask = NULL; - // we call this only once by default + // we call this only once by default (*byeHandler)(fByeHandlerClientData); } @@ -516,7 +519,7 @@ #endif subPacketOK = True; break; - } + } if (!subPacketOK) break; // need to check for (& handle) SSRC collision! ##### @@ -524,7 +527,7 @@ #ifdef DEBUG fprintf(stderr, "validated RTCP subpacket (type %d): %d, %d, %d, 0x%08x\n", typeOfPacket, rc, pt, length, reportSenderSSRC); #endif - + // Skip over any remaining bytes in this subpacket: ADVANCE(length); @@ -546,7 +549,7 @@ break; } } - + if (!packetOK) { #ifdef DEBUG fprintf(stderr, "rejected bad RTCP subpacket: header 0x%08x\n", rtcpHdr); @@ -557,7 +560,7 @@ fprintf(stderr, "validated entire RTCP packet\n"); #endif } - + onReceive(typeOfPacket, totPacketSize, reportSenderSSRC); } while (0); } @@ -733,7 +736,7 @@ void RTCPInstance::enqueueCommonReportSuffix() { // Output the report blocks for each source: - if (fSource != NULL) { + if (fSource != NULL) { RTPReceptionStatsDB& allReceptionStats = fSource->receptionStatsDB(); @@ -768,7 +771,7 @@ unsigned numExpectedSinceLastReset = highestExtSeqNumReceived - stats->lastResetExtSeqNumReceived(); int numLostSinceLastReset - = numExpectedSinceLastReset - stats->numPacketsReceivedSinceLastReset(); + = numExpectedSinceLastReset - stats->numPacketsReceivedSinceLastReset(); unsigned char lossFraction; if (numExpectedSinceLastReset == 0 || numLostSinceLastReset < 0) { lossFraction = 0; @@ -776,7 +779,7 @@ lossFraction = (unsigned char) ((numLostSinceLastReset << 8) / numExpectedSinceLastReset); } - + fOutBuf->enqueueWord((lossFraction<<24) | totNumLost); fOutBuf->enqueueWord(highestExtSeqNumReceived); @@ -798,7 +801,7 @@ timeSinceLSR.tv_sec = timeNow.tv_sec - LSRtime.tv_sec; timeSinceLSR.tv_usec = timeNow.tv_usec - LSRtime.tv_usec; // The enqueued time is in units of 1/65536 seconds. - // (Note that 65536/1000000 == 1024/15625) + // (Note that 65536/1000000 == 1024/15625) unsigned DLSR; if (LSR == 0) { DLSR = 0; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTPInterface.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An abstraction of a network interface used for RTP (or RTCP). // (This allows the RTP-over-TCP hack (RFC 2326, section 10.12) to // be implemented transparently.) @@ -130,13 +130,24 @@ fTCPStreams = new tcpStreamRecord(sockNum, streamChannelId, fTCPStreams); } +static void deregisterSocket(UsageEnvironment& env, int sockNum, unsigned char streamChannelId) { + SocketDescriptor* socketDescriptor = lookupSocketDescriptor(env, sockNum); + if (socketDescriptor != NULL) { + socketDescriptor->deregisterRTPInterface(streamChannelId); + // Note: This may delete "socketDescriptor", + // if no more interfaces are using this socket + } +} + void RTPInterface::removeStreamSocket(int sockNum, unsigned char streamChannelId) { for (tcpStreamRecord** streamsPtr = &fTCPStreams; *streamsPtr != NULL; streamsPtr = &((*streamsPtr)->fNext)) { if ((*streamsPtr)->fStreamSocketNum == sockNum && (*streamsPtr)->fStreamChannelId == streamChannelId) { - // Remove the record pointed to by *streamsPtr : + deregisterSocket(envir(), sockNum, streamChannelId); + + // Then remove the record pointed to by *streamsPtr : tcpStreamRecord* next = (*streamsPtr)->fNext; (*streamsPtr)->fNext = NULL; delete (*streamsPtr); @@ -195,9 +206,9 @@ // Read from the TCP connection: bytesRead = 0; unsigned totBytesToRead = fNextTCPReadSize; - if (totBytesToRead > bufferMaxSize) totBytesToRead = bufferMaxSize; + if (totBytesToRead > bufferMaxSize) totBytesToRead = bufferMaxSize; unsigned curBytesToRead = totBytesToRead; - unsigned curBytesRead; + int curBytesRead; while ((curBytesRead = readSocket(envir(), fNextTCPReadStreamSocketNum, &buffer[bytesRead], curBytesToRead, fromAddress)) > 0) { @@ -229,13 +240,7 @@ // Also turn off read handling on each of our TCP connections: for (tcpStreamRecord* streams = fTCPStreams; streams != NULL; streams = streams->fNext) { - SocketDescriptor* socketDescriptor - = lookupSocketDescriptor(envir(), streams->fStreamSocketNum); - if (socketDescriptor != NULL) { - socketDescriptor->deregisterRTPInterface(streams->fStreamChannelId); - // Note: This may delete "socketDescriptor", - // if no more interfaces are using this socket - } + deregisterSocket(envir(), streams->fStreamSocketNum, streams->fStreamChannelId); } } @@ -330,9 +335,13 @@ // (Later, fix) ##### unsigned char c; struct sockaddr_in fromAddress; + struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; do { - if (readSocket(env, socketNum, &c, 1, fromAddress) != 1) { // error reading TCP socket - env.taskScheduler().turnOffBackgroundReadHandling(socketNum); // stops further calls to us + int result = readSocket(env, socketNum, &c, 1, fromAddress, &timeout); + if (result != 1) { // error reading TCP socket + if (result < 0) { + env.taskScheduler().turnOffBackgroundReadHandling(socketNum); // stops further calls to us + } return; } } while (c != '$'); @@ -378,4 +387,4 @@ tcpStreamRecord::~tcpStreamRecord() { delete fNext; } - + | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sinks // Implementation @@ -215,7 +215,7 @@ RTPTransmissionStats* RTPTransmissionStatsDB::Iterator::next() { char const* key; // dummy - + return (RTPTransmissionStats*)(fIter->next(key)); } @@ -237,7 +237,7 @@ : fOurRTPSink(rtpSink), fSSRC(SSRC), fLastPacketNumReceived(0), fPacketLossRatio(0), fTotNumPacketsLost(0), fJitter(0), fLastSRTime(0), fDiffSR_RRTime(0), fFirstPacket(True), - fTotalOctetCount_hi(0), fTotalOctetCount_lo(0), + fTotalOctetCount_hi(0), fTotalOctetCount_lo(0), fTotalPacketCount_hi(0), fTotalPacketCount_lo(0) { gettimeofday(&fTimeCreated, NULL); @@ -272,7 +272,7 @@ #ifdef DEBUG_RR fprintf(stderr, "RTCP RR data (received at %lu.%06ld): lossStats 0x%08x, lastPacketNumReceived 0x%08x, jitter 0x%08x, lastSRTime 0x%08x, diffSR_RRTime 0x%08x\n", fTimeReceived.tv_sec, fTimeReceived.tv_usec, lossStats, lastPacketNumReceived, jitter, lastSRTime, diffSR_RRTime); - unsigned rtd = roundTripDelay(); + unsigned rtd = roundTripDelay(); fprintf(stderr, "=> round-trip delay: 0x%04x (== %f seconds)\n", rtd, rtd/65536.0); #endif @@ -300,7 +300,7 @@ unsigned RTPTransmissionStats::roundTripDelay() const { // Compute the round-trip delay that was indicated by the most recently-received // RTCP RR packet. Use the method noted in the RTP/RTCP specification (RFC 3350). - + if (fLastSRTime == 0) { // Either no RTCP RR packet has been received yet, or else the // reporting receiver has not yet received any RTCP SR packets from us: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sources // Implementation @@ -57,7 +57,7 @@ fRTPPayloadFormat(rtpPayloadFormat), fTimestampFrequency(rtpTimestampFrequency), fSSRC(our_random32()) { - fReceptionStatsDB = new RTPReceptionStatsDB(*this); + fReceptionStatsDB = new RTPReceptionStatsDB(); } RTPSource::~RTPSource() { @@ -71,9 +71,8 @@ ////////// RTPReceptionStatsDB ////////// -RTPReceptionStatsDB::RTPReceptionStatsDB(RTPSource& rtpSource) - : fOurRTPSource(rtpSource), - fTable(HashTable::create(ONE_WORD_HASH_KEYS)), fTotNumPacketsReceived(0) { +RTPReceptionStatsDB::RTPReceptionStatsDB() + : fTable(HashTable::create(ONE_WORD_HASH_KEYS)), fTotNumPacketsReceived(0) { reset(); } @@ -110,7 +109,7 @@ if (stats == NULL) { // This is the first time we've heard from this SSRC. // Create a new record for it: - stats = new RTPReceptionStats(fOurRTPSource, SSRC, seqNum); + stats = new RTPReceptionStats(SSRC, seqNum); if (stats == NULL) return; add(SSRC, stats); } @@ -133,7 +132,7 @@ if (stats == NULL) { // This is the first time we've heard of this SSRC. // Create a new record for it: - stats = new RTPReceptionStats(fOurRTPSource, SSRC); + stats = new RTPReceptionStats(SSRC); if (stats == NULL) return; add(SSRC, stats); } @@ -186,15 +185,12 @@ ////////// RTPReceptionStats ////////// -RTPReceptionStats::RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC, - u_int16_t initialSeqNum) - : fOurRTPSource(rtpSource) { +RTPReceptionStats::RTPReceptionStats(u_int32_t SSRC, u_int16_t initialSeqNum) { initSeqNum(initialSeqNum); init(SSRC); } -RTPReceptionStats::RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC) - : fOurRTPSource(rtpSource) { +RTPReceptionStats::RTPReceptionStats(u_int32_t SSRC) { init(SSRC); } @@ -320,8 +316,7 @@ // (as long as "int" is 32 bits) // Divide this by the timestamp frequency to get real time: - double timeDiff - = timestampDiff/(double)(fOurRTPSource.timestampFrequency()); + double timeDiff = timestampDiff/(double)timestampFrequency; // Add this to the 'sync time' to get our result: unsigned const million = 1000000; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTSPClient.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTSP client // Implementation @@ -100,7 +100,7 @@ // Change the existing user agent header string: char const* const formatStr = "User-Agent: %s\r\n"; - unsigned headerSize = strlen(formatStr) + strlen(userAgentStr); + unsigned const headerSize = strlen(formatStr) + strlen(userAgentStr) + 1; delete[] fUserAgentHeaderStr; fUserAgentHeaderStr = new char[headerSize]; sprintf(fUserAgentHeaderStr, formatStr, userAgentStr); @@ -146,10 +146,15 @@ static char* getLine(char* startOfLine) { // returns the start of the next line, or NULL if none for (char* ptr = startOfLine; *ptr != '\0'; ++ptr) { + // Check for the end of line: \r\n (but also accept \r or \n by itself): if (*ptr == '\r' || *ptr == '\n') { // We found the end of the line - *ptr++ = '\0'; - if (*ptr == '\n') ++ptr; + if (*ptr == '\r') { + *ptr++ = '\0'; + if (*ptr == '\n') ++ptr; + } else { + *ptr++ = '\0'; + } return ptr; } } @@ -158,20 +163,20 @@ } char* RTSPClient::describeURL(char const* url, Authenticator* authenticator, - Boolean allowKasennaProtocol) { + Boolean allowKasennaProtocol, int timeout) { char* cmd = NULL; fDescribeStatusCode = 0; - do { + do { // First, check whether "url" contains a username:password to be used: char* username; char* password; if (authenticator == NULL && parseRTSPURLUsernamePassword(url, username, password)) { - char* result = describeWithPassword(url, username, password, allowKasennaProtocol); + char* result = describeWithPassword(url, username, password, allowKasennaProtocol, timeout); delete[] username; delete[] password; // they were dynamically allocated return result; } - if (!openConnectionFromURL(url, authenticator)) break; + if (!openConnectionFromURL(url, authenticator, timeout)) break; // Send the DESCRIBE command: @@ -260,7 +265,7 @@ } else if (strncmp(lineStart, "Content-Base:", 13) == 0) { int cbIndex = 13; - while (lineStart[cbIndex] == ' ' || lineStart[cbIndex] == '\t') ++cbIndex; + while (lineStart[cbIndex] == ' ' || lineStart[cbIndex] == '\t') ++cbIndex; if (lineStart[cbIndex] != '\0'/*sanity check*/) { delete[] fBaseURL; fBaseURL = strDup(&lineStart[cbIndex]); } @@ -270,7 +275,7 @@ #ifdef SUPPORT_REAL_RTSP } else if (sscanf(lineStart, "ETag: %s", fRealETagStr) == 1) { #endif - } else if (wantRedirection) { + } else if (wantRedirection) { if (sscanf(lineStart, "Location: %s", redirectionURL) == 1) { // Try again with this URL if (fVerbosityLevel >= 1) { @@ -278,13 +283,14 @@ << redirectionURL << "\"\n"; } reset(); - char* result = describeURL(redirectionURL, authenticator, allowKasennaProtocol); + char* result = describeURL(redirectionURL, authenticator, allowKasennaProtocol, timeout); delete[] redirectionURL; delete[] serverType; + delete[] cmd; return result; } } - } + } delete[] serverType; // We're now at the end of the response header lines @@ -369,10 +375,10 @@ delete[] fKasennaContentType; fKasennaContentType = new char[fResponseBufferSize]; // ensures enough space char* currentPos = bodyStart; - + while (strcmp(currentWord, "</MediaDescription>") != 0) { sscanf(currentPos, "%s", currentWord); - + if (strcmp(currentWord, "VideoPid") == 0) { currentPos += strlen(currentWord) + 1; sscanf(currentPos, "%s", currentWord); @@ -380,7 +386,7 @@ sscanf(currentPos, "%d", &videoPid); currentPos += 3; } - + if (strcmp(currentWord, "AudioPid") == 0) { currentPos += strlen(currentWord) + 1; sscanf(currentPos, "%s", currentWord); @@ -388,7 +394,7 @@ sscanf(currentPos, "%d", &audioPid); currentPos += 3; } - + if (strcmp(currentWord, "Duration") == 0) { currentPos += strlen(currentWord) + 1; sscanf(currentPos, "%s", currentWord); @@ -396,7 +402,7 @@ sscanf(currentPos, "%llu", &mh_duration); currentPos += 3; } - + if (strcmp(currentWord, "TypeSpecificData") == 0) { currentPos += strlen(currentWord) + 1; sscanf(currentPos, "%s", currentWord); @@ -405,24 +411,24 @@ currentPos += 3; printf("Kasenna Content Type: %s\n", fKasennaContentType); } - + currentPos += strlen(currentWord) + 1; } - + if (fKasennaContentType != NULL && strcmp(fKasennaContentType, "PARTNER_41_MPEG-4") == 0) { - char* describeSDP = describeURL(url, authenticator, True); - + char* describeSDP = describeURL(url, authenticator, True, timeout); + delete[] currentWord; delete[] cmd; return describeSDP; } - + unsigned char byte1 = fServerAddress & 0x000000ff; unsigned char byte2 = (fServerAddress & 0x0000ff00) >> 8; unsigned char byte3 = (fServerAddress & 0x00ff0000) >> 16; unsigned char byte4 = (fServerAddress & 0xff000000) >> 24; - + char const* sdpFmt = "v=0\r\n" "o=NoSpacesAllowed 1 1 IN IP4 %u.%u.%u.%u\r\n" @@ -445,18 +451,18 @@ byte1, byte2, byte3, byte4, mh_duration/1000000, videoPid); - + char* result = strDup(sdpBuf); delete[] sdpBuf; delete[] currentWord; delete[] cmd; return result; } ////////// END Kasenna BS ////////// - + delete[] cmd; return strDup(bodyStart); } while (0); - + delete[] cmd; if (fDescribeStatusCode == 0) fDescribeStatusCode = 2; return NULL; @@ -465,10 +471,10 @@ char* RTSPClient ::describeWithPassword(char const* url, char const* username, char const* password, - Boolean allowKasennaProtocol) { + Boolean allowKasennaProtocol, int timeout) { Authenticator authenticator; authenticator.setUsernameAndPassword(username, password); - char* describeResult = describeURL(url, &authenticator, allowKasennaProtocol); + char* describeResult = describeURL(url, &authenticator, allowKasennaProtocol, timeout); if (describeResult != NULL) { // We are already authorized return describeResult; @@ -481,7 +487,7 @@ } // Try again: - describeResult = describeURL(url, &authenticator, allowKasennaProtocol); + describeResult = describeURL(url, &authenticator, allowKasennaProtocol, timeout); if (describeResult != NULL) { // The authenticator worked, so use it in future requests: fCurrentAuthenticator = authenticator; @@ -492,7 +498,8 @@ char* RTSPClient::sendOptionsCmd(char const* url, char* username, char* password, - Authenticator* authenticator) { + Authenticator* authenticator, + int timeout) { char* result = NULL; char* cmd = NULL; Boolean haveAllocatedAuthenticator = False; @@ -502,9 +509,9 @@ // (and no username,password pair was supplied separately): if (username == NULL && password == NULL && parseRTSPURLUsernamePassword(url, username, password)) { - Authenticator authenticator; - authenticator.setUsernameAndPassword(username, password); - result = sendOptionsCmd(url, username, password, &authenticator); + Authenticator newAuthenticator; + newAuthenticator.setUsernameAndPassword(username, password); + result = sendOptionsCmd(url, username, password, &newAuthenticator, timeout); delete[] username; delete[] password; // they were dynamically allocated break; } else if (username != NULL && password != NULL) { @@ -513,7 +520,7 @@ haveAllocatedAuthenticator = True; authenticator->setUsernameAndPassword(username, password); - result = sendOptionsCmd(url, username, password, authenticator); + result = sendOptionsCmd(url, username, password, authenticator, timeout); if (result != NULL) break; // We are already authorized // The "realm" field should have been filled in: @@ -525,7 +532,7 @@ } } - if (!openConnectionFromURL(url, authenticator)) break; + if (!openConnectionFromURL(url, authenticator, timeout)) break; // Send the OPTIONS command: @@ -602,22 +609,29 @@ return False; } +char const* RTSPClient::sessionURL(MediaSession const& session) const { + char const* url = session.controlPath(); + if (url == NULL || strcmp(url, "*") == 0) url = fBaseURL; + + return url; +} + void RTSPClient::constructSubsessionURL(MediaSubsession const& subsession, char const*& prefix, char const*& separator, char const*& suffix) { // Figure out what the URL describing "subsession" will look like. // The URL is returned in three parts: prefix; separator; suffix - //##### NOTE: This code doesn't really do the right thing if "fBaseURL" + //##### NOTE: This code doesn't really do the right thing if "sessionURL()" // doesn't end with a "/", and "subsession.controlPath()" is relative. - // The right thing would have been to truncate "fBaseURL" back to the + // The right thing would have been to truncate "sessionURL()" back to the // rightmost "/", and then add "subsession.controlPath()". // In practice, though, each "DESCRIBE" response typically contains - // a "Content-Base:" header that consists of "fBaseURL" followed by + // a "Content-Base:" header that consists of "sessionURL()" followed by // a "/", in which case this code ends up giving the correct result. // However, we should really fix this code to do the right thing, and // also check for and use the "Content-Base:" header appropriately. ##### - prefix = fBaseURL; + prefix = sessionURL(subsession.parentSession()); if (prefix == NULL) prefix = ""; suffix = subsession.controlPath(); @@ -633,10 +647,11 @@ Boolean RTSPClient::announceSDPDescription(char const* url, char const* sdpDescription, - Authenticator* authenticator) { + Authenticator* authenticator, + int timeout) { char* cmd = NULL; do { - if (!openConnectionFromURL(url, authenticator)) break; + if (!openConnectionFromURL(url, authenticator, timeout)) break; // Send the ANNOUNCE command: @@ -694,10 +709,10 @@ Boolean RTSPClient ::announceWithPassword(char const* url, char const* sdpDescription, - char const* username, char const* password) { + char const* username, char const* password, int timeout) { Authenticator authenticator; authenticator.setUsernameAndPassword(username, password); - if (announceSDPDescription(url, sdpDescription, &authenticator)) { + if (announceSDPDescription(url, sdpDescription, &authenticator, timeout)) { // We are already authorized return True; } @@ -710,7 +725,7 @@ // Try again: Boolean secondTrySuccess - = announceSDPDescription(url, sdpDescription, &authenticator); + = announceSDPDescription(url, sdpDescription, &authenticator, timeout); if (secondTrySuccess) { // The authenticator worked, so use it in future requests: @@ -750,7 +765,7 @@ sessionStr = new char[20+strlen(fLastSessionId)]; sprintf(sessionStr, "Session: %s\r\n", fLastSessionId); } else { - sessionStr = ""; + sessionStr = strDup(""); } char* transportStr = NULL; @@ -856,7 +871,7 @@ portTypeStr = ";interleaved"; rtpNumber = fTCPStreamIdCount++; rtcpNumber = fTCPStreamIdCount++; - } else { // normal RTP streaming + } else { // normal RTP streaming unsigned connectionAddress = subsession.connectionEndpointAddress(); Boolean requestMulticastStreaming = IsMulticastAddress(connectionAddress) || (connectionAddress == 0 && forceMulticastOnUnspecified); @@ -865,6 +880,7 @@ rtpNumber = subsession.clientPortNum(); if (rtpNumber == 0) { envir().setResultMsg("Client port number unknown\n"); + delete[] authenticatorStr; delete[] sessionStr; delete[] setupStr; break; } rtcpNumber = rtpNumber + 1; @@ -902,9 +918,7 @@ sessionStr, authenticatorStr, fUserAgentHeaderStr); - delete[] authenticatorStr; - if (sessionStr[0] != '\0') delete[] sessionStr; - delete[] setupStr; delete[] transportStr; + delete[] authenticatorStr; delete[] sessionStr; delete[] setupStr; delete[] transportStr; // And then send it: if (!sendRequest(cmd, "SETUP")) break; @@ -919,6 +933,7 @@ // For now, ignore other headers. char* lineStart; char* sessionId = new char[fResponseBufferSize]; // ensures we have enough space + unsigned cLength = 0; while (1) { lineStart = nextLineStart; if (lineStart == NULL) break; @@ -952,7 +967,11 @@ subsession.rtcpChannelId = rtcpChannelId; continue; } - } + + // Also check for a "Content-Length:" header. Some weird servers include this + // in the RTSP "SETUP" response. + if (sscanf(lineStart, "Content-Length: %d", &cLength) == 1) continue; + } delete[] sessionId; if (subsession.sessionId == NULL) { @@ -960,6 +979,14 @@ break; } + // If we saw a "Content-Length:" header in the response, then discard whatever + // included data it refers to: + if (cLength > 0) { + char* dummyBuf = new char[cLength]; + getResponse1(dummyBuf, cLength); + delete[] dummyBuf; + } + if (streamUsingTCP) { // Tell the subsession to receive RTP (and send/receive RTCP) // over the RTSP stream: @@ -972,8 +999,10 @@ } else { // Normal case. // Set the RTP and RTCP sockets' destination address and port - // from the information in the SETUP response: - subsession.setDestinations(fServerAddress); + // from the information in the SETUP response (if present): + netAddressBits destAddress = subsession.connectionEndpointAddress(); + if (destAddress == 0) destAddress = fServerAddress; + subsession.setDestinations(destAddress); } delete[] cmd; @@ -990,35 +1019,35 @@ // This is the default value; we don't need a "Scale:" header: buf[0] = '\0'; } else { - Locale("POSIX", LC_NUMERIC); + Locale("C", LC_NUMERIC); sprintf(buf, "Scale: %f\r\n", scale); } return strDup(buf); } - -static char* createRangeString(float start, float end) { + +static char* createRangeString(double start, double end) { char buf[100]; if (start < 0) { // We're resuming from a PAUSE; there's no "Range:" header at all buf[0] = '\0'; } else if (end < 0) { // There's no end time: - Locale("POSIX", LC_NUMERIC); + Locale("C", LC_NUMERIC); sprintf(buf, "Range: npt=%.3f-\r\n", start); } else { // There's both a start and an end time; include them both in the "Range:" hdr - Locale("POSIX", LC_NUMERIC); + Locale("C", LC_NUMERIC); sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end); } return strDup(buf); } - + static char const* NoSessionErr = "No RTSP session is currently in progress\n"; Boolean RTSPClient::playMediaSession(MediaSession& session, - float start, float end, float scale) { + double start, double end, float scale) { #ifdef SUPPORT_REAL_RTSP if (session.isRealNetworksRDT) { // This is a RealNetworks stream; set the "Subscribe" parameter before proceeding: @@ -1055,8 +1084,9 @@ "%s" "\r\n"; + char const* sessURL = sessionURL(session); unsigned cmdSize = strlen(cmdFmt) - + strlen(fBaseURL) + + strlen(sessURL) + 20 /* max int len */ + strlen(fLastSessionId) + strlen(scaleStr) @@ -1065,7 +1095,7 @@ + fUserAgentHeaderStrSize; cmd = new char[cmdSize]; sprintf(cmd, cmdFmt, - fBaseURL, + sessURL, ++fCSeq, fLastSessionId, scaleStr, @@ -1091,7 +1121,23 @@ nextLineStart = getLine(lineStart); - if (parseScaleHeader(lineStart, session.scale())) break; + if (parseScaleHeader(lineStart, session.scale())) continue; + if (parseRangeHeader(lineStart, session.playStartTime(), session.playEndTime())) continue; + + u_int16_t seqNum; u_int32_t timestamp; + if (parseRTPInfoHeader(lineStart, seqNum, timestamp)) { + // This is data for our first subsession. Fill it in, and do the same for our other subsessions: + MediaSubsessionIterator iter(session); + MediaSubsession* subsession; + while ((subsession = iter.next()) != NULL) { + subsession->rtpInfo.seqNum = seqNum; + subsession->rtpInfo.timestamp = timestamp; + subsession->rtpInfo.infoIsNew = True; + + if (!parseRTPInfoHeader(lineStart, seqNum, timestamp)) break; + } + continue; + } } if (fTCPStreamIdCount == 0) { // we're not receiving RTP-over-TCP @@ -1109,7 +1155,7 @@ } Boolean RTSPClient::playMediaSubsession(MediaSubsession& subsession, - float start, float end, float scale, + double start, double end, float scale, Boolean hackForDSS) { char* cmd = NULL; do { @@ -1185,13 +1231,16 @@ nextLineStart = getLine(lineStart); - if (parseRTPInfoHeader(lineStart, - subsession.rtpInfo.trackId, - subsession.rtpInfo.seqNum, - subsession.rtpInfo.timestamp)) { + if (parseScaleHeader(lineStart, subsession.scale())) continue; + if (parseRangeHeader(lineStart, subsession._playStartTime(), subsession._playEndTime())) continue; + + u_int16_t seqNum; u_int32_t timestamp; + if (parseRTPInfoHeader(lineStart, seqNum, timestamp)) { + subsession.rtpInfo.seqNum = seqNum; + subsession.rtpInfo.timestamp = timestamp; + subsession.rtpInfo.infoIsNew = True; continue; } - if (parseScaleHeader(lineStart, subsession.scale())) continue; } delete[] cmd; @@ -1217,6 +1266,7 @@ char* authenticatorStr = createAuthenticatorString(&fCurrentAuthenticator, "PAUSE", fBaseURL); + char const* sessURL = sessionURL(session); char* const cmdFmt = "PAUSE %s RTSP/1.0\r\n" "CSeq: %d\r\n" @@ -1226,14 +1276,14 @@ "\r\n"; unsigned cmdSize = strlen(cmdFmt) - + strlen(fBaseURL) + + strlen(sessURL) + 20 /* max int len */ + strlen(fLastSessionId) + strlen(authenticatorStr) + fUserAgentHeaderStrSize; cmd = new char[cmdSize]; sprintf(cmd, cmdFmt, - fBaseURL, + sessURL, ++fCSeq, fLastSessionId, authenticatorStr, @@ -1265,13 +1315,13 @@ envir().setResultMsg(NoSessionErr); break; } - + // Send the PAUSE command: - + // First, construct an authenticator string: char* authenticatorStr = createAuthenticatorString(&fCurrentAuthenticator, "PAUSE", fBaseURL); - + char* const cmdFmt = "PAUSE %s%s%s RTSP/1.0\r\n" "CSeq: %d\r\n" @@ -1279,7 +1329,7 @@ "%s" "%s" "\r\n"; - + char const *prefix, *separator, *suffix; constructSubsessionURL(subsession, prefix, separator, suffix); if (fServerIsKasenna) separator = suffix = ""; @@ -1298,7 +1348,7 @@ authenticatorStr, fUserAgentHeaderStr); delete[] authenticatorStr; - + if (!sendRequest(cmd, "PAUSE")) break; if (fTCPStreamIdCount == 0) { // When TCP streaming, don't look for a response @@ -1307,11 +1357,11 @@ char* firstLine; char* nextLineStart; if (!getResponse("PAUSE", bytesRead, responseCode, firstLine, nextLineStart)) break; } - + delete[] cmd; return True; } while (0); - + delete[] cmd; return False; } @@ -1398,16 +1448,18 @@ "Session: %s\r\n" "%s" "%s" - "%s: %s\r\n" - "\r\n"; + "Content-length: %d\r\n\r\n" + "%s: %s\r\n"; + unsigned parameterNameLen = strlen(parameterName); + unsigned parameterValueLen = strlen(parameterValue); unsigned cmdSize = strlen(cmdFmt) + strlen(fBaseURL) + 20 /* max int len */ + strlen(fLastSessionId) + strlen(authenticatorStr) + fUserAgentHeaderStrSize - + strlen(parameterName) + strlen(parameterValue); + + parameterNameLen + parameterValueLen; cmd = new char[cmdSize]; sprintf(cmd, cmdFmt, fBaseURL, @@ -1415,6 +1467,7 @@ fLastSessionId, authenticatorStr, fUserAgentHeaderStr, + parameterNameLen + parameterValueLen + 2, // the "+ 2" is for the \r\n after the parameter "name: value" parameterName, parameterValue); delete[] authenticatorStr; @@ -1461,16 +1514,16 @@ "%s" "Content-type: text/parameters\r\n" "Content-length: %d\r\n\r\n" - "%s\r\n" - "\r\n"; - + "%s\r\n"; + + unsigned parameterNameLen = strlen(parameterName); unsigned cmdSize = strlen(cmdFmt) + strlen(fBaseURL) + 20 /* max int len */ + strlen(fLastSessionId) + strlen(authenticatorStr) + fUserAgentHeaderStrSize - + strlen(parameterName); + + parameterNameLen; cmd = new char[cmdSize]; sprintf(cmd, cmdFmt, fBaseURL, @@ -1478,7 +1531,7 @@ fLastSessionId, authenticatorStr, fUserAgentHeaderStr, - strlen(parameterName)+2, + parameterNameLen + 2, // the "+ 2" is for the \r\n after the parameter name parameterName); } else { char* const cmdFmt = @@ -1488,7 +1541,7 @@ "%s" "%s" "\r\n"; - + unsigned cmdSize = strlen(cmdFmt) + strlen(fBaseURL) + 20 /* max int len */ @@ -1511,7 +1564,7 @@ // This section was copied/modified from the RTSPClient::describeURL func unsigned bytesRead; unsigned responseCode; char* firstLine; char* nextLineStart; - if (!getResponse("GET_PARAMETER", bytesRead, responseCode, firstLine, + if (!getResponse("GET_PARAMETER", bytesRead, responseCode, firstLine, nextLineStart, False /*don't check for response code 200*/)) break; // Inspect the first line to check whether it's a result code that @@ -1541,12 +1594,12 @@ break; } } - } + } delete[] serverType; // We're now at the end of the response header lines if (lineStart == NULL) { - envir().setResultMsg("no content following header lines: ", + envir().setResultMsg("no content following header lines: ", fResponseBuffer); break; } @@ -1603,7 +1656,7 @@ delete[] cmd; return True; } while (0); - + delete[] cmd; return False; } @@ -1624,6 +1677,7 @@ = createAuthenticatorString(&fCurrentAuthenticator, "TEARDOWN", fBaseURL); + char const* sessURL = sessionURL(session); char* const cmdFmt = "TEARDOWN %s RTSP/1.0\r\n" "CSeq: %d\r\n" @@ -1633,14 +1687,14 @@ "\r\n"; unsigned cmdSize = strlen(cmdFmt) - + strlen(fBaseURL) + + strlen(sessURL) + 20 /* max int len */ + strlen(fLastSessionId) + strlen(authenticatorStr) + fUserAgentHeaderStrSize; cmd = new char[cmdSize]; sprintf(cmd, cmdFmt, - fBaseURL, + sessURL, ++fCSeq, fLastSessionId, authenticatorStr, @@ -1654,7 +1708,7 @@ unsigned bytesRead; unsigned responseCode; char* firstLine; char* nextLineStart; if (!getResponse("TEARDOWN", bytesRead, responseCode, firstLine, nextLineStart)) break; - + // Run through each subsession, deleting its "sessionId": MediaSubsessionIterator iter(session); MediaSubsession* subsession; @@ -1666,7 +1720,7 @@ delete[] fLastSessionId; fLastSessionId = NULL; // we're done with this session } - + delete[] cmd; return True; } while (0); @@ -1725,7 +1779,7 @@ char* firstLine; char* nextLineStart; if (!getResponse("TEARDOWN", bytesRead, responseCode, firstLine, nextLineStart)) break; } - + delete[] (char*)subsession.sessionId; subsession.sessionId = NULL; // we're done with this session @@ -1739,7 +1793,7 @@ } Boolean RTSPClient -::openConnectionFromURL(char const* url, Authenticator* authenticator) { +::openConnectionFromURL(char const* url, Authenticator* authenticator, int timeout) { do { // Set this as our base URL: delete[] fBaseURL; fBaseURL = strDup(url); if (fBaseURL == NULL) break; @@ -1752,26 +1806,60 @@ if (!parseRTSPURL(envir(), url, destAddress, urlPortNum, &urlSuffix)) break; portNumBits destPortNum = fTunnelOverHTTPPortNum == 0 ? urlPortNum : fTunnelOverHTTPPortNum; - + if (fInputSocketNum < 0) { // We don't yet have a TCP socket. Set one up (blocking) now: fInputSocketNum = fOutputSocketNum = setupStreamSocket(envir(), 0, False /* =>blocking */); if (fInputSocketNum < 0) break; - + // Connect to the remote endpoint: fServerAddress = *(unsigned*)(destAddress.data()); MAKE_SOCKADDR_IN(remoteName, fServerAddress, htons(destPortNum)); + //Start change for timeout on connect + +/* if (connect(fInputSocketNum, (struct sockaddr*)&remoteName, sizeof remoteName) != 0) { envir().setResultErrMsg("connect() failed: "); break; +*/ + fd_set set; + FD_ZERO(&set); + timeval tvout = {0,0}; + if (timeout > 0) { + FD_SET((unsigned)fInputSocketNum, &set); + tvout.tv_sec = timeout; + tvout.tv_usec = 0; + makeSocketNonBlocking(fInputSocketNum); + } + if (connect(fInputSocketNum, (struct sockaddr*) &remoteName, sizeof remoteName) != 0) { +#if defined(__WIN32__) || defined(_WIN32) + if (errno != WSAEINPROGRESS) { +#else + if (errno != EINPROGRESS) { +#endif + envir().setResultErrMsg("connect() failed: "); + break; + } + if (timeout > 0 && (select(fInputSocketNum + 1, NULL, &set, NULL, &tvout) <= 0)) { + envir().setResultErrMsg("select/connect() failed: "); + break; + } +/* +errno = 0; +if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len) < 0 || errno != 0 ) +{ +break; +} +*/ + //End change for timeout on connect } - + if (fTunnelOverHTTPPortNum != 0 && !setupHTTPTunneling(urlSuffix, authenticator)) break; } - return True; + return True; } while (0); fDescribeStatusCode = 1; @@ -1927,7 +2015,7 @@ sprintf(usernamePassword, "%s:%s", authenticator->username(), authenticator->password()); char* response = base64Encode(usernamePassword, usernamePasswordLength); - unsigned authBufSize = strlen(authFmt) + strlen(response); + unsigned const authBufSize = strlen(authFmt) + strlen(response) + 1; authenticatorStr = new char[authBufSize]; sprintf(authenticatorStr, authFmt, response); delete[] response; delete[] usernamePassword; @@ -1969,7 +2057,7 @@ } delete[] realm; delete[] nonce; if (foundAuthenticateHeader) break; - } + } } } @@ -2022,7 +2110,7 @@ nextLineStart = getLine(firstLine); if (!parseResponseCode(firstLine, responseCode)) break; - + if (responseCode != 200 && checkFor200Response) { envir().setResultMsg(tag, ": cannot handle response: ", firstLine); break; @@ -2038,7 +2126,7 @@ unsigned RTSPClient::getResponse1(char*& responseBuffer, unsigned responseBufferSize) { struct sockaddr_in fromAddress; - + if (responseBufferSize == 0) return 0; // just in case... responseBuffer[0] = '\0'; // ditto @@ -2048,7 +2136,9 @@ Boolean success = False; while (1) { unsigned char firstByte; - if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress) + struct timeval timeout; + timeout.tv_sec = 30; timeout.tv_usec = 0; + if (readSocket(envir(), fInputSocketNum, &firstByte, 1, fromAddress, &timeout) != 1) break; if (firstByte != '$') { // Normal case: This is the start of a regular response; use it: @@ -2075,7 +2165,7 @@ if (tmpBuffer == NULL) break; unsigned bytesRead = 0; unsigned bytesToRead = size; - unsigned curBytesRead; + int curBytesRead; while ((curBytesRead = readSocket(envir(), fInputSocketNum, &tmpBuffer[bytesRead], bytesToRead, fromAddress)) > 0) { @@ -2090,7 +2180,7 @@ } } if (!success) return 0; - + // Keep reading data from the socket until we see "\r\n\r\n" (except // at the start), or until we fill up our buffer. // Don't read any more than this. @@ -2098,23 +2188,24 @@ Boolean haveSeenNonCRLF = False; int bytesRead = 1; // because we've already read the first byte while (bytesRead < (int)responseBufferSize) { - unsigned bytesReadNow + int bytesReadNow = readSocket(envir(), fInputSocketNum, (unsigned char*)(responseBuffer+bytesRead), 1, fromAddress); - if (bytesReadNow == 0) { + if (bytesReadNow <= 0) { envir().setResultMsg("RTSP response was truncated"); break; } bytesRead += bytesReadNow; - - // Check whether we have "\r\n\r\n": + + // Check whether we have "\r\n\r\n" (or "\r\r" or "\n\n"): char* lastToCheck = responseBuffer+bytesRead-4; if (lastToCheck < responseBuffer) continue; for (; p <= lastToCheck; ++p) { if (haveSeenNonCRLF) { - if (*p == '\r' && *(p+1) == '\n' && - *(p+2) == '\r' && *(p+3) == '\n') { + if ((*p == '\r' && *(p+1) == '\n' && *(p+2) == '\r' && *(p+3) == '\n') + || (*(p+2) == '\r' && *(p+3) == '\r') + || (*(p+2) == '\n' && *(p+3) == '\n')) { responseBuffer[bytesRead] = '\0'; // Before returning, trim any \r or \n from the start: @@ -2131,12 +2222,12 @@ } } } - + envir().setResultMsg("We received a response not ending with <CR><LF><CR><LF>"); return 0; } -Boolean RTSPClient::parseResponseCode(char const* line, +Boolean RTSPClient::parseResponseCode(char const* line, unsigned& responseCode) { if (sscanf(line, "%*s%u", &responseCode) != 1) { envir().setResultMsg("no response code in line: \"", line, "\""); @@ -2146,7 +2237,7 @@ return True; } -Boolean RTSPClient::parseTransportResponse(char const* line, +Boolean RTSPClient::parseTransportResponse(char const* line, char*& serverAddressStr, portNumBits& serverPortNum, unsigned char& rtpChannelId, @@ -2218,25 +2309,29 @@ return False; } -Boolean RTSPClient::parseRTPInfoHeader(char const* line, - unsigned& trackId, - u_int16_t& seqNum, - u_int32_t& timestamp) { - if (_strncasecmp(line, "RTP-Info: ", 10) != 0) return False; - line += 10; - char const* fields = line; - char* field = strDupSize(fields); - - while (sscanf(fields, "%[^;]", field) == 1) { - if (sscanf(field, "url=trackID=%u", &trackId) == 1 || - sscanf(field, "url=trackid=%u", &trackId) == 1 || - sscanf(field, "seq=%hu", &seqNum) == 1 || +Boolean RTSPClient::parseRTPInfoHeader(char*& line, u_int16_t& seqNum, u_int32_t& timestamp) { + // At this point in the parsing, "line" should begin with either "RTP-Info: " (for the start of the header), + // or ",", indicating the RTP-Info parameter list for the 2nd-through-nth subsessions: + if (_strncasecmp(line, "RTP-Info: ", 10) == 0) { + line += 10; + } else if (line[0] == ',') { + ++line; + } else { + return False; + } + + // "line" now consists of a ';'-separated list of parameters, ending with ',' or '\0'. + char* field = strDupSize(line); + + while (sscanf(line, "%[^;,]", field) == 1) { + if (sscanf(field, "seq=%hu", &seqNum) == 1 || sscanf(field, "rtptime=%u", ×tamp) == 1) { } - - fields += strlen(field); - if (fields[0] == '\0') break; - ++fields; // skip over the ';' + + line += strlen(field); + if (line[0] == '\0' || line[0] == ',') break; + // ASSERT: line[0] == ';' + ++line; // skip over the ';' } delete[] field; @@ -2247,14 +2342,14 @@ if (_strncasecmp(line, "Scale: ", 7) != 0) return False; line += 7; - Locale("POSIX", LC_NUMERIC); + Locale("C", LC_NUMERIC); return sscanf(line, "%f", &scale) == 1; } -Boolean RTSPClient::parseGetParameterHeader(char const* line, +Boolean RTSPClient::parseGetParameterHeader(char const* line, const char* param, char*& value) { - if ((param != NULL && param[0] != '\0') && + if ((param != NULL && param[0] != '\0') && (line != NULL && line[0] != '\0')) { int param_len = strlen(param); int line_len = strlen(line); @@ -2265,7 +2360,7 @@ } return False; } - + // Strip \r\n from the end if it's there. if (line[line_len-2] == '\r' && line[line_len-1] == '\n') { line_len -= 2; @@ -2281,7 +2376,7 @@ param_len += 2; } } - + // Get the string we want out of the line: value = strDup(line+param_len); return True; @@ -2313,7 +2408,7 @@ our_MD5Data((unsigned char*)(&seedData), sizeof seedData, sessionCookie); // DSS seems to require that the 'session cookie' string be 22 bytes long: sessionCookie[23] = '\0'; - + // Construct an authenticator string: char* authenticatorStr = createAuthenticatorString(authenticator, "GET", urlSuffix); @@ -2341,7 +2436,7 @@ sessionCookie); delete[] authenticatorStr; if (!sendRequest(cmd, "HTTP GET", False/*don't base64-encode*/)) break; - + // Get the response from the server: unsigned bytesRead; unsigned responseCode; char* firstLine; char* nextLineStart; @@ -2358,7 +2453,7 @@ // this socket. fOutputSocketNum = setupStreamSocket(envir(), 0, False /* =>blocking */); if (fOutputSocketNum < 0) break; - + // Connect to the remote endpoint: MAKE_SOCKADDR_IN(remoteName, fServerAddress, htons(fTunnelOverHTTPPortNum)); if (connect(fOutputSocketNum, @@ -2393,7 +2488,7 @@ sessionCookie); delete[] authenticatorStr; if (!sendRequest(cmd, "HTTP POST", False/*don't base64-encode*/)) break; - + // Note that there's no response to the "POST". delete[] cmd; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTSPCommon.cpp ^ |
@@ -11,14 +11,17 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines used by both RTSP clients and servers // Implementation #include "RTSPCommon.hh" +#include "Locale.hh" +#include <string.h> +#include <stdio.h> Boolean parseRTSPRequestString(char const* reqStr, unsigned reqStrSize, @@ -46,11 +49,11 @@ } resultCmdName[i] = '\0'; if (!parseSucceeded) return False; - + // Skip over the prefix of any "rtsp://" or "rtsp:/" URL that follows: unsigned j = i+1; while (j < reqStrSize && (reqStr[j] == ' ' || reqStr[j] == '\t')) ++j; // skip over any additional white space - for (j = i+1; j < reqStrSize-8; ++j) { + for (; (int)j < (int)(reqStrSize-8); ++j) { if ((reqStr[j] == 'r' || reqStr[j] == 'R') && (reqStr[j+1] == 't' || reqStr[j+1] == 'T') && (reqStr[j+2] == 's' || reqStr[j+2] == 'S') @@ -72,7 +75,7 @@ // Look for the URL suffix (before the following "RTSP/"): parseSucceeded = False; - for (unsigned k = i+1; k < reqStrSize-5; ++k) { + for (unsigned k = i+1; (int)k < (int)(reqStrSize-5); ++k) { if (reqStr[k] == 'R' && reqStr[k+1] == 'T' && reqStr[k+2] == 'S' && reqStr[k+3] == 'P' && reqStr[k+4] == '/') { while (--k >= i && reqStr[k] == ' ') {} // go back over all spaces before "RTSP/" @@ -87,7 +90,7 @@ resultURLSuffix[n] = '\0'; // Also look for the URL 'pre-suffix' before this: - unsigned k3 = --k1; + unsigned k3 = (k1 == 0) ? 0 : --k1; while (k3 > i && reqStr[k3] != '/') --k3; // the URL pre-suffix comes from [k3+1,k1] @@ -107,7 +110,7 @@ // Look for "CSeq:", skip whitespace, // then read everything up to the next \r or \n as 'CSeq': parseSucceeded = False; - for (j = i; j < reqStrSize-5; ++j) { + for (j = i; (int)j < (int)(reqStrSize-5); ++j) { if (reqStr[j] == 'C' && reqStr[j+1] == 'S' && reqStr[j+2] == 'e' && reqStr[j+3] == 'q' && reqStr[j+4] == ':') { j += 5; @@ -130,3 +133,29 @@ return True; } + +Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd) { + // First, find "Range:" + while (1) { + if (*buf == '\0') return False; // not found + if (_strncasecmp(buf, "Range: ", 7) == 0) break; + ++buf; + } + + // Then, run through each of the fields, looking for ones we handle: + char const* fields = buf + 7; + while (*fields == ' ') ++fields; + double start, end; + Locale("C", LC_NUMERIC); + if (sscanf(fields, "npt = %lf - %lf", &start, &end) == 2) { + rangeStart = start; + rangeEnd = end; + } else if (sscanf(fields, "npt = %lf -", &start) == 1) { + rangeStart = start; + rangeEnd = 0.0; + } else { + return False; // The header is malformed + } + + return True; +} | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTSPOverHTTPServer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple HTTP server that acts solely to implement RTSP-over-HTTP tunneling // (to a separate RTSP server), as described in // http://developer.apple.com/documentation/QuickTime/QTSS/Concepts/chapter_2_section_14.html @@ -24,7 +24,9 @@ #include "RTSPCommon.hh" #include <GroupsockHelper.hh> +#include <string.h> #if defined(__WIN32__) || defined(_WIN32) || defined(_QNX4) +#define snprintf _snprintf #else #include <signal.h> #define USE_SIGNALS 1 @@ -42,7 +44,7 @@ int ourSocket = -1; do { - int ourSocket = setUpOurSocket(env, ourHTTPPort); + ourSocket = setUpOurSocket(env, ourHTTPPort); if (ourSocket == -1) break; return new RTSPOverHTTPServer(env, ourSocket, rtspServerPort, rtspServerHostName); @@ -163,7 +165,7 @@ struct sockaddr_in dummy; // 'from' address, meaningless in this case Boolean endOfMsg = False; unsigned char* ptr = &fRequestBuffer[fRequestBytesAlreadySeen]; - + int bytesRead = readSocket(envir(), fClientSocket, ptr, fRequestBufferBytesLeft, dummy); if (bytesRead <= 0 || (unsigned)bytesRead >= fRequestBufferBytesLeft) { @@ -195,7 +197,7 @@ } ++tmpPtr; } - + fRequestBufferBytesLeft -= bytesRead; fRequestBytesAlreadySeen += bytesRead; @@ -238,7 +240,7 @@ } #endif } - + #ifdef DEBUG fprintf(stderr, "sending response: %s", fResponseBuffer); #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/RTSPServer.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A RTSP server // Implementation @@ -40,7 +40,7 @@ int ourSocket = -1; do { - int ourSocket = setUpOurSocket(env, ourPort); + ourSocket = setUpOurSocket(env, ourPort); if (ourSocket == -1) break; return new RTSPServer(env, ourSocket, ourPort, authDatabase, @@ -105,7 +105,7 @@ // Use our default IP address in the URL: ourAddress.sin_addr.s_addr = ReceivingInterfaceAddr != 0 ? ReceivingInterfaceAddr - : ourSourceAddressForMulticast(envir()); // hack + : ourIPAddress(envir()); // hack } else { SOCKLEN_T namelen = sizeof ourAddress; getsockname(clientSocket, (struct sockaddr*)&ourAddress, &namelen); @@ -160,7 +160,7 @@ } return ourSocket; - } while (0); + } while (0); if (ourSocket != -1) ::closeSocket(ourSocket); return -1; @@ -179,7 +179,7 @@ : Medium(env), fServerSocket(ourSocket), fServerPort(ourPort), fAuthDB(authDatabase), fReclamationTestSeconds(reclamationTestSeconds), - fServerMediaSessions(HashTable::create(STRING_HASH_KEYS)), + fServerMediaSessions(HashTable::create(STRING_HASH_KEYS)), fSessionIdCounter(0) { #ifdef USE_SIGNALS // Ignore the SIGPIPE signal, so that clients on the same host that are killed @@ -312,7 +312,7 @@ struct sockaddr_in dummy; // 'from' address, meaningless in this case Boolean endOfMsg = False; unsigned char* ptr = &fRequestBuffer[fRequestBytesAlreadySeen]; - + int bytesRead = readSocket(envir(), fClientSocket, ptr, fRequestBufferBytesLeft, dummy); if (bytesRead <= 0 || (unsigned)bytesRead >= fRequestBufferBytesLeft) { @@ -343,7 +343,7 @@ } ++tmpPtr; } - + fRequestBufferBytesLeft -= bytesRead; fRequestBytesAlreadySeen += bytesRead; @@ -385,7 +385,7 @@ handleCmd_notSupported(cseq); } } - + #ifdef DEBUG fprintf(stderr, "sending response: %s", fResponseBuffer); #endif @@ -420,7 +420,7 @@ WCHAR timeFormat[] = L"HH:mm:ss GMT\r\n"; WCHAR inBuf[200]; DWORD locale = LOCALE_NEUTRAL; - + int ret = GetDateFormat(locale, 0, &SystemTime, (LPTSTR)dateFormat, (LPTSTR)inBuf, sizeof inBuf); inBuf[ret - 1] = ' '; @@ -530,7 +530,7 @@ RTP_UDP, RTP_TCP, RAW_UDP -}; +} StreamingMode; static void parseTransportHeader(char const* buf, StreamingMode& streamingMode, @@ -548,7 +548,7 @@ destinationAddressStr = NULL; destinationTTL = 255; clientRTPPortNum = 0; - clientRTCPPortNum = 1; + clientRTCPPortNum = 1; rtpChannelId = rtcpChannelId = 0xFF; portNumBits p1, p2; @@ -594,33 +594,6 @@ delete[] field; } -static Boolean parseRangeHeader(char const* buf, float& rangeStart, float& rangeEnd) { - // Initialize the result parameters to default values: - rangeStart = rangeEnd = 0.0; - - // First, find "Range:" - while (1) { - if (*buf == '\0') return False; // not found - if (_strncasecmp(buf, "Range: ", 7) == 0) break; - ++buf; - } - - // Then, run through each of the fields, looking for ones we handle: - char const* fields = buf + 7; - while (*fields == ' ') ++fields; - float start, end; - if (sscanf(fields, "npt = %f - %f", &start, &end) == 2) { - rangeStart = start; - rangeEnd = end; - } else if (sscanf(fields, "npt = %f -", &start) == 1) { - rangeStart = start; - } else { - return False; // The header is malformed - } - - return True; -} - static Boolean parsePlayNowHeader(char const* buf) { // Find "x-playNow:" header, if present while (1) { @@ -708,7 +681,7 @@ // Look for a "Transport:" header in the request string, // to extract client parameters: StreamingMode streamingMode; - char* streamingModeString; // set when RAW_UDP streaming is specified + char* streamingModeString = NULL; // set when RAW_UDP streaming is specified char* clientsDestinationAddressStr; u_int8_t clientsDestinationTTL; portNumBits clientRTPPortNum, clientRTCPPortNum; @@ -730,7 +703,7 @@ // Next, check whether a "Range:" header is present in the request. // This isn't legal, but some clients do this to combine "SETUP" and "PLAY": - float rangeStart, rangeEnd; + double rangeStart = 0.0, rangeEnd = 0.0; fStreamAfterSETUP = parseRangeHeader(fullRequestStr, rangeStart, rangeEnd) || parsePlayNowHeader(fullRequestStr); @@ -792,7 +765,6 @@ dateHeader(), streamingModeString, destAddrStr, sourceAddrStr, ntohs(serverRTPPort.num()), destinationTTL, fOurSessionId); - delete[] streamingModeString; break; } } else { @@ -834,12 +806,11 @@ dateHeader(), streamingModeString, destAddrStr, sourceAddrStr, ntohs(clientRTPPort.num()), ntohs(serverRTPPort.num()), fOurSessionId); - delete[] streamingModeString; break; } } - delete[] destAddrStr; delete[] sourceAddrStr; } + delete[] destAddrStr; delete[] sourceAddrStr; delete[] streamingModeString; } void RTSPServer::RTSPClientSession @@ -928,7 +899,7 @@ char* rtspURL = fOurServer.rtspURL(fOurServerMediaSession, fClientSocket); unsigned rtspURLSize = strlen(rtspURL); - //// Parse the client's "Scale:" header, if any: + //// Parse the client's "Scale:" header, if any: float scale; Boolean sawScaleHeader = parseScaleHeader(fullRequestStr, scale); @@ -948,8 +919,8 @@ } scaleHeader = strDup(buf); - //// Parse the client's "Range:" header, if any: - float rangeStart, rangeEnd; + //// Parse the client's "Range:" header, if any: + double rangeStart = 0.0, rangeEnd = 0.0; Boolean sawRangeHeader = parseRangeHeader(fullRequestStr, rangeStart, rangeEnd); // Use this information, plus the stream's duration (if known), to create @@ -982,7 +953,7 @@ // Create a "RTP-Info:" line. It will get filled in from each subsession's state: char const* rtpInfoFmt = "%s" // "RTP-Info:", plus any preceding rtpInfo items - "%s" // comma separator, if needed + "%s" // comma separator, if needed "url=%s/%s" ";seq=%d" #ifdef RTPINFO_INCLUDE_RTPTIME @@ -1032,7 +1003,7 @@ #ifdef RTPINFO_INCLUDE_RTPTIME + 10 /*max unsigned (32-bit) len*/ #endif - + 2 /*allows for trailing \r\n at final end of string*/; + + 2 /*allows for trailing \r\n at final end of string*/; rtpInfo = new char[rtpInfoSize]; sprintf(rtpInfo, rtpInfoFmt, prevRTPInfo, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/SIPClient.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic SIP client // Implementation @@ -59,7 +59,7 @@ fApplicationNameSize = strlen(fApplicationName); struct in_addr ourAddress; - ourAddress.s_addr = ourSourceAddressForMulticast(env); // hack + ourAddress.s_addr = ourIPAddress(env); // hack fOurAddressStr = strDup(our_inet_ntoa(ourAddress)); fOurAddressStrSize = strlen(fOurAddressStr); @@ -89,7 +89,7 @@ << env.getResultMsg() << "\n"; } } - + // Set various headers to be used in each request: char const* formatStr; unsigned headerSize; @@ -202,7 +202,7 @@ char* rtpmapLine; unsigned rtpmapLineSize; if (fMIMESubtypeSize > 0) { - char* const rtpmapFmt = + char* const rtpmapFmt = "a=rtpmap:%u %s/8000\r\n"; unsigned rtpmapFmtSize = strlen(rtpmapFmt) + 3 /* max char len */ + fMIMESubtypeSize; @@ -215,7 +215,7 @@ rtpmapLine = strDup(""); rtpmapLineSize = 0; } - char* const inviteSDPFmt = + char* const inviteSDPFmt = "v=0\r\n" "o=- %u %u IN IP4 %s\r\n" "s=%s session\r\n" @@ -371,10 +371,10 @@ fInviteClientState = Calling; if (!sendINVITE()) doInviteStateTerminated(0); } else { - // Turn off timers A & B before moving to a new state: + // Turn off timers A & B before moving to a new state: sched.unscheduleDelayedTask(fTimerA); sched.unscheduleDelayedTask(fTimerB); - + if (responseCode == timerBFires) { envir().setResultMsg("No response from server"); doInviteStateTerminated(0); @@ -458,7 +458,7 @@ char* firstLine = NULL; char* nextLineStart = NULL; unsigned bytesRead = getResponse(readBuf, readBufSize); - if (bytesRead < 0) break; + if (bytesRead == 0) break; if (fVerbosityLevel >= 1) { envir() << "Received INVITE response: " << readBuf << "\n"; } @@ -502,7 +502,7 @@ } delete[] realm; delete[] nonce; if (foundAuthenticateHeader) break; - } + } } envir().setResultMsg("cannot handle INVITE response: ", firstLine); break; @@ -528,7 +528,7 @@ fToTagStrSize = strlen(fToTagStr); } delete[] toTagStr; - + if (sscanf(lineStart, "Content-Length: %d", &contentLength) == 1 || sscanf(lineStart, "Content-length: %d", &contentLength) == 1) { if (contentLength < 0) { @@ -549,7 +549,7 @@ // the "Content-length:" header (if any) that we saw. We may need to // read more data, or we may have extraneous data in the buffer. char* bodyStart = nextLineStart; - if (contentLength >= 0) { + if (bodyStart != NULL && contentLength >= 0) { // We saw a "Content-length:" header unsigned numBodyBytes = &readBuf[bytesRead] - bodyStart; if (contentLength > (int)numBodyBytes) { @@ -658,7 +658,7 @@ fURL, fToTagStr, fCallId, fOurAddressStr, fCSeq /* note: it's the same as before; not incremented */); - + if (!sendRequest(cmd, strlen(cmd))) { envir().setResultErrMsg("ACK send() failed: "); break; @@ -699,7 +699,7 @@ fURL, fToTagStr, fCallId, fOurAddressStr, ++fCSeq); - + if (!sendRequest(cmd, strlen(cmd))) { envir().setResultErrMsg("BYE send() failed: "); break; @@ -721,14 +721,14 @@ NetAddress destAddress; if (!parseSIPURL(envir(), url, destAddress, fServerPortNum)) break; fServerAddress.s_addr = *(unsigned*)(destAddress.data()); - + if (fOurSocket != NULL) { fOurSocket->changeDestinationParameters(fServerAddress, fServerPortNum, 255); } } - return True; + return True; } while (0); fInviteStatusCode = 1; @@ -908,7 +908,7 @@ break; } bytesRead += bytesReadNow; - + // Check whether we have "\r\n\r\n": char* lastToCheck = responseBuffer+bytesRead-4; if (lastToCheck < responseBuffer) continue; @@ -932,11 +932,11 @@ } } } - + return 0; } -Boolean SIPClient::parseResponseCode(char const* line, +Boolean SIPClient::parseResponseCode(char const* line, unsigned& responseCode) { if (sscanf(line, "%*s%u", &responseCode) != 1) { envir().setResultMsg("no response code in line: \"", line, "\""); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/ServerMediaSession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A data structure that represents a session that consists of // potentially multiple (audio and/or video) sub-sessions // (This data structure is used for media *streamers* - i.e., servers. @@ -183,11 +183,10 @@ } char* ServerMediaSession::generateSDPDescription() { - struct in_addr ourIPAddress; - ourIPAddress.s_addr = ourSourceAddressForMulticast(envir()); - char* const ourIPAddressStr - = strDup(our_inet_ntoa(ourIPAddress)); - unsigned ourIPAddressStrSize = strlen(ourIPAddressStr); + struct in_addr ipAddress; + ipAddress.s_addr = ourIPAddress(envir()); + char* const ipAddressStr = strDup(our_inet_ntoa(ipAddress)); + unsigned ipAddressStrSize = strlen(ipAddressStr); // For a SSM sessions, we need a "a=source-filter: incl ..." line also: char* sourceFilterLine; @@ -195,12 +194,10 @@ char const* const sourceFilterFmt = "a=source-filter: incl IN IP4 * %s\r\n" "a=rtcp-unicast: reflection\r\n"; - unsigned sourceFilterFmtSize = strlen(sourceFilterFmt) - + ourIPAddressStrSize; + unsigned const sourceFilterFmtSize = strlen(sourceFilterFmt) + ipAddressStrSize + 1; sourceFilterLine = new char[sourceFilterFmtSize]; - sprintf(sourceFilterLine, sourceFilterFmt, - ourIPAddressStr); + sprintf(sourceFilterLine, sourceFilterFmt, ipAddressStr); } else { sourceFilterLine = strDup(""); } @@ -233,7 +230,7 @@ } else { // subsessions have differing durations, so "a=range:" lines go there rangeLine = strDup(""); } - + char const* const sdpPrefixFmt = "v=0\r\n" "o=- %ld%06ld %d IN IP4 %s\r\n" @@ -249,7 +246,7 @@ "a=x-qt-text-inf:%s\r\n" "%s"; sdpLength += strlen(sdpPrefixFmt) - + 20 + 6 + 20 + ourIPAddressStrSize + + 20 + 6 + 20 + ipAddressStrSize + strlen(fDescriptionSDPString) + strlen(fInfoSDPString) + strlen(libNameStr) + strlen(libVersionStr) @@ -260,12 +257,12 @@ + strlen(fMiscSDPLines); sdp = new char[sdpLength]; if (sdp == NULL) break; - + // Generate the SDP prefix (session-level lines): sprintf(sdp, sdpPrefixFmt, fCreationTime.tv_sec, fCreationTime.tv_usec, // o= <session id> 1, // o= <version> // (needs to change if params are modified) - ourIPAddressStr, // o= <address> + ipAddressStr, // o= <address> fDescriptionSDPString, // s= <description> fInfoSDPString, // i= <info> libNameStr, libVersionStr, // a=tool: @@ -284,7 +281,7 @@ } } while (0); - delete[] rangeLine; delete[] sourceFilterLine; delete[] ourIPAddressStr; + delete[] rangeLine; delete[] sourceFilterLine; delete[] ipAddressStr; return sdp; } @@ -342,7 +339,7 @@ // default implementation: do nothing } void ServerMediaSubsession::seekStream(unsigned /*clientSessionId*/, - void* /*streamToken*/, float /*seekNPT*/) { + void* /*streamToken*/, double /*seekNPT*/) { // default implementation: do nothing } void ServerMediaSubsession::setStreamScale(unsigned /*clientSessionId*/, @@ -386,5 +383,5 @@ char buf[100]; sprintf(buf, "a=range:npt=0-%.3f\r\n", ourDuration); return strDup(buf); - } + } } | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/SimpleRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple RTP sink that packs frames into each outgoing // packet, without any fragmentation or special headers. // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/SimpleRTPSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A RTP source for a simple RTP payload format that // - doesn't have any special headers following the RTP header // - doesn't have any special framing apart from the packet data itself | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/StreamParser.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Abstract class for parsing a byte stream // Implementation @@ -61,7 +61,7 @@ // Swap banks, but save any still-needed bytes from the old bank: unsigned numBytesToSave = fTotNumValidBytes - fSavedParserIndex; unsigned char const* from = &curBank()[fSavedParserIndex]; - + fCurBankNum = (fCurBankNum + 1)%2; fCurBank = fBank[fCurBankNum]; memmove(curBank(), from, numBytesToSave); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/StreamParser.hh ^ |
@@ -11,17 +11,17 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Abstract class for parsing a byte stream // C++ header #ifndef _STREAM_PARSER_HH #define _STREAM_PARSER_HH -#ifndef _FRAMED_SOURCE_HH +#ifndef _FRAMED_SOURCE_HH #include "FramedSource.hh" #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/VideoRTPSink.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTP sink for video codecs (abstract base class) // Implementation | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/WAVAudioFileServerMediaSubsession.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an WAV audio file. // Implementation @@ -43,7 +43,7 @@ } void WAVAudioFileServerMediaSubsession -::seekStreamSource(FramedSource* inputSource, float seekNPT) { +::seekStreamSource(FramedSource* inputSource, double seekNPT) { WAVAudioFileSource* wavSource; if (fBitsPerSample == 16) { // "inputSource" is a filter; its input source is the original WAV file source: @@ -55,7 +55,7 @@ unsigned seekSampleNumber = (unsigned)(seekNPT*fSamplingFrequency); unsigned seekByteNumber = (seekSampleNumber*fNumChannels*fBitsPerSample)/8; - + wavSource->seekToPCMByte(seekByteNumber); } @@ -109,7 +109,7 @@ = uLawFromPCMAudioSource::createNew(envir(), wavSource, 1/*little-endian*/); bitsPerSecond /= 2; } else { - // Add a filter that converts from little-endian to network (big-endian) order: + // Add a filter that converts from little-endian to network (big-endian) order: resultSource = EndianSwap16::createNew(envir(), wavSource); } } else { // fBitsPerSample == 8 @@ -133,7 +133,7 @@ do { char* mimeType; unsigned char payloadFormatCode; - if (fAudioFormat == WA_PCM) { + if (fAudioFormat == WA_PCM) { if (fBitsPerSample == 16) { if (fConvertToULaw) { mimeType = "PCMU"; @@ -170,10 +170,10 @@ } else { payloadFormatCode = rtpPayloadTypeIfDynamic; } - } else { //unknown format - break; + } else { //unknown format + break; } - + return SimpleRTPSink::createNew(envir(), rtpGroupsock, payloadFormatCode, fSamplingFrequency, "audio", mimeType, fNumChannels); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/WAVAudioFileSource.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A WAV audio file source // Implementation @@ -75,26 +75,25 @@ #define nextc fgetc(fid) -#define ucEOF ((unsigned char)EOF) static Boolean get4Bytes(FILE* fid, unsigned& result) { // little-endian - unsigned char c0, c1, c2, c3; - if ((c0 = nextc) == ucEOF || (c1 = nextc) == ucEOF || - (c2 = nextc) == ucEOF || (c3 = nextc) == ucEOF) return False; + int c0, c1, c2, c3; + if ((c0 = nextc) == EOF || (c1 = nextc) == EOF || + (c2 = nextc) == EOF || (c3 = nextc) == EOF) return False; result = (c3<<24)|(c2<<16)|(c1<<8)|c0; return True; } static Boolean get2Bytes(FILE* fid, unsigned short& result) {//little-endian - unsigned char c0, c1; - if ((c0 = nextc) == ucEOF || (c1 = nextc) == ucEOF) return False; + int c0, c1; + if ((c0 = nextc) == EOF || (c1 = nextc) == EOF) return False; result = (c1<<8)|c0; return True; } static Boolean skipBytes(FILE* fid, int num) { while (num-- > 0) { - if (nextc == ucEOF) return False; + if (nextc == EOF) return False; } return True; } @@ -127,7 +126,7 @@ if (!get2Bytes(fid, audioFormat)) break; fAudioFormat = (unsigned char)audioFormat; - if (fAudioFormat != WA_PCM && fAudioFormat != WA_PCMA && fAudioFormat != WA_PCMU) { + if (fAudioFormat != WA_PCM && fAudioFormat != WA_PCMA && fAudioFormat != WA_PCMU) { // not PCM/PCMU/PCMA - we can't handle this env.setResultMsg("Audio format is not PCM/PCMU/PCMA"); break; @@ -157,7 +156,7 @@ if (!skipBytes(fid, formatLength - 16)) break; // FACT chunk (optional): - unsigned char c = nextc; + int c = nextc; if (c == 'f') { if (nextc != 'a' || nextc != 'c' || nextc != 't') break; unsigned factLength; @@ -174,7 +173,7 @@ fWAVHeaderSize = ftell(fid); success = True; } while (0); - + if (!success) { env.setResultMsg("Bad WAV file format"); // Set "fBitsPerSample" to zero, to indicate failure: @@ -219,7 +218,7 @@ fFrameSize = fread(fTo, 1, bytesToRead, fFid); } else { // We read every 'fScaleFactor'th sample: - fFrameSize = 0; + fFrameSize = 0; while (bytesToRead > 0) { size_t bytesRead = fread(fTo, 1, bytesPerSample, fFid); if (bytesRead <= 0) break; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AC3AudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for AC3 audio // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AC3AudioRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AC3 Audio RTP Sources // C++ header @@ -45,7 +45,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AC3AudioStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an AC3 audio elementary stream into frames // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/ADTSAudioFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an AAC audio file in ADTS format // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/ADTSAudioFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AAC audio files in ADTS format // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an AMR audio file. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioFileSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AMR Audio File Sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AMR audio files (as defined in RFC 3267, section 5) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for AMR audio (RFC 3267) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // AMR Audio RTP Sources (RFC 3267) // C++ header @@ -39,7 +39,7 @@ Boolean isOctetAligned = True, unsigned interleaving = 0, // relevant only if "isOctetAligned" - // The maximum # of frame-blocks in a group + // The maximum # of frame-blocks in a group // 0 means: no interleaving Boolean robustSortingOrder = False, // relevant only if "isOctetAligned" | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AMRAudioSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source object for AMR audio sources // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AVIFileSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A sink that generates an AVI file from a composite media session // C++ header @@ -44,7 +44,7 @@ private: AVIFileSink(UsageEnvironment& env, MediaSession& inputSession, - FILE* outFid, unsigned bufferSize, + char const* outputFileName, unsigned bufferSize, unsigned short movieWidth, unsigned short movieHeight, unsigned movieFPS, Boolean packetLossCompensate); // called only by createNew() | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AudioInputDevice.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Generic audio input device (such as a microphone, or an input sound card) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/AudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTP sink for audio codecs (abstract base class) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/Base64.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Base64 encoding and decoding // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/BasicUDPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple UDP sink (i.e., without RTP or other headers added); one frame per packet // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/BasicUDPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple UDP source, where every UDP payload is a complete frame // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/ByteStreamFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A file source that is a plain byte stream (rather than frames) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/ByteStreamMultiFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A source that consists of multiple byte-stream files, read sequentially // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/DarwinInjector.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An object that redirects one or more RTP/RTCP streams - forming a single // multimedia session - into a 'Darwin Streaming Server' (for subsequent // reflection to potentially arbitrarily many remote RTSP clients). @@ -48,8 +48,8 @@ </Limit> require any-user Use the "remoteUserName" and "remotePassword" parameters to - "setDestination()", as appropriate. - 4/ Call "startPlaying" on each RTP sink (from the corresponding 'source'). + "setDestination()", as appropriate. + 4/ Call "startPlaying" on each RTP sink (from the corresponding 'source'). */ class SubstreamDescriptor; // forward @@ -65,7 +65,7 @@ void addStream(RTPSink* rtpSink, RTCPInstance* rtcpInstance); - Boolean setDestination(char const* remoteRTSPServerNameOrAddress, + Boolean setDestination(char const* remoteRTSPServerNameOrAddress, char const* remoteFileName, char const* sessionName = "", char const* sessionInfo = "", @@ -92,6 +92,8 @@ unsigned fSubstreamSDPSizes; SubstreamDescriptor* fHeadSubstream; SubstreamDescriptor* fTailSubstream; + MediaSession* fSession; + unsigned fLastTrackId; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/DeviceSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A template for a MediaSource encapsulating an audio/video input device // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/DigestAuthentication.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class used for digest authentication. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/FileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a file. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/FileSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // File Sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/FramedFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed File Sources // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/FramedFilter.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed Filters // C++ header @@ -29,6 +29,9 @@ public: FramedSource* inputSource() const { return fInputSource; } + // Call before destruction if you want to prevent the destructor from closing the input source + void detachInputSource() { fInputSource = NULL; } + protected: FramedFilter(UsageEnvironment& env, FramedSource* inputSource); // abstract base class | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/FramedSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Framed Sources // C++ header @@ -43,20 +43,7 @@ void* afterGettingClientData, onCloseFunc* onCloseFunc, void* onCloseClientData); - // ##### The following is for backwards-compatibility; remove it eventually: -#ifdef BACKWARDS_COMPATIBLE_WITH_OLD_AFTER_GETTING_FUNC - typedef void (bwCompatAfterGettingFunc)(void* clientData, unsigned frameSize, - struct timeval presentationTime); - void getNextFrame(unsigned char* to, unsigned maxSize, - bwCompatAfterGettingFunc* afterGettingFunc, - void* afterGettingClientData, - onCloseFunc* onCloseFunc, - void* onCloseClientData); - bwCompatAfterGettingFunc* fSavedBWCompatAfterGettingFunc; - void* fSavedBWCompatAfterGettingClientData; -#endif - // ##### End of code for backwards-compatibility. - + static void handleClosure(void* clientData); // This should be called (on ourself) if the source is discovered // to be closed (i.e., no longer readable) | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/GSMAudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for GSM audio // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H261VideoRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.261 Video RTP Sources // C++ header @@ -47,7 +47,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: u_int32_t fLastSpecialHeader; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H263plusVideoFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-4 video file. // C++ header @@ -31,27 +31,18 @@ static H263plusVideoFileServerMediaSubsession* createNew(UsageEnvironment& env, char const* fileName, Boolean reuseFirstSource); - void setDoneFlag() { fDoneFlag = ~0; } - void checkForAuxSDPLine1(); - private: H263plusVideoFileServerMediaSubsession(UsageEnvironment& env, - char const* fileName, Boolean reuseFirstSource); + char const* fileName, Boolean reuseFirstSource); // called only by createNew(); virtual ~H263plusVideoFileServerMediaSubsession(); private: // redefined virtual functions - virtual char const* getAuxSDPLine(RTPSink* rtpSink, - FramedSource* inputSource); virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource); - -private: - char fDoneFlag; // used when setting up "fSDPLines" - RTPSink* fDummyRTPSink; // ditto }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H263plusVideoRTPSink.hh ^ |
@@ -11,11 +11,11 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. -// RTP sink for H.263+ video (RFC 2429) +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. +// RTP sink for H.263+ video (RFC 4629) // C++ header #ifndef _H263_PLUS_VIDEO_RTP_SINK_HH @@ -30,7 +30,7 @@ static H263plusVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, u_int32_t rtpTimestampFrequency = 90000); - + protected: H263plusVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H263plusVideoRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.263+ Video RTP Sources // C++ header @@ -54,7 +54,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H263plusVideoStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an H263 video elementary stream into frames. // Author Benhard Feiten | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H264VideoFileSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.264 Video File Sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H264VideoRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for H.264 video (RFC 3984) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H264VideoRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // H.264 Video RTP Sources // C++ header @@ -46,7 +46,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: friend class H264BufferedPacket; @@ -67,6 +67,6 @@ // Returns the binary value of each 'parameter set' specified in a // "sprop-parameter-sets" string (in the SDP description for a H.264/RTP stream). // The value is returned as an array (length "numSPropRecords") of "SPropRecord"s. - // This array is dynamically allocated by this routine, and must be delete[]d by the caller. + // This array is dynamically allocated by this routine, and must be delete[]d by the caller. #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/H264VideoStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Any source that feeds into a "H264VideoRTPSink" must be of this class. // This is a virtual base class; subclasses must implement the // "currentNALUnitEndsAccessUnit()" virtual function. | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/HTTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // HTTP Sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/InputFile.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines for opening/closing named input files // C++ header @@ -31,10 +31,10 @@ u_int64_t GetFileSize(char const* fileName, FILE* fid); // 0 means zero-length, unbounded, or unknown -u_int64_t SeekFile64(FILE *fid, int64_t offset, int whence); +int64_t SeekFile64(FILE *fid, int64_t offset, int whence); // A platform-independent routine for seeking within (possibly) large files -u_int64_t TellFile64(FILE *fid); +int64_t TellFile64(FILE *fid); // A platform-independent routine for reporting the position within // (possibly) large files | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/JPEGVideoRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for JPEG video (RFC 2435) // C++ header @@ -28,7 +28,7 @@ class JPEGVideoRTPSink: public VideoRTPSink { public: static JPEGVideoRTPSink* createNew(UsageEnvironment& env, Groupsock* RTPgs); - + protected: JPEGVideoRTPSink(UsageEnvironment& env, Groupsock* RTPgs); // called only by createNew() | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/JPEGVideoRTPSource.hh ^ |
@@ -11,11 +11,11 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. -// JPEG Video (RFC 2435) RTP Sources +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. +// JPEG Video (RFC 2435) RTP Sources // C++ header #ifndef _JPEG_VIDEO_RTP_SOURCE_HH @@ -32,7 +32,8 @@ static JPEGVideoRTPSource* createNew(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat = 26, - unsigned rtpPayloadFrequency = 90000); + unsigned rtpPayloadFrequency = 90000, + unsigned defaultWidth = 0, unsigned defaultHeight = 0); protected: virtual ~JPEGVideoRTPSource(); @@ -40,15 +41,19 @@ private: JPEGVideoRTPSource(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, - unsigned rtpTimestampFrequency); + unsigned rtpTimestampFrequency, + unsigned defaultWidth, unsigned defaultHeight); // called only by createNew() + // Image dimensions from the SDP description, if any + unsigned fDefaultWidth, fDefaultHeight; + private: // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - - virtual char const* MIMEtype() const; + + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/JPEGVideoSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // JPEG video sources // C++ header @@ -36,7 +36,7 @@ u_int16_t& length); // If "qFactor()" returns a value >= 128, then this function is called // to tell us the quantization tables that are being used. - // (The default implementation of this function just returns NULL.) + // (The default implementation of this function just returns NULL.) // "precision" and "length" are as defined in RFC 2435, section 3.1.8. protected: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/Locale.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Support for temporarily setting the locale (e.g., to POSIX) for (e.g.) parsing or printing // floating-point numbers in protocol headers, or calling toupper()/tolower() on human-input strings. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3ADU.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // 'ADU' MP3 streams (for improved loss-tolerance) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3ADURTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for 'ADUized' MP3 frames ("mpa-robust") // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3ADURTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP source for 'ADUized' MP3 frames ("mpa-robust") // C++ header @@ -43,7 +43,7 @@ private: // redefined virtual functions: - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3ADUTranscoder.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Transcoder for ADUized MP3 frames // C++ header @@ -31,7 +31,7 @@ unsigned outBitrate /* in kbps */, FramedSource* inputSource); - unsigned outBitrate() const { return fOutBitrate; } + unsigned outBitrate() const { return fOutBitrate; } protected: MP3ADUTranscoder(UsageEnvironment& env, unsigned outBitrate /* in kbps */, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3ADUinterleaving.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Interleaving of MP3 ADUs // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3AudioFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an MP3 audio file. // (Actually, any MPEG-1 or MPEG-2 audio file should work.) @@ -47,7 +47,7 @@ virtual ~MP3AudioFileServerMediaSubsession(); private: // redefined virtual functions - virtual void seekStreamSource(FramedSource* inputSource, float seekNPT); + virtual void seekStreamSource(FramedSource* inputSource, double seekNPT); virtual void setStreamSourceScale(FramedSource* inputSource, float scale); virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3FileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 File Sources // C++ header @@ -33,7 +33,7 @@ float filePlayTime() const; void setPresentationTimeScale(unsigned scale); - void seekWithinFile(float seekNPT); + void seekWithinFile(double seekNPT); protected: MP3FileSource(UsageEnvironment& env, FILE* fid); @@ -50,7 +50,7 @@ private: // redefined virtual functions: virtual void doGetNextFrame(); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; virtual void getAttributes() const; private: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3HTTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 HTTP Sources // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MP3Transcoder.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP3 Transcoder // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2AudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG audio (RFC 2250) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2AudioRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-1 or MPEG-2 Audio RTP Sources // C++ header @@ -45,7 +45,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2AudioStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG (1,2) audio elementary stream into frames // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2Demux.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Demultiplexer for a MPEG 1 or 2 Program Stream // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2DemuxedElementaryStream.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A MPEG 1 or 2 Elementary Stream, demultiplexed from a Program Stream // C++ header @@ -43,7 +43,7 @@ // redefined virtual functions: virtual void doGetNextFrame(); virtual void doStopGettingFrames(); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; virtual unsigned maxFrameSize() const; private: | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2DemuxedServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-1 or 2 demuxer. // C++ header @@ -45,7 +45,7 @@ virtual ~MPEG1or2DemuxedServerMediaSubsession(); private: // redefined virtual functions - virtual void seekStreamSource(FramedSource* inputSource, float seekNPT); + virtual void seekStreamSource(FramedSource* inputSource, double seekNPT); virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2FileServerDemux.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A server demultiplexer for a MPEG 1 or 2 Program Stream // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-1 or 2 Elementary Stream video file. // C++ header @@ -40,7 +40,7 @@ char const* fileName, Boolean reuseFirstSource, Boolean iFramesOnly, - double vshPeriod); + double vshPeriod); // called only by createNew(); virtual ~MPEG1or2VideoFileServerMediaSubsession(); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoHTTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A HTTP Sink specifically for MPEG Video // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG video (RFC 2250) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-1 or MPEG-2 Video RTP Sources // C++ header @@ -47,7 +47,7 @@ unsigned& resultSpecialHeaderSize); virtual Boolean packetIsUsableInJitterCalculation(unsigned char* packet, unsigned packetSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoStreamDiscreteFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simplified version of "MPEG1or2VideoStreamFramer" that takes only // complete, discrete frames (rather than an arbitrary byte stream) as input. // This avoids the parsing and data copying overhead of the full @@ -36,18 +36,18 @@ createNew(UsageEnvironment& env, FramedSource* inputSource, Boolean iFramesOnly = False, double vshPeriod = 5.0); // see MPEG1or2VideoStreamFramer.hh - + private: MPEG1or2VideoStreamDiscreteFramer(UsageEnvironment& env, FramedSource* inputSource, Boolean iFramesOnly, double vshPeriod); // called only by createNew() virtual ~MPEG1or2VideoStreamDiscreteFramer(); - + private: // redefined virtual functions: virtual void doGetNextFrame(); - + private: static void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG1or2VideoStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG 1 or 2 video elementary stream into // frames for: Video_Sequence_Header, GOP_Header, Picture_Header // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2IndexFromTransportStream.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that produces a sequence of I-frame indices from a MPEG-2 Transport Stream // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-2 Transport Stream file. // C++ header @@ -57,7 +57,7 @@ unsigned short& rtpSeqNum, unsigned& rtpTimestamp); virtual void pauseStream(unsigned clientSessionId, void* streamToken); - virtual void seekStream(unsigned clientSessionId, void* streamToken, float seekNPT); + virtual void seekStream(unsigned clientSessionId, void* streamToken, double seekNPT); virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale); virtual void deleteStream(unsigned clientSessionId, void*& streamToken); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that passes through (unchanged) chunks that contain an integral number // of MPEG-2 Transport Stream packets, but returning (in "fDurationInMicroseconds") // an updated estimate of the time gap between chunks. @@ -66,6 +66,7 @@ unsigned long fTSPacketCount; double fTSPacketDurationEstimate; HashTable* fPIDStatusTable; + unsigned long fTSPCRCount; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamFromESSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter for converting one or more MPEG Elementary Streams // to a MPEG-2 Transport Stream // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamFromPESSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter for converting a stream of MPEG PES packets to a MPEG-2 Transport Stream // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamIndexFile.hh ^ |
@@ -11,14 +11,14 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class that encapsulates MPEG-2 Transport Stream 'index files'/ // These index files are used to implement 'trick play' operations // (seek-by-time, fast forward, reverse play) on Transport Stream files. -// +// // C++ header #ifndef _MPEG2_TRANSPORT_STREAM_INDEX_FILE_HH | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamMultiplexor.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A class for generating MPEG-2 Transport Stream from one or more input // Elementary Stream data sources // C++ header @@ -69,7 +69,7 @@ u_int8_t streamType; // for use in Program Maps } fPIDState[PID_TABLE_SIZE]; u_int8_t fPCR_PID, fCurrentPID; - // Note: We map 8-bit stream_ids directly to PIDs + // Note: We map 8-bit stream_ids directly to PIDs MPEG1or2Demux::SCR fPCR; unsigned char* fInputBuffer; unsigned fInputBufferSize, fInputBufferBytesUsed; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG2TransportStreamTrickModeFilter.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved.// A filter that converts a MPEG Transport Stream file - with corresponding index file +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved.// A filter that converts a MPEG Transport Stream file - with corresponding index file // - to a corresponding Video Elementary Stream. It also uses a "scale" parameter // to implement 'trick mode' (fast forward or reverse play, using I-frames) on // the video stream. | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4ESVideoRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG-4 Elementary Stream video (RFC 3016) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4ESVideoRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MP4V-ES video RTP stream sources // C++ header @@ -45,7 +45,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4GenericRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4GenericRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG4-GENERIC ("audio", "video", or "application") RTP stream sources // C++ header @@ -59,7 +59,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: char* fMIMEType; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4LATMAudioRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for MPEG-4 audio, using LATM multiplexing (RFC 3016) // (Note that the initial 'size' field is assumed to be present at the start of // each frame.) | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4LATMAudioRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // MPEG-4 audio, using LATM multiplexing // C++ header @@ -51,7 +51,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: Boolean fIncludeLATMDataLengthField; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4VideoFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from a MPEG-4 video file. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4VideoStreamDiscreteFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simplified version of "MPEG4VideoStreamFramer" that takes only complete, // discrete frames (rather than an arbitrary byte stream) as input. // This avoids the parsing and data copying overhead of the full | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEG4VideoStreamFramer.hh ^ |
@@ -11,16 +11,16 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG-4 video elementary stream into // frames for: // - Visual Object Sequence (VS) Header + Visual Object (VO) Header // + Video Object Layer (VOL) Header // - Group of VOP (GOV) Header -// - VOP frame +// - VOP frame // C++ header #ifndef _MPEG4_VIDEO_STREAM_FRAMER_HH | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MPEGVideoStreamFramer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A filter that breaks up an MPEG video elementary stream into // headers and frames // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/Media.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Medium // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MediaSession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A data structure that represents a session that consists of // potentially multiple (audio and/or video) sub-sessions // (This data structure is used for media *receivers* - i.e., clients. @@ -39,7 +39,8 @@ MediaSession*& resultSession); Boolean hasSubsessions() const { return fSubsessionsHead != NULL; } - float& playEndTime() { return fMaxPlayEndTime; } + double& playStartTime() { return fMaxPlayStartTime; } + double& playEndTime() { return fMaxPlayEndTime; } char* connectionEndpointName() const { return fConnectionEndpointName; } char const* CNAME() const { return fCNAME; } struct in_addr const& sourceFilterAddr() const { return fSourceFilterAddr; } @@ -47,6 +48,7 @@ char* mediaSessionType() const { return fMediaSessionType; } char* sessionName() const { return fSessionName; } char* sessionDescription() const { return fSessionDescription; } + char const* controlPath() const { return fControlPath; } Boolean initiateByMediaType(char const* mimeType, MediaSubsession*& resultSubsession, @@ -78,6 +80,7 @@ Boolean parseSDPLine_i(char const* sdpLine); Boolean parseSDPLine_c(char const* sdpLine); Boolean parseSDPAttribute_type(char const* sdpLine); + Boolean parseSDPAttribute_control(char const* sdpLine); Boolean parseSDPAttribute_range(char const* sdpLine); Boolean parseSDPAttribute_source_filter(char const* sdpLine); @@ -97,12 +100,14 @@ // Fields set from a SDP description: char* fConnectionEndpointName; - float fMaxPlayEndTime; + double fMaxPlayStartTime; + double fMaxPlayEndTime; struct in_addr fSourceFilterAddr; // used for SSM float fScale; // set from a RTSP "Scale:" header char* fMediaSessionType; // holds a=type value char* fSessionName; // holds s=<session name> value char* fSessionDescription; // holds i=<session description> value + char* fControlPath; // holds optional a=control: string }; @@ -110,10 +115,10 @@ public: MediaSubsessionIterator(MediaSession& session); virtual ~MediaSubsessionIterator(); - + MediaSubsession* next(); // NULL if none void reset(); - + private: MediaSession& fOurSession; MediaSubsession* fNextPtr; @@ -147,7 +152,11 @@ // This is the source that client sinks read from. It is usually // (but not necessarily) the same as "rtpSource()" - float playEndTime() const; + double playStartTime() const; + double playEndTime() const; + // Used only to set the local fields: + double& _playStartTime() { return fPlayStartTime; } + double& _playEndTime() { return fPlayEndTime; } Boolean initiate(int useSpecialRTPoffset = -1); // Creates a "RTPSource" for this subsession. (Has no effect if it's @@ -190,9 +199,9 @@ char const* fmtp_mode() const { return fMode; } char const* fmtp_spropparametersets() const { return fSpropParameterSets; } - unsigned connectionEndpointAddress() const; + netAddressBits connectionEndpointAddress() const; // Converts "fConnectionEndpointName" to an address (or 0 if unknown) - void setDestinations(unsigned defaultDestAddress); + void setDestinations(netAddressBits defaultDestAddress); // Uses "fConnectionEndpointName" and "serverPortNum" to set // the destination address and port of the RTP and RTCP objects. // This is typically called by RTSP clients after doing "SETUP". @@ -207,11 +216,19 @@ // Parameters set from a RTSP "RTP-Info:" header: struct { - unsigned trackId; u_int16_t seqNum; u_int32_t timestamp; + Boolean infoIsNew; // not part of the RTSP header; instead, set whenever this struct is filled in } rtpInfo; + double getNormalPlayTime(struct timeval const& presentationTime); + // Computes the stream's "Normal Play Time" (NPT) from the given "presentationTime". + // (For the definition of "Normal Play Time", see RFC 2326, section 3.6.) + // This function is useful only if the "rtpInfo" structure was previously filled in + // (e.g., by a "RTP-Info:" header in a RTSP response). + // Also, for this function to work properly, the RTP stream's presentation times must (eventually) be + // synchronized via RTCP. + #ifdef SUPPORT_REAL_RTSP // Attributes specific to RealNetworks streams: unsigned fRealMaxBitRate, fRealAvgBitRate, fRealMaxPacketSize, fRealAvgPacketSize, fRealPreroll; @@ -255,7 +272,7 @@ char* fCodecName; char* fProtocolName; unsigned fRTPTimestampFrequency; - char* fControlPath; + char* fControlPath; // holds optional a=control: string struct in_addr fSourceFilterAddr; // used for SSM // Parameters set by "a=fmtp:" SDP lines: @@ -268,7 +285,8 @@ Boolean fCpresent, fRandomaccessindication; char *fConfig, *fMode, *fSpropParameterSets; - float fPlayEndTime; + double fPlayStartTime; + double fPlayEndTime; unsigned short fVideoWidth, fVideoHeight; // screen dimensions (set by an optional a=x-dimensions: <w>,<h> line) unsigned fVideoFPS; @@ -276,6 +294,7 @@ unsigned fNumChannels; // optionally set by "a=rtpmap:" lines for audio sessions. Default: 1 float fScale; // set from a RTSP "Scale:" header + double fNPT_PTS_Offset; // set by "getNormalPlayTime()"; add this to a PTS to get NPT // Fields set by initiate(): Groupsock* fRTPSocket; Groupsock* fRTCPSocket; // works even for unicast | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MediaSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Media Sinks // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MediaSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Media Sources // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MultiFramedRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP sink for a common kind of payload format: Those which pack multiple, // complete codec frames (as many as possible) into each RTP packet. // C++ header @@ -80,9 +80,11 @@ unsigned ourMaxPacketSize() const { return fOurMaxPacketSize; } +public: // redefined virtual functions: + virtual void stopPlaying(); + protected: // redefined virtual functions: virtual Boolean continuePlaying(); - virtual void stopPlaying(); private: void buildAndSendPacket(Boolean isFirstPacket); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/MultiFramedRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP source for a common kind of payload format: Those which pack multiple, // complete codec frames (as many as possible) into each RTP packet. // C++ header @@ -93,7 +93,7 @@ Boolean fillInData(RTPInterface& rtpInterface); void assignMiscParams(unsigned short rtpSeqNo, unsigned rtpTimestamp, struct timeval presentationTime, - Boolean hasBeenSyncedUsingRTCP, + Boolean hasBeenSyncedUsingRTCP, Boolean rtpMarkerBit, struct timeval timeReceived); void skip(unsigned numBytes); // used to skip over an initial header void removePadding(unsigned numBytes); // used to remove trailing bytes @@ -112,6 +112,7 @@ unsigned char* data() const { return &fBuf[fHead]; } unsigned dataSize() const { return fTail-fHead; } Boolean rtpMarkerBit() const { return fRTPMarkerBit; } + Boolean& isFirstPacket() { return fIsFirstPacket; } protected: virtual void reset(); @@ -137,6 +138,7 @@ struct timeval fPresentationTime; // corresponding to "fRTPTimestamp" Boolean fHasBeenSyncedUsingRTCP; Boolean fRTPMarkerBit; + Boolean fIsFirstPacket; struct timeval fTimeReceived; }; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/OnDemandServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand. // C++ header @@ -56,14 +56,14 @@ unsigned short& rtpSeqNum, unsigned& rtpTimestamp); virtual void pauseStream(unsigned clientSessionId, void* streamToken); - virtual void seekStream(unsigned clientSessionId, void* streamToken, float seekNPT); + virtual void seekStream(unsigned clientSessionId, void* streamToken, double seekNPT); virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale); virtual void deleteStream(unsigned clientSessionId, void*& streamToken); protected: // new virtual functions, possibly redefined by subclasses virtual char const* getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource); - virtual void seekStreamSource(FramedSource* inputSource, float seekNPT); + virtual void seekStreamSource(FramedSource* inputSource, double seekNPT); virtual void setStreamSourceScale(FramedSource* inputSource, float scale); virtual void closeStreamSource(FramedSource *inputSource); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/OutputFile.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines for opening/closing named output files // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/PassiveServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that represents an existing // 'RTPSink', rather than one that creates new 'RTPSink's on demand. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/QCELPAudioRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Qualcomm "PureVoice" (aka. "QCELP") Audio RTP Sources // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/QuickTimeFileSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A sink that generates a QuickTime file from a composite media session // C++ header @@ -47,7 +47,7 @@ private: QuickTimeFileSink(UsageEnvironment& env, MediaSession& inputSession, - FILE* outFid, unsigned bufferSize, + char const* outputFileName, unsigned bufferSize, unsigned short movieWidth, unsigned short movieHeight, unsigned movieFPS, Boolean packetLossCompensate, Boolean syncStreams, Boolean generateHintTracks, | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/QuickTimeGenericRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sources containing generic QuickTime stream data, as defined in // <http://developer.apple.com/quicktime/icefloe/dispatch026.html> // C++ header @@ -59,7 +59,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: char const* fMIMEtypeString; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTCP.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTCP // C++ header @@ -66,7 +66,7 @@ // This prevents (for example) the handler for a multicast receiver being // called if some other multicast receiver happens to exit. // If "handleActiveParticipantsOnly" is False, then the handler is called - // for any incoming RTCP "BYE". + // for any incoming RTCP "BYE". void setSRHandler(TaskFunc* handlerTask, void* clientData); void setRRHandler(TaskFunc* handlerTask, void* clientData); // Assigns a handler routine to be called if a "SR" or "RR" @@ -84,7 +84,7 @@ void setStreamSocket(int sockNum, unsigned char streamChannelId); void addStreamSocket(int sockNum, unsigned char streamChannelId); void removeStreamSocket(int sockNum, unsigned char streamChannelId) { - fRTCPInterface.removeStreamSocket(sockNum, streamChannelId); + fRTCPInterface.removeStreamSocket(sockNum, streamChannelId); } // hacks to allow sending RTP over TCP (RFC 2236, section 10.12) | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTPInterface.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // An abstraction of a network interface used for RTP (or RTCP). // (This allows the RTP-over-TCP hack (RFC 2326, section 10.12) to // be implemented transparently.) @@ -89,7 +89,7 @@ int fNextTCPReadStreamSocketNum; unsigned char fNextTCPReadStreamChannelId; TaskScheduler::BackgroundHandlerProc* fReadHandlerProc; // if any - + AuxHandlerFunc* fAuxReadHandlerFunc; void* fAuxReadHandlerClientData; }; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sinks // C++ header @@ -75,10 +75,10 @@ fRTPInterface.setStreamSocket(sockNum, streamChannelId); } void addStreamSocket(int sockNum, unsigned char streamChannelId) { - fRTPInterface.addStreamSocket(sockNum, streamChannelId); + fRTPInterface.addStreamSocket(sockNum, streamChannelId); } void removeStreamSocket(int sockNum, unsigned char streamChannelId) { - fRTPInterface.removeStreamSocket(sockNum, streamChannelId); + fRTPInterface.removeStreamSocket(sockNum, streamChannelId); } // hacks to allow sending RTP over TCP (RFC 2236, section 10.12) @@ -137,7 +137,7 @@ HashTable::Iterator* fIter; }; - // The following is called whenever a RTCP RR packet is received: + // The following is called whenever a RTCP RR packet is received: void noteIncomingRR(u_int32_t SSRC, struct sockaddr_in const& lastFromAddress, unsigned lossStats, unsigned lastPacketNumReceived, unsigned jitter, unsigned lastSRTime, unsigned diffSR_RRTime); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // RTP Sources // C++ header @@ -35,8 +35,6 @@ static Boolean lookupByName(UsageEnvironment& env, char const* sourceName, RTPSource*& resultSource); - u_int16_t curPacketRTPSeqNum() const { return fCurPacketRTPSeqNum; } - u_int32_t curPacketRTPTimestamp() const { return fCurPacketRTPTimestamp; } Boolean curPacketMarkerBit() const { return fCurPacketMarkerBit; } unsigned char rtpPayloadFormat() const { return fRTPPayloadFormat; } @@ -72,6 +70,12 @@ handlerClientData); } + // Note that RTP receivers will usually not need to call either of the following two functions, because + // RTP sequence numbers and timestamps are usually not useful to receivers. + // (Our implementation of RTP reception already does all needed handling of RTP sequence numbers and timestamps.) + u_int16_t curPacketRTPSeqNum() const { return fCurPacketRTPSeqNum; } + u_int32_t curPacketRTPTimestamp() const { return fCurPacketRTPTimestamp; } + protected: RTPSource(UsageEnvironment& env, Groupsock* RTPgs, unsigned char rtpPayloadFormat, u_int32_t rtpTimestampFrequency); @@ -125,7 +129,7 @@ HashTable::Iterator* fIter; }; - // The following is called whenever a RTP packet is received: + // The following is called whenever a RTP packet is received: void noteIncomingPacket(u_int32_t SSRC, u_int16_t seqNum, u_int32_t rtpTimestamp, unsigned timestampFrequency, @@ -134,7 +138,7 @@ Boolean& resultHasBeenSyncedUsingRTCP, unsigned packetSize /* payload only */); - // The following is called whenever a RTCP SR packet is received: + // The following is called whenever a RTCP SR packet is received: void noteIncomingSR(u_int32_t SSRC, u_int32_t ntpTimestampMSW, u_int32_t ntpTimestampLSW, u_int32_t rtpTimestamp); @@ -146,7 +150,7 @@ protected: // constructor and destructor, called only by RTPSource: friend class RTPSource; - RTPReceptionStatsDB(RTPSource& rtpSource); + RTPReceptionStatsDB(); virtual ~RTPReceptionStatsDB(); protected: @@ -154,7 +158,6 @@ protected: friend class Iterator; - RTPSource& fOurRTPSource; unsigned fNumActiveSourcesSinceLastReset; private: @@ -200,9 +203,8 @@ protected: // called only by RTPReceptionStatsDB: friend class RTPReceptionStatsDB; - RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC, - u_int16_t initialSeqNum); - RTPReceptionStats(RTPSource& rtpSource, u_int32_t SSRC); + RTPReceptionStats(u_int32_t SSRC, u_int16_t initialSeqNum); + RTPReceptionStats(u_int32_t SSRC); virtual ~RTPReceptionStats(); private: @@ -221,7 +223,6 @@ // generate a reception report) protected: - RTPSource& fOurRTPSource; u_int32_t fSSRC; unsigned fNumPacketsReceivedSinceLastReset; unsigned fTotNumPacketsReceived; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTSPClient.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTSP client // C++ header @@ -48,32 +48,35 @@ RTSPClient*& resultClient); char* describeURL(char const* url, Authenticator* authenticator = NULL, - Boolean allowKasennaProtocol = False); + Boolean allowKasennaProtocol = False, int timeout = -1); // Issues a RTSP "DESCRIBE" command // Returns the SDP description of a session, or NULL if none // (This is dynamically allocated, and must later be freed // by the caller - using "delete[]") char* describeWithPassword(char const* url, char const* username, char const* password, - Boolean allowKasennaProtocol = False); + Boolean allowKasennaProtocol = False, + int timeout = -1); // Uses "describeURL()" to do a "DESCRIBE" - first // without using "password", then (if we get an Unauthorized // response) with an authentication response computed from "password" Boolean announceSDPDescription(char const* url, char const* sdpDescription, - Authenticator* authenticator = NULL); + Authenticator* authenticator = NULL, + int timeout = -1); // Issues a RTSP "ANNOUNCE" command // Returns True iff this command succeeds Boolean announceWithPassword(char const* url, char const* sdpDescription, - char const* username, char const* password); + char const* username, char const* password, int timeout = -1); // Uses "announceSDPDescription()" to do an "ANNOUNCE" - first // without using "password", then (if we get an Unauthorized // response) with an authentication response computed from "password" char* sendOptionsCmd(char const* url, char* username = NULL, char* password = NULL, - Authenticator* authenticator = NULL); + Authenticator* authenticator = NULL, + int timeout = -1); // Issues a RTSP "OPTIONS" command // Returns a string containing the list of options, or NULL @@ -86,16 +89,16 @@ // If "forceMulticastOnUnspecified" is True (and "streamUsingTCP" is False), // then the client will request a multicast stream if the media address // in the original SDP response was unspecified (i.e., 0.0.0.0). - // Note, however, that not all servers will support this. + // Note, however, that not all servers will support this. Boolean playMediaSession(MediaSession& session, - float start = 0.0f, float end = -1.0f, + double start = 0.0f, double end = -1.0f, float scale = 1.0f); // Issues an aggregate RTSP "PLAY" command on "session". // Returns True iff this command succeeds // (Note: start=-1 means 'resume'; end=-1 means 'play to end') Boolean playMediaSubsession(MediaSubsession& subsession, - float start = 0.0f, float end = -1.0f, + double start = 0.0f, double end = -1.0f, float scale = 1.0f, Boolean hackForDSS = False); // Issues a RTSP "PLAY" command on "subsession". @@ -164,7 +167,8 @@ void reset(); void resetTCPSockets(); - Boolean openConnectionFromURL(char const* url, Authenticator* authenticator); + Boolean openConnectionFromURL(char const* url, Authenticator* authenticator, + int timeout = -1); char* createAuthenticatorString(Authenticator const* authenticator, char const* cmd, char const* url); static void checkForAuthenticationFailure(unsigned responseCode, @@ -183,12 +187,12 @@ portNumBits& serverPortNum, unsigned char& rtpChannelId, unsigned char& rtcpChannelId); - Boolean parseRTPInfoHeader(char const* line, unsigned& trackId, - u_int16_t& seqNum, u_int32_t& timestamp); + Boolean parseRTPInfoHeader(char*& line, u_int16_t& seqNum, u_int32_t& timestamp); Boolean parseScaleHeader(char const* line, float& scale); - Boolean parseGetParameterHeader(char const* line, + Boolean parseGetParameterHeader(char const* line, const char* param, char*& value); + char const* sessionURL(MediaSession const& session) const; void constructSubsessionURL(MediaSubsession const& subsession, char const*& prefix, char const*& separator, @@ -215,7 +219,7 @@ Authenticator fCurrentAuthenticator; unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP char* fLastSessionId; - unsigned fSessionTimeoutParameter; // optionally set in response "Session:" headers + unsigned fSessionTimeoutParameter; // optionally set in response "Session:" headers #ifdef SUPPORT_REAL_RTSP char* fRealChallengeStr; char* fRealETagStr; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTSPCommon.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Common routines used by both RTSP clients and servers // C++ header @@ -36,11 +36,14 @@ Boolean parseRTSPRequestString(char const *reqStr, unsigned reqStrSize, char *resultCmdName, - unsigned resultCmdNameMaxSize, + unsigned resultCmdNameMaxSize, char* resultURLPreSuffix, - unsigned resultURLPreSuffixMaxSize, + unsigned resultURLPreSuffixMaxSize, char* resultURLSuffix, - unsigned resultURLSuffixMaxSize, + unsigned resultURLSuffixMaxSize, char* resultCSeq, - unsigned resultCSeqMaxSize); + unsigned resultCSeqMaxSize); + +Boolean parseRangeHeader(char const* buf, double& rangeStart, double& rangeEnd); + #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTSPOverHTTPServer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple HTTP server that acts solely to implement RTSP-over-HTTP tunneling // (to a separate RTSP server), as described in // http://developer.apple.com/documentation/QuickTime/QTSS/Concepts/chapter_2_section_14.html @@ -57,7 +57,7 @@ UsageEnvironment& envir() { return fOurServer.envir(); } void resetRequestBuffer(); Boolean parseHTTPRequestString(char* resultCmdName, - unsigned resultCmdNameMaxSize, + unsigned resultCmdNameMaxSize, char* sessionCookie, unsigned sessionCookieMaxSize, char* acceptStr, @@ -113,7 +113,7 @@ #if 0 //#####@@@@@ Authenticator fCurrentAuthenticator; // used if access control is needed unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP - unsigned fNumStreamStates; + unsigned fNumStreamStates; struct streamState { ServerMediaSubsession* subsession; void* streamToken; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/RTSPServer.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A RTSP server // C++ header @@ -63,7 +63,7 @@ public: static RTSPServer* createNew(UsageEnvironment& env, Port ourPort = 554, UserAuthenticationDatabase* authDatabase = NULL, - unsigned reclamationTestSeconds = 45); + unsigned reclamationTestSeconds = 65); // If ourPort.num() == 0, we'll choose the port number // Note: The caller is responsible for reclaiming "authDatabase" // If "reclamationTestSeconds" > 0, then the "RTSPClientSession" state for @@ -168,7 +168,7 @@ Boolean fIsMulticast, fSessionIsActive, fStreamAfterSETUP; Authenticator fCurrentAuthenticator; // used if access control is needed unsigned char fTCPStreamIdCount; // used for (optional) RTP/TCP - unsigned fNumStreamStates; + unsigned fNumStreamStates; struct streamState { ServerMediaSubsession* subsession; void* streamToken; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/SIPClient.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic SIP client // C++ header @@ -88,7 +88,7 @@ Boolean processURL(char const* url); Boolean sendINVITE(); static void inviteResponseHandler(void* clientData, int mask); - void doInviteStateMachine(unsigned responseCode); + void doInviteStateMachine(unsigned responseCode); void doInviteStateTerminated(unsigned responseCode); TaskToken fTimerA, fTimerB, fTimerD; static void timerAHandler(void* clientData); @@ -126,7 +126,7 @@ char const* fURL; unsigned fURLSize; struct in_addr fServerAddress; - portNumBits fServerPortNum; // in host order + portNumBits fServerPortNum; // in host order portNumBits fClientStartPortNum; // in host order unsigned fCallId, fFromTag; // set by us char const* fToTagStr; // set by the responder @@ -142,7 +142,7 @@ inviteClientState fInviteClientState; char fEventLoopStopFlag; unsigned fInviteStatusCode; - // 0: OK; 1: connection failed; 2: stream unavailable + // 0: OK; 1: connection failed; 2: stream unavailable }; #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/ServerMediaSession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A data structure that represents a session that consists of // potentially multiple (audio and/or video) sub-sessions // (This data structure is used for media *streamers* - i.e., servers. @@ -41,7 +41,7 @@ char const* description = NULL, Boolean isSSM = False, char const* miscSDPLines = NULL); - + virtual ~ServerMediaSession(); static Boolean lookupByName(UsageEnvironment& env, @@ -98,10 +98,10 @@ public: ServerMediaSubsessionIterator(ServerMediaSession& session); virtual ~ServerMediaSubsessionIterator(); - + ServerMediaSubsession* next(); // NULL if none void reset(); - + private: ServerMediaSession& fOurSession; ServerMediaSubsession* fNextPtr; @@ -135,7 +135,7 @@ unsigned short& rtpSeqNum, unsigned& rtpTimestamp) = 0; virtual void pauseStream(unsigned clientSessionId, void* streamToken); - virtual void seekStream(unsigned clientSessionId, void* streamToken, float seekNPT); + virtual void seekStream(unsigned clientSessionId, void* streamToken, double seekNPT); virtual void setStreamScale(unsigned clientSessionId, void* streamToken, float scale); virtual void deleteStream(unsigned clientSessionId, void*& streamToken); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/SimpleRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A simple RTP sink that packs frames into each outgoing // packet, without any fragmentation or special headers. // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/SimpleRTPSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A RTP source for a simple RTP payload format that // - doesn't have any special headers following the RTP header // (if necessary, the "offset" parameter can be used to specify a @@ -56,7 +56,7 @@ // redefined virtual functions: virtual Boolean processSpecialHeader(BufferedPacket* packet, unsigned& resultSpecialHeaderSize); - virtual char const* MIMEtype() const; + virtual char const* MIMEtype() const; private: char const* fMIMEtypeString; | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/VideoRTPSink.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A generic RTP sink for video codecs (abstract base class) // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/WAVAudioFileServerMediaSubsession.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s // on demand, from an WAV audio file. // C++ header @@ -41,7 +41,7 @@ virtual ~WAVAudioFileServerMediaSubsession(); protected: // redefined virtual functions - virtual void seekStreamSource(FramedSource* inputSource, float seekNPT); + virtual void seekStreamSource(FramedSource* inputSource, double seekNPT); virtual void setStreamSourceScale(FramedSource* inputSource, float scale); virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate); | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/WAVAudioFileSource.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // A WAV audio file source // NOTE: Samples are returned in little-endian order (the same order in which // they were stored in the file). | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/liveMedia.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Inclusion of header files representing the interface // for the entire library // | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/liveMedia_version.hh ^ |
@@ -1,10 +1,10 @@ // Version information for the "liveMedia" library -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. #ifndef _LIVEMEDIA_VERSION_HH #define _LIVEMEDIA_VERSION_HH -#define LIVEMEDIA_LIBRARY_VERSION_STRING "2007.10.31" -#define LIVEMEDIA_LIBRARY_VERSION_INT 1193788800 +#define LIVEMEDIA_LIBRARY_VERSION_STRING "2008.12.19" +#define LIVEMEDIA_LIBRARY_VERSION_INT 1229644800 #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/include/uLawAudioFilter.hh ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Filters for converting between raw PCM audio and uLaw // C++ header | ||
[+] | Changed | live.2008.12.20.tar.bz2/liveMedia/uLawAudioFilter.cpp ^ |
@@ -11,10 +11,10 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ // "liveMedia" -// Copyright (c) 1996-2007 Live Networks, Inc. All rights reserved. +// Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. // Filters for converting between raw PCM audio and uLaw // Implementation @@ -28,7 +28,7 @@ if (byteOrdering < 0 || byteOrdering > 2) { env.setResultMsg("uLawFromPCMAudioSource::createNew(): bad \"byteOrdering\" parameter"); return NULL; - } + } return new uLawFromPCMAudioSource(env, inputSource, byteOrdering); } @@ -37,11 +37,11 @@ int byteOrdering) : FramedFilter(env, inputSource), fByteOrdering(byteOrdering), fInputBuffer(NULL), fInputBufferSize(0) { -} +} uLawFromPCMAudioSource::~uLawFromPCMAudioSource() { delete[] fInputBuffer; -} +} void uLawFromPCMAudioSource::doGetNextFrame() { // Figure out how many bytes of input data to ask for, and increase @@ -154,11 +154,11 @@ FramedSource* inputSource) : FramedFilter(env, inputSource), fInputBuffer(NULL), fInputBufferSize(0) { -} +} PCMFromuLawAudioSource::~PCMFromuLawAudioSource() { delete[] fInputBuffer; -} +} void PCMFromuLawAudioSource::doGetNextFrame() { // Figure out how many bytes of input data to ask for, and increase @@ -230,10 +230,10 @@ ::NetworkFromHostOrder16(UsageEnvironment& env, FramedSource* inputSource) : FramedFilter(env, inputSource) { -} +} NetworkFromHostOrder16::~NetworkFromHostOrder16() { -} +} void NetworkFromHostOrder16::doGetNextFrame() { // Arrange to read data directly into the client's buffer: @@ -284,10 +284,10 @@ ::HostFromNetworkOrder16(UsageEnvironment& env, FramedSource* inputSource) : FramedFilter(env, inputSource) { -} +} HostFromNetworkOrder16::~HostFromNetworkOrder16() { -} +} void HostFromNetworkOrder16::doGetNextFrame() { // Arrange to read data directly into the client's buffer: @@ -337,10 +337,10 @@ EndianSwap16::EndianSwap16(UsageEnvironment& env, FramedSource* inputSource) : FramedFilter(env, inputSource) { -} +} EndianSwap16::~EndianSwap16() { -} +} void EndianSwap16::doGetNextFrame() { // Arrange to read data directly into the client's buffer: | ||
[+] | Changed | live.2008.12.20.tar.bz2/mediaServer/DynamicRTSPServer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand, // based on whether or not the specified stream name exists as a file // Implementation @@ -24,14 +24,15 @@ DynamicRTSPServer* DynamicRTSPServer::createNew(UsageEnvironment& env, Port ourPort, - UserAuthenticationDatabase* authDatabase) { + UserAuthenticationDatabase* authDatabase, + unsigned reclamationTestSeconds) { int ourSocket = -1; do { int ourSocket = setUpOurSocket(env, ourPort); if (ourSocket == -1) break; - return new DynamicRTSPServer(env, ourSocket, ourPort, authDatabase); + return new DynamicRTSPServer(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds); } while (0); if (ourSocket != -1) ::closeSocket(ourSocket); @@ -40,8 +41,8 @@ DynamicRTSPServer::DynamicRTSPServer(UsageEnvironment& env, int ourSocket, Port ourPort, - UserAuthenticationDatabase* authDatabase) - : RTSPServer(env, ourSocket, ourPort, authDatabase, 45/*reclamationTestSeconds*/) { + UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds) + : RTSPServer(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds) { } DynamicRTSPServer::~DynamicRTSPServer() { @@ -55,11 +56,11 @@ // First, check whether the specified "streamName" exists as a local file: FILE* fid = fopen(streamName, "rb"); Boolean fileExists = fid != NULL; - + // Next, check whether we already have a "ServerMediaSession" for this file: ServerMediaSession* sms = RTSPServer::lookupServerMediaSession(streamName); Boolean smsExists = sms != NULL; - + // Handle the four possibilities for "fileExists" and "smsExists": if (!fileExists) { if (smsExists) { @@ -148,7 +149,7 @@ // change the following to True: Boolean convertToULaw = False; sms->addSubsession(WAVAudioFileServerMediaSubsession::createNew(env, fileName, reuseSource, convertToULaw)); - } + } return sms; } | ||
[+] | Changed | live.2008.12.20.tar.bz2/mediaServer/DynamicRTSPServer.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand, // based on whether or not the specified stream name exists as a file // Header file @@ -28,11 +28,12 @@ class DynamicRTSPServer: public RTSPServer { public: static DynamicRTSPServer* createNew(UsageEnvironment& env, Port ourPort, - UserAuthenticationDatabase* authDatabase); + UserAuthenticationDatabase* authDatabase, + unsigned reclamationTestSeconds = 65); private: DynamicRTSPServer(UsageEnvironment& env, int ourSocket, Port ourPort, - UserAuthenticationDatabase* authDatabase); + UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds); // called only by createNew(); virtual ~DynamicRTSPServer(); | ||
[+] | Changed | live.2008.12.20.tar.bz2/mediaServer/live555MediaServer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // LIVE555 Media Server // main program | ||
[+] | Changed | live.2008.12.20.tar.bz2/mediaServer/version.hh ^ |
@@ -1,10 +1,10 @@ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // Version information for the LIVE555 Media Server application // Header file #ifndef _MEDIA_SERVER_VERSION_HH #define _MEDIA_SERVER_VERSION_HH -#define MEDIA_SERVER_VERSION_STRING "0.18" +#define MEDIA_SERVER_VERSION_STRING "0.20" #endif | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/MPEG2TransportStreamIndexer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A program that reads an existing MPEG-2 Transport Stream file, // and generates a separate index file that can be used - by our RTSP server // implementation - to support 'trick play' operations when streaming the @@ -74,7 +74,7 @@ *env << "Failed to open output file \"" << outputFileName << "\"\n"; exit(1); } - + // Start playing, to generate the output index file: *env << "Writing index file \"" << outputFileName << "\"..."; output->startPlaying(*indexer, afterPlaying, NULL); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/openRTSP.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A RTSP client test program that opens a RTSP URL argument, // and extracts the data from each incoming RTP stream. @@ -63,15 +63,16 @@ extern double initialSeekTime, duration, scale; double endTime = initialSeekTime; if (scale > 0) { - endTime = initialSeekTime + duration; - } else if (scale < 0) { + if (duration <= 0) endTime = -1.0f; + else endTime = initialSeekTime + duration; + } else { endTime = initialSeekTime - duration; if (endTime < 0) endTime = 0.0f; } if (client == NULL || session == NULL) return False; RTSPClient* rtspClient = (RTSPClient*)client; - return rtspClient->playMediaSession(*session, (float)initialSeekTime, (float)endTime, (float)scale); + return rtspClient->playMediaSession(*session, initialSeekTime, endTime, (float)scale); } Boolean clientTearDownSession(Medium* client, | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/playCommon.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A common framework, used for the "openRTSP" and "playSIP" applications // Implementation @@ -173,7 +173,7 @@ break; } - case 'I': { // specify input interface... + case 'I': { // specify input interface... NetAddressList addresses(argv[2]); if (addresses.numAddresses() == 0) { *env << "Failed to find network address for \"" << argv[2] << "\""; @@ -410,8 +410,8 @@ } case 's': { // specify initial seek time (trick play) - float arg; - if (sscanf(argv[2], "%g", &arg) != 1 || arg < 0) { + double arg; + if (sscanf(argv[2], "%lg", &arg) != 1 || arg < 0) { usage(); } initialSeekTime = arg; @@ -579,7 +579,7 @@ // Because we're saving the incoming data, rather than playing // it in real time, allow an especially large time threshold // (1 second) for reordering misordered incoming packets: - unsigned const thresh = 1000000; // 1 second + unsigned const thresh = 1000000; // 1 second subsession->rtpSource()->setPacketReorderingThresholdTime(thresh); if (socketInputBufferSize > 0) { @@ -605,7 +605,7 @@ << subsession->mediumName() << "/" << subsession->codecName() << "\" subsession. (Try adding the \"-p <portNum>\" option.)\n"; - } else { + } else { madeProgress = True; } } @@ -677,11 +677,10 @@ while ((subsession = iter.next()) != NULL) { if (subsession->readSource() == NULL) continue; // was not initiated - fileSink->startPlaying(*(subsession->readSource()), - subsessionAfterPlaying, - subsession); - madeProgress = True; - break; // play from one subsession only + fileSink->startPlaying(*(subsession->readSource()), + subsessionAfterPlaying, subsession); + madeProgress = True; + break; // play from one subsession only } if (!madeProgress) shutdown(); #endif @@ -691,7 +690,7 @@ iter.reset(); while ((subsession = iter.next()) != NULL) { if (subsession->readSource() == NULL) continue; // was not initiated - + // Create an output file for each desired stream: char outFileName[1000]; if (singleMedium == NULL) { @@ -752,7 +751,7 @@ subsession->sink->startPlaying(*(subsession->readSource()), subsessionAfterPlaying, subsession); - + // Also set a handler to be called if a RTCP "BYE" arrives // for this subsession: if (subsession->rtcpInstance() != NULL) { @@ -766,7 +765,7 @@ if (!madeProgress) shutdown(); } } - + // Finally, start playing each subsession, to start the data flow: startPlayingStreams(); @@ -959,7 +958,7 @@ } } virtual ~qosMeasurementRecord() { delete fNext; } - + void periodicQOSMeasurement(struct timeval const& timeNow); public: @@ -1108,16 +1107,16 @@ *env << "subsession\t" << subsession->mediumName() << "/" << subsession->codecName() << "\n"; - + unsigned numPacketsReceived = 0, numPacketsExpected = 0; - + if (curQOSRecord != NULL) { numPacketsReceived = curQOSRecord->totNumPacketsReceived; numPacketsExpected = curQOSRecord->totNumPacketsExpected; } *env << "num_packets_received\t" << numPacketsReceived << "\n"; *env << "num_packets_lost\t" << numPacketsExpected - numPacketsReceived << "\n"; - + if (curQOSRecord != NULL) { unsigned secsDiff = curQOSRecord->measurementEndTime.tv_sec - curQOSRecord->measurementStartTime.tv_sec; @@ -1125,11 +1124,11 @@ - curQOSRecord->measurementStartTime.tv_usec; double measurementTime = secsDiff + usecsDiff/1000000.0; *env << "elapsed_measurement_time\t" << measurementTime << "\n"; - + *env << "kBytes_received_total\t" << curQOSRecord->kBytesTotal << "\n"; - + *env << "measurement_sampling_interval_ms\t" << qosMeasurementIntervalMS << "\n"; - + if (curQOSRecord->kbits_per_second_max == 0) { // special case: we didn't receive any data: *env << @@ -1142,7 +1141,7 @@ << (measurementTime == 0.0 ? 0.0 : 8*curQOSRecord->kBytesTotal/measurementTime) << "\n"; *env << "kbits_per_second_max\t" << curQOSRecord->kbits_per_second_max << "\n"; } - + *env << "packet_loss_percentage_min\t" << 100*curQOSRecord->packet_loss_fraction_min << "\n"; double packetLossFraction = numPacketsExpected == 0 ? 1.0 : 1.0 - numPacketsReceived/(double)numPacketsExpected; @@ -1150,7 +1149,7 @@ *env << "packet_loss_percentage_ave\t" << 100*packetLossFraction << "\n"; *env << "packet_loss_percentage_max\t" << (packetLossFraction == 1.0 ? 100.0 : 100*curQOSRecord->packet_loss_fraction_max) << "\n"; - + #ifdef SUPPORT_REAL_RTSP if (session->isRealNetworksRDT) { RealRDTSource* rdt = (RealRDTSource*)src; @@ -1178,11 +1177,11 @@ #ifdef SUPPORT_REAL_RTSP } #endif - + curQOSRecord = curQOSRecord->fNext; } } - } + } *env << "end_QOS_statistics\n"; delete qosRecordHead; @@ -1220,7 +1219,7 @@ } void checkForPacketArrival(void* /*clientData*/) { - if (!notifyOnPacketArrival) return; // we're not checking + if (!notifyOnPacketArrival) return; // we're not checking // Check each subsession, to see whether it has received data packets: unsigned numSubsessionsChecked = 0; @@ -1278,7 +1277,7 @@ } void checkInterPacketGaps(void* /*clientData*/) { - if (interPacketGapMaxTime == 0) return; // we're not checking + if (interPacketGapMaxTime == 0) return; // we're not checking // Check each subsession, counting up how many packets have been received: unsigned newTotNumPacketsReceived = 0; @@ -1299,7 +1298,7 @@ sessionAfterPlaying(); } else { totNumPacketsReceived = newTotNumPacketsReceived; - // Check again, after the specified delay: + // Check again, after the specified delay: interPacketGapCheckTimerTask = env->taskScheduler().scheduleDelayedTask(interPacketGapMaxTime*1000000, (TaskFunc*)checkInterPacketGaps, NULL); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/playCommon.hh ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2003, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A common framework, used for the "openRTSP" and "playSIP" applications // Interfaces | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/playSIP.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A SIP client test program that opens a SIP URL argument, // and extracts the data from each incoming RTP stream. @@ -64,7 +64,7 @@ unsigned proxyServerAddress // later, allow for IPv6 ##### = *(unsigned*)(address.data()); if (proxyServerPortNum == 0) proxyServerPortNum = 5060; // default - + sipClient->setProxyServer(proxyServerAddress, proxyServerPortNum); } } | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/sapWatch.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A program that receives and prints SDP/SAP announcements // (on the default SDP/SAP directory: 224.2.127.254/9875) @@ -38,9 +38,9 @@ const Port port(9875); const unsigned char ttl = 0; // we're only reading from this mcast group - + Groupsock inputGroupsock(*env, sessionAddress, port, ttl); - + // Start reading and printing incoming packets // (Because this is the only thing we do, we can just do this // synchronously, in a loop, so we don't need to set up an asynchronous | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testAMRAudioStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads an AMR audio file (as defined in RFC 3267) // and streams it using RTP // main program @@ -114,7 +114,7 @@ << env->getResultMsg() << "\n"; exit(1); } - + // Finally, start playing: *env << "Beginning to read from file...\n"; audioSink->startPlaying(*audioSource, afterPlaying, audioSink); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testGSMStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that streams GSM audio via RTP/RTCP // main program @@ -78,12 +78,12 @@ const unsigned short rtpPortNum = 6666; const unsigned short rtcpPortNum = rtpPortNum+1; const unsigned char ttl = 1; // low, in case routers don't admin scope - + struct in_addr destinationAddress; destinationAddress.s_addr = our_inet_addr(destinationAddressStr); const Port rtpPort(rtpPortNum); const Port rtcpPort(rtcpPortNum); - + sessionState.rtpGroupsock = new Groupsock(*env, destinationAddress, rtpPort, ttl); sessionState.rtcpGroupsock @@ -92,11 +92,11 @@ sessionState.rtpGroupsock->multicastSendOnly(); sessionState.rtcpGroupsock->multicastSendOnly(); #endif - + // Create a 'GSM RTP' sink from the RTP 'groupsock': sessionState.sink = GSMAudioRTPSink::createNew(*env, sessionState.rtpGroupsock); - + // Create (and start) a 'RTCP instance' for this RTP sink: const unsigned estimatedSessionBandwidth = 160; // in kbps; for RTCP b/w share const unsigned maxCNAMElen = 100; @@ -141,7 +141,7 @@ *env << "Failed to create GSM source\n"; exit(1); } - + // Finally, start the streaming: *env << "Beginning streaming...\n"; sessionState.sink->startPlaying(*sessionState.source, afterPlaying, NULL); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMP3Receiver.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that receives a RTP/RTCP multicast MP3 stream, // and outputs the resulting MP3 file stream to 'stdout' // main program @@ -67,12 +67,12 @@ #ifndef USE_SSM const unsigned char ttl = 1; // low, in case routers don't admin scope #endif - + struct in_addr sessionAddress; sessionAddress.s_addr = our_inet_addr(sessionAddressStr); const Port rtpPort(rtpPortNum); const Port rtcpPort(rtcpPortNum); - + #ifdef USE_SSM char* sourceAddressStr = "aaa.bbb.ccc.ddd"; // replace this with the real source address @@ -87,7 +87,7 @@ Groupsock rtpGroupsock(*env, sessionAddress, rtpPort, ttl); Groupsock rtcpGroupsock(*env, sessionAddress, rtcpPort, ttl); #endif - + RTPSource* rtpSource; #ifndef STREAM_USING_ADUS // Create the data source: a "MPEG Audio RTP source" | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMP3Streamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that streams a MP3 file via RTP/RTCP // main program @@ -80,12 +80,12 @@ const unsigned short rtpPortNum = 6666; const unsigned short rtcpPortNum = rtpPortNum+1; const unsigned char ttl = 1; // low, in case routers don't admin scope - + struct in_addr destinationAddress; destinationAddress.s_addr = our_inet_addr(destinationAddressStr); const Port rtpPort(rtpPortNum); const Port rtcpPort(rtcpPortNum); - + sessionState.rtpGroupsock = new Groupsock(*env, destinationAddress, rtpPort, ttl); sessionState.rtcpGroupsock @@ -94,7 +94,7 @@ sessionState.rtpGroupsock->multicastSendOnly(); sessionState.rtcpGroupsock->multicastSendOnly(); #endif - + // Create a 'MP3 RTP' sink from the RTP 'groupsock': #ifdef STREAM_USING_ADUS unsigned char rtpPayloadFormat = 96; // A dynamic payload format code @@ -105,7 +105,7 @@ sessionState.sink = MPEG1or2AudioRTPSink::createNew(*env, sessionState.rtpGroupsock); #endif - + // Create (and start) a 'RTCP instance' for this RTP sink: const unsigned estimatedSessionBandwidth = 160; // in kbps; for RTCP b/w share const unsigned maxCNAMElen = 100; @@ -155,7 +155,7 @@ << "\" as a MP3 file source\n"; exit(1); } - + #ifdef STREAM_USING_ADUS // Add a filter that converts the source MP3s to ADUs: sessionState.source @@ -170,7 +170,7 @@ unsigned char interleaveCycle[] = {0,2,1,3}; // or choose your own order... unsigned const interleaveCycleSize = (sizeof interleaveCycle)/(sizeof (unsigned char)); - Interleaving interleaving(interleaveCycleSize, interleaveCycle); + Interleaving interleaving(interleaveCycleSize, interleaveCycle); sessionState.source = MP3ADUinterleaver::createNew(*env, interleaving, sessionState.source); if (sessionState.source == NULL) { | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2AudioVideoStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-1 or 2 Program Stream file, // splits it into Audio and Video Elementary Streams, // and streams both using RTP @@ -156,7 +156,7 @@ // wait until its sink ends playing also: if (audioSource->isCurrentlyAwaitingData() || videoSource->isCurrentlyAwaitingData()) return; - + // Now that both sinks have ended, close both input sources, // and start playing again: *env << "...done reading from file\n"; @@ -182,7 +182,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + // We must demultiplex Audio and Video Elementary Streams // from the input source: mpegDemux = MPEG1or2Demux::createNew(*env, fileSource); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2AudioVideoToDarwin.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-1 or 2 Program Stream file, // splits it into Audio and Video Elementary Streams, // and streams both using RTP, through a remote Darwin Streaming Server. @@ -143,7 +143,7 @@ // wait until its sink ends playing also: if (audioSource->isCurrentlyAwaitingData() || videoSource->isCurrentlyAwaitingData()) return; - + // Now that both sinks have ended, close both input sources, // and start playing again: *env << "...done reading from file\n"; @@ -169,7 +169,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + // We must demultiplex Audio and Video Elementary Streams // from the input source: mpegDemux = MPEG1or2Demux::createNew(*env, fileSource); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2ProgramToTransportStream.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A program that converts a MPEG-1 or 2 Program Stream file into // a Transport Stream file. // main program @@ -40,7 +40,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + // Create a MPEG demultiplexor that reads from that source. MPEG1or2Demux* baseDemultiplexor = MPEG1or2Demux::createNew(*env, inputSource); @@ -57,7 +57,7 @@ *env << "Unable to open file \"" << outputFileName << "\" as a file sink\n"; exit(1); } - + // Finally, start playing: *env << "Beginning to read...\n"; outputSink->startPlaying(*tsFrames, afterPlaying, NULL); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2Splitter.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that splits a MPEG-1 or 2 Program Stream file into // video and audio output files. // main program @@ -53,7 +53,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + // Create a MPEG demultiplexor that reads from that source. sessionState.baseDemultiplexor = MPEG1or2Demux::createNew(*env, inputSource); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2VideoReceiver.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2000, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that receives a RTP/RTCP multicast MPEG video stream, // and outputs the resulting MPEG file stream to 'stdout' // main program @@ -62,12 +62,12 @@ #ifndef USE_SSM const unsigned char ttl = 1; // low, in case routers don't admin scope #endif - + struct in_addr sessionAddress; sessionAddress.s_addr = our_inet_addr(sessionAddressStr); const Port rtpPort(rtpPortNum); const Port rtcpPort(rtcpPortNum); - + #ifdef USE_SSM char* sourceAddressStr = "aaa.bbb.ccc.ddd"; // replace this with the real source address @@ -82,7 +82,7 @@ Groupsock rtpGroupsock(*env, sessionAddress, rtpPort, ttl); Groupsock rtcpGroupsock(*env, sessionAddress, rtcpPort, ttl); #endif - + // Create the data source: a "MPEG Video RTP source" sessionState.source = MPEG1or2VideoRTPSource::createNew(*env, &rtpGroupsock); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG1or2VideoStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-1 or 2 Video Elementary Stream file, // and streams it using RTP // main program @@ -152,7 +152,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + FramedSource* videoES; #ifdef SOURCE_IS_PROGRAM_STREAM // We must demultiplex a Video Elementary Stream from the input source: | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG2TransportStreamTrickPlay.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A program that tests 'trick mode' operations on a MPEG-2 Transport Stream file, // by generating a new Transport Stream file that represents the result of the // 'trick mode' operation (seeking and/or fast forward/reverse play). @@ -114,7 +114,7 @@ *env << "Failed to open output file \"" << outputFileName << "\"\n"; exit(1); } - + // Start playing, to generate the output file: *env << "Writing output file \"" << outputFileName << "\" (start time " << startTime | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG2TransportStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-2 Transport Stream file, // and streams it using RTP // main program @@ -147,7 +147,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + // Create a 'framer' for the input source (to give us proper inter-packet gaps): videoSource = MPEG2TransportStreamFramer::createNew(*env, fileSource); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG4VideoStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-4 Video Elementary Stream file, // and streams it using RTP // main program @@ -113,12 +113,12 @@ << "\" as a byte-stream file source\n"; exit(1); } - + FramedSource* videoES = fileSource; // Create a framer for the Video Elementary Stream: videoSource = MPEG4VideoStreamFramer::createNew(*env, videoES); - + // Finally, start playing: *env << "Beginning to read from file...\n"; videoSink->startPlaying(*videoSource, afterPlaying, videoSink); | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testMPEG4VideoToDarwin.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a MPEG-4 Video Elementary Stream file, // and streams both using RTP, through a remote Darwin Streaming Server. // main program @@ -137,7 +137,7 @@ << "\" as a byte-stream file source\n"; exit(1); } - + FramedSource* videoES = fileSource; // Create a framer for the Video Elementary Stream: | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testOnDemandRTSPServer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that demonstrates how to stream - via unicast RTP // - various kinds of file on demand, using a built-in RTSP server. // main program @@ -51,7 +51,7 @@ #endif // Create the RTSP server: - RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554, authDB, 45); + RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554, authDB); if (rtspServer == NULL) { *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n"; exit(1); @@ -126,13 +126,13 @@ descriptionString); Boolean useADUs = False; Interleaving* interleaving = NULL; -#ifdef STREAM_USING_ADUS +#ifdef STREAM_USING_ADUS useADUs = True; #ifdef INTERLEAVE_ADUS unsigned char interleaveCycle[] = {0,2,1,3}; // or choose your own... unsigned const interleaveCycleSize = (sizeof interleaveCycle)/(sizeof (unsigned char)); - interleaving = new Interleaving(interleaveCycleSize, interleaveCycle); + interleaving = new Interleaving(interleaveCycleSize, interleaveCycle); #endif #endif sms->addSubsession(MP3AudioFileServerMediaSubsession @@ -228,7 +228,7 @@ static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms, char const* streamName, char const* inputFileName) { char* url = rtspServer->rtspURL(sms); - UsageEnvironment& env = rtspServer->envir(); + UsageEnvironment& env = rtspServer->envir(); env << "\n\"" << streamName << "\" stream, from the file \"" << inputFileName << "\"\n"; env << "Play this stream using the URL \"" << url << "\"\n"; | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testRelay.cpp ^ |
@@ -11,11 +11,11 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that receives a UDP multicast stream -// and retransmits it to another (multicast or unicast) address & port +// and retransmits it to another (multicast or unicast) address & port // main program #include <liveMedia.hh> @@ -44,7 +44,7 @@ Port const inputPort(8888); unsigned char const inputTTL = 0; // we're only reading from this mcast group - + #ifdef USE_SSM char* sourceAddressStr = "aaa.bbb.ccc.ddd"; // replace this with the real source address @@ -55,7 +55,7 @@ #else Groupsock inputGroupsock(*env, inputAddress, inputPort, inputTTL); #endif - + // Then create a liveMedia 'source' object, encapsulating this groupsock: FramedSource* source = BasicUDPSource::createNew(*env, &inputGroupsock); @@ -67,10 +67,10 @@ // address as "inputAddressStr". struct in_addr outputAddress; outputAddress.s_addr = our_inet_addr(outputAddressStr); - + Port const outputPort(4444); unsigned char const outputTTL = 255; - + Groupsock outputGroupsock(*env, outputAddress, outputPort, outputTTL); // Then create a liveMedia 'sink' object, encapsulating this groupsock: | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/testWAVAudioStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that streams a WAV audio file via RTP/RTCP // main program @@ -83,7 +83,7 @@ *env << bitsPerSample << " bits-per-sample, "; *env << numChannels << " channels => "; *env << bitsPerSecond << " bits-per-second\n"; - + // Add in any filter necessary to transform the data prior to streaming. // (This is where any audio compression would get added.) char* mimeType; @@ -143,24 +143,24 @@ const unsigned short rtpPortNum = 2222; const unsigned short rtcpPortNum = rtpPortNum+1; const unsigned char ttl = 255; - + const Port rtpPort(rtpPortNum); const Port rtcpPort(rtcpPortNum); - + sessionState.rtpGroupsock = new Groupsock(*env, destinationAddress, rtpPort, ttl); sessionState.rtpGroupsock->multicastSendOnly(); // we're a SSM source sessionState.rtcpGroupsock = new Groupsock(*env, destinationAddress, rtcpPort, ttl); sessionState.rtcpGroupsock->multicastSendOnly(); // we're a SSM source - + // Create an appropriate audio RTP sink (using "SimpleRTPSink") // from the RTP 'groupsock': sessionState.sink = SimpleRTPSink::createNew(*env, sessionState.rtpGroupsock, payloadFormatCode, samplingFrequency, "audio", mimeType, numChannels); - + // Create (and start) a 'RTCP instance' for this RTP sink: const unsigned estimatedSessionBandwidth = bitsPerSecond/1000; // in kbps; for RTCP b/w share | ||
[+] | Changed | live.2008.12.20.tar.bz2/testProgs/vobStreamer.cpp ^ |
@@ -11,9 +11,9 @@ 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., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA **********/ -// Copyright (c) 1996-2007, Live Networks, Inc. All rights reserved +// Copyright (c) 1996-2008, Live Networks, Inc. All rights reserved // A test program that reads a VOB file // splits it into Audio (AC3) and Video (MPEG) Elementary Streams, // and streams both using RTP. @@ -122,7 +122,7 @@ if (iFramesOnly && (mediaToStream&VOB_VIDEO) == 0) { *env << "Warning: Because we're not streaming video, the -i flag has no effect.\n"; } - + inputFileNames = &argv[1]; curInputFileName = inputFileNames; @@ -155,7 +155,7 @@ audioSink = AC3AudioRTPSink::createNew(*env, rtpGroupsockAudio, 96, 0); // set the RTP timestamp frequency 'for real' later - + // Create (and start) a 'RTCP instance' for this RTP sink: rtcpGroupsockAudio = new Groupsock(*env, destinationAddress, rtcpPortAudio, ttl); @@ -173,10 +173,10 @@ rtpGroupsockVideo = new Groupsock(*env, destinationAddress, rtpPortVideo, ttl); rtpGroupsockVideo->multicastSendOnly(); // because we're a SSM source - + // Create a 'MPEG Video RTP' sink from the RTP 'groupsock': videoSink = MPEG1or2VideoRTPSink::createNew(*env, rtpGroupsockVideo); - + // Create (and start) a 'RTCP instance' for this RTP sink: rtcpGroupsockVideo = new Groupsock(*env, destinationAddress, rtcpPortVideo, ttl); @@ -229,7 +229,7 @@ || videoSource != NULL && videoSource->isCurrentlyAwaitingData()) { return; } - + // Now that both sinks have ended, close both input sources, // and start playing again: *env << "...done reading from file\n"; @@ -257,7 +257,7 @@ haveReadOneFile = False; curInputFileName = inputFileNames; } - + // Open the current input file as a 'byte-stream file source': ByteStreamFileSource* fileSource = ByteStreamFileSource::createNew(*env, *curInputFileName); @@ -270,7 +270,7 @@ return; } haveReadOneFile = True; - + // We must demultiplex Audio and Video Elementary Streams // from the input source: mpegDemux = MPEG1or2Demux::createNew(*env, fileSource); |