Commit 0f838e12 authored by Sebastian Dröge's avatar Sebastian Dröge

Imported Upstream version 2.3

parent 69f585a0
......@@ -4,6 +4,24 @@ Copyright 2009-2010 Howard Chu
Copyright 2009 The Flvstreamer Team
http://rtmpdump.mplayerhq.hu/
30 June 2010, v2.3
- fix RC4 cleanup for GnuTLS/gcrypt
- declare RTMP_Write buf as const
- cleanup Makefile
- replace all use of bool with int
- add RTMP_Socket() and RTMP_Pause() APIs
- add ping/pong message handling
- add basic shared library support
- fix RTMP_ParseURL extension skipping
- fix bad switch() from -r477 in RTMP_Read
- fix rtmpsrv to always use .flv extension on output
- fix crash on socket failure while RTMP_Read() is reading header
- fix RTMP_ReadPacket signed/unsigned chars for m_nChannel
- license cleanup, use current FSF address
- fix RTMP_SetupURL tcUrl generation
- ignore multiple spaces between URL options
- only send CheckBW request once per session
29 May 2010, v2.2e
- port to Xbox
- add explicit URL scheme for rtmpts
......
VERSION=v2.2e
VERSION=v2.3
prefix=/usr/local
......@@ -33,7 +33,7 @@ MANDIR=$(DESTDIR)$(mandir)
LIBS_posix=
LIBS_mingw=-lws2_32 -lwinmm -lgdi32
LIBS=$(CRYPTO_LIB) -lz $(LIBS_$(SYS))
LIBS=$(CRYPTO_LIB) -lz $(LIBS_$(SYS)) $(XLIBS)
THREADLIB_posix=-lpthread
THREADLIB_mingw=
......@@ -57,7 +57,7 @@ install: progs
cp rtmpgw$(EXT) rtmpsrv$(EXT) rtmpsuck$(EXT) $(SBINDIR)
cp rtmpdump.1 $(MANDIR)/man1
cp rtmpgw.8 $(MANDIR)/man8
@cd librtmp; $(MAKE) install $(MAKEFLAGS)
@cd librtmp; $(MAKE) install
clean:
rm -f *.o rtmpdump$(EXT) rtmpgw$(EXT) rtmpsrv$(EXT) rtmpsuck$(EXT)
......@@ -66,7 +66,7 @@ clean:
FORCE:
$(LIBRTMP): FORCE
@cd librtmp; $(MAKE) $(MF) all
@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
......
RTMP Dump v2.2e
RTMP Dump v2.3
(C) 2009 Andrej Stepanchuk
(C) 2009-2010 Howard Chu
(C) 2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090
License: GPLv2
librtmp license: LGPLv2.1
http://rtmpdump.mplayerhq.hu/
To compile type "make" with SYS=<platform name>, e.g.
......@@ -36,6 +37,13 @@ You may also turn off all crypto support if desired
$ make CRYPTO=
A shared library is now built by default, in addition to the static
library. You can also turn it off if desired
$ make SHARED=
The rtmpdump programs still link to the static library, regardless.
Note that if using OpenSSL, you must have version 0.9.8 or newer.
Credit goes to team boxee for the XBMC RTMP code originally used in RTMPDumper.
......
VERSION=v2.2e
VERSION=v2.3
prefix=/usr/local
......@@ -6,6 +6,7 @@ CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
AR=$(CROSS_COMPILE)ar
SYS=posix
CRYPTO=OPENSSL
#CRYPTO=GNUTLS
DEF_POLARSSL=-DUSE_POLARSSL
......@@ -14,28 +15,55 @@ DEF_GNUTLS=-DUSE_GNUTLS
DEF_=-DNO_CRYPTO
REQ_GNUTLS=gnutls
REQ_OPENSSL=libssl,libcrypto
LIBZ=-lz
LIBS_posix=
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))
CRYPTO_REQ=$(REQ_$(CRYPTO))
CRYPTO_DEF=$(DEF_$(CRYPTO))
SO_posix=so.0
SO_mingw=dll
SO_EXT=$(SO_$(SYS))
SHARED=yes
SODEF_yes=-fPIC
SOLIB_yes=librtmp.$(SO_EXT)
SOINST_yes=install_$(SO_EXT)
SO_DEF=$(SODEF_$(SHARED))
SO_LIB=$(SOLIB_$(SHARED))
SO_INST=$(SOINST_$(SHARED))
DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) $(XDEF)
OPT=-O2
CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT)
CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) $(SO_DEF)
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)
all: librtmp.a
OBJS=rtmp.o log.o amf.o hashswf.o parseurl.o
all: librtmp.a $(SO_LIB)
clean:
rm -f *.o *.a
rm -f *.o *.a *.so *.$(SO_EXT)
librtmp.a: rtmp.o log.o amf.o hashswf.o parseurl.o
librtmp.a: $(OBJS)
$(AR) rs $@ $?
librtmp.$(SO_EXT): $(OBJS)
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB)
ln -sf $@ librtmp.so
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
amf.o: amf.c amf.h bytes.h log.h Makefile
......@@ -46,9 +74,18 @@ librtmp.pc: librtmp.pc.in Makefile
sed -e "s;@prefix@;$(prefix);" -e "s;@VERSION@;$(VERSION);" \
-e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" librtmp.pc.in > $@
install: librtmp.a librtmp.pc
install: install_base $(SO_INST)
install_base: librtmp.a librtmp.pc
-mkdir -p $(INCDIR) $(LIBDIR)/pkgconfig $(MANDIR)/man3
cp amf.h http.h log.h rtmp.h $(INCDIR)
cp librtmp.a $(LIBDIR)
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_dll: librtmp.dll
cp librtmp.dll $(BINDIR)
......@@ -18,7 +18,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......@@ -126,7 +127,7 @@ AMF_DecodeNumber(const char *data)
return dVal;
}
bool
int
AMF_DecodeBoolean(const char *data)
{
return *data != 0;
......@@ -255,7 +256,7 @@ AMF_EncodeNumber(char *output, char *outend, double dVal)
}
char *
AMF_EncodeBoolean(char *output, char *outend, bool bVal)
AMF_EncodeBoolean(char *output, char *outend, int bVal)
{
if (output+2 > outend)
return NULL;
......@@ -294,7 +295,7 @@ AMF_EncodeNamedNumber(char *output, char *outend, const AVal *strName, double dV
}
char *
AMF_EncodeNamedBoolean(char *output, char *outend, const AVal *strName, bool bVal)
AMF_EncodeNamedBoolean(char *output, char *outend, const AVal *strName, int bVal)
{
if (output+2+strName->av_len > outend)
return NULL;
......@@ -330,7 +331,7 @@ AMFProp_GetNumber(AMFObjectProperty *prop)
return prop->p_vu.p_number;
}
bool
int
AMFProp_GetBoolean(AMFObjectProperty *prop)
{
return prop->p_vu.p_number != 0;
......@@ -348,7 +349,7 @@ AMFProp_GetObject(AMFObjectProperty *prop, AMFObject *obj)
*obj = prop->p_vu.p_object;
}
bool
int
AMFProp_IsValid(AMFObjectProperty *prop)
{
return prop->p_type != AMF_INVALID;
......@@ -478,7 +479,7 @@ AMF3ReadString(const char *data, AVal *str)
int
AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
bool bDecodeName)
int bDecodeName)
{
int nOriginalSize = nSize;
AMF3DataType type;
......@@ -575,7 +576,7 @@ AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
}
case AMF3_OBJECT:
{
int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, true);
int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE);
if (nRes == -1)
return -1;
nSize -= nRes;
......@@ -595,7 +596,7 @@ AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
int
AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
bool bDecodeName)
int bDecodeName)
{
int nOriginalSize = nSize;
int nRes;
......@@ -667,7 +668,7 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
}
case AMF_OBJECT:
{
int nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer, nSize, true);
int nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE);
if (nRes == -1)
return -1;
nSize -= nRes;
......@@ -695,7 +696,7 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
nSize -= 4;
/* next comes the rest, mixed array has a final 0x000009 mark and names, so its an object */
nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer + 4, nSize, true);
nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer + 4, nSize, TRUE);
if (nRes == -1)
return -1;
nSize -= nRes;
......@@ -713,7 +714,7 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
nSize -= 4;
nRes = AMF_DecodeArray(&prop->p_vu.p_object, pBuffer + 4, nSize,
nArrayLen, false);
nArrayLen, FALSE);
if (nRes == -1)
return -1;
nSize -= nRes;
......@@ -763,7 +764,7 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
}
case AMF_AVMPLUS:
{
int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, true);
int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE);
if (nRes == -1)
return -1;
nSize -= nRes;
......@@ -893,10 +894,10 @@ AMF_Encode(AMFObject *obj, char *pBuffer, char *pBufEnd)
int
AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize,
int nArrayLen, bool bDecodeName)
int nArrayLen, int bDecodeName)
{
int nOriginalSize = nSize;
bool bError = false;
int bError = FALSE;
obj->o_num = 0;
obj->o_props = NULL;
......@@ -908,7 +909,7 @@ AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize,
nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName);
if (nRes == -1)
bError = true;
bError = TRUE;
else
{
nSize -= nRes;
......@@ -923,7 +924,7 @@ AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize,
}
int
AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
{
int nOriginalSize = nSize;
int32_t ref;
......@@ -1007,7 +1008,7 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
RTMP_Log(RTMP_LOGDEBUG, "Externalizable, TODO check");
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, false);
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE);
if (nRes == -1)
RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!",
__FUNCTION__);
......@@ -1025,7 +1026,7 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
int nRes, i;
for (i = 0; i < cd.cd_num; i++) /* non-dynamic */
{
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, false);
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE);
if (nRes == -1)
RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!",
__FUNCTION__);
......@@ -1042,7 +1043,7 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
do
{
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, true);
nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, TRUE);
AMF_AddProp(obj, &prop);
pBuffer += nRes;
......@@ -1059,10 +1060,10 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
}
int
AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bDecodeName)
AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bDecodeName)
{
int nOriginalSize = nSize;
bool bError = false; /* if there is an error while decoding - try to at least find the end mark AMF_OBJECT_END */
int bError = FALSE; /* if there is an error while decoding - try to at least find the end mark AMF_OBJECT_END */
obj->o_num = 0;
obj->o_props = NULL;
......@@ -1074,7 +1075,7 @@ AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bDecodeName)
if (nSize >=3 && AMF_DecodeInt24(pBuffer) == AMF_OBJECT_END)
{
nSize -= 3;
bError = false;
bError = FALSE;
break;
}
......@@ -1089,7 +1090,7 @@ AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bDecodeName)
nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName);
if (nRes == -1)
bError = true;
bError = TRUE;
else
{
nSize -= nRes;
......
......@@ -20,23 +20,16 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
#include <stdint.h>
#ifdef _XBOX
#ifndef __cplusplus
#define bool _Bool
typedef unsigned char _Bool;
#define false 0
#define true 1
#endif
#else
#include <stdbool.h>
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#ifdef __cplusplus
......@@ -95,28 +88,28 @@ extern "C"
char *AMF_EncodeInt16(char *output, char *outend, short nVal);
char *AMF_EncodeInt24(char *output, char *outend, int nVal);
char *AMF_EncodeInt32(char *output, char *outend, int nVal);
char *AMF_EncodeBoolean(char *output, char *outend, bool bVal);
char *AMF_EncodeBoolean(char *output, char *outend, int bVal);
/* Shortcuts for AMFProp_Encode */
char *AMF_EncodeNamedString(char *output, char *outend, const AVal * name, const AVal * value);
char *AMF_EncodeNamedNumber(char *output, char *outend, const AVal * name, double dVal);
char *AMF_EncodeNamedBoolean(char *output, char *outend, const AVal * name, bool bVal);
char *AMF_EncodeNamedBoolean(char *output, char *outend, const AVal * name, int bVal);
unsigned short AMF_DecodeInt16(const char *data);
unsigned int AMF_DecodeInt24(const char *data);
unsigned int AMF_DecodeInt32(const char *data);
void AMF_DecodeString(const char *data, AVal * str);
void AMF_DecodeLongString(const char *data, AVal * str);
bool AMF_DecodeBoolean(const char *data);
int AMF_DecodeBoolean(const char *data);
double AMF_DecodeNumber(const char *data);
char *AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd);
int AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize,
bool bDecodeName);
int bDecodeName);
int AMF_DecodeArray(AMFObject * obj, const char *pBuffer, int nSize,
int nArrayLen, bool bDecodeName);
int nArrayLen, int bDecodeName);
int AMF3_Decode(AMFObject * obj, const char *pBuffer, int nSize,
bool bDecodeName);
int bDecodeName);
void AMF_Dump(AMFObject * obj);
void AMF_Reset(AMFObject * obj);
......@@ -127,24 +120,24 @@ extern "C"
AMFDataType AMFProp_GetType(AMFObjectProperty * prop);
void AMFProp_SetNumber(AMFObjectProperty * prop, double dval);
void AMFProp_SetBoolean(AMFObjectProperty * prop, bool bflag);
void AMFProp_SetBoolean(AMFObjectProperty * prop, int bflag);
void AMFProp_SetString(AMFObjectProperty * prop, AVal * str);
void AMFProp_SetObject(AMFObjectProperty * prop, AMFObject * obj);
void AMFProp_GetName(AMFObjectProperty * prop, AVal * name);
void AMFProp_SetName(AMFObjectProperty * prop, AVal * name);
double AMFProp_GetNumber(AMFObjectProperty * prop);
bool AMFProp_GetBoolean(AMFObjectProperty * prop);
int AMFProp_GetBoolean(AMFObjectProperty * prop);
void AMFProp_GetString(AMFObjectProperty * prop, AVal * str);
void AMFProp_GetObject(AMFObjectProperty * prop, AMFObject * obj);
bool AMFProp_IsValid(AMFObjectProperty * prop);
int AMFProp_IsValid(AMFObjectProperty * prop);
char *AMFProp_Encode(AMFObjectProperty * prop, char *pBuffer, char *pBufEnd);
int AMF3Prop_Decode(AMFObjectProperty * prop, const char *pBuffer,
int nSize, bool bDecodeName);
int nSize, int bDecodeName);
int AMFProp_Decode(AMFObjectProperty * prop, const char *pBuffer,
int nSize, bool bDecodeName);
int nSize, int bDecodeName);
void AMFProp_Dump(AMFObjectProperty * prop);
void AMFProp_Reset(AMFObjectProperty * prop);
......
......@@ -18,7 +18,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......
......@@ -16,7 +16,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......@@ -150,10 +151,10 @@ typedef BIGNUM * MP_t;
#include "dhgroups.h"
/* RFC 2631, Section 2.1.5, http://www.ietf.org/rfc/rfc2631.txt */
static bool
static int
isValidPublicKey(MP_t y, MP_t p, MP_t q)
{
int ret = true;
int ret = TRUE;
MP_t bn;
assert(y);
......@@ -165,7 +166,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
if (MP_cmp(y, bn) < 0)
{
RTMP_Log(RTMP_LOGERROR, "DH public key must be at least 2");
ret = false;
ret = FALSE;
goto failed;
}
......@@ -175,7 +176,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
if (MP_cmp(y, bn) > 0)
{
RTMP_Log(RTMP_LOGERROR, "DH public key must be at most p-2");
ret = false;
ret = FALSE;
goto failed;
}
......
......@@ -15,7 +15,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......
This diff is collapsed.
......@@ -15,7 +15,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......@@ -186,7 +187,7 @@ HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb)
}
sb.sb_size = 0;
sb.sb_timedout = false;
sb.sb_timedout = FALSE;
if (RTMPSockBuf_Fill(&sb) < 1)
{
ret = HTTPRES_LOST_CONNECTION;
......
......@@ -18,7 +18,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......
......@@ -16,7 +16,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......
......@@ -16,7 +16,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......
......@@ -16,7 +16,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......@@ -29,7 +30,7 @@
#include "rtmp_sys.h"
#include "log.h"
bool RTMP_ParseURL(const char *url, int *protocol, AVal *host, unsigned int *port,
int RTMP_ParseURL(const char *url, int *protocol, AVal *host, unsigned int *port,
AVal *playpath, AVal *app)
{
char *p, *end, *col, *ques, *slash;
......@@ -49,7 +50,7 @@ bool RTMP_ParseURL(const char *url, int *protocol, AVal *host, unsigned int *por
p = strstr(url, "://");
if(!p) {
RTMP_Log(RTMP_LOGERROR, "RTMP URL: No :// in url!");
return false;
return FALSE;
}
{
int len = (int)(p-url);
......@@ -83,7 +84,7 @@ parsehost:
/* check for sudden death */
if(*p==0) {
RTMP_Log(RTMP_LOGWARNING, "No hostname in URL!");
return false;
return FALSE;
}
end = p + strlen(p);
......@@ -125,7 +126,7 @@ parsehost:
if(!slash) {
RTMP_Log(RTMP_LOGWARNING, "No application or playpath in URL!");
return true;
return TRUE;
}
p = slash+1;
......@@ -178,7 +179,7 @@ parsehost:
RTMP_ParsePlaypath(&av, playpath);
}
return true;
return TRUE;
}
/*
......@@ -264,6 +265,7 @@ void RTMP_ParsePlaypath(AVal *in, AVal *out) {
if (subExt && p == ext) {
p += 4;
pplen -= 4;
continue;
}
if (*p == '%') {
unsigned int c;
......
This diff is collapsed.
......@@ -20,7 +20,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with librtmp see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/lgpl.html
*/
......@@ -39,7 +40,7 @@ extern "C"
{
#endif
#define RTMP_LIB_VERSION 0x020205 /* 2.2e */
#define RTMP_LIB_VERSION 0x020300 /* 2.3 */
#define RTMP_FEATURE_HTTP 0x01
#define RTMP_FEATURE_ENC 0x02
......@@ -66,7 +67,7 @@ extern "C"
extern const char RTMPProtocolStringsLower[][7];
extern const AVal RTMP_DefaultFlashVer;
extern bool RTMP_ctrlC;
extern int RTMP_ctrlC;
uint32_t RTMP_GetTime(void);
......@@ -109,13 +110,13 @@ extern "C"
int sb_size; /* number of unprocessed bytes in buffer */
char *sb_start; /* pointer into sb_pBuffer of next byte to process */
char sb_buf[RTMP_BUFFER_CACHE_SIZE]; /* data read from socket */
bool sb_timedout;
int sb_timedout;
void *sb_ssl;
} RTMPSockBuf;
void RTMPPacket_Reset(RTMPPacket *p);
void RTMPPacket_Dump(RTMPPacket *p);
bool RTMPPacket_Alloc(RTMPPacket *p, int nSize);
int RTMPPacket_Alloc(RTMPPacket *p, int nSize);
void RTMPPacket_Free(RTMPPacket *p);
#define RTMPPacket_IsReady(a) ((a)->m_nBytesRead == (a)->m_nBodySize)
......@@ -146,6 +147,7 @@ extern "C"
#define RTMP_LF_SWFV 0x0004 /* do SWF verification */
#define RTMP_LF_PLST 0x0008 /* send playlist before play */
#define RTMP_LF_BUFX 0x0010 /* toggle stream on BufferEmpty msg */
#define RTMP_LF_FTCU 0x0020 /* free tcUrl on close */
int lFlags;
int swfAge;
......@@ -252,15 +254,15 @@ extern "C"
RTMP_LNK Link;
} RTMP;
bool RTMP_ParseURL(const char *url, int *protocol, AVal *host,
int RTMP_ParseURL(const char *url, int *protocol, AVal *host,
unsigned int *port, AVal *playpath, AVal *app);
void RTMP_ParsePlaypath(AVal *in, AVal *out);
void RTMP_SetBufferMS(RTMP *r, int size);
void RTMP_UpdateBufferMS(RTMP *r);
bool RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg);
bool RTMP_SetupURL(RTMP *r, char *url);
int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg);
int RTMP_SetupURL(RTMP *r, char *url);
void RTMP_SetupStream(RTMP *r, int protocol,
AVal *hostname,
unsigned int port,
......@@ -276,24 +278,25 @@ extern "C"
AVal *flashVer,
AVal *subscribepath,
int dStart,
int dStop, bool bLiveStream, long int timeout);
int dStop, int bLiveStream, long int timeout);
bool RTMP_Connect(RTMP *r, RTMPPacket *cp);
int RTMP_Connect(RTMP *r, RTMPPacket *cp);
struct sockaddr;
bool RTMP_Connect0(RTMP *r, struct sockaddr *svc);
bool RTMP_Connect1(RTMP *r, RTMPPacket *cp);
bool RTMP_Serve(RTMP *r);
bool RTMP_ReadPacket(RTMP *r, RTMPPacket *packet);
bool RTMP_SendPacket(RTMP *r, RTMPPacket *packet, bool queue);
bool RTMP_SendChunk(RTMP *r, RTMPChunk *chunk);
bool RTMP_IsConnected(RTMP *r);
bool RTMP_IsTimedout(RTMP *r);
int RTMP_Connect0(RTMP *r, struct sockaddr *svc);
int RTMP_Connect1(RTMP *r, RTMPPacket *cp);
int RTMP_Serve(RTMP *r);
int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet);
int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue);
int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk);
int RTMP_IsConnected(RTMP *r);
int RTMP_Socket(RTMP *r);
int RTMP_IsTimedout(RTMP *r);
double RTMP_GetDuration(RTMP *r);
bool RTMP_ToggleStream(RTMP *r);
int RTMP_ToggleStream(RTMP *r);
bool RTMP_ConnectStream(RTMP *r, int seekTime);
bool RTMP_ReconnectStream(RTMP *r, int seekTime);
int RTMP_ConnectStream(RTMP *r, int seekTime);
int RTMP_ReconnectStream(RTMP *r, int seekTime);
void RTMP_DeleteStream(RTMP *r);
int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet);
int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet);
......@@ -307,23 +310,29 @@ extern "C"
int RTMP_LibVersion(void);
void RTMP_UserInterrupt(void); /* user typed Ctrl-C */
bool RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject,
int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject,
unsigned int nTime);