diff options
author | Tony Theodore <tonyt@logyst.com> | 2014-11-27 02:21:11 (GMT) |
---|---|---|
committer | Tony Theodore <tonyt@logyst.com> | 2014-11-27 02:21:11 (GMT) |
commit | a01c68fa02cc75ef38b8b8b5c1baa4fbb4089e11 (patch) | |
tree | 7ab452fc781c62a6a26ff0becea675d46207d977 /src/librtmp-1-v2.4.patch | |
parent | b8e84481d61157024e78fd081e387d689f3bbb1d (diff) | |
download | mxe-a01c68fa02cc75ef38b8b8b5c1baa4fbb4089e11.zip mxe-a01c68fa02cc75ef38b8b8b5c1baa4fbb4089e11.tar.gz mxe-a01c68fa02cc75ef38b8b8b5c1baa4fbb4089e11.tar.bz2 |
librtmp: switch to dev version and enable shared
fixes #566
Diffstat (limited to 'src/librtmp-1-v2.4.patch')
-rw-r--r-- | src/librtmp-1-v2.4.patch | 2587 |
1 files changed, 0 insertions, 2587 deletions
diff --git a/src/librtmp-1-v2.4.patch b/src/librtmp-1-v2.4.patch deleted file mode 100644 index fcf61e1..0000000 --- a/src/librtmp-1-v2.4.patch +++ /dev/null @@ -1,2587 +0,0 @@ -This file is part of MXE. -See index.html for further information. - -From 272a91d06d71c2a326996f62797ed9ab42f69859 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Wed, 30 Jun 2010 22:34:59 +0000 -Subject: [PATCH 01/34] zlib dependency is only when CRYPTO is enabled - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@536 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index 7470eb4..c7767b4 100644 ---- a/Makefile -+++ b/Makefile -@@ -11,9 +11,10 @@ SYS=posix - CRYPTO=OPENSSL - #CRYPTO=POLARSSL - #CRYPTO=GNUTLS --LIB_GNUTLS=-lgnutls -lgcrypt --LIB_OPENSSL=-lssl -lcrypto --LIB_POLARSSL=-lpolarssl -+LIBZ=-lz -+LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) -+LIB_OPENSSL=-lssl -lcrypto$ (LIBZ) -+LIB_POLARSSL=-lpolarssl $(LIBZ) - CRYPTO_LIB=$(LIB_$(CRYPTO)) - DEF_=-DNO_CRYPTO - CRYPTO_DEF=$(DEF_$(CRYPTO)) -@@ -33,7 +34,7 @@ MANDIR=$(DESTDIR)$(mandir) - - LIBS_posix= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 --LIBS=$(CRYPTO_LIB) -lz $(LIBS_$(SYS)) $(XLIBS) -+LIBS=$(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) - - THREADLIB_posix=-lpthread - THREADLIB_mingw= -diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c -index 06d2bbb..277f21c 100644 ---- a/librtmp/hashswf.c -+++ b/librtmp/hashswf.c -@@ -66,10 +66,10 @@ - extern void RTMP_TLS_Init(); - extern TLS_CTX RTMP_TLS_ctx; - --#endif /* CRYPTO */ -- - #include <zlib.h> - -+#endif /* CRYPTO */ -+ - #define AGENT "Mozilla/5.0" - - HTTPResult --- -1.7.10.4 - - -From 6556b9f9328acb1199dc1cc3f22fa82c86b51c8a Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 1 Jul 2010 12:00:43 +0000 -Subject: [PATCH 02/34] Fix typo - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@537 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index c7767b4..1fcdd78 100644 ---- a/Makefile -+++ b/Makefile -@@ -13,7 +13,7 @@ CRYPTO=OPENSSL - #CRYPTO=GNUTLS - LIBZ=-lz - LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) --LIB_OPENSSL=-lssl -lcrypto$ (LIBZ) -+LIB_OPENSSL=-lssl -lcrypto $(LIBZ) - LIB_POLARSSL=-lpolarssl $(LIBZ) - CRYPTO_LIB=$(LIB_$(CRYPTO)) - DEF_=-DNO_CRYPTO --- -1.7.10.4 - - -From 8a5901c8a74280c898deb4ebf1a2f5d6f68bce42 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Sat, 3 Jul 2010 10:25:48 +0000 -Subject: [PATCH 03/34] Document the escape coding used for special characters - in values - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@538 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/librtmp.3 b/librtmp/librtmp.3 -index 055b52b..a5a7558 100644 ---- a/librtmp/librtmp.3 -+++ b/librtmp/librtmp.3 -@@ -57,14 +57,19 @@ The session handle is freed using - .BR RTMP_Free (). - - All data is transferred using FLV format. The basic session requires --an RTMP URL. Additional options may be specified by appending --space-separated key=value pairs to the URL. The RTMP URL format --is of the form -+an RTMP URL. The RTMP URL format is of the form - .nf - rtmp[t][e|s]://hostname[:port][/app[/playpath]] - .fi - - Plain rtmp, as well as tunneled and encrypted sessions are supported. -+ -+Additional options may be specified by appending space-separated -+key=value pairs to the URL. Special characters in values may need -+to be escaped to prevent misinterpretation by the option parser. -+The escape encoding uses a backslash followed by two hexadecimal digits -+representing the ASCII value of the character. E.g., spaces must -+be escaped as \fB\\20\fP and backslashes must be escaped as \fB\\5c\fP. - .SH OPTIONS - .SS "Network Parameters" - These options define how to connect to the media server. --- -1.7.10.4 - - -From c41568f57bec297581e8508a7e6a3d1e470dc81d Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Sat, 3 Jul 2010 10:28:57 +0000 -Subject: [PATCH 04/34] Update from prev commit - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@539 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/librtmp.3 b/librtmp/librtmp.3 -index a5a7558..66197d5 100644 ---- a/librtmp/librtmp.3 -+++ b/librtmp/librtmp.3 -@@ -1,4 +1,4 @@ --.TH LIBRTMP 3 "2010-05-29" "RTMPDump v2.2e" -+.TH LIBRTMP 3 "2010-07-03" "RTMPDump v2.3" - .\" Copyright 2010 Howard Chu. - .\" Copying permitted according to the GNU General Public License V2. - .SH NAME -diff --git a/librtmp/librtmp.3.html b/librtmp/librtmp.3.html -index daf636f..e5e6f4b 100644 ---- a/librtmp/librtmp.3.html -+++ b/librtmp/librtmp.3.html -@@ -6,7 +6,7 @@ - <tr><td>LIBRTMP(3)<td align="center"><td align="right">LIBRTMP(3) - </thead> - <tfoot> --<tr><td>RTMPDump v2.2e<td align="center">2010-05-29<td align="right">LIBRTMP(3) -+<tr><td>RTMPDump v2.3<td align="center">2010-07-03<td align="right">LIBRTMP(3) - </tfoot> - <tbody><tr><td colspan="3"><br><br><ul> - <!-- Copyright 2010 Howard Chu. -@@ -75,14 +75,19 @@ The session handle is freed using - <b>RTMP_Free</b>(). - <p> - All data is transferred using FLV format. The basic session requires --an RTMP URL. Additional options may be specified by appending --space-separated key=value pairs to the URL. The RTMP URL format --is of the form -+an RTMP URL. The RTMP URL format is of the form - <pre> - rtmp[t][e|s]://hostname[:port][/app[/playpath]] - </pre> - <p> - Plain rtmp, as well as tunneled and encrypted sessions are supported. -+<p> -+Additional options may be specified by appending space-separated -+key=value pairs to the URL. Special characters in values may need -+to be escaped to prevent misinterpretation by the option parser. -+The escape encoding uses a backslash followed by two hexadecimal digits -+representing the ASCII value of the character. E.g., spaces must -+be escaped as <b>\20</b> and backslashes must be escaped as <b>\5c</b>. - </ul> - - <h3>OPTIONS</h3><ul> --- -1.7.10.4 - - -From f1c4f0ed07659cbeae4ffaa78ca8cce7500afa58 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 5 Jul 2010 20:07:39 +0000 -Subject: [PATCH 05/34] Hide strtime() - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@541 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c -index 277f21c..23e754b 100644 ---- a/librtmp/hashswf.c -+++ b/librtmp/hashswf.c -@@ -435,7 +435,7 @@ make_unix_time(char *s) - /* Convert a Unix time to a network time string - * Weekday, DD-MMM-YYYY HH:MM:SS GMT - */ --void -+static void - strtime(time_t * t, char *s) - { - struct tm *tm; --- -1.7.10.4 - - -From da78eba764eda23fb3bf9aa91bd6c5fee1839932 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 5 Jul 2010 20:16:55 +0000 -Subject: [PATCH 06/34] Remove obsolete XBOX defs - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@542 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h -index 0874cbe..6a3f215 100644 ---- a/librtmp/rtmp_sys.h -+++ b/librtmp/rtmp_sys.h -@@ -24,17 +24,14 @@ - - #ifdef _WIN32 - --#ifdef _XBOX --#include <xtl.h> --#include <winsockx.h> -+#include <winsock2.h> -+#include <ws2tcpip.h> -+ -+#ifdef _MSC_VER /* MSVC */ - #define snprintf _snprintf - #define strcasecmp stricmp - #define strncasecmp strnicmp - #define vsnprintf _vsnprintf -- --#else /* !_XBOX */ --#include <winsock2.h> --#include <ws2tcpip.h> - #endif - - #define GetSockError() WSAGetLastError() --- -1.7.10.4 - - -From eef87483b92036a1631c98c9c85dc3cae66411ee Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 5 Jul 2010 20:17:16 +0000 -Subject: [PATCH 07/34] Update XBOX/XBMC support - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@543 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c -index 23e754b..3c56b69 100644 ---- a/librtmp/hashswf.c -+++ b/librtmp/hashswf.c -@@ -466,7 +466,7 @@ RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, - - date[0] = '\0'; - #ifdef _WIN32 --#ifdef _XBOX -+#ifdef XBMC4XBOX - hpre.av_val = "Q:"; - hpre.av_len = 2; - home.av_val = "\\UserData"; --- -1.7.10.4 - - -From 24f7e724fc10d737a0f14c7741711b6b542c9d45 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 8 Jul 2010 10:38:33 +0000 -Subject: [PATCH 08/34] Don't link explicitly against static library - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@544 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index 1fcdd78..741e438 100644 ---- a/Makefile -+++ b/Makefile -@@ -34,7 +34,7 @@ MANDIR=$(DESTDIR)$(mandir) - - LIBS_posix= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 --LIBS=$(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) -+LIBS=-L librtmp -lrtmp $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) - - THREADLIB_posix=-lpthread - THREADLIB_mingw= -@@ -48,9 +48,11 @@ EXT_posix= - EXT_mingw=.exe - EXT=$(EXT_$(SYS)) - --all: $(LIBRTMP) progs -+PROGS=rtmpdump rtmpgw rtmpsrv rtmpsuck - --progs: rtmpdump rtmpgw rtmpsrv rtmpsuck -+all: $(LIBRTMP) $(PROGS) -+ -+$(PROGS): $(LIBRTMP) - - install: progs - -mkdir -p $(BINDIR) $(SBINDIR) $(MANDIR)/man1 $(MANDIR)/man8 -@@ -69,20 +71,17 @@ FORCE: - $(LIBRTMP): FORCE - @cd librtmp; $(MAKE) all - --# note: $^ is GNU Make's equivalent to BSD $> --# we use both since either make will ignore the one it doesn't recognize -- --rtmpdump: rtmpdump.o $(LIBRTMP) -- $(CC) $(LDFLAGS) $^ $> -o $@$(EXT) $(LIBS) -+rtmpdump: rtmpdump.o -+ $(CC) $(LDFLAGS) -o $@$(EXT) $@.o $(LIBS) - --rtmpsrv: rtmpsrv.o thread.o $(LIBRTMP) -- $(CC) $(LDFLAGS) $^ $> -o $@$(EXT) $(SLIBS) -+rtmpsrv: rtmpsrv.o thread.o -+ $(CC) $(LDFLAGS) -o $@$(EXT) $@.o thread.o $(SLIBS) - --rtmpsuck: rtmpsuck.o thread.o $(LIBRTMP) -- $(CC) $(LDFLAGS) $^ $> -o $@$(EXT) $(SLIBS) -+rtmpsuck: rtmpsuck.o thread.o -+ $(CC) $(LDFLAGS) -o $@$(EXT) $@.o thread.o $(SLIBS) - --rtmpgw: rtmpgw.o thread.o $(LIBRTMP) -- $(CC) $(LDFLAGS) $^ $> -o $@$(EXT) $(SLIBS) -+rtmpgw: rtmpgw.o thread.o -+ $(CC) $(LDFLAGS) -o $@$(EXT) $@.o thread.o $(SLIBS) - - rtmpgw.o: rtmpgw.c $(INCRTMP) Makefile - rtmpdump.o: rtmpdump.c $(INCRTMP) Makefile --- -1.7.10.4 - - -From 5a3d6003a9745595583015c5b3b24e7bea818790 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 8 Jul 2010 11:11:47 +0000 -Subject: [PATCH 09/34] Fix install target - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@545 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index 741e438..75628dd 100644 ---- a/Makefile -+++ b/Makefile -@@ -54,7 +54,7 @@ all: $(LIBRTMP) $(PROGS) - - $(PROGS): $(LIBRTMP) - --install: progs -+install: $(PROGS) - -mkdir -p $(BINDIR) $(SBINDIR) $(MANDIR)/man1 $(MANDIR)/man8 - cp rtmpdump$(EXT) $(BINDIR) - cp rtmpgw$(EXT) rtmpsrv$(EXT) rtmpsuck$(EXT) $(SBINDIR) --- -1.7.10.4 - - -From 2340f0e27cd21d624d5f915fc42182750be6fca6 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 12 Jul 2010 08:20:04 +0000 -Subject: [PATCH 10/34] MacOSX/Darwin shared library flags - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@546 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index 75628dd..fda3c74 100644 ---- a/Makefile -+++ b/Makefile -@@ -33,10 +33,12 @@ SBINDIR=$(DESTDIR)$(sbindir) - MANDIR=$(DESTDIR)$(mandir) - - LIBS_posix= -+LIBS_darwin= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 - LIBS=-L librtmp -lrtmp $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) - - THREADLIB_posix=-lpthread -+THREADLIB_darwin=-lpthread - THREADLIB_mingw= - THREADLIB=$(THREADLIB_$(SYS)) - SLIBS=$(THREADLIB) $(LIBS) -@@ -45,6 +47,7 @@ LIBRTMP=librtmp/librtmp.a - INCRTMP=librtmp/rtmp_sys.h librtmp/rtmp.h librtmp/log.h librtmp/amf.h - - EXT_posix= -+EXT_darwin= - EXT_mingw=.exe - EXT=$(EXT_$(SYS)) - -diff --git a/README b/README -index 6607a1d..5689853 100644 ---- a/README -+++ b/README -@@ -10,7 +10,11 @@ To compile type "make" with SYS=<platform name>, e.g. - - $ make SYS=posix - --for Linux, MacOSX, Unix, etc. or -+for Linux, Unix, etc. or -+ -+ $ make SYS=darwin -+ -+for MacOSX or - - $ make SYS=mingw - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 6774db7..2fd5869 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -17,6 +17,7 @@ REQ_GNUTLS=gnutls - REQ_OPENSSL=libssl,libcrypto - LIBZ=-lz - LIBS_posix= -+LIBS_darwin= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 - LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) - LIB_OPENSSL=-lssl -lcrypto $(LIBZ) -@@ -26,9 +27,16 @@ CRYPTO_REQ=$(REQ_$(CRYPTO)) - CRYPTO_DEF=$(DEF_$(CRYPTO)) - - SO_posix=so.0 -+SO_darwin=so.0 - SO_mingw=dll - SO_EXT=$(SO_$(SYS)) - -+SO_LDFLAGS_posix=-shared -Wl,-soname,$@ -+SO_LDFLAGS_darwin=-bundle -flat_namespace -undefined suppress -fno-common \ -+ -headerpad_max_install_names -+SO_LDFLAGS_mingw= -+SO_LDFLAGS=$(SO_LDFLAGS_$(SYS)) -+ - SHARED=yes - SODEF_yes=-fPIC - SOLIB_yes=librtmp.$(SO_EXT) -@@ -40,6 +48,7 @@ SO_INST=$(SOINST_$(SHARED)) - DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) $(XDEF) - OPT=-O2 - CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) $(SO_DEF) -+LDFLAGS=$(XLDFLAGS) - - incdir=$(prefix)/include/librtmp - bindir=$(prefix)/bin -@@ -61,7 +70,7 @@ librtmp.a: $(OBJS) - $(AR) rs $@ $? - - librtmp.$(SO_EXT): $(OBJS) -- $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB) -+ $(CC) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB) - ln -sf $@ librtmp.so - - log.o: log.c log.h Makefile --- -1.7.10.4 - - -From 13798268e10fc8c56eecf5fce297375f7fca1526 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 9 Aug 2010 21:46:31 +0000 -Subject: [PATCH 11/34] Fixes for Darwin - use dylib, not bundle for shared - lib - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@547 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/Makefile b/Makefile -index fda3c74..c322e9a 100644 ---- a/Makefile -+++ b/Makefile -@@ -35,7 +35,7 @@ MANDIR=$(DESTDIR)$(mandir) - LIBS_posix= - LIBS_darwin= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 --LIBS=-L librtmp -lrtmp $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) -+LIBS=-Llibrtmp -lrtmp $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) - - THREADLIB_posix=-lpthread - THREADLIB_darwin=-lpthread -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 2fd5869..a4bf67e 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -26,13 +26,14 @@ CRYPTO_LIB=$(LIB_$(CRYPTO)) $(LIBS_$(SYS)) - CRYPTO_REQ=$(REQ_$(CRYPTO)) - CRYPTO_DEF=$(DEF_$(CRYPTO)) - --SO_posix=so.0 --SO_darwin=so.0 -+SO_VERSION=0 -+SO_posix=so.$(SO_VERSION) -+SO_darwin=$(SO_VERSION).dylib - SO_mingw=dll - SO_EXT=$(SO_$(SYS)) - - SO_LDFLAGS_posix=-shared -Wl,-soname,$@ --SO_LDFLAGS_darwin=-bundle -flat_namespace -undefined suppress -fno-common \ -+SO_LDFLAGS_darwin=-dynamiclib -flat_namespace -undefined suppress -fno-common \ - -headerpad_max_install_names - SO_LDFLAGS_mingw= - SO_LDFLAGS=$(SO_LDFLAGS_$(SYS)) -@@ -92,9 +93,13 @@ install_base: librtmp.a librtmp.pc - cp librtmp.pc $(LIBDIR)/pkgconfig - cp librtmp.3 $(MANDIR)/man3 - --install_so.0: librtmp.so.0 -- cp librtmp.so.0 $(LIBDIR) -- cd $(LIBDIR); ln -sf librtmp.so.0 librtmp.so -+install_so.$(SO_VERSION): librtmp.$(SO_EXT) -+ cp librtmp.$(SO_EXT) $(LIBDIR) -+ cd $(LIBDIR); ln -sf librtmp.$(SO_EXT) librtmp.so -+ -+install_$(SO_VERSION).dylib: librtmp.$(SO_EXT) -+ cp librtmp.$(SO_EXT) $(LIBDIR) -+ cd $(LIBDIR); ln -sf librtmp.$(SO_EXT) librtmp.dylib - - install_dll: librtmp.dll - cp librtmp.dll $(BINDIR) --- -1.7.10.4 - - -From eb806247dc8eab25d8a675a4f633d3feaf2b2045 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Tue, 10 Aug 2010 06:41:50 +0000 -Subject: [PATCH 12/34] More dynlib tweaks - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@548 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index a4bf67e..6a1b08b 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -2,6 +2,15 @@ VERSION=v2.3 - - prefix=/usr/local - -+incdir=$(prefix)/include/librtmp -+bindir=$(prefix)/bin -+libdir=$(prefix)/lib -+mandir=$(prefix)/man -+BINDIR=$(DESTDIR)$(bindir) -+INCDIR=$(DESTDIR)$(incdir) -+LIBDIR=$(DESTDIR)$(libdir) -+MANDIR=$(DESTDIR)$(mandir) -+ - CC=$(CROSS_COMPILE)gcc - LD=$(CROSS_COMPILE)ld - AR=$(CROSS_COMPILE)ar -@@ -27,11 +36,20 @@ CRYPTO_REQ=$(REQ_$(CRYPTO)) - CRYPTO_DEF=$(DEF_$(CRYPTO)) - - SO_VERSION=0 --SO_posix=so.$(SO_VERSION) --SO_darwin=$(SO_VERSION).dylib -+SOX_posix=so -+SOX_darwin=dylib -+SOX_mingw=so # useless -+SOX=$(SOX_$(SYS)) -+SO_posix=$(SOX).$(SO_VERSION) -+SO_darwin=$(SO_VERSION).$(SOX) - SO_mingw=dll - SO_EXT=$(SO_$(SYS)) - -+SODIR_posix=$(LIBDIR) -+SODIR_darwin=$(LIBDIR) -+SODIR_mingw=$(BINDIR) -+SODIR=$(SODIR_$(SYS)) -+ - SO_LDFLAGS_posix=-shared -Wl,-soname,$@ - SO_LDFLAGS_darwin=-dynamiclib -flat_namespace -undefined suppress -fno-common \ - -headerpad_max_install_names -@@ -41,7 +59,7 @@ SO_LDFLAGS=$(SO_LDFLAGS_$(SYS)) - SHARED=yes - SODEF_yes=-fPIC - SOLIB_yes=librtmp.$(SO_EXT) --SOINST_yes=install_$(SO_EXT) -+SOINST_yes=install_so - SO_DEF=$(SODEF_$(SHARED)) - SO_LIB=$(SOLIB_$(SHARED)) - SO_INST=$(SOINST_$(SHARED)) -@@ -51,28 +69,20 @@ OPT=-O2 - CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) $(SO_DEF) - LDFLAGS=$(XLDFLAGS) - --incdir=$(prefix)/include/librtmp --bindir=$(prefix)/bin --libdir=$(prefix)/lib --mandir=$(prefix)/man --BINDIR=$(DESTDIR)$(bindir) --INCDIR=$(DESTDIR)$(incdir) --LIBDIR=$(DESTDIR)$(libdir) --MANDIR=$(DESTDIR)$(mandir) - - OBJS=rtmp.o log.o amf.o hashswf.o parseurl.o - - all: librtmp.a $(SO_LIB) - - clean: -- rm -f *.o *.a *.so *.$(SO_EXT) -+ rm -f *.o *.a *.$(SOX) *.$(SO_EXT) - - librtmp.a: $(OBJS) - $(AR) rs $@ $? - - librtmp.$(SO_EXT): $(OBJS) - $(CC) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB) -- ln -sf $@ librtmp.so -+ ln -sf $@ librtmp.$(SOX) - - log.o: log.c log.h Makefile - rtmp.o: rtmp.c rtmp.h rtmp_sys.h handshake.h dh.h log.h amf.h Makefile -@@ -93,13 +103,7 @@ install_base: librtmp.a librtmp.pc - cp librtmp.pc $(LIBDIR)/pkgconfig - cp librtmp.3 $(MANDIR)/man3 - --install_so.$(SO_VERSION): librtmp.$(SO_EXT) -- cp librtmp.$(SO_EXT) $(LIBDIR) -- cd $(LIBDIR); ln -sf librtmp.$(SO_EXT) librtmp.so -- --install_$(SO_VERSION).dylib: librtmp.$(SO_EXT) -- cp librtmp.$(SO_EXT) $(LIBDIR) -- cd $(LIBDIR); ln -sf librtmp.$(SO_EXT) librtmp.dylib -+install_so: librtmp.$(SO_EXT) -+ cp librtmp.$(SO_EXT) $(SODIR) -+ cd $(SODIR); ln -sf librtmp.$(SO_EXT) librtmp.$(SOX) - --install_dll: librtmp.dll -- cp librtmp.dll $(BINDIR) --- -1.7.10.4 - - -From 08bdebed5423602d195fa981b3f2663e62820677 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Fri, 13 Aug 2010 20:05:35 +0000 -Subject: [PATCH 13/34] Substitute libdir in pkgconfig file - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@549 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 6a1b08b..7cba62a 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -91,7 +91,8 @@ hashswf.o: hashswf.c http.h rtmp.h rtmp_sys.h Makefile - parseurl.o: parseurl.c rtmp.h rtmp_sys.h log.h Makefile - - librtmp.pc: librtmp.pc.in Makefile -- sed -e "s;@prefix@;$(prefix);" -e "s;@VERSION@;$(VERSION);" \ -+ sed -e "s;@prefix@;$(prefix);" -e "s;@libdir@;$(libdir);" \ -+ -e "s;@VERSION@;$(VERSION);" \ - -e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" librtmp.pc.in > $@ - - install: install_base $(SO_INST) -diff --git a/librtmp/librtmp.pc.in b/librtmp/librtmp.pc.in -index d58e269..70bd268 100644 ---- a/librtmp/librtmp.pc.in -+++ b/librtmp/librtmp.pc.in -@@ -1,6 +1,6 @@ - prefix=@prefix@ - exec_prefix=${prefix} --libdir=${exec_prefix}/lib -+libdir=@libdir@ - incdir=${prefix}/include - - Name: librtmp --- -1.7.10.4 - - -From 59ca19036ed45667b08d98f09e4d4a7a727b77b3 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Fri, 13 Aug 2010 20:34:58 +0000 -Subject: [PATCH 14/34] Less case-sensitive check for Content-length: header - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@550 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index f152648..5c678fd 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -3664,11 +3664,15 @@ HTTP_read(RTMP *r, int fill) - return -1; - if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) - return -1; -- ptr = strstr(r->m_sb.sb_start, "Content-Length:"); -+ ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); -+ while ((ptr = strstr(ptr, "Content-"))) { -+ if (!strncasecmp(ptr+8, "length:", 7)) break; -+ ptr += 8; -+ } - if (!ptr) - return -1; - hlen = atoi(ptr+16); -- ptr = strstr(ptr, "\r\n\r\n"); -+ ptr = strstr(ptr+16, "\r\n\r\n"); - if (!ptr) - return -1; - ptr += 4; --- -1.7.10.4 - - -From 8afb3681407a0a83dcb1fec449b83854da440738 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Fri, 8 Oct 2010 07:45:54 +0000 -Subject: [PATCH 15/34] Log error message for unsupported SWF Verification - types - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@551 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index 5c678fd..3e4e00a 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -2789,11 +2789,17 @@ HandleCtrl(RTMP *r, const RTMPPacket *packet) - if (nType == 0x1A) - { - RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__); -+ if (packet->m_nBodySize > 2 && packet->m_body[2] > 0x01) -+ { -+ RTMP_Log(RTMP_LOGERROR, -+ "%s: SWFVerification Type %d request not supported! Patches welcome...", -+ __FUNCTION__, packet->m_body[2]); -+ } - #ifdef CRYPTO - /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ - - /* respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied */ -- if (r->Link.SWFSize) -+ else if (r->Link.SWFSize) - { - RTMP_SendCtrl(r, 0x1B, 0, 0); - } --- -1.7.10.4 - - -From 9ca7e22d94c6e07e8ef05acbf636809a5914f50c Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Tue, 26 Oct 2010 23:51:10 +0000 -Subject: [PATCH 16/34] Timeout fix from Antti Ajanki - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@552 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index 3e4e00a..db882dc 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -1019,6 +1019,9 @@ RTMP_ToggleStream(RTMP *r) - - if (!r->m_pausing) - { -+ if (RTMP_IsTimedout(r) && r->m_read.status == RTMP_READ_EOF) -+ r->m_read.status = 0; -+ - res = RTMP_SendPause(r, TRUE, r->m_pauseStamp); - if (!res) - return res; -diff --git a/rtmpdump.c b/rtmpdump.c -index 7aa19ab..c1cd95b 100644 ---- a/rtmpdump.c -+++ b/rtmpdump.c -@@ -583,7 +583,7 @@ Download(RTMP * rtmp, // connected RTMP object - #endif - - } -- while (!RTMP_ctrlC && nRead > -1 && RTMP_IsConnected(rtmp)); -+ while (!RTMP_ctrlC && nRead > -1 && RTMP_IsConnected(rtmp) && !RTMP_IsTimedout(rtmp)); - free(buffer); - if (nRead < 0) - nRead = rtmp->m_read.status; --- -1.7.10.4 - - -From 1379a2c0d22f238d97970a7e7420287a9bd794de Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Fri, 24 Dec 2010 22:35:35 +0000 -Subject: [PATCH 17/34] Fix infinite loop on Error/Close - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@554 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index db882dc..e6e8ed8 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -3395,10 +3395,10 @@ RTMP_Close(RTMP *r) - { - if (r->m_stream_id > 0) - { -- if ((r->Link.protocol & RTMP_FEATURE_WRITE)) -- SendFCUnpublish(r); - i = r->m_stream_id; - r->m_stream_id = 0; -+ if ((r->Link.protocol & RTMP_FEATURE_WRITE)) -+ SendFCUnpublish(r); - SendDeleteStream(r, i); - } - if (r->m_clientID.av_val) --- -1.7.10.4 - - -From 8c713f4c5c8e72369b48d15772e19d1c9ebd5a19 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Fri, 25 Feb 2011 05:51:40 +0000 -Subject: [PATCH 18/34] Fix FLV timestamps during resume - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@557 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index e6e8ed8..e2925a7 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -4083,7 +4083,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - /* grab first timestamp and see if it needs fixing */ - nTimeStamp = AMF_DecodeInt24(packetBody + 4); - nTimeStamp |= (packetBody[7] << 24); -- delta = packet.m_nTimeStamp - nTimeStamp; -+ delta = packet.m_nTimeStamp - nTimeStamp + r->m_read.nResumeTS; - - while (pos + 11 < nPacketLen) - { --- -1.7.10.4 - - -From bca1ef01727cac659f7ac171c791490efe4e48d6 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 10 Mar 2011 14:30:06 +0000 -Subject: [PATCH 19/34] Add Libs.private to pkgconfig for Windows - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@558 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 7cba62a..87618af 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -31,7 +31,8 @@ LIBS_mingw=-lws2_32 -lwinmm -lgdi32 - LIB_GNUTLS=-lgnutls -lgcrypt $(LIBZ) - LIB_OPENSSL=-lssl -lcrypto $(LIBZ) - LIB_POLARSSL=-lpolarssl $(LIBZ) --CRYPTO_LIB=$(LIB_$(CRYPTO)) $(LIBS_$(SYS)) -+PRIVATE_LIBS=$(LIBS_$(SYS)) -+CRYPTO_LIB=$(LIB_$(CRYPTO)) $(PRIVATE_LIBS) - CRYPTO_REQ=$(REQ_$(CRYPTO)) - CRYPTO_DEF=$(DEF_$(CRYPTO)) - -@@ -93,7 +94,8 @@ parseurl.o: parseurl.c rtmp.h rtmp_sys.h log.h Makefile - librtmp.pc: librtmp.pc.in Makefile - sed -e "s;@prefix@;$(prefix);" -e "s;@libdir@;$(libdir);" \ - -e "s;@VERSION@;$(VERSION);" \ -- -e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" librtmp.pc.in > $@ -+ -e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" \ -+ -e "s;@PRIVATE_LIBS@;$(PRIVATE_LIBS));" librtmp.pc.in > $@ - - install: install_base $(SO_INST) - -diff --git a/librtmp/librtmp.pc.in b/librtmp/librtmp.pc.in -index 70bd268..5933ca1 100644 ---- a/librtmp/librtmp.pc.in -+++ b/librtmp/librtmp.pc.in -@@ -9,4 +9,5 @@ Version: @VERSION@ - Requires: @CRYPTO_REQ@ - URL: http://rtmpdump.mplayerhq.hu - Libs: -L${libdir} -lrtmp -lz -+Libs.private; @PRIVATE_LIBS@ - Cflags: -I${incdir} --- -1.7.10.4 - - -From 25447a0f675cc6e9eefc8eb420ad3a2725be8ab1 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 10 Mar 2011 14:33:32 +0000 -Subject: [PATCH 20/34] Fix typos in prev commit - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@559 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 87618af..1ea31a0 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -95,7 +95,7 @@ librtmp.pc: librtmp.pc.in Makefile - sed -e "s;@prefix@;$(prefix);" -e "s;@libdir@;$(libdir);" \ - -e "s;@VERSION@;$(VERSION);" \ - -e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" \ -- -e "s;@PRIVATE_LIBS@;$(PRIVATE_LIBS));" librtmp.pc.in > $@ -+ -e "s;@PRIVATE_LIBS@;$(PRIVATE_LIBS);" librtmp.pc.in > $@ - - install: install_base $(SO_INST) - -diff --git a/librtmp/librtmp.pc.in b/librtmp/librtmp.pc.in -index 5933ca1..a82beca 100644 ---- a/librtmp/librtmp.pc.in -+++ b/librtmp/librtmp.pc.in -@@ -9,5 +9,5 @@ Version: @VERSION@ - Requires: @CRYPTO_REQ@ - URL: http://rtmpdump.mplayerhq.hu - Libs: -L${libdir} -lrtmp -lz --Libs.private; @PRIVATE_LIBS@ -+Libs.private: @PRIVATE_LIBS@ - Cflags: -I${incdir} --- -1.7.10.4 - - -From 0a219ffeeb0094111fd00c509fce3ddd6eba2de2 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Mon, 14 Mar 2011 06:48:09 +0000 -Subject: [PATCH 21/34] Bump up play command buffer sizes - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@560 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/rtmpsrv.c b/rtmpsrv.c -index f2af85b..4d5699f 100644 ---- a/rtmpsrv.c -+++ b/rtmpsrv.c -@@ -266,7 +266,7 @@ static int - SendPlayStart(RTMP *r) - { - RTMPPacket packet; -- char pbuf[384], *pend = pbuf+sizeof(pbuf); -+ char pbuf[512], *pend = pbuf+sizeof(pbuf); - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ -@@ -298,7 +298,7 @@ static int - SendPlayStop(RTMP *r) - { - RTMPPacket packet; -- char pbuf[384], *pend = pbuf+sizeof(pbuf); -+ char pbuf[512], *pend = pbuf+sizeof(pbuf); - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ --- -1.7.10.4 - - -From a1bcab1da064cca8a534d26970333220b57a72f0 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Wed, 16 Mar 2011 12:11:21 +0000 -Subject: [PATCH 22/34] Fix rtmpt read hangs - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@561 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index e2925a7..3042c7f 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -877,7 +877,13 @@ RTMP_Connect1(RTMP *r, RTMPPacket *cp) - r->m_clientID.av_val = NULL; - r->m_clientID.av_len = 0; - HTTP_Post(r, RTMPT_OPEN, "", 1); -- HTTP_read(r, 1); -+ if (HTTP_read(r, 1) != 0) -+ { -+ r->m_msgCounter = 0; -+ RTMP_Log(RTMP_LOGDEBUG, "%s, Could not connect for handshake", __FUNCTION__); -+ RTMP_Close(r); -+ return 0; -+ } - r->m_msgCounter = 0; - } - RTMP_Log(RTMP_LOGDEBUG, "%s, ... connected, handshaking", __FUNCTION__); -@@ -1284,7 +1290,12 @@ ReadN(RTMP *r, char *buffer, int n) - return 0; - } - } -- HTTP_read(r, 0); -+ if (HTTP_read(r, 0) == -1) -+ { -+ RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); -+ RTMP_Close(r); -+ return 0; -+ } - } - if (r->m_resplen && !r->m_sb.sb_size) - RTMPSockBuf_Fill(&r->m_sb); -@@ -3670,7 +3681,7 @@ HTTP_read(RTMP *r, int fill) - if (fill) - RTMPSockBuf_Fill(&r->m_sb); - if (r->m_sb.sb_size < 144) -- return -1; -+ return -2; - if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) - return -1; - ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); --- -1.7.10.4 - - -From aa2825fbb1d1f70652d558a730baed28149ebbdd Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Sat, 19 Mar 2011 23:32:53 +0000 -Subject: [PATCH 23/34] Drop back on the handshake version, avoid rtmpe 9 - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@562 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/handshake.h b/librtmp/handshake.h -index 958579a..d4d2913 100644 ---- a/librtmp/handshake.h -+++ b/librtmp/handshake.h -@@ -400,8 +400,10 @@ HandShake(RTMP * r, int FP9HandShake) - /* set version to at least 9.0.115.0 */ - if (encrypted) - { -- clientsig[4] = 128; -- clientsig[6] = 3; -+/* clientsig[4] = 128; -+ clientsig[6] = 3; */ -+ clientsig[4] = 0x7c; -+ clientsig[6] = 0x2; - } - else - { --- -1.7.10.4 - - -From ac1843db901184bef349615e3b67d7d2fcebdb7f Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Tue, 22 Mar 2011 15:13:18 +0000 -Subject: [PATCH 24/34] Fix prev commit - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@563 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/handshake.h b/librtmp/handshake.h -index d4d2913..b172dbf 100644 ---- a/librtmp/handshake.h -+++ b/librtmp/handshake.h -@@ -402,8 +402,8 @@ HandShake(RTMP * r, int FP9HandShake) - { - /* clientsig[4] = 128; - clientsig[6] = 3; */ -- clientsig[4] = 0x7c; -- clientsig[6] = 0x2; -+ clientsig[4] = 9; -+ clientsig[6] = 0x7c; - } - else - { --- -1.7.10.4 - - -From 495e1e64106f10a7a1c15f0e2f870a02aa90605c Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 7 Apr 2011 19:07:31 +0000 -Subject: [PATCH 25/34] Handle Play.PublishNotify like Play.Start - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@566 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index 3042c7f..286b6ae 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -2282,6 +2282,8 @@ static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete"); - static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop"); - static const AVal av_NetStream_Seek_Notify = AVC("NetStream.Seek.Notify"); - static const AVal av_NetStream_Pause_Notify = AVC("NetStream.Pause.Notify"); -+static const AVal av_NetStream_Play_PublishNotify = -+AVC("NetStream.Play.PublishNotify"); - static const AVal av_NetStream_Play_UnpublishNotify = - AVC("NetStream.Play.UnpublishNotify"); - static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start"); -@@ -2449,7 +2451,8 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) - RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val); - } - -- else if (AVMATCH(&code, &av_NetStream_Play_Start)) -+ else if (AVMATCH(&code, &av_NetStream_Play_Start) -+ || AVMATCH(&code, &av_NetStream_Play_PublishNotify)) - { - int i; - r->m_bPlaying = TRUE; --- -1.7.10.4 - - -From 041cf3f2c927b26dc4b27b5e802fbb89362ea3e2 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 7 Apr 2011 19:11:13 +0000 -Subject: [PATCH 26/34] Handle multiple sessions at once (ugly) - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@567 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/rtmpsuck.c b/rtmpsuck.c -index ce6d879..3293e8b 100644 ---- a/rtmpsuck.c -+++ b/rtmpsuck.c -@@ -718,15 +718,15 @@ controlServerThread(void *unused) - TFRET(); - } - --void doServe(STREAMING_SERVER * server, // server socket and state (our listening socket) -- int sockfd // client connection socket -- ) -+TFTYPE doServe(void *arg) // server socket and state (our listening socket) - { -+ STREAMING_SERVER *server = arg; - RTMPPacket pc = { 0 }, ps = { 0 }; - RTMPChunk rk = { 0 }; - char *buf = NULL; - unsigned int buflen = 131072; - int paused = FALSE; -+ int sockfd = server->socket; - - // timeout for http requests - fd_set rfds; -@@ -990,7 +990,7 @@ quit: - if (server->state == STREAMING_IN_PROGRESS) - server->state = STREAMING_ACCEPTING; - -- return; -+ TFRET(); - } - - TFTYPE -@@ -1003,6 +1003,7 @@ serverThread(void *arg) - { - struct sockaddr_in addr; - socklen_t addrlen = sizeof(struct sockaddr_in); -+ STREAMING_SERVER *srv2 = malloc(sizeof(STREAMING_SERVER)); - int sockfd = - accept(server->socket, (struct sockaddr *) &addr, &addrlen); - -@@ -1020,8 +1021,10 @@ serverThread(void *arg) - RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__, - inet_ntoa(addr.sin_addr)); - #endif -+ *srv2 = *server; -+ srv2->socket = sockfd; - /* Create a new thread and transfer the control to that */ -- doServe(server, sockfd); -+ ThreadCreate(doServe, srv2); - RTMP_Log(RTMP_LOGDEBUG, "%s: processed request\n", __FUNCTION__); - } - else --- -1.7.10.4 - - -From 6155179b296f9749f713bb9bf47e9ca1fdb1a201 Mon Sep 17 00:00:00 2001 -From: hyc <hyc@400ebc74-4327-4243-bc38-086b20814532> -Date: Thu, 7 Apr 2011 19:33:28 +0000 -Subject: [PATCH 27/34] Use symbolic constants for packet types. From Peter - Miller @ opensource.org.au - -git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@568 400ebc74-4327-4243-bc38-086b20814532 - -diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c -index 286b6ae..5ef3ae9 100644 ---- a/librtmp/rtmp.c -+++ b/librtmp/rtmp.c -@@ -1103,32 +1103,32 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - int bHasMediaPacket = 0; - switch (packet->m_packetType) - { -- case 0x01: -+ case RTMP_PACKET_TYPE_CHUNK_SIZE: - /* chunk size */ - HandleChangeChunkSize(r, packet); - break; - -- case 0x03: -+ case RTMP_PACKET_TYPE_BYTES_READ_REPORT: - /* bytes read report */ - RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__); - break; - -- case 0x04: -+ case RTMP_PACKET_TYPE_CONTROL: - /* ctrl */ - HandleCtrl(r, packet); - break; - -- case 0x05: -+ case RTMP_PACKET_TYPE_SERVER_BW: - /* server bw */ - HandleServerBW(r, packet); - break; - -- case 0x06: -+ case RTMP_PACKET_TYPE_CLIENT_BW: - /* client bw */ - HandleClientBW(r, packet); - break; - -- case 0x08: -+ case RTMP_PACKET_TYPE_AUDIO: - /* audio data */ - /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize); */ - HandleAudio(r, packet); -@@ -1139,7 +1139,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - r->m_mediaStamp = packet->m_nTimeStamp; - break; - -- case 0x09: -+ case RTMP_PACKET_TYPE_VIDEO: - /* video data */ - /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize); */ - HandleVideo(r, packet); -@@ -1150,19 +1150,22 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - r->m_mediaStamp = packet->m_nTimeStamp; - break; - -- case 0x0F: /* flex stream send */ -+ case RTMP_PACKET_TYPE_FLEX_STREAM_SEND: -+ /* flex stream send */ - RTMP_Log(RTMP_LOGDEBUG, - "%s, flex stream send, size %lu bytes, not supported, ignoring", - __FUNCTION__, packet->m_nBodySize); - break; - -- case 0x10: /* flex shared object */ -+ case RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT: -+ /* flex shared object */ - RTMP_Log(RTMP_LOGDEBUG, - "%s, flex shared object, size %lu bytes, not supported, ignoring", - __FUNCTION__, packet->m_nBodySize); - break; - -- case 0x11: /* flex message */ -+ case RTMP_PACKET_TYPE_FLEX_MESSAGE: -+ /* flex message */ - { - RTMP_Log(RTMP_LOGDEBUG, - "%s, flex message, size %lu bytes, not fully supported", -@@ -1185,7 +1188,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - bHasMediaPacket = 2; - break; - } -- case 0x12: -+ case RTMP_PACKET_TYPE_INFO: - /* metadata (notify) */ - RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %lu bytes", __FUNCTION__, - packet->m_nBodySize); -@@ -1193,12 +1196,12 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - bHasMediaPacket = 1; - break; - -- case 0x13: -+ case RTMP_PACKET_TYPE_SHARED_OBJECT: - RTMP_Log(RTMP_LOGDEBUG, "%s, shared object, not supported, ignoring", - __FUNCTION__); - break; - -- case 0x14: -+ case RTMP_PACKET_TYPE_INVOKE: - /* invoke */ - RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__, - packet->m_nBodySize); -@@ -1208,7 +1211,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) - bHasMediaPacket = 2; - break; - -- case 0x16: -+ case RTMP_PACKET_TYPE_FLASH_VIDEO: - { - /* go through FLV packets and handle metadata packets */ - unsigned int pos = 0; -@@ -1448,7 +1451,7 @@ SendConnectPacket(RTMP *r, RTMPPacket *cp) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1559,7 +1562,7 @@ SendBGHasStream(RTMP *r, double dId, AVal *playpath) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1591,7 +1594,7 @@ RTMP_SendCreateStream(RTMP *r) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1617,7 +1620,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribepath) - char *enc; - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1649,7 +1652,7 @@ SendReleaseStream(RTMP *r) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1679,7 +1682,7 @@ SendFCPublish(RTMP *r) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1709,7 +1712,7 @@ SendFCUnpublish(RTMP *r) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1741,7 +1744,7 @@ SendPublish(RTMP *r) - - packet.m_nChannel = 0x04; /* source channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = r->m_stream_id; - packet.m_hasAbsTimestamp = 0; -@@ -1776,7 +1779,7 @@ SendDeleteStream(RTMP *r, double dStreamId) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1805,7 +1808,7 @@ RTMP_SendPause(RTMP *r, int DoPause, int iTime) - - packet.m_nChannel = 0x08; /* video channel */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* invoke */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1842,7 +1845,7 @@ RTMP_SendSeek(RTMP *r, int iTime) - - packet.m_nChannel = 0x08; /* video channel */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* invoke */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1870,7 +1873,7 @@ RTMP_SendServerBW(RTMP *r) - - packet.m_nChannel = 0x02; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x05; /* Server BW */ -+ packet.m_packetType = RTMP_PACKET_TYPE_SERVER_BW; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1890,7 +1893,7 @@ RTMP_SendClientBW(RTMP *r) - - packet.m_nChannel = 0x02; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x06; /* Client BW */ -+ packet.m_packetType = RTMP_PACKET_TYPE_CLIENT_BW; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1911,7 +1914,7 @@ SendBytesReceived(RTMP *r) - - packet.m_nChannel = 0x02; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x03; /* bytes in */ -+ packet.m_packetType = RTMP_PACKET_TYPE_BYTES_READ_REPORT; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1937,7 +1940,7 @@ SendCheckBW(RTMP *r) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */ - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1965,7 +1968,7 @@ SendCheckBWResult(RTMP *r, double txn) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; /* temp inc value. till we figure it out. */ - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -1994,7 +1997,7 @@ SendPong(RTMP *r, double txn) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; /* temp inc value. till we figure it out. */ - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -2021,7 +2024,7 @@ SendPlay(RTMP *r) - - packet.m_nChannel = 0x08; /* we make 8 our stream channel */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = r->m_stream_id; /*0x01000000; */ - packet.m_hasAbsTimestamp = 0; -@@ -2089,7 +2092,7 @@ SendPlaylist(RTMP *r) - - packet.m_nChannel = 0x08; /* we make 8 our stream channel */ - packet.m_headerType = RTMP_PACKET_SIZE_LARGE; -- packet.m_packetType = 0x14; /* INVOKE */ -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = r->m_stream_id; /*0x01000000; */ - packet.m_hasAbsTimestamp = 0; -@@ -2127,7 +2130,7 @@ SendSecureTokenResponse(RTMP *r, AVal *resp) - - packet.m_nChannel = 0x03; /* control channel (invoke) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x14; -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -2174,7 +2177,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime) - - packet.m_nChannel = 0x02; /* control channel (ping) */ - packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; -- packet.m_packetType = 0x04; /* ctrl */ -+ packet.m_packetType = RTMP_PACKET_TYPE_CONTROL; - packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */ - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -3372,7 +3375,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) - } - - /* we invoked a remote method */ -- if (packet->m_packetType == 0x14) -+ if (packet->m_packetType == RTMP_PACKET_TYPE_INVOKE) - { - AVal method; - char *ptr; -@@ -3748,8 +3751,8 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - char *packetBody = packet.m_body; - unsigned int nPacketLen = packet.m_nBodySize; - -- /* Return -3 if this was completed nicely with invoke message -- * Play.Stop or Play.Complete -+ /* Return RTMP_READ_COMPLETE if this was completed nicely with -+ * invoke message Play.Stop or Play.Complete - */ - if (rtnGetNextMediaPacket == 2) - { -@@ -3760,17 +3763,17 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - break; - } - -- r->m_read.dataType |= (((packet.m_packetType == 0x08) << 2) | -- (packet.m_packetType == 0x09)); -+ r->m_read.dataType |= (((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO) << 2) | -+ (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO)); - -- if (packet.m_packetType == 0x09 && nPacketLen <= 5) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO && nPacketLen <= 5) - { - RTMP_Log(RTMP_LOGDEBUG, "ignoring too small video packet: size: %d", - nPacketLen); - ret = RTMP_READ_IGNORE; - break; - } -- if (packet.m_packetType == 0x08 && nPacketLen <= 1) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_AUDIO && nPacketLen <= 1) - { - RTMP_Log(RTMP_LOGDEBUG, "ignoring too small audio packet: size: %d", - nPacketLen); -@@ -3787,7 +3790,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, TS: %d ms, abs TS: %d", - packet.m_packetType, nPacketLen, packet.m_nTimeStamp, - packet.m_hasAbsTimestamp); -- if (packet.m_packetType == 0x09) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) - RTMP_Log(RTMP_LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0)); - #endif - -@@ -3797,7 +3800,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - if (packet.m_nTimeStamp == 0) - { - if (r->m_read.nMetaHeaderSize > 0 -- && packet.m_packetType == 0x12) -+ && packet.m_packetType == RTMP_PACKET_TYPE_INFO) - { - AMFObject metaObj; - int nRes = -@@ -3858,7 +3861,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - * in the first FLV stream chunk and we have to compare - * it and filter it out !! - */ -- if (packet.m_packetType == 0x16) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) - { - /* basically we have to find the keyframe with the - * correct TS being nResumeTS -@@ -3970,7 +3973,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - * (seeking might put us somewhere before it) - */ - if (!(r->m_read.flags & RTMP_READ_GOTKF) && -- packet.m_packetType != 0x16) -+ packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) - { - RTMP_Log(RTMP_LOGWARNING, - "Stream does not start with requested frame, ignoring data... "); -@@ -3983,7 +3986,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - } - /* ok, do the same for FLV streams */ - if (!(r->m_read.flags & RTMP_READ_GOTFLVK) && -- packet.m_packetType == 0x16) -+ packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) - { - RTMP_Log(RTMP_LOGWARNING, - "Stream does not start with requested FLV frame, ignoring data... "); -@@ -4002,9 +4005,11 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - * the preceding if clause) - */ - if (!(r->m_read.flags & RTMP_READ_NO_IGNORE) && -- packet.m_packetType != 0x16) -- { /* exclude type 0x16 (FLV) since it can -- * contain several FLV packets */ -+ packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) -+ { -+ /* exclude type RTMP_PACKET_TYPE_FLASH_VIDEO since it can -+ * contain several FLV packets -+ */ - if (packet.m_nTimeStamp == 0) - { - ret = RTMP_READ_IGNORE; -@@ -4020,9 +4025,10 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - - /* calculate packet size and allocate slop buffer if necessary */ - size = nPacketLen + -- ((packet.m_packetType == 0x08 || packet.m_packetType == 0x09 -- || packet.m_packetType == 0x12) ? 11 : 0) + -- (packet.m_packetType != 0x16 ? 4 : 0); -+ ((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO -+ || packet.m_packetType == RTMP_PACKET_TYPE_VIDEO -+ || packet.m_packetType == RTMP_PACKET_TYPE_INFO) ? 11 : 0) + -+ (packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO ? 4 : 0); - - if (size + 4 > buflen) - { -@@ -4048,8 +4054,9 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - - /* audio (0x08), video (0x09) or metadata (0x12) packets : - * construct 11 byte header then add rtmp packet's data */ -- if (packet.m_packetType == 0x08 || packet.m_packetType == 0x09 -- || packet.m_packetType == 0x12) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_AUDIO -+ || packet.m_packetType == RTMP_PACKET_TYPE_VIDEO -+ || packet.m_packetType == RTMP_PACKET_TYPE_INFO) - { - nTimeStamp = r->m_read.nResumeTS + packet.m_nTimeStamp; - prevTagSize = 11 + nPacketLen; -@@ -4059,7 +4066,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - ptr = AMF_EncodeInt24(ptr, pend, nPacketLen); - - #if 0 -- if(packet.m_packetType == 0x09) { /* video */ -+ if(packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) { - - /* H264 fix: */ - if((packetBody[0] & 0x0f) == 7) { /* CodecId = H264 */ -@@ -4089,7 +4096,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - len = nPacketLen; - - /* correct tagSize and obtain timestamp if we have an FLV stream */ -- if (packet.m_packetType == 0x16) -+ if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) - { - unsigned int pos = 0; - int delta; -@@ -4167,7 +4174,7 @@ Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) - } - ptr += len; - -- if (packet.m_packetType != 0x16) -+ if (packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) - { - /* FLV tag packets contain their own prevTagSize */ - AMF_EncodeInt32(ptr, pend, prevTagSize); -@@ -4352,11 +4359,12 @@ RTMP_Write(RTMP *r, const char *buf, int size) - buf += 3; - s2 -= 11; - -- if (((pkt->m_packetType == 0x08 || pkt->m_packetType == 0x09) && -- !pkt->m_nTimeStamp) || pkt->m_packetType == 0x12) -+ if (((pkt->m_packetType == RTMP_PACKET_TYPE_AUDIO -+ || pkt->m_packetType == RTMP_PACKET_TYPE_VIDEO) && -+ !pkt->m_nTimeStamp) || pkt->m_packetType == RTMP_PACKET_TYPE_INFO) - { - pkt->m_headerType = RTMP_PACKET_SIZE_LARGE; -- if (pkt->m_packetType == 0x12) -+ if (pkt->m_packetType == RTMP_PACKET_TYPE_INFO) - pkt->m_nBodySize += 16; - } - else -@@ -4371,7 +4379,7 @@ RTMP_Write(RTMP *r, const char *buf, int size) - } - enc = pkt->m_body; - pend = enc + pkt->m_nBodySize; -- if (pkt->m_packetType == 0x12) -+ if (pkt->m_packetType == RTMP_PACKET_TYPE_INFO) - { - enc = AMF_EncodeString(enc, pend, &av_setDataFrame); - pkt->m_nBytesRead = enc - pkt->m_body; -diff --git a/librtmp/rtmp.h b/librtmp/rtmp.h -index de0b795..1ece207 100644 ---- a/librtmp/rtmp.h -+++ b/librtmp/rtmp.h -@@ -71,9 +71,29 @@ extern "C" - - uint32_t RTMP_GetTime(void); - --#define RTMP_PACKET_TYPE_AUDIO 0x08 --#define RTMP_PACKET_TYPE_VIDEO 0x09 --#define RTMP_PACKET_TYPE_INFO 0x12 -+/* RTMP_PACKET_TYPE_... 0x00 */ -+#define RTMP_PACKET_TYPE_CHUNK_SIZE 0x01 -+/* RTMP_PACKET_TYPE_... 0x02 */ -+#define RTMP_PACKET_TYPE_BYTES_READ_REPORT 0x03 -+#define RTMP_PACKET_TYPE_CONTROL 0x04 -+#define RTMP_PACKET_TYPE_SERVER_BW 0x05 -+#define RTMP_PACKET_TYPE_CLIENT_BW 0x06 -+/* RTMP_PACKET_TYPE_... 0x07 */ -+#define RTMP_PACKET_TYPE_AUDIO 0x08 -+#define RTMP_PACKET_TYPE_VIDEO 0x09 -+/* RTMP_PACKET_TYPE_... 0x0A */ -+/* RTMP_PACKET_TYPE_... 0x0B */ -+/* RTMP_PACKET_TYPE_... 0x0C */ -+/* RTMP_PACKET_TYPE_... 0x0D */ -+/* RTMP_PACKET_TYPE_... 0x0E */ -+#define RTMP_PACKET_TYPE_FLEX_STREAM_SEND 0x0F -+#define RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT 0x10 -+#define RTMP_PACKET_TYPE_FLEX_MESSAGE 0x11 -+#define RTMP_PACKET_TYPE_INFO 0x12 -+#define RTMP_PACKET_TYPE_SHARED_OBJECT 0x13 -+#define RTMP_PACKET_TYPE_INVOKE 0x14 -+/* RTMP_PACKET_TYPE_... 0x15 */ -+#define RTMP_PACKET_TYPE_FLASH_VIDEO 0x16 - - #define RTMP_MAX_HEADER_SIZE 18 - -diff --git a/rtmpsrv.c b/rtmpsrv.c -index 4d5699f..f1b6c66 100644 ---- a/rtmpsrv.c -+++ b/rtmpsrv.c -@@ -175,7 +175,7 @@ SendConnectResult(RTMP *r, double txn) - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ -- packet.m_packetType = 0x14; // INVOKE -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -236,7 +236,7 @@ SendResultNumber(RTMP *r, double txn, double ID) - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ -- packet.m_packetType = 0x14; // INVOKE -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -270,7 +270,7 @@ SendPlayStart(RTMP *r) - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ -- packet.m_packetType = 0x14; // INVOKE -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -@@ -302,7 +302,7 @@ SendPlayStop(RTMP *r) - - packet.m_nChannel = 0x03; // control channel (invoke) - packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ -- packet.m_packetType = 0x14; // INVOKE -+ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; - packet.m_nTimeStamp = 0; - packet.m_nInfoField2 = 0; - packet.m_hasAbsTimestamp = 0; -diff --git a/rtmpsuck.c b/rtmpsuck.c -index 3293e8b..661e64b 100644 ---- a/rtmpsuck.c -+++ b/rtmpsuck.c -@@ -461,67 +461,71 @@ ServePacket(STREAMING_SERVER *server, int which, RTMPPacket *packet) - - switch (packet->m_packetType) - { -- case 0x01: -+ case RTMP_PACKET_TYPE_CHUNK_SIZE: - // chunk size - // HandleChangeChunkSize(r, packet); - break; - -- case 0x03: -+ case RTMP_PACKET_TYPE_BYTES_READ_REPORT: - // bytes read report - break; - -- case 0x04: -+ case RTMP_PACKET_TYPE_CONTROL: - // ctrl - // HandleCtrl(r, packet); - break; - -- case 0x05: -+ case RTMP_PACKET_TYPE_SERVER_BW: - // server bw - // HandleServerBW(r, packet); - break; - -- case 0x06: -+ case RTMP_PACKET_TYPE_CLIENT_BW: - // client bw - // HandleClientBW(r, packet); - break; - -- case 0x08: -+ case RTMP_PACKET_TYPE_AUDIO: - // audio data - //RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize); - break; - -- case 0x09: -+ case RTMP_PACKET_TYPE_VIDEO: - // video data - //RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize); - break; - -- case 0x0F: // flex stream send -+ case RTMP_PACKET_TYPE_FLEX_STREAM_SEND: -+ // flex stream send - break; - -- case 0x10: // flex shared object -+ case RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT: -+ // flex shared object - break; - -- case 0x11: // flex message -+ case RTMP_PACKET_TYPE_FLEX_MESSAGE: -+ // flex message - { - ret = ServeInvoke(server, which, packet, packet->m_body + 1); - break; - } -- case 0x12: -+ case RTMP_PACKET_TYPE_INFO: - // metadata (notify) - break; - -- case 0x13: -+ case RTMP_PACKET_TYPE_SHARED_OBJECT: - /* shared object */ - break; - -- case 0x14: -+ case RTMP_PACKET_TYPE_INVOKE: - // invoke - ret = ServeInvoke(server, which, packet, packet->m_body); - break; - -- case 0x16: -+ case RTMP_PACKET_TYPE_FLASH_VIDEO: - /* flv */ - break; -+ - default: - RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__, - packet->m_packetType); -@@ -547,21 +551,21 @@ WriteStream(char **buf, // target pointer, maybe preallocated - unsigned int nPacketLen = packet->m_nBodySize; - - // skip video info/command packets -- if (packet->m_packetType == 0x09 && -+ if (packet->m_packetType == RTMP_PACKET_TYPE_VIDEO && - nPacketLen == 2 && ((*packetBody & 0xf0) == 0x50)) - { - ret = 0; - break; - } - -- if (packet->m_packetType == 0x09 && nPacketLen <= 5) -+ if (packet->m_packetType == RTMP_PACKET_TYPE_VIDEO && nPacketLen <= 5) - { - RTMP_Log(RTMP_LOGWARNING, "ignoring too small video packet: size: %d", - nPacketLen); - ret = 0; - break; - } -- if (packet->m_packetType == 0x08 && nPacketLen <= 1) -+ if (packet->m_packetType == RTMP_PACKET_TYPE_AUDIO && nPacketLen <= 1) - { - RTMP_Log(RTMP_LOGWARNING, "ignoring too small audio packet: size: %d", - nPacketLen); -@@ -571,19 +575,22 @@ WriteStream(char **buf, // target pointer, maybe preallocated - #ifdef _DEBUG - RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, TS: %d ms", packet->m_packetType, - nPacketLen, packet->m_nTimeStamp); -- if (packet->m_packetType == 0x09) -+ if (packet->m_packetType == RTMP_PACKET_TYPE_VIDEO) - RTMP_Log(RTMP_LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0)); - #endif - - // calculate packet size and reallocate buffer if necessary - unsigned int size = nPacketLen - + -- ((packet->m_packetType == 0x08 || packet->m_packetType == 0x09 -- || packet->m_packetType == 0x12) ? 11 : 0) + (packet->m_packetType != -- 0x16 ? 4 : 0); -+ ((packet->m_packetType == RTMP_PACKET_TYPE_AUDIO -+ || packet->m_packetType == RTMP_PACKET_TYPE_VIDEO -+ || packet->m_packetType == RTMP_PACKET_TYPE_INFO) ? 11 : 0) -+ + (packet->m_packetType != 0x16 ? 4 : 0); - - if (size + 4 > len) -- { // the extra 4 is for the case of an FLV stream without a last prevTagSize (we need extra 4 bytes to append it) -+ { -+ /* The extra 4 is for the case of an FLV stream without a last -+ * prevTagSize (we need extra 4 bytes to append it). */ - *buf = (char *) realloc(*buf, size + 4); - if (*buf == 0) - { -@@ -594,13 +601,15 @@ WriteStream(char **buf, // target pointer, maybe preallocated - } - char *ptr = *buf, *pend = ptr + size+4; - -- // audio (0x08), video (0x09) or metadata (0x12) packets : -- // construct 11 byte header then add rtmp packet's data -- if (packet->m_packetType == 0x08 || packet->m_packetType == 0x09 -- || packet->m_packetType == 0x12) -+ /* audio (RTMP_PACKET_TYPE_AUDIO), video (RTMP_PACKET_TYPE_VIDEO) -+ * or metadata (RTMP_PACKET_TYPE_INFO) packets: construct 11 byte -+ * header then add rtmp packet's data. */ -+ if (packet->m_packetType == RTMP_PACKET_TYPE_AUDIO -+ || packet->m_packetType == RTMP_PACKET_TYPE_VIDEO -+ || packet->m_packetType == RTMP_PACKET_TYPE_INFO) - { - // set data type -- //*dataType |= (((packet->m_packetType == 0x08)<<2)|(packet->m_packetType == 0x09)); -+ //*dataType |= (((packet->m_packetType == RTMP_PACKET_TYPE_AUDIO)<<2)|(packet->m_packetType == RTMP_PACKET_TYPE_VIDEO)); - - (*nTimeStamp) = packet->m_nTimeStamp; - prevTagSize = 11 + nPacketLen; -@@ -619,7 +628,7 @@ WriteStream(char **buf, // target pointer, maybe preallocated - unsigned int len = nPacketLen; - - // correct tagSize and obtain timestamp if we have an FLV stream -- if (packet->m_packetType == 0x16) -+ if (packet->m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) - { - unsigned int pos = 0; - -@@ -629,8 +638,11 @@ WriteStream(char **buf, // target pointer, maybe preallocated - *nTimeStamp = AMF_DecodeInt24(packetBody + pos + 4); - *nTimeStamp |= (packetBody[pos + 7] << 24); - -- // set data type -- //*dataType |= (((*(packetBody+pos) == 0x08)<<2)|(*(packetBody+pos) == 0x09)); -+#if 0 -+ /* set data type */ -+ *dataType |= (((*(packetBody+pos) == RTMP_PACKET_TYPE_AUDIO) << 2) -+ | (*(packetBody+pos) == RTMP_PACKET_TYPE_VIDEO)); -+#endif - - if (pos + 11 + dataSize + 4 > nPacketLen) - { -@@ -680,7 +692,7 @@ WriteStream(char **buf, // target pointer, maybe preallocated - } - ptr += len; - -- if (packet->m_packetType != 0x16) -+ if (packet->m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) - { // FLV tag packets contain their own prevTagSize - AMF_EncodeInt32(ptr, pend, prevTagSize); - //ptr += 4; -@@ -828,7 +840,7 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - if (RTMPPacket_IsReady(&ps)) - { - /* change chunk size */ -- if (ps.m_packetType == 0x01) -+ if (ps.m_packetType == RTMP_PACKET_TYPE_CHUNK_SIZE) - { - if (ps.m_nBodySize >= 4) - { -@@ -839,7 +851,7 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - } - } - /* bytes received */ -- else if (ps.m_packetType == 0x03) -+ else if (ps.m_packetType == RTMP_PACKET_TYPE_BYTES_READ_REPORT) - { - if (ps.m_nBodySize >= 4) - { -@@ -849,7 +861,7 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - } - } - /* ctrl */ -- else if (ps.m_packetType == 0x04) -+ else if (ps.m_packetType == RTMP_PACKET_TYPE_CONTROL) - { - short nType = AMF_DecodeInt16(ps.m_body); - /* UpdateBufferMS */ -@@ -875,13 +887,16 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - } - } - } -- else if (ps.m_packetType == 0x11 || ps.m_packetType == 0x14) -- if (ServePacket(server, 0, &ps) && server->f_cur) -- { -- fclose(server->f_cur->f_file); -- server->f_cur->f_file = NULL; -- server->f_cur = NULL; -- } -+ else if (ps.m_packetType == RTMP_PACKET_TYPE_FLEX_MESSAGE -+ || ps.m_packetType == RTMP_PACKET_TYPE_INVOKE) -+ { -+ if (ServePacket(server, 0, &ps) && server->f_cur) -+ { -+ fclose(server->f_cur->f_file); -+ server->f_cur->f_file = NULL; -+ server->f_cur = NULL; -+ } -+ } - RTMP_SendPacket(&server->rc, &ps, FALSE); - RTMPPacket_Free(&ps); - break; -@@ -902,7 +917,7 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - server->rc.m_pausing = 0; - } - /* change chunk size */ -- if (pc.m_packetType == 0x01) -+ if (pc.m_packetType == RTMP_PACKET_TYPE_CHUNK_SIZE) - { - if (pc.m_nBodySize >= 4) - { -@@ -912,7 +927,7 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - server->rs.m_outChunkSize = server->rc.m_inChunkSize; - } - } -- else if (pc.m_packetType == 0x04) -+ else if (pc.m_packetType == RTMP_PACKET_TYPE_CONTROL) - { - short nType = AMF_DecodeInt16(pc.m_body); - /* SWFverification */ -@@ -929,17 +944,18 @@ TFTYPE doServe(void *arg) // server socket and state (our listening socket) - #endif - } - else if (server->f_cur && ( -- pc.m_packetType == 0x08 || -- pc.m_packetType == 0x09 || -- pc.m_packetType == 0x12 || -- pc.m_packetType == 0x16) && -+ pc.m_packetType == RTMP_PACKET_TYPE_AUDIO || -+ pc.m_packetType == RTMP_PACKET_TYPE_VIDEO || -+ pc.m_packetType == RTMP_PACKET_TYPE_INFO || -+ pc.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) && - RTMP_ClientPacket(&server->rc, &pc)) - { - int len = WriteStream(&buf, &buflen, &server->stamp, &pc); - if (len > 0 && fwrite(buf, 1, len, server->f_cur->f_file) != len) - goto cleanup; - } -- else if ( pc.m_packetType == 0x11 || pc.m_packetType == 0x14) -+ else if (pc.m_packetType == RTMP_PACKET_TYPE_FLEX_MESSAGE || -+ pc.m_packetType == RTMP_PACKET_TYPE_INVOKE) - { - if (ServePacket(server, 1, &pc) && server->f_cur) - { --- -1.7.10.4 - - -From e09abc08504988e5c286ffc9c92da3ba76f95a20 Mon Sep 17 00:00:00 2001 -From: Compn <tempn@twmi.rr.com> -Date: Tue, 5 Jul 2011 09:48:23 -0400 -Subject: [PATCH 28/34] add -shared to mingw ldflags, fixes compilation error - patch by Martin Storsjo - - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 1ea31a0..785e869 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -54,7 +54,7 @@ SODIR=$(SODIR_$(SYS)) - SO_LDFLAGS_posix=-shared -Wl,-soname,$@ - SO_LDFLAGS_darwin=-dynamiclib -flat_namespace -undefined suppress -fno-common \ - -headerpad_max_install_names --SO_LDFLAGS_mingw= -+SO_LDFLAGS_mingw=-shared - SO_LDFLAGS=$(SO_LDFLAGS_$(SYS)) - - SHARED=yes --- -1.7.10.4 - - -From 0e9b4917c1163227c48cd83e081aa972ed7d3111 Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 14:41:11 -0700 -Subject: [PATCH 29/34] Revert "Drop back on the handshake version, avoid - rtmpe 9" - -This reverts commit aa2825fbb1d1f70652d558a730baed28149ebbdd. - -Conflicts: - - librtmp/handshake.h - -diff --git a/librtmp/handshake.h b/librtmp/handshake.h -index b172dbf..958579a 100644 ---- a/librtmp/handshake.h -+++ b/librtmp/handshake.h -@@ -400,10 +400,8 @@ HandShake(RTMP * r, int FP9HandShake) - /* set version to at least 9.0.115.0 */ - if (encrypted) - { --/* clientsig[4] = 128; -- clientsig[6] = 3; */ -- clientsig[4] = 9; -- clientsig[6] = 0x7c; -+ clientsig[4] = 128; -+ clientsig[6] = 3; - } - else - { --- -1.7.10.4 - - -From d1f14b147e03aa17c968b96d6573320410a5252c Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 16:12:39 -0700 -Subject: [PATCH 30/34] Add RTMPE type 9 handshake signature - - -diff --git a/librtmp/handshake.h b/librtmp/handshake.h -index 958579a..98bf3c8 100644 ---- a/librtmp/handshake.h -+++ b/librtmp/handshake.h -@@ -358,6 +358,337 @@ static void rtmpe8_sig(uint8_t *in, uint8_t *out, int keyid) - out[7] = v1; - } - -+/* RTMPE type 9 uses Blowfish on the regular signature -+ * http://en.wikipedia.org/wiki/Blowfish_(cipher) -+ */ -+#define BF_ROUNDS 16 -+typedef struct bf_key { -+ uint32_t s[4][256]; -+ uint32_t p[BF_ROUNDS+2]; -+} bf_key; -+ -+static const uint32_t bf_sinit[][256] = { -+ -+ /* S-Box 0 */ -+ { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, -+ 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, -+ 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, -+ 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, -+ 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, -+ 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, -+ 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, -+ 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, -+ 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, -+ 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, -+ 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, -+ 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, -+ 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, -+ 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, -+ 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, -+ 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, -+ 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, -+ 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, -+ 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, -+ 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, -+ 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, -+ 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, -+ 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, -+ 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, -+ 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, -+ 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, -+ 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, -+ 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, -+ 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, -+ 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, -+ 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, -+ 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, -+ 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, -+ 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, -+ 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, -+ 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, -+ 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, -+ 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, -+ 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, -+ 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, -+ 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, -+ 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, -+ 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, }, -+ -+ /* S-Box 1 */ -+ { 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, -+ 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, -+ 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, -+ 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, -+ 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, -+ 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, -+ 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, -+ 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, -+ 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, -+ 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, -+ 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, -+ 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, -+ 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, -+ 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, -+ 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, -+ 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, -+ 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, -+ 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, -+ 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, -+ 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, -+ 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, -+ 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, -+ 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, -+ 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, -+ 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, -+ 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, -+ 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, -+ 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, -+ 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, -+ 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, -+ 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, -+ 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, -+ 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, -+ 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, -+ 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, -+ 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, -+ 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, -+ 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, -+ 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, -+ 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, -+ 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, -+ 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, -+ 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, }, -+ -+ /* S-Box 2 */ -+ { 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, -+ 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, -+ 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, -+ 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, -+ 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, -+ 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, -+ 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, -+ 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, -+ 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, -+ 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, -+ 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, -+ 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, -+ 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, -+ 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, -+ 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, -+ 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, -+ 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, -+ 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, -+ 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, -+ 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, -+ 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, -+ 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, -+ 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, -+ 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, -+ 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, -+ 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, -+ 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, -+ 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, -+ 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, -+ 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, -+ 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, -+ 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, -+ 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, -+ 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, -+ 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, -+ 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, -+ 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, -+ 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, -+ 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, -+ 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, -+ 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, -+ 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, -+ 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, }, -+ -+ /* S-Box 3 */ -+ { 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, -+ 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, -+ 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, -+ 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, -+ 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, -+ 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, -+ 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, -+ 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, -+ 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, -+ 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, -+ 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, -+ 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, -+ 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, -+ 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, -+ 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, -+ 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, -+ 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, -+ 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, -+ 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, -+ 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, -+ 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, -+ 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, -+ 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, -+ 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, -+ 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, -+ 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, -+ 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, -+ 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, -+ 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, -+ 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, -+ 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, -+ 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, -+ 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, -+ 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, -+ 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, -+ 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, -+ 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, -+ 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, -+ 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, -+ 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, -+ 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, -+ 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, -+ 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6, }, -+}; -+ -+static const uint32_t bf_pinit[] = { -+ /* P-Box */ -+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, -+ 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, -+ 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, -+}; -+ -+#define KEYBYTES 24 -+ -+static const unsigned char rtmpe9_keys[16][KEYBYTES] = { -+ { 0x79, 0x34, 0x77, 0x4c, 0x67, 0xd1, 0x38, 0x3a, 0xdf, 0xb3, 0x56, 0xbe, -+ 0x8b, 0x7b, 0xd0, 0x24, 0x38, 0xe0, 0x73, 0x58, 0x41, 0x5d, 0x69, 0x67, }, -+ { 0x46, 0xf6, 0xb4, 0xcc, 0x01, 0x93, 0xe3, 0xa1, 0x9e, 0x7d, 0x3c, 0x65, -+ 0x55, 0x86, 0xfd, 0x09, 0x8f, 0xf7, 0xb3, 0xc4, 0x6f, 0x41, 0xca, 0x5c, }, -+ { 0x1a, 0xe7, 0xe2, 0xf3, 0xf9, 0x14, 0x79, 0x94, 0xc0, 0xd3, 0x97, 0x43, -+ 0x08, 0x7b, 0xb3, 0x84, 0x43, 0x2f, 0x9d, 0x84, 0x3f, 0x21, 0x01, 0x9b, }, -+ { 0xd3, 0xe3, 0x54, 0xb0, 0xf7, 0x1d, 0xf6, 0x2b, 0x5a, 0x43, 0x4d, 0x04, -+ 0x83, 0x64, 0x3e, 0x0d, 0x59, 0x2f, 0x61, 0xcb, 0xb1, 0x6a, 0x59, 0x0d, }, -+ { 0xc8, 0xc1, 0xe9, 0xb8, 0x16, 0x56, 0x99, 0x21, 0x7b, 0x5b, 0x36, 0xb7, -+ 0xb5, 0x9b, 0xdf, 0x06, 0x49, 0x2c, 0x97, 0xf5, 0x95, 0x48, 0x85, 0x7e, }, -+ { 0xeb, 0xe5, 0xe6, 0x2e, 0xa4, 0xba, 0xd4, 0x2c, 0xf2, 0x16, 0xe0, 0x8f, -+ 0x66, 0x23, 0xa9, 0x43, 0x41, 0xce, 0x38, 0x14, 0x84, 0x95, 0x00, 0x53, }, -+ { 0x66, 0xdb, 0x90, 0xf0, 0x3b, 0x4f, 0xf5, 0x6f, 0xe4, 0x9c, 0x20, 0x89, -+ 0x35, 0x5e, 0xd2, 0xb2, 0xc3, 0x9e, 0x9f, 0x7f, 0x63, 0xb2, 0x28, 0x81, }, -+ { 0xbb, 0x20, 0xac, 0xed, 0x2a, 0x04, 0x6a, 0x19, 0x94, 0x98, 0x9b, 0xc8, -+ 0xff, 0xcd, 0x93, 0xef, 0xc6, 0x0d, 0x56, 0xa7, 0xeb, 0x13, 0xd9, 0x30, }, -+ { 0xbc, 0xf2, 0x43, 0x82, 0x09, 0x40, 0x8a, 0x87, 0x25, 0x43, 0x6d, 0xe6, -+ 0xbb, 0xa4, 0xb9, 0x44, 0x58, 0x3f, 0x21, 0x7c, 0x99, 0xbb, 0x3f, 0x24, }, -+ { 0xec, 0x1a, 0xaa, 0xcd, 0xce, 0xbd, 0x53, 0x11, 0xd2, 0xfb, 0x83, 0xb6, -+ 0xc3, 0xba, 0xab, 0x4f, 0x62, 0x79, 0xe8, 0x65, 0xa9, 0x92, 0x28, 0x76, }, -+ { 0xc6, 0x0c, 0x30, 0x03, 0x91, 0x18, 0x2d, 0x7b, 0x79, 0xda, 0xe1, 0xd5, -+ 0x64, 0x77, 0x9a, 0x12, 0xc5, 0xb1, 0xd7, 0x91, 0x4f, 0x96, 0x4c, 0xa3, }, -+ { 0xd7, 0x7c, 0x2a, 0xbf, 0xa6, 0xe7, 0x85, 0x7c, 0x45, 0xad, 0xff, 0x12, -+ 0x94, 0xd8, 0xde, 0xa4, 0x5c, 0x3d, 0x79, 0xa4, 0x44, 0x02, 0x5d, 0x22, }, -+ { 0x16, 0x19, 0x0d, 0x81, 0x6a, 0x4c, 0xc7, 0xf8, 0xb8, 0xf9, 0x4e, 0xcd, -+ 0x2c, 0x9e, 0x90, 0x84, 0xb2, 0x08, 0x25, 0x60, 0xe1, 0x1e, 0xae, 0x18, }, -+ { 0xe9, 0x7c, 0x58, 0x26, 0x1b, 0x51, 0x9e, 0x49, 0x82, 0x60, 0x61, 0xfc, -+ 0xa0, 0xa0, 0x1b, 0xcd, 0xf5, 0x05, 0xd6, 0xa6, 0x6d, 0x07, 0x88, 0xa3, }, -+ { 0x2b, 0x97, 0x11, 0x8b, 0xd9, 0x4e, 0xd9, 0xdf, 0x20, 0xe3, 0x9c, 0x10, -+ 0xe6, 0xa1, 0x35, 0x21, 0x11, 0xf9, 0x13, 0x0d, 0x0b, 0x24, 0x65, 0xb2, }, -+ { 0x53, 0x6a, 0x4c, 0x54, 0xac, 0x8b, 0x9b, 0xb8, 0x97, 0x29, 0xfc, 0x60, -+ 0x2c, 0x5b, 0x3a, 0x85, 0x68, 0xb5, 0xaa, 0x6a, 0x44, 0xcd, 0x3f, 0xa7, }, -+}; -+ -+#define BF_ENC(X,S) \ -+ (((S[0][X>>24] + S[1][X>>16 & 0xff]) ^ S[2][(X>>8) & 0xff]) + S[3][X & 0xff]) -+ -+static void bf_enc(uint32_t *x, bf_key *key) -+{ -+ uint32_t Xl; -+ uint32_t Xr; -+ uint32_t temp; -+ int i; -+ -+ Xl = x[0]; -+ Xr = x[1]; -+ -+ for (i = 0; i < BF_ROUNDS; ++i) { -+ Xl ^= key->p[i]; -+ Xr ^= BF_ENC(Xl,key->s); -+ -+ temp = Xl; -+ Xl = Xr; -+ Xr = temp; -+ } -+ -+ Xl ^= key->p[BF_ROUNDS]; -+ Xr ^= key->p[BF_ROUNDS + 1]; -+ -+ x[0] = Xr; -+ x[1] = Xl; -+} -+ -+static void bf_setkey(const unsigned char *kp, int keybytes, bf_key *key) -+{ -+ int i; -+ int j; -+ int k; -+ uint32_t data; -+ uint32_t d[2]; -+ -+ memcpy(key->p, bf_pinit, sizeof(key->p)); -+ memcpy(key->s, bf_sinit, sizeof(key->s)); -+ -+ j = 0; -+ for (i = 0; i < BF_ROUNDS + 2; ++i) { -+ data = 0x00000000; -+ for (k = 0; k < 4; ++k) { -+ data = (data << 8) | kp[j]; -+ j = j + 1; -+ if (j >= keybytes) { -+ j = 0; -+ } -+ } -+ key->p[i] ^= data; -+ } -+ -+ d[0] = 0x00000000; -+ d[1] = 0x00000000; -+ -+ for (i = 0; i < BF_ROUNDS + 2; i += 2) { -+ bf_enc(d, key); -+ -+ key->p[i] = d[0]; -+ key->p[i + 1] = d[1]; -+ } -+ -+ for (i = 0; i < 4; ++i) { -+ for (j = 0; j < 256; j += 2) { -+ -+ bf_enc(d, key); -+ -+ key->s[i][j] = d[0]; -+ key->s[i][j + 1] = d[1]; -+ } -+ } -+} -+ -+static void rtmpe9_sig(uint8_t *in, uint8_t *out, int keyid) -+{ -+ uint32_t d[2]; -+ bf_key key; -+ -+ bf_setkey(rtmpe9_keys[keyid], KEYBYTES, &key); -+ -+ /* input is little-endian */ -+ d[0] = in[0] | (in[1] << 8) | (in[2] << 16) | (in[3] << 24); -+ d[1] = in[4] | (in[5] << 8) | (in[6] << 16) | (in[7] << 24); -+ bf_enc(d, &key); -+ out[0] = d[0] & 0xff; -+ out[1] = (d[0] >> 8) & 0xff; -+ out[2] = (d[0] >> 16) & 0xff; -+ out[3] = (d[0] >> 24) & 0xff; -+ out[4] = d[1] & 0xff; -+ out[5] = (d[1] >> 8) & 0xff; -+ out[6] = (d[1] >> 16) & 0xff; -+ out[7] = (d[1] >> 24) & 0xff; -+} -+ - static int - HandShake(RTMP * r, int FP9HandShake) - { -@@ -605,8 +936,7 @@ HandShake(RTMP * r, int FP9HandShake) - for (i=0; i<SHA256_DIGEST_LENGTH; i+=8) - rtmpe8_sig(sig+i, sig+i, dptr[i] % 15); - } --#if 0 -- else if (type == 9)) -+ else if (type == 9) - { - uint8_t *dptr = digestResp; - uint8_t *sig = signatureResp; -@@ -615,7 +945,6 @@ HandShake(RTMP * r, int FP9HandShake) - rtmpe9_sig(sig+i, sig+i, dptr[i] % 15); - } - #endif --#endif - RTMP_Log(RTMP_LOGDEBUG, "%s: Client signature calculated:", __FUNCTION__); - RTMP_LogHex(RTMP_LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH); - } -@@ -680,7 +1009,6 @@ HandShake(RTMP * r, int FP9HandShake) - for (i=0; i<SHA256_DIGEST_LENGTH; i+=8) - rtmpe8_sig(sig+i, sig+i, dptr[i] % 15); - } --#if 0 - else if (type == 9) - { - uint8_t *dptr = digest; -@@ -690,7 +1018,6 @@ HandShake(RTMP * r, int FP9HandShake) - rtmpe9_sig(sig+i, sig+i, dptr[i] % 15); - } - #endif --#endif - RTMP_Log(RTMP_LOGDEBUG, "%s: Signature calculated:", __FUNCTION__); - RTMP_LogHex(RTMP_LOGDEBUG, signature, SHA256_DIGEST_LENGTH); - if (memcmp -@@ -964,8 +1291,7 @@ SHandShake(RTMP * r) - for (i=0; i<SHA256_DIGEST_LENGTH; i+=8) - rtmpe8_sig(sig+i, sig+i, dptr[i] % 15); - } --#if 0 -- else if (type == 9)) -+ else if (type == 9) - { - uint8_t *dptr = digestResp; - uint8_t *sig = signatureResp; -@@ -974,7 +1300,6 @@ SHandShake(RTMP * r) - rtmpe9_sig(sig+i, sig+i, dptr[i] % 15); - } - #endif --#endif - - /* some info output */ - RTMP_Log(RTMP_LOGDEBUG, -@@ -1030,17 +1355,15 @@ SHandShake(RTMP * r) - for (i=0; i<SHA256_DIGEST_LENGTH; i+=8) - rtmpe8_sig(sig+i, sig+i, dptr[i] % 15); - } --#if 0 -- else if (type == 9)) -+ else if (type == 9) - { -- uint8_t *dptr = digestResp; -- uint8_t *sig = signatureResp; -+ uint8_t *dptr = digest; -+ uint8_t *sig = signature; - /* encrypt signatureResp */ - for (i=0; i<SHA256_DIGEST_LENGTH; i+=8) - rtmpe9_sig(sig+i, sig+i, dptr[i] % 15); - } - #endif --#endif - - /* show some information */ - RTMP_Log(RTMP_LOGDEBUG, "%s: Digest key: ", __FUNCTION__); --- -1.7.10.4 - - -From be0590a86af80df528e3556b86f110ad4b5cbb27 Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 16:41:28 -0700 -Subject: [PATCH 31/34] Add LIB_RTMP macro - -Allows changing to static linking on the cmd line - -diff --git a/Makefile b/Makefile -index c322e9a..1597be8 100644 ---- a/Makefile -+++ b/Makefile -@@ -35,7 +35,8 @@ MANDIR=$(DESTDIR)$(mandir) - LIBS_posix= - LIBS_darwin= - LIBS_mingw=-lws2_32 -lwinmm -lgdi32 --LIBS=-Llibrtmp -lrtmp $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) -+LIB_RTMP=-Llibrtmp -lrtmp -+LIBS=$(LIB_RTMP) $(CRYPTO_LIB) $(LIBS_$(SYS)) $(XLIBS) - - THREADLIB_posix=-lpthread - THREADLIB_darwin=-lpthread --- -1.7.10.4 - - -From 4028a5aa7f72cac44a62b4aac596ff3c82e6e019 Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 17:19:25 -0700 -Subject: [PATCH 32/34] Additional credit for RTMPE 9 keys - - -diff --git a/README b/README -index 5689853..865c6c4 100644 ---- a/README -+++ b/README -@@ -1,7 +1,8 @@ --RTMP Dump v2.3 -+RTMP Dump v2.4 - (C) 2009 Andrej Stepanchuk --(C) 2009-2010 Howard Chu -+(C) 2009-2011 Howard Chu - (C) 2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090 -+(C) 2011 33ae1ce77301f4b4494faaa5f609f3c48b9dcf82 - License: GPLv2 - librtmp license: LGPLv2.1 - http://rtmpdump.mplayerhq.hu/ --- -1.7.10.4 - - -From 3121324046e4ca1934e7e28293fc8326475d5053 Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 17:22:43 -0700 -Subject: [PATCH 33/34] Version bump - - -diff --git a/Makefile b/Makefile -index 1597be8..6ef5742 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,4 +1,4 @@ --VERSION=v2.3 -+VERSION=v2.4 - - prefix=/usr/local - -diff --git a/librtmp/Makefile b/librtmp/Makefile -index 785e869..d61e7a4 100644 ---- a/librtmp/Makefile -+++ b/librtmp/Makefile -@@ -1,4 +1,4 @@ --VERSION=v2.3 -+VERSION=v2.4 - - prefix=/usr/local - --- -1.7.10.4 - - -From c28f1bab7822de97353849e7787b59e50bbb1428 Mon Sep 17 00:00:00 2001 -From: Howard Chu <hyc@symas.com> -Date: Mon, 11 Jul 2011 17:24:33 -0700 -Subject: [PATCH 34/34] v2.4 changes - - -diff --git a/ChangeLog b/ChangeLog -index f57c580..fb2319f 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,9 +1,12 @@ - RTMPDump - Copyright 2008-2009 Andrej Stepanchuk; Distributed under the GPL v2 --Copyright 2009-2010 Howard Chu -+Copyright 2009-2011 Howard Chu - Copyright 2009 The Flvstreamer Team - http://rtmpdump.mplayerhq.hu/ - -+11 July 2011, v2.4 -+- add RTMPE type 9 handshake support -+ - 30 June 2010, v2.3 - - fix RC4 cleanup for GnuTLS/gcrypt - - declare RTMP_Write buf as const --- -1.7.10.4 - |