Commit cb38960f authored by Felix Paul Kühne's avatar Felix Paul Kühne

* update live building, removed support for compilation on OSX < 10.4 and...

* update live building, removed support for compilation on OSX < 10.4 and included the current patches
parent b73506f5
...@@ -1072,16 +1072,22 @@ live555-$(LIVEDOTCOM_VERSION).tar.gz: ...@@ -1072,16 +1072,22 @@ live555-$(LIVEDOTCOM_VERSION).tar.gz:
live: live555-$(LIVEDOTCOM_VERSION).tar.gz live: live555-$(LIVEDOTCOM_VERSION).tar.gz
$(EXTRACT_GZ) $(EXTRACT_GZ)
patch -p 0 < Patches/live.patch patch -p 0 < Patches/live.patch
patch -p 0 < Patches/livedotcom-win32.patch ifdef HAVE_WIN32
patch -p 0 < Patches/live-osx.patch patch -p0 < Patches/livedotcom-win32.patch
endif
ifdef HAVE_DARWIN_OS
patch -p0 < Patches/live-osx.patch
endif
patch -p0 < Patches/live-starttime.patch
patch -p0 < Patches/live-config.patch
ifdef HAVE_UCLIBC
patch -p0 < Patches/live-noapps.patch
endif
.live: live .live: live
ifdef HAVE_WIN32 ifdef HAVE_WIN32
(cd $<;./genMakefiles mingw && make $(HOSTCC)) (cd $<;./genMakefiles mingw && make $(HOSTCC))
else else
ifeq ($(HOST),ppc-darwin)
(cd $<; ./genMakefiles macosx-before-version-10.4 && make )
else
ifdef HAVE_DARWIN_OS ifdef HAVE_DARWIN_OS
(cd $<; sed -e 's%EXTRA_CFLAGS%$(EXTRA_CFLAGS)%' -e 's%EXTRA_LDFLAGS%$(EXTRA_LDFLAGS)%' -i.orig config.macosx) (cd $<; sed -e 's%EXTRA_CFLAGS%$(EXTRA_CFLAGS)%' -e 's%EXTRA_LDFLAGS%$(EXTRA_LDFLAGS)%' -i.orig config.macosx)
(cd $<; ./genMakefiles macosx && make) (cd $<; ./genMakefiles macosx && make)
...@@ -1089,7 +1095,6 @@ else ...@@ -1089,7 +1095,6 @@ else
(cd $<; sed -e 's/=/= EXTRA_CPPFLAGS/' -e 's%EXTRA_CPPFLAGS%-I/include%' -i.orig groupsock/Makefile.head) (cd $<; sed -e 's/=/= EXTRA_CPPFLAGS/' -e 's%EXTRA_CPPFLAGS%-I/include%' -i.orig groupsock/Makefile.head)
(cd $<; ./genMakefiles linux && make $(HOSTCC)) (cd $<; ./genMakefiles linux && make $(HOSTCC))
endif endif
endif
endif endif
touch $@ touch $@
......
diff -x Makefile -uN live/config.cygwin live.new/config.cygwin
--- live/config.cygwin 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.cygwin 2007-02-22 09:32:20.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=socklen_t
+COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=socklen_t -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = gcc
C_FLAGS = $(COMPILE_OPTS) -DUSE_OUR_BZERO=1 -D__CYGWIN__
diff -x Makefile -uN live/config.freebsd live.new/config.freebsd
--- live/config.freebsd 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.freebsd 2007-02-22 09:32:06.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1
+COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.linux live.new/config.linux
--- live/config.linux 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.linux 2007-02-22 09:31:24.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.linux-gdb live.new/config.linux-gdb
--- live/config.linux-gdb 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.linux-gdb 2007-02-22 09:09:55.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=socklen_t -g -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=socklen_t -g -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.macosx-before-version-10.4 live.new/config.macosx-before-version-10.4
--- live/config.macosx-before-version-10.4 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.macosx-before-version-10.4 2007-02-22 09:10:30.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=int
+COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=int -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.mingw live.new/config.mingw
--- live/config.mingw 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.mingw 2007-02-22 09:10:48.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=int
+COMPILE_OPTS = $(INCLUDES) -I. -O -DSOCKLEN_T=int -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = gcc
C_FLAGS = $(COMPILE_OPTS) -DUSE_OUR_BZERO=1 -D__MINGW32__
diff -x Makefile -uN live/config.openbsd live.new/config.openbsd
--- live/config.openbsd 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.openbsd 2007-02-22 09:31:42.000000000 +0100
@@ -1,5 +1,5 @@
.SUFFIXES: .cpp
-COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t
+COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.solaris live.new/config.solaris
--- live/config.solaris 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.solaris 2007-02-22 09:34:49.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O -DSOLARIS -DSOCKLEN_T=socklen_t
+COMPILE_OPTS = $(INCLUDES) -I. -O -DSOLARIS -DSOCKLEN_T=socklen_t -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS)
diff -x Makefile -uN live/config.uClinux live.new/config.uClinux
--- live/config.uClinux 2007-02-20 12:33:45.000000000 +0100
+++ live.new/config.uClinux 2007-02-22 09:35:01.000000000 +0100
@@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = $(CC)
CFLAGS += $(COMPILE_OPTS)
--- live/config.armlinux 2007-04-24 11:38:22.000000000 +0200
+++ live.new/config.armlinux 2007-04-28 15:59:33.000000000 +0200
@@ -1,5 +1,5 @@
CROSS_COMPILE= arm-elf-
-COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DUSE_SYSTEM_RANDOM=1
C = c
C_COMPILER = $(CROSS_COMPILE)gcc
C_FLAGS = $(COMPILE_OPTS)
--- /dev/null 2007-05-14 09:00:32.045340388 +0200
+++ live/config.armeb-uclibc 2007-05-14 16:55:22.000000000 +0200
@@ -0,0 +1,18 @@
+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 -DUSE_SYSTEM_RANDOM=1
+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 =
--- live/Makefile.tail.orig 2007-05-14 17:15:25.000000000 +0200
+++ live/Makefile.tail 2007-05-14 17:16:17.000000000 +0200
@@ -18,9 +18,7 @@
ALL = $(LIVEMEDIA_LIB) \
$(GROUPSOCK_LIB) \
$(USAGE_ENVIRONMENT_LIB) \
- $(BASIC_USAGE_ENVIRONMENT_LIB) \
- $(TESTPROGS_APP) \
- $(MEDIA_SERVER_APP)
+ $(BASIC_USAGE_ENVIRONMENT_LIB)
all: $(ALL)
diff -ruN live.old/Makefile.tail live/Makefile.tail diff -ruN live/Makefile.tail live.new/Makefile.tail
--- live.old/Makefile.tail 2006-11-16 03:09:43.000000000 +0100 --- live/Makefile.tail 2007-01-17 21:44:27.000000000 +0100
+++ live/Makefile.tail 2006-11-16 22:10:06.000000000 +0100 +++ live.new/Makefile.tail 2007-02-20 08:45:20.000000000 +0100
@@ -18,9 +18,7 @@ @@ -17,10 +17,8 @@
ALL = $(LIVEMEDIA_LIB) \ ALL = $(LIVEMEDIA_LIB) \
$(GROUPSOCK_LIB) \ $(GROUPSOCK_LIB) \
$(USAGE_ENVIRONMENT_LIB) \ $(USAGE_ENVIRONMENT_LIB) \
...@@ -12,26 +13,12 @@ diff -ruN live.old/Makefile.tail live/Makefile.tail ...@@ -12,26 +13,12 @@ diff -ruN live.old/Makefile.tail live/Makefile.tail
all: $(ALL) all: $(ALL)
diff -ruN live.old/config.macosx live/config.macosx diff -ruN live/config.macosx live.new/config.macosx
--- live.old/config.macosx 2006-11-16 03:09:43.000000000 +0100 --- live/config.macosx 2007-01-17 21:44:26.000000000 +0100
+++ live/config.macosx 2006-11-16 22:09:58.000000000 +0100 +++ live.new/config.macosx 2007-02-20 08:43:45.000000000 +0100
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
-COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1 -COMPILE_OPTS = $(INCLUDES) -I. -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1
+COMPILE_OPTS = $(INCLUDES) -I. EXTRA_CFLAGS -DBSD=1 -O -DSOCKLEN_T=socklen_t -DUSE_LOCALE -DHAVE_SOCKADDR_LEN=1 +COMPILE_OPTS = $(INCLUDES) -I. $(EXTRA_LDFLAGS) -DBSD=1 -O -DSOCKLEN_T=socklen_t -DHAVE_SOCKADDR_LEN=1
C = c C = c
C_COMPILER = cc C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS) C_FLAGS = $(COMPILE_OPTS)
@@ -7,10 +7,10 @@
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall
OBJ = o
LINK = c++ -o
-LINK_OPTS = -L.
+LINK_OPTS = -L. EXTRA_LDFLAGS
CONSOLE_LINK_OPTS = $(LINK_OPTS)
-LIBRARY_LINK = ld -o
-LIBRARY_LINK_OPTS = $(LINK_OPTS) -r
+LIBRARY_LINK = ar cru
+LIBRARY_LINK_OPTS =
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
diff -ruN live.orig/liveMedia/MediaSession.cpp live/liveMedia/MediaSession.cpp
--- live.orig/liveMedia/MediaSession.cpp 2007-01-17 21:44:26.000000000 +0100
+++ live/liveMedia/MediaSession.cpp 2007-01-22 22:17:54.000000000 +0100
@@ -61,7 +61,7 @@
MediaSession::MediaSession(UsageEnvironment& env)
: Medium(env),
fSubsessionsHead(NULL), fSubsessionsTail(NULL),
- fConnectionEndpointName(NULL), fMaxPlayEndTime(0.0f),
+ fConnectionEndpointName(NULL), fMaxPlayStartTime(0.0f), fMaxPlayEndTime(0.0f),
fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL) {
#ifdef SUPPORT_REAL_RTSP
RealInitSDPAttributes(this);
@@ -348,8 +348,8 @@
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, float& startTime, float& endTime) {
+ return sscanf(sdpLine, "a=range: npt = %g - %g", &startTime, &endTime) == 2;
}
Boolean MediaSession::parseSDPAttribute_range(char const* sdpLine) {
@@ -357,9 +357,13 @@
// (Later handle other kinds of "a=range" attributes also???#####)
Boolean parseSuccess = False;
+ float playStartTime;
float playEndTime;
- if (parseRangeAttribute(sdpLine, playEndTime)) {
+ if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
parseSuccess = True;
+ if (playStartTime != fMaxPlayStartTime && playStartTime >= 0.0f) {
+ fMaxPlayStartTime = playStartTime;
+ }
if (playEndTime > fMaxPlayEndTime) {
fMaxPlayEndTime = playEndTime;
}
@@ -526,7 +530,7 @@
fSizelength(0), fStreamstateindication(0), fStreamtype(0),
fCpresent(False), fRandomaccessindication(False),
fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL),
- fPlayEndTime(0.0),
+ fPlayStartTime(0.0), fPlayEndTime(0.0),
fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f),
fRTPSocket(NULL), fRTCPSocket(NULL),
fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL) {
@@ -548,6 +552,12 @@
#endif
}
+float MediaSubsession::playStartTime() const {
+ if (fPlayStartTime > 0) return fPlayStartTime;
+
+ return fParent.playStartTime();
+}
+
float MediaSubsession::playEndTime() const {
if (fPlayEndTime > 0) return fPlayEndTime;
@@ -967,9 +977,16 @@
// (Later handle other kinds of "a=range" attributes also???#####)
Boolean parseSuccess = False;
+ float playStartTime;
float playEndTime;
- if (parseRangeAttribute(sdpLine, playEndTime)) {
+ if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
parseSuccess = True;
+ if (playStartTime != fPlayStartTime && playStartTime >= 0.0f ) {
+ fPlayStartTime = playStartTime;
+ if (playStartTime != fParent.playStartTime()) {
+ fParent.playStartTime() = playStartTime;
+ }
+ }
if (playEndTime > fPlayEndTime) {
fPlayEndTime = playEndTime;
if (playEndTime > fParent.playEndTime()) {
diff -ruN live.orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
--- live.orig/liveMedia/RTSPClient.cpp 2007-01-22 22:17:46.000000000 +0100
+++ live/liveMedia/RTSPClient.cpp 2007-01-22 22:21:12.000000000 +0100
@@ -1128,7 +1128,8 @@
nextLineStart = getLine(lineStart);
- if (parseScaleHeader(lineStart, session.scale())) break;
+ if( parseScaleHeader(lineStart, session.scale())) continue;
+ if( parseRangeHeader(lineStart, session.playStartTime(), session.playEndTime()) ) continue;
}
if (fTCPStreamIdCount == 0) { // we're not receiving RTP-over-TCP
@@ -1229,6 +1230,7 @@
continue;
}
if (parseScaleHeader(lineStart, subsession.scale())) continue;
+ //if (parseRangeHeader(lineStart, subsession.playStartTime(), subsession.playEndTime())) continue;
}
delete[] cmd;
@@ -2287,6 +2289,14 @@
return radix_safe_sscanf(line, "%f", &scale) == 1;
}
+Boolean RTSPClient::parseRangeHeader(char const* line, float& start, float& end) {
+ if (_strncasecmp(line, "Range: ", 7) != 0) return False;
+ line += 7;
+
+ /* "npt=start-" is also valid */
+ return radix_safe_sscanf(line, "npt = %f - %f", &start, &end) >= 1;
+}
+
Boolean RTSPClient::parseGetParameterHeader(char const* line,
const char* param,
char*& value) {
diff -ruN live.orig/liveMedia/include/MediaSession.hh live/liveMedia/include/MediaSession.hh
--- live.orig/liveMedia/include/MediaSession.hh 2007-01-17 21:44:26.000000000 +0100
+++ live/liveMedia/include/MediaSession.hh 2007-01-22 22:20:30.000000000 +0100
@@ -39,6 +39,7 @@
MediaSession*& resultSession);
Boolean hasSubsessions() const { return fSubsessionsHead != NULL; }
+ float& playStartTime() { return fMaxPlayStartTime; }
float& playEndTime() { return fMaxPlayEndTime; }
char* connectionEndpointName() const { return fConnectionEndpointName; }
char const* CNAME() const { return fCNAME; }
@@ -97,6 +98,7 @@
// Fields set from a SDP description:
char* fConnectionEndpointName;
+ float fMaxPlayStartTime;
float fMaxPlayEndTime;
struct in_addr fSourceFilterAddr; // used for SSM
float fScale; // set from a RTSP "Scale:" header
@@ -147,6 +149,7 @@
// This is the source that client sinks read from. It is usually
// (but not necessarily) the same as "rtpSource()"
+ float playStartTime() const;
float playEndTime() const;
Boolean initiate(int useSpecialRTPoffset = -1);
@@ -268,6 +271,7 @@
Boolean fCpresent, fRandomaccessindication;
char *fConfig, *fMode, *fSpropParameterSets;
+ float fPlayStartTime;
float fPlayEndTime;
unsigned short fVideoWidth, fVideoHeight;
// screen dimensions (set by an optional a=x-dimensions: <w>,<h> line)
diff -ruN live.orig/liveMedia/include/RTSPClient.hh live/liveMedia/include/RTSPClient.hh
--- live.orig/liveMedia/include/RTSPClient.hh 2007-01-17 21:44:26.000000000 +0100
+++ live/liveMedia/include/RTSPClient.hh 2007-01-22 22:17:54.000000000 +0100
@@ -185,6 +185,7 @@
Boolean parseRTPInfoHeader(char const* line, unsigned& trackId,
u_int16_t& seqNum, u_int32_t& timestamp);
Boolean parseScaleHeader(char const* line, float& scale);
+ Boolean parseRangeHeader(char const* line, float& start, float& end);
Boolean parseGetParameterHeader(char const* line,
const char* param,
char*& value);
--- live/liveMedia/include/liveMedia_version.hh.orig 2007-05-24 22:44:37.000000000 +0200
+++ live/liveMedia/include/liveMedia_version.hh 2007-05-27 14:16:11.000000000 +0200
@@ -5,6 +5,6 @@
#define _LIVEMEDIA_VERSION_HH
#define LIVEMEDIA_LIBRARY_VERSION_STRING "2007.05.24"
-#define LIVEMEDIA_LIBRARY_VERSION_INT 1179964800
+#define LIVEMEDIA_LIBRARY_VERSION_INT 9999999999
#endif
...@@ -22,61 +22,38 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp ...@@ -22,61 +22,38 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp
#endif #endif
////////// NetInterface ////////// ////////// NetInterface //////////
--- live/liveMedia/RTSPClient.cpp 2005-10-28 18:54:17.000000000 +0200 --- live/liveMedia/RTSPClient.cpp 2007-04-24 11:38:22.000000000 +0200
+++ live-patched/liveMedia/RTSPClient.cpp 2005-10-28 22:04:54.000000000 +0200 +++ live-patched/liveMedia/RTSPClient.cpp 2007-04-26 15:19:54.000000000 +0200
@@ -32,40 +32,47 @@ @@ -21,13 +21,53 @@
#define _strncasecmp strncasecmp #include "RTSPClient.hh"
#include "RTSPCommon.hh"
#include "Base64.hh"
-#include "Locale.hh"
#include <GroupsockHelper.hh>
#include "our_md5.h"
#ifdef SUPPORT_REAL_RTSP
#include "../RealRTSP/include/RealRTSP.hh"
#endif #endif
-// Experimental support for temporarily setting the locale (e.g., to POSIX, +#include <locale.h>
-// for parsing or printing floating-point numbers in protocol headers).
-#ifdef USE_LOCALE
#include <locale.h>
-#else
-#ifndef LC_NUMERIC
-#define LC_NUMERIC 0
-#endif
-#endif
+#include <stdarg.h> +#include <stdarg.h>
-class Locale {
-public:
- Locale(char const* newLocale, int category = LC_NUMERIC)
- : fCategory(category) {
-#ifdef USE_LOCALE
- fPrevLocale = strDup(setlocale(category, NULL));
- setlocale(category, newLocale);
-#endif
- }
+/* Radix safe (always uses .) printf and friends */ +/* Radix safe (always uses .) printf and friends */
+int radix_safe_sprintf( char *str, const char *format, ...) +int radix_safe_sprintf( char *str, const char *format, ...)
+{ +{
+ va_list args; + va_list args;
+ int result = 0; + int result = 0;
+ char *locale = NULL; + char *locale = NULL;
+
- virtual ~Locale() {
-#ifdef USE_LOCALE
- if (fPrevLocale != NULL) {
- setlocale(fCategory, fPrevLocale);
- delete[] fPrevLocale;
- }
-#endif
- }
+ locale = strDup( setlocale( LC_NUMERIC, NULL ) ); + locale = strDup( setlocale( LC_NUMERIC, NULL ) );
+ setlocale( LC_NUMERIC, "C" ); + setlocale( LC_NUMERIC, "C" );
+ +
+ va_start( args, format ); + va_start( args, format );
+ result = vsprintf(str, format, args ); + result = vsprintf(str, format, args );
+ va_end( args ); + va_end( args );
+
-private:
- int fCategory;
- char* fPrevLocale;
-};
+ setlocale( LC_NUMERIC, locale ); + setlocale( LC_NUMERIC, locale );
+ delete[] locale; + delete[] locale;
+
+ return result; + return result;
+} +}
+ +
...@@ -98,39 +75,40 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp ...@@ -98,39 +75,40 @@ diff -ru live/groupsock/NetInterface.cpp live-patched/groupsock/NetInterface.cpp
+ +
+ return result; + return result;
+} +}
+
////////// RTSPClient ////////// ////////// RTSPClient //////////
@@ -948,8 +955,7 @@
RTSPClient* RTSPClient::createNew(UsageEnvironment& env,
@@ -989,8 +1029,7 @@
// This is the default value; we don't need a "Scale:" header: // This is the default value; we don't need a "Scale:" header:
buf[0] = '\0'; buf[0] = '\0';
} else { } else {
- Locale("POSIX"); - Locale("POSIX", LC_NUMERIC);
- sprintf(buf, "Scale: %f\r\n", scale); - sprintf(buf, "Scale: %f\r\n", scale);
+ radix_safe_sprintf(buf, "Scale: %f\r\n", scale); + radix_safe_sprintf(buf, "Scale: %f\r\n", scale);
} }
return strDup(buf); return strDup(buf);
@@ -962,12 +968,10 @@ @@ -1003,12 +1042,10 @@
buf[0] = '\0'; buf[0] = '\0';
} else if (end < 0) { } else if (end < 0) {
// There's no end time: // There's no end time:
- Locale("POSIX"); - Locale("POSIX", LC_NUMERIC);
- sprintf(buf, "Range: npt=%.3f-\r\n", start); - sprintf(buf, "Range: npt=%.3f-\r\n", start);
+ radix_safe_sprintf(buf, "Range: npt=%.3f-\r\n", start); + radix_safe_sprintf(buf, "Range: npt=%.3f-\r\n", start);
} else { } else {
// There's both a start and an end time; include them both in the "Range:" hdr // There's both a start and an end time; include them both in the "Range:" hdr
- Locale("POSIX"); - Locale("POSIX", LC_NUMERIC);
- sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end); - sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
+ radix_safe_sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end); + radix_safe_sprintf(buf, "Range: npt=%.3f-%.3f\r\n", start, end);
} }
return strDup(buf); return strDup(buf);
@@ -2153,8 +2157,7 @@ @@ -2246,8 +2283,7 @@
if (_strncasecmp(line, "Scale: ", 7) != 0) return False; if (_strncasecmp(line, "Scale: ", 7) != 0) return False;
line += 7; line += 7;
- Locale("POSIX"); - Locale("POSIX", LC_NUMERIC);
- return sscanf(line, "%f", &scale) == 1; - return sscanf(line, "%f", &scale) == 1;
+ return radix_safe_sscanf(line, "%f", &scale) == 1; + return radix_safe_sscanf(line, "%f", &scale) == 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment