rtmpdump
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
April 2010
- 16 participants
- 65 discussions
Author: hyc
Date: Fri Apr 16 02:46:02 2010
New Revision: 432
Log:
rel 2.2c
Replaced:
web/ChangeLog
- copied unchanged from r431, trunk/ChangeLog
Modified:
web/index.html
Modified: web/index.html
==============================================================================
--- web/index.html Fri Apr 16 01:52:20 2010 (r431)
+++ web/index.html Fri Apr 16 02:46:02 2010 (r432)
@@ -39,9 +39,9 @@ Also the code
has recently split between version 1.x and 2.x (trunk is now 2.x). You can find
the 1.x code in <b>svn://svn.mplayerhq.hu/rtmpdump/branches/1.x</b> .</p> -->
<p>
-The latest release is 2.2b which you can check out from:
+The latest release is 2.2c which you can check out from:
<ul>
-<b>svn://svn.mplayerhq.hu/rtmpdump/tags/rel-2.2b</b>
+<b>svn://svn.mplayerhq.hu/rtmpdump/tags/rel-2.2c</b>
</ul>
Releases will also be provided as compressed tar archives in
the <a href="download">download</a> directory. There are also zip archives
@@ -82,11 +82,11 @@ negotiated, it records the cleartext str
relaying the data from the server to the client.
</p>
<p>
-2010-03-22: Download source tarball <a href="download/rtmpdump-2.2b.tar.gz">rtmpdump-2.2b.tar.gz</a>
+2010-04-15: Download source tarball <a href="download/rtmpdump-2.2c.tar.gz">rtmpdump-2.2c.tar.gz</a>
<br>
-2010-03-22: Download Windows build <a href="download/rtmpdump-2.2b-windows.zip">rtmpdump-2.2b-windows.zip</a>
+2010-04-15: Download Windows build <a href="download/rtmpdump-2.2c-windows.zip">rtmpdump-2.2c-windows.zip</a>
<br>
-2010-03-22: Download Android build <a href="download/rtmpdump-2.2b-android.zip">rtmpdump-2.2b-android.zip</a>
+2010-04-15: Download Android build <a href="download/rtmpdump-2.2c-android.zip">rtmpdump-2.2c-android.zip</a>
<br>
</p>
<p>
1
0
Author: hyc
Date: Fri Apr 16 01:52:20 2010
New Revision: 431
Log:
Release 2.2c
Added:
tags/rel-2.2c/
- copied from r430, trunk/
1
0
r430 - in trunk: ChangeLog Makefile README librtmp/Makefile librtmp/handshake.h librtmp/rtmp.h
by hyc 14 Apr '10
by hyc 14 Apr '10
14 Apr '10
Author: hyc
Date: Wed Apr 14 21:38:11 2010
New Revision: 430
Log:
v2.2c stuff. not much user-visible
Modified:
trunk/ChangeLog
trunk/Makefile
trunk/README
trunk/librtmp/Makefile
trunk/librtmp/handshake.h
trunk/librtmp/rtmp.h
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/ChangeLog Wed Apr 14 21:38:11 2010 (r430)
@@ -4,6 +4,11 @@ Copyright 2009-2010 Howard Chu
Copyright 2009 The Flvstreamer Team
http://rtmpdump.mplayerhq.hu/
+14 April 2010, v2.2c
+- internal restructuring, fix #undef CRYPTO builds
+- add RTMP_SetupURL, RTMP_SetOpt APIs
+- add logging callback
+
22 March 2010, v2.2b
- fix v2.2a crashes in rtmpsrv/rtmpsuck
- fix v2.2a .swfinfo location on Windows
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/Makefile Wed Apr 14 21:38:11 2010 (r430)
@@ -1,4 +1,4 @@
-VERSION=v2.2b
+VERSION=v2.2c
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
Modified: trunk/README
==============================================================================
--- trunk/README Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/README Wed Apr 14 21:38:11 2010 (r430)
@@ -1,4 +1,4 @@
-RTMP Dump v2.2b
+RTMP Dump v2.2c
(C) 2009 Andrej Stepanchuk
(C) 2009-2010 Howard Chu
(C) 2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090
Modified: trunk/librtmp/Makefile
==============================================================================
--- trunk/librtmp/Makefile Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/librtmp/Makefile Wed Apr 14 21:38:11 2010 (r430)
@@ -1,4 +1,4 @@
-VERSION=v2.2b
+VERSION=v2.2c
prefix=/usr/local
Modified: trunk/librtmp/handshake.h
==============================================================================
--- trunk/librtmp/handshake.h Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/librtmp/handshake.h Wed Apr 14 21:38:11 2010 (r430)
@@ -43,9 +43,9 @@ typedef gcry_cipher_hd_t RC4_handle;
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/rc4.h>
-#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, (uint8_t *)key, len, EVP_sha256(), 0)
-#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, (uint8_t *)buf, len)
-#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, (uint8_t *)dig, &dlen); HMAC_CTX_cleanup(&ctx)
+#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
+#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
+#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, dig, &dlen); HMAC_CTX_cleanup(&ctx)
typedef RC4_KEY * RC4_handle;
#define RC4_setup(h) *h = malloc(sizeof(RC4_KEY))
Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h Wed Apr 14 20:58:14 2010 (r429)
+++ trunk/librtmp/rtmp.h Wed Apr 14 21:38:11 2010 (r430)
@@ -39,7 +39,7 @@ extern "C"
{
#endif
-#define RTMP_LIB_VERSION 0x020202 /* 2.2b */
+#define RTMP_LIB_VERSION 0x020203 /* 2.2c */
#define RTMP_FEATURE_HTTP 0x01
#define RTMP_FEATURE_ENC 0x02
1
0
r429 - in trunk/librtmp: amf.c bytes.h dh.h dhgroups.h handshake.h hashswf.c http.h log.c log.h parseurl.c rtmp.c rtmp.h
by hyc 14 Apr '10
by hyc 14 Apr '10
14 Apr '10
Author: hyc
Date: Wed Apr 14 20:58:14 2010
New Revision: 429
Log:
More cleanup
Modified:
trunk/librtmp/amf.c
trunk/librtmp/bytes.h
trunk/librtmp/dh.h
trunk/librtmp/dhgroups.h
trunk/librtmp/handshake.h
trunk/librtmp/hashswf.c
trunk/librtmp/http.h
trunk/librtmp/log.c
trunk/librtmp/log.h
trunk/librtmp/parseurl.c
trunk/librtmp/rtmp.c
trunk/librtmp/rtmp.h
Modified: trunk/librtmp/amf.c
==============================================================================
--- trunk/librtmp/amf.c Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/amf.c Wed Apr 14 20:58:14 2010 (r429)
@@ -96,7 +96,7 @@ AMF_DecodeNumber(const char *data)
co[7] = ci[0];
#endif
#else
-#if __BYTE_ORDER == __LITTLE_ENDIAN // __FLOAT_WORD_ORER == __BIG_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */
unsigned char *ci, *co;
ci = (unsigned char *)data;
co = (unsigned char *)&dVal;
@@ -108,7 +108,7 @@ AMF_DecodeNumber(const char *data)
co[5] = ci[6];
co[6] = ci[5];
co[7] = ci[4];
-#else // __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN
+#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */
unsigned char *ci, *co;
ci = (unsigned char *)data;
co = (unsigned char *)&dVal;
@@ -198,7 +198,7 @@ AMF_EncodeNumber(char *output, char *out
if (output+1+8 > outend)
return NULL;
- *output++ = AMF_NUMBER; // type: Number
+ *output++ = AMF_NUMBER; /* type: Number */
#if __FLOAT_WORD_ORDER == __BYTE_ORDER
#if __BYTE_ORDER == __BIG_ENDIAN
@@ -414,9 +414,9 @@ AMF3ReadInteger(const char *data, int32_
while (i <= 2)
{ /* handle first 3 bytes */
if (data[i] & 0x80)
- { // byte used
- val <<= 7; // shift up
- val |= (data[i] & 0x7f); // add bits
+ { /* byte used */
+ val <<= 7; /* shift up */
+ val |= (data[i] & 0x7f); /* add bits */
i++;
}
else
@@ -426,16 +426,16 @@ AMF3ReadInteger(const char *data, int32_
}
if (i > 2)
- { // use 4th byte, all 8bits
+ { /* use 4th byte, all 8bits */
val <<= 8;
val |= data[3];
- // range check
+ /* range check */
if (val > AMF3_INTEGER_MAX)
val -= (1 << 29);
}
else
- { // use 7bits of last unparsed byte (0xxxxxxx)
+ { /* use 7bits of last unparsed byte (0xxxxxxx) */
val <<= 7;
val |= data[i];
}
@@ -883,7 +883,7 @@ AMF_Encode(AMFObject *obj, char *pBuffer
}
if (pBuffer + 3 >= pBufEnd)
- return NULL; // no room for the end marker
+ return NULL; /* no room for the end marker */
pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END);
@@ -973,13 +973,13 @@ AMF3_Decode(AMFObject *obj, const char *
cd.cd_num = classExtRef >> 2;
- // class name
+ /* class name */
len = AMF3ReadString(pBuffer, &cd.cd_name);
nSize -= len;
pBuffer += len;
- //std::string str = className;
+ /*std::string str = className; */
RTMP_Log(RTMP_LOGDEBUG,
"Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d",
Modified: trunk/librtmp/bytes.h
==============================================================================
--- trunk/librtmp/bytes.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/bytes.h Wed Apr 14 20:58:14 2010 (r429)
@@ -28,7 +28,7 @@
#include <stdint.h>
#ifdef WIN32
-// Windows is little endian only
+/* Windows is little endian only */
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __LITTLE_ENDIAN
@@ -54,7 +54,7 @@ typedef unsigned char uint8_t;
#endif /* !WIN32 */
-// define default endianness
+/* define default endianness */
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
@@ -68,7 +68,7 @@ typedef unsigned char uint8_t;
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif
-// ok, we assume to have the same float word order and byte order if float word order is not defined
+/* ok, we assume to have the same float word order and byte order if float word order is not defined */
#ifndef __FLOAT_WORD_ORDER
#warning "Float word order not defined, assuming the same as byte order!"
#define __FLOAT_WORD_ORDER __BYTE_ORDER
Modified: trunk/librtmp/dh.h
==============================================================================
--- trunk/librtmp/dh.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/dh.h Wed Apr 14 20:58:14 2010 (r429)
@@ -121,7 +121,7 @@ void dh_pg_init()
}
*/
-// RFC 2631, Section 2.1.5, http://www.ietf.org/rfc/rfc2631.txt
+/* RFC 2631, Section 2.1.5, http://www.ietf.org/rfc/rfc2631.txt */
static bool
isValidPublicKey(MP_t y, MP_t p, MP_t q)
{
@@ -132,7 +132,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
bn = MP_new();
assert(bn);
- // y must lie in [2,p-1]
+ /* y must lie in [2,p-1] */
MP_set_w(bn, 1);
if (MP_cmp(y, bn) < 0)
{
@@ -141,7 +141,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
goto failed;
}
- // bn = p-2
+ /* bn = p-2 */
MP_set(bn, p);
MP_sub_w(bn, 1);
if (MP_cmp(y, bn) > 0)
@@ -151,15 +151,15 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
goto failed;
}
- // Verify with Sophie-Germain prime
- //
- // This is a nice test to make sure the public key position is calculated
- // correctly. This test will fail in about 50% of the cases if applied to
- // random data.
- //
+ /* Verify with Sophie-Germain prime
+ *
+ * This is a nice test to make sure the public key position is calculated
+ * correctly. This test will fail in about 50% of the cases if applied to
+ * random data.
+ */
if (q)
{
- // y must fulfill y^q mod p = 1
+ /* y must fulfill y^q mod p = 1 */
MP_modexp(bn, y, q, p);
if (MP_cmp_1(bn) != 0)
@@ -187,13 +187,13 @@ DHInit(int nKeyBits)
if (!dh->g)
goto failed;
- MP_gethex(&dh->p, P1024, res); // prime P1024, see dhgroups.h
+ MP_gethex(&dh->p, P1024, res); /* prime P1024, see dhgroups.h */
if (!res)
{
goto failed;
}
- if (!MP_set_w(dh->g, 2)) // base 2
+ if (!MP_set_w(dh->g, 2)) /* base 2 */
{
goto failed;
}
@@ -238,8 +238,9 @@ DHGenerateKey(MDH *dh)
return 1;
}
-// fill pubkey with the public key in BIG ENDIAN order
-// 00 00 00 00 00 x1 x2 x3 .....
+/* fill pubkey with the public key in BIG ENDIAN order
+ * 00 00 00 00 00 x1 x2 x3 .....
+ */
static int
DHGetPublicKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen)
@@ -274,7 +275,9 @@ DHGetPrivateKey(MDH *dh, uint8_t *privke
}
#endif
-// computes the shared secret key from the private MDH value and the othe parties public key (pubkey)
+/* computes the shared secret key from the private MDH value and the
+ * other party's public key (pubkey)
+ */
static int
DHComputeSharedSecretKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen,
uint8_t *secret)
Modified: trunk/librtmp/dhgroups.h
==============================================================================
--- trunk/librtmp/dhgroups.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/dhgroups.h Wed Apr 14 20:58:14 2010 (r429)
@@ -21,14 +21,14 @@
/* from RFC 3526, see http://www.ietf.org/rfc/rfc3526.txt */
-// 2^768 - 2 ^704 - 1 + 2^64 * { [2^638 pi] + 149686 }
+/* 2^768 - 2 ^704 - 1 + 2^64 * { [2^638 pi] + 149686 } */
#define P768 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
"E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF"
-// 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }
+/* 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */
#define P1024 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -37,7 +37,7 @@
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" \
"FFFFFFFFFFFFFFFF"
-// Group morder largest prime factor:
+/* Group morder largest prime factor: */
#define Q1024 \
"7FFFFFFFFFFFFFFFE487ED5110B4611A62633145C06E0E68" \
"948127044533E63A0105DF531D89CD9128A5043CC71A026E" \
@@ -46,7 +46,7 @@
"F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \
"FFFFFFFFFFFFFFFF"
-// 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 }
+/* 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 } */
#define P1536 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -57,7 +57,7 @@
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
"670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF"
-// 2^2048 - 2^1984 - 1 + 2^64 * { [2^1918 pi] + 124476 }
+/* 2^2048 - 2^1984 - 1 + 2^64 * { [2^1918 pi] + 124476 } */
#define P2048 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -71,7 +71,7 @@
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
"15728E5A8AACAA68FFFFFFFFFFFFFFFF"
-// 2^3072 - 2^3008 - 1 + 2^64 * { [2^2942 pi] + 1690314 }
+/* 2^3072 - 2^3008 - 1 + 2^64 * { [2^2942 pi] + 1690314 } */
#define P3072 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -90,7 +90,7 @@
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \
"43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF"
-// 2^4096 - 2^4032 - 1 + 2^64 * { [2^3966 pi] + 240904 }
+/* 2^4096 - 2^4032 - 1 + 2^64 * { [2^3966 pi] + 240904 } */
#define P4096 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -115,7 +115,7 @@
"93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \
"FFFFFFFFFFFFFFFF"
-// 2^6144 - 2^6080 - 1 + 2^64 * { [2^6014 pi] + 929484 }
+/* 2^6144 - 2^6080 - 1 + 2^64 * { [2^6014 pi] + 929484 } */
#define P6144 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
@@ -150,7 +150,7 @@
"DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE" \
"12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF"
-// 2^8192 - 2^8128 - 1 + 2^64 * { [2^8062 pi] + 4743158 }
+/* 2^8192 - 2^8128 - 1 + 2^64 * { [2^8062 pi] + 4743158 } */
#define P8192 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
Modified: trunk/librtmp/handshake.h
==============================================================================
--- trunk/librtmp/handshake.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/handshake.h Wed Apr 14 20:58:14 2010 (r429)
@@ -43,9 +43,9 @@ typedef gcry_cipher_hd_t RC4_handle;
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/rc4.h>
-#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, (unsigned char *)key, len, EVP_sha256(), 0)
-#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, (unsigned char *)buf, len)
-#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, (unsigned char *)dig, &dlen); HMAC_CTX_cleanup(&ctx)
+#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, (uint8_t *)key, len, EVP_sha256(), 0)
+#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, (uint8_t *)buf, len)
+#define HMAC_finish(ctx, dig, dlen) HMAC_Final(&ctx, (uint8_t *)dig, &dlen); HMAC_CTX_cleanup(&ctx)
typedef RC4_KEY * RC4_handle;
#define RC4_setup(h) *h = malloc(sizeof(RC4_KEY))
@@ -58,7 +58,7 @@ typedef RC4_KEY * RC4_handle;
#include "dh.h"
-static const char GenuineFMSKey[] = {
+static const uint8_t GenuineFMSKey[] = {
0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20, 0x41, 0x64, 0x6f, 0x62,
0x65, 0x20, 0x46, 0x6c,
0x61, 0x73, 0x68, 0x20, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x20, 0x53, 0x65,
@@ -71,7 +71,7 @@ static const char GenuineFMSKey[] = {
0xcf, 0xeb, 0x31, 0xae
}; /* 68 */
-static const char GenuineFPKey[] = {
+static const uint8_t GenuineFPKey[] = {
0x47, 0x65, 0x6E, 0x75, 0x69, 0x6E, 0x65, 0x20, 0x41, 0x64, 0x6F, 0x62,
0x65, 0x20, 0x46, 0x6C,
0x61, 0x73, 0x68, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72, 0x20, 0x30,
@@ -100,7 +100,7 @@ static void InitRC4Encryption
HMAC_finish(ctx, digest, digestLen);
RTMP_Log(RTMP_LOGDEBUG, "RC4 Out Key: ");
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) digest, 16);
+ RTMP_LogHex(RTMP_LOGDEBUG, digest, 16);
RC4_setkey(*rc4keyOut, 16, digest);
@@ -109,18 +109,18 @@ static void InitRC4Encryption
HMAC_finish(ctx, digest, digestLen);
RTMP_Log(RTMP_LOGDEBUG, "RC4 In Key: ");
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) digest, 16);
+ RTMP_LogHex(RTMP_LOGDEBUG, digest, 16);
RC4_setkey(*rc4keyIn, 16, digest);
}
-typedef unsigned int (getoff)(char *buf, unsigned int len);
+typedef unsigned int (getoff)(uint8_t *buf, unsigned int len);
static unsigned int
-GetDHOffset2(char *handshake, unsigned int len)
+GetDHOffset2(uint8_t *handshake, unsigned int len)
{
unsigned int offset = 0;
- unsigned char *ptr = (unsigned char *) handshake + 768;
+ uint8_t *ptr = handshake + 768;
unsigned int res;
assert(RTMP_SIG_SIZE <= len);
@@ -146,10 +146,10 @@ GetDHOffset2(char *handshake, unsigned i
}
static unsigned int
-GetDigestOffset2(char *handshake, unsigned int len)
+GetDigestOffset2(uint8_t *handshake, unsigned int len)
{
unsigned int offset = 0;
- unsigned char *ptr = (unsigned char *) handshake + 772;
+ uint8_t *ptr = handshake + 772;
unsigned int res;
offset += (*ptr);
@@ -173,10 +173,10 @@ GetDigestOffset2(char *handshake, unsign
}
static unsigned int
-GetDHOffset1(char *handshake, unsigned int len)
+GetDHOffset1(uint8_t *handshake, unsigned int len)
{
unsigned int offset = 0;
- unsigned char *ptr = (unsigned char *) handshake + 1532;
+ uint8_t *ptr = handshake + 1532;
unsigned int res;
assert(RTMP_SIG_SIZE <= len);
@@ -202,10 +202,10 @@ GetDHOffset1(char *handshake, unsigned i
}
static unsigned int
-GetDigestOffset1(char *handshake, unsigned int len)
+GetDigestOffset1(uint8_t *handshake, unsigned int len)
{
unsigned int offset = 0;
- unsigned char *ptr = (unsigned char *) handshake + 8;
+ uint8_t *ptr = handshake + 8;
unsigned int res;
assert(12 <= len);
@@ -232,8 +232,8 @@ GetDigestOffset1(char *handshake, unsign
}
static void
-HMACsha256(const char *message, size_t messageLen, const char *key,
- size_t keylen, char *digest)
+HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key,
+ size_t keylen, uint8_t *digest)
{
unsigned int digestLen;
HMAC_CTX ctx;
@@ -246,11 +246,11 @@ HMACsha256(const char *message, size_t m
}
static void
-CalculateDigest(unsigned int digestPos, char *handshakeMessage,
- const char *key, size_t keyLen, char *digest)
+CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage,
+ const uint8_t *key, size_t keyLen, uint8_t *digest)
{
const int messageLen = RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH;
- char message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH];
+ uint8_t message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH];
memcpy(message, handshakeMessage, digestPos);
memcpy(message + digestPos,
@@ -261,10 +261,10 @@ CalculateDigest(unsigned int digestPos,
}
static bool
-VerifyDigest(unsigned int digestPos, char *handshakeMessage, const char *key,
+VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key,
size_t keyLen)
{
- char calcDigest[SHA256_DIGEST_LENGTH];
+ uint8_t calcDigest[SHA256_DIGEST_LENGTH];
CalculateDigest(digestPos, handshakeMessage, key, keyLen, calcDigest);
@@ -304,7 +304,7 @@ static const uint32_t rtmpe8_keys[16][4]
/* RTMPE type 8 uses XTEA on the regular signature
* http://en.wikipedia.org/wiki/XTEA
*/
-static void rtmpe8_sig(unsigned char *in, unsigned char *out, int keyid)
+static void rtmpe8_sig(uint8_t *in, uint8_t *out, int keyid)
{
unsigned int i, num_rounds = 32;
uint32_t v0, v1, sum=0, delta=0x9E3779B9;
@@ -345,9 +345,9 @@ HandShake(RTMP * r, bool FP9HandShake)
int32_t *ip;
uint32_t uptime;
- char clientbuf[RTMP_SIG_SIZE + 4], *clientsig=clientbuf+4;
- char serversig[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply;
- char type;
+ uint8_t clientbuf[RTMP_SIG_SIZE + 4], *clientsig=clientbuf+4;
+ uint8_t serversig[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply;
+ uint8_t type;
getoff *getdh, *getdig;
if (encrypted || r->Link.SWFSize)
@@ -424,8 +424,7 @@ HandShake(RTMP * r, bool FP9HandShake)
return false;
}
- if (!DHGetPublicKey
- (r->Link.dh, (uint8_t *) &clientsig[dhposClient], 128))
+ if (!DHGetPublicKey(r->Link.dh, &clientsig[dhposClient], 128))
{
RTMP_Log(RTMP_LOGERROR, "%s: Couldn't write public key!", __FUNCTION__);
return false;
@@ -440,7 +439,7 @@ HandShake(RTMP * r, bool FP9HandShake)
&clientsig[digestPosClient]);
RTMP_Log(RTMP_LOGDEBUG, "%s: Initial client digest: ", __FUNCTION__);
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) clientsig + digestPosClient,
+ RTMP_LogHex(RTMP_LOGDEBUG, clientsig + digestPosClient,
SHA256_DIGEST_LENGTH);
}
@@ -449,10 +448,10 @@ HandShake(RTMP * r, bool FP9HandShake)
RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE);
#endif
- if (!WriteN(r, clientsig-1, RTMP_SIG_SIZE + 1))
+ if (!WriteN(r, (char *)clientsig-1, RTMP_SIG_SIZE + 1))
return false;
- if (ReadN(r, &type, 1) != 1) /* 0x03 or 0x06 */
+ if (ReadN(r, (char *)&type, 1) != 1) /* 0x03 or 0x06 */
return false;
RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer : %02X", __FUNCTION__, type);
@@ -461,7 +460,7 @@ HandShake(RTMP * r, bool FP9HandShake)
RTMP_Log(RTMP_LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d",
__FUNCTION__, clientsig[-1], type);
- if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+ if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
/* decode server response */
@@ -482,9 +481,9 @@ HandShake(RTMP * r, bool FP9HandShake)
if (FP9HandShake)
{
- int dhposServer;
- char digestResp[SHA256_DIGEST_LENGTH];
- char *signatureResp = NULL;
+ int dhposServer;
+ uint8_t digestResp[SHA256_DIGEST_LENGTH];
+ uint8_t *signatureResp = NULL;
/* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */
int digestPosServer = GetDigestOffset2(serversig, RTMP_SIG_SIZE);
@@ -513,14 +512,15 @@ HandShake(RTMP * r, bool FP9HandShake)
if (r->Link.SWFSize)
{
const char swfVerify[] = { 0x01, 0x01 };
- char *vend = r->Link.SWFVerificationResponse+sizeof(r->Link.SWFVerificationResponse);
+ char *vend = r->Link.SWFVerificationResponse+sizeof(r->Link.SWFVerificationResponse);
memcpy(r->Link.SWFVerificationResponse, swfVerify, 2);
AMF_EncodeInt32(&r->Link.SWFVerificationResponse[2], vend, r->Link.SWFSize);
AMF_EncodeInt32(&r->Link.SWFVerificationResponse[6], vend, r->Link.SWFSize);
HMACsha256(r->Link.SWFHash, SHA256_DIGEST_LENGTH,
&serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
- SHA256_DIGEST_LENGTH, &r->Link.SWFVerificationResponse[10]);
+ SHA256_DIGEST_LENGTH,
+ (uint8_t *)&r->Link.SWFVerificationResponse[10]);
}
/* do Diffie-Hellmann Key exchange for encrypted RTMP */
@@ -530,8 +530,7 @@ HandShake(RTMP * r, bool FP9HandShake)
uint8_t secretKey[128] = { 0 };
int len =
- DHComputeSharedSecretKey(r->Link.dh,
- (uint8_t *) & serversig[dhposServer], 128,
+ DHComputeSharedSecretKey(r->Link.dh, &serversig[dhposServer], 128,
secretKey);
if (len < 0)
{
@@ -540,7 +539,7 @@ HandShake(RTMP * r, bool FP9HandShake)
}
RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) secretKey, 128);
+ RTMP_LogHex(RTMP_LOGDEBUG, secretKey, 128);
InitRC4Encryption(secretKey,
(uint8_t *) & serversig[dhposServer],
@@ -574,8 +573,8 @@ HandShake(RTMP * r, bool FP9HandShake)
#ifdef FP10
if (type == 8 )
{
- unsigned char *dptr = (unsigned char *)digestResp;
- unsigned char *sig = (unsigned char *)signatureResp;
+ uint8_t *dptr = digestResp;
+ uint8_t *sig = signatureResp;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe8_sig(sig+i, sig+i, dptr[i] % 15);
@@ -583,8 +582,8 @@ HandShake(RTMP * r, bool FP9HandShake)
#if 0
else if (type == 9))
{
- unsigned char *dptr = (unsigned char *)digestResp;
- unsigned char *sig = (unsigned char *)signatureResp;
+ uint8_t *dptr = digestResp;
+ uint8_t *sig = signatureResp;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe9_sig(sig+i, sig+i, dptr[i] % 15);
@@ -606,11 +605,11 @@ HandShake(RTMP * r, bool FP9HandShake)
__FUNCTION__);
RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE);
#endif
- if (!WriteN(r, reply, RTMP_SIG_SIZE))
+ if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE))
return false;
/* 2nd part of handshake */
- if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+ if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
#ifdef _DEBUG
@@ -620,8 +619,8 @@ HandShake(RTMP * r, bool FP9HandShake)
if (FP9HandShake)
{
- char signature[SHA256_DIGEST_LENGTH];
- char digest[SHA256_DIGEST_LENGTH];
+ uint8_t signature[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
if (serversig[4] == 0 && serversig[5] == 0 && serversig[6] == 0
&& serversig[7] == 0)
@@ -647,8 +646,8 @@ HandShake(RTMP * r, bool FP9HandShake)
#ifdef FP10
if (type == 8 )
{
- unsigned char *dptr = (unsigned char *)digest;
- unsigned char *sig = (unsigned char *)signature;
+ uint8_t *dptr = digest;
+ uint8_t *sig = signature;
/* encrypt signature */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe8_sig(sig+i, sig+i, dptr[i] % 15);
@@ -656,8 +655,8 @@ HandShake(RTMP * r, bool FP9HandShake)
#if 0
else if (type == 9)
{
- unsigned char *dptr = (unsigned char *)digest;
- unsigned char *sig = (unsigned char *)signature;
+ 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);
@@ -724,15 +723,15 @@ SHandShake(RTMP * r)
bool encrypted;
int32_t *ip;
- char clientsig[RTMP_SIG_SIZE];
- char serverbuf[RTMP_SIG_SIZE + 4], *serversig = serverbuf+4;
- char type;
+ uint8_t clientsig[RTMP_SIG_SIZE];
+ uint8_t serverbuf[RTMP_SIG_SIZE + 4], *serversig = serverbuf+4;
+ uint8_t type;
uint32_t uptime;
- if (ReadN(r, &type, 1) != 1) /* 0x03 or 0x06 */
+ if (ReadN(r, (char *)&type, 1) != 1) /* 0x03 or 0x06 */
return false;
- if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+ if (ReadN(r, (char *)clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
RTMP_Log(RTMP_LOGDEBUG, "%s: Type Requested : %02X", __FUNCTION__, type);
@@ -827,14 +826,14 @@ SHandShake(RTMP * r)
&serversig[digestPosServer]);
RTMP_Log(RTMP_LOGDEBUG, "%s: Initial server digest: ", __FUNCTION__);
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) serversig + digestPosServer,
+ RTMP_LogHex(RTMP_LOGDEBUG, serversig + digestPosServer,
SHA256_DIGEST_LENGTH);
}
RTMP_Log(RTMP_LOGDEBUG2, "Serversig: ");
RTMP_LogHex(RTMP_LOGDEBUG2, serversig, RTMP_SIG_SIZE);
- if (!WriteN(r, serversig-1, RTMP_SIG_SIZE + 1))
+ if (!WriteN(r, (char *)serversig-1, RTMP_SIG_SIZE + 1))
return false;
/* decode client response */
@@ -847,8 +846,8 @@ SHandShake(RTMP * r)
if (FP9HandShake)
{
- char digestResp[SHA256_DIGEST_LENGTH];
- char *signatureResp = NULL;
+ uint8_t digestResp[SHA256_DIGEST_LENGTH];
+ uint8_t *signatureResp = NULL;
/* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */
int digestPosClient = GetDigestOffset1(clientsig, RTMP_SIG_SIZE);
@@ -884,7 +883,8 @@ SHandShake(RTMP * r)
AMF_EncodeInt32(&r->Link.SWFVerificationResponse[6], vend, r->Link.SWFSize);
HMACsha256(r->Link.SWFHash, SHA256_DIGEST_LENGTH,
&serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
- SHA256_DIGEST_LENGTH, &r->Link.SWFVerificationResponse[10]);
+ SHA256_DIGEST_LENGTH,
+ (uint8_t *)&r->Link.SWFVerificationResponse[10]);
}
/* do Diffie-Hellmann Key exchange for encrypted RTMP */
@@ -904,7 +904,7 @@ SHandShake(RTMP * r)
}
RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
- RTMP_LogHex(RTMP_LOGDEBUG, (char *) secretKey, 128);
+ RTMP_LogHex(RTMP_LOGDEBUG, secretKey, 128);
InitRC4Encryption(secretKey,
(uint8_t *) &clientsig[dhposClient],
@@ -923,8 +923,8 @@ SHandShake(RTMP * r)
#ifdef FP10
if (type == 8 )
{
- unsigned char *dptr = (unsigned char *)digestResp;
- unsigned char *sig = (unsigned char *)signatureResp;
+ uint8_t *dptr = digestResp;
+ uint8_t *sig = signatureResp;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe8_sig(sig+i, sig+i, dptr[i] % 15);
@@ -932,8 +932,8 @@ SHandShake(RTMP * r)
#if 0
else if (type == 9))
{
- unsigned char *dptr = (unsigned char *)digestResp;
- unsigned char *sig = (unsigned char *)signatureResp;
+ uint8_t *dptr = digestResp;
+ uint8_t *sig = signatureResp;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe9_sig(sig+i, sig+i, dptr[i] % 15);
@@ -960,11 +960,11 @@ SHandShake(RTMP * r)
__FUNCTION__);
RTMP_LogHex(RTMP_LOGDEBUG2, clientsig, RTMP_SIG_SIZE);
- if (!WriteN(r, clientsig, RTMP_SIG_SIZE))
+ if (!WriteN(r, (char *)clientsig, RTMP_SIG_SIZE))
return false;
/* 2nd part of handshake */
- if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+ if (ReadN(r, (char *)clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
RTMP_Log(RTMP_LOGDEBUG2, "%s: 2nd handshake: ", __FUNCTION__);
@@ -972,8 +972,8 @@ SHandShake(RTMP * r)
if (FP9HandShake)
{
- char signature[SHA256_DIGEST_LENGTH];
- char digest[SHA256_DIGEST_LENGTH];
+ uint8_t signature[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
RTMP_Log(RTMP_LOGDEBUG, "%s: Client sent signature:", __FUNCTION__);
RTMP_LogHex(RTMP_LOGDEBUG, &clientsig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
@@ -987,8 +987,8 @@ SHandShake(RTMP * r)
#ifdef FP10
if (type == 8 )
{
- unsigned char *dptr = (unsigned char *)digest;
- unsigned char *sig = (unsigned char *)signature;
+ uint8_t *dptr = digest;
+ uint8_t *sig = signature;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe8_sig(sig+i, sig+i, dptr[i] % 15);
@@ -996,8 +996,8 @@ SHandShake(RTMP * r)
#if 0
else if (type == 9))
{
- unsigned char *dptr = (unsigned char *)digestResp;
- unsigned char *sig = (unsigned char *)signatureResp;
+ uint8_t *dptr = digestResp;
+ uint8_t *sig = signatureResp;
/* encrypt signatureResp */
for (i=0; i<SHA256_DIGEST_LENGTH; i+=8)
rtmpe9_sig(sig+i, sig+i, dptr[i] % 15);
Modified: trunk/librtmp/hashswf.c
==============================================================================
--- trunk/librtmp/hashswf.c Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/hashswf.c Wed Apr 14 20:58:14 2010 (r429)
@@ -157,7 +157,7 @@ HTTP_get(struct HTTP_ctx *http, const ch
#endif
RTMPSockBuf_Send(&sb, sb.sb_buf, i);
- // set timeout
+ /* set timeout */
#define HTTP_TIMEOUT 5
{
SET_RCVTIMEO(tv, HTTP_TIMEOUT);
Modified: trunk/librtmp/http.h
==============================================================================
--- trunk/librtmp/http.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/http.h Wed Apr 14 20:58:14 2010 (r429)
@@ -29,7 +29,7 @@ typedef enum {
HTTPRES_BAD_REQUEST, /* client error */
HTTPRES_SERVER_ERROR, /* server reported an error */
HTTPRES_REDIRECTED, /* resource has been moved */
- HTTPRES_LOST_CONNECTION, /* connection lost while waiting for data */
+ HTTPRES_LOST_CONNECTION /* connection lost while waiting for data */
} HTTPResult;
struct HTTP_ctx {
Modified: trunk/librtmp/log.c
==============================================================================
--- trunk/librtmp/log.c Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/log.c Wed Apr 14 20:58:14 2010 (r429)
@@ -49,7 +49,7 @@ static void rtmp_log_default(int level,
vsnprintf(str, MAX_PRINT_LEN-1, format, vl);
- // Filter out 'no-name'
+ /* Filter out 'no-name' */
if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL )
return;
@@ -97,7 +97,7 @@ void RTMP_Log(int level, const char *for
static const char hexdig[] = "0123456789abcdef";
-void RTMP_LogHex(int level, const char *data, unsigned long len)
+void RTMP_LogHex(int level, const uint8_t *data, unsigned long len)
{
unsigned long i;
char line[50], *ptr;
@@ -124,7 +124,7 @@ void RTMP_LogHex(int level, const char *
}
}
-void RTMP_LogHexString(int level, const char *data, unsigned long len)
+void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len)
{
#define BP_OFFSET 9
#define BP_GRAPH 60
@@ -162,7 +162,7 @@ void RTMP_LogHexString(int level, const
off = BP_GRAPH + n + ((n >= 8)?1:0);
- if ( isprint( (unsigned char) data[i] )) {
+ if ( isprint( data[i] )) {
line[BP_GRAPH + n] = data[i];
} else {
line[BP_GRAPH + n] = '.';
Modified: trunk/librtmp/log.h
==============================================================================
--- trunk/librtmp/log.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/log.h Wed Apr 14 20:58:14 2010 (r429)
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdarg.h>
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -49,8 +50,8 @@ void RTMP_LogSetOutput(FILE *file);
void RTMP_LogPrintf(const char *format, ...);
void RTMP_LogStatus(const char *format, ...);
void RTMP_Log(int level, const char *format, ...);
-void RTMP_LogHex(int level, const char *data, unsigned long len);
-void RTMP_LogHexString(int level, const char *data, unsigned long len);
+void RTMP_LogHex(int level, const uint8_t *data, unsigned long len);
+void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len);
void RTMP_LogSetLevel(RTMP_LogLevel lvl);
RTMP_LogLevel RTMP_LogGetLevel(void);
Modified: trunk/librtmp/parseurl.c
==============================================================================
--- trunk/librtmp/parseurl.c Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/parseurl.c Wed Apr 14 20:58:14 2010 (r429)
@@ -43,9 +43,9 @@ bool RTMP_ParseURL(const char *url, int
app->av_len = 0;
app->av_val = NULL;
- // Old School Parsing
+ /* Old School Parsing */
- // look for usual :// pattern
+ /* look for usual :// pattern */
p = strstr(url, "://");
if(!p) {
RTMP_Log(RTMP_LOGERROR, "RTMP URL: No :// in url!");
@@ -75,10 +75,10 @@ bool RTMP_ParseURL(const char *url, int
RTMP_Log(RTMP_LOGDEBUG, "Parsed protocol: %d", *protocol);
parsehost:
- // lets get the hostname
+ /* let's get the hostname */
p+=3;
- // check for sudden death
+ /* check for sudden death */
if(*p==0) {
RTMP_Log(RTMP_LOGWARNING, "No hostname in URL!");
return false;
@@ -109,7 +109,7 @@ parsehost:
p+=hostlen;
}
- // get the port number if available
+ /* get the port number if available */
if(*p == ':') {
unsigned int p2;
p++;
@@ -128,10 +128,11 @@ parsehost:
p = slash+1;
{
- // parse application
- //
- // rtmp://host[:port]/app[/appinstance][/...]
- // application = app[/appinstance]
+ /* parse application
+ *
+ * rtmp://host[:port]/app[/appinstance][/...]
+ * application = app[/appinstance]
+ */
char *slash2, *slash3 = NULL;
int applen, appnamelen;
@@ -140,18 +141,18 @@ parsehost:
if(slash2)
slash3 = strchr(slash2+1, '/');
- applen = end-p; // ondemand, pass all parameters as app
- appnamelen = applen; // ondemand length
+ applen = end-p; /* ondemand, pass all parameters as app */
+ appnamelen = applen; /* ondemand length */
- if(ques && strstr(p, "slist=")) { // whatever it is, the '?' and slist= means we need to use everything as app and parse plapath from slist=
+ if(ques && strstr(p, "slist=")) { /* whatever it is, the '?' and slist= means we need to use everything as app and parse plapath from slist= */
appnamelen = ques-p;
}
else if(strncmp(p, "ondemand/", 9)==0) {
- // app = ondemand/foobar, only pass app=ondemand
+ /* app = ondemand/foobar, only pass app=ondemand */
applen = 8;
appnamelen = 8;
}
- else { // app!=ondemand, so app is app[/appinstance]
+ else { /* app!=ondemand, so app is app[/appinstance] */
if(slash3)
appnamelen = slash3-p;
else if(slash2)
@@ -225,7 +226,7 @@ void RTMP_ParsePlaypath(AVal *in, AVal *
(strncmp(ext, ".mp4", 4) == 0)) {
addMP4 = 1;
subExt = 1;
- // Only remove .flv from rtmp URL, not slist params
+ /* Only remove .flv from rtmp URL, not slist params */
} else if ((ppstart == playpath) &&
(strncmp(ext, ".flv", 4) == 0)) {
subExt = 1;
@@ -255,7 +256,7 @@ void RTMP_ParsePlaypath(AVal *in, AVal *
pplen -= 4;
}
if (*p == '%') {
- int c;
+ unsigned int c;
sscanf(p+1, "%02x", &c);
*destptr++ = c;
pplen -= 3;
Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/rtmp.c Wed Apr 14 20:58:14 2010 (r429)
@@ -649,7 +649,7 @@ bool RTMP_SetupURL(RTMP *r, char *url)
port = arg.av_len;
for (p1=p2; port >0;) {
if (*p1 == '\\') {
- int c;
+ unsigned int c;
if (port < 3)
return false;
sscanf(p1+1, "%02x", &c);
@@ -769,7 +769,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
return false;
}
- // set timeout
+ /* set timeout */
{
SET_RCVTIMEO(tv, r->Link.timeout);
if (setsockopt
@@ -845,13 +845,13 @@ RTMP_Connect(RTMP *r, RTMPPacket *cp)
if (r->Link.socksport)
{
- // Connect via SOCKS
+ /* Connect via SOCKS */
if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport))
return false;
}
else
{
- // Connect directly
+ /* Connect directly */
if (!add_addr_info(&service, &r->Link.hostname, r->Link.port))
return false;
}
@@ -876,13 +876,13 @@ SocksNegotiate(RTMP *r)
{
char packet[] = {
- 4, 1, // SOCKS 4, connect
+ 4, 1, /* SOCKS 4, connect */
(r->Link.port >> 8) & 0xFF,
(r->Link.port) & 0xFF,
(char)(addr >> 24) & 0xFF, (char)(addr >> 16) & 0xFF,
(char)(addr >> 8) & 0xFF, (char)addr & 0xFF,
0
- }; // NULL terminate
+ }; /* NULL terminate */
WriteN(r, packet, sizeof packet);
@@ -1030,33 +1030,33 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
switch (packet->m_packetType)
{
case 0x01:
- // chunk size
+ /* chunk size */
HandleChangeChunkSize(r, packet);
break;
case 0x03:
- // bytes read report
+ /* bytes read report */
RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__);
break;
case 0x04:
- // ctrl
+ /* ctrl */
HandleCtrl(r, packet);
break;
case 0x05:
- // server bw
+ /* server bw */
HandleServerBW(r, packet);
break;
case 0x06:
- // client bw
+ /* client bw */
HandleClientBW(r, packet);
break;
case 0x08:
- // audio data
- //RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
+ /* audio data */
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize); */
HandleAudio(r, packet);
bHasMediaPacket = 1;
if (!r->m_mediaChannel)
@@ -1066,8 +1066,8 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
break;
case 0x09:
- // video data
- //RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
+ /* video data */
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize); */
HandleVideo(r, packet);
bHasMediaPacket = 1;
if (!r->m_mediaChannel)
@@ -1076,41 +1076,43 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
r->m_mediaStamp = packet->m_nTimeStamp;
break;
- case 0x0F: // flex stream send
+ case 0x0F: /* 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 0x10: /* 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 0x11: /* flex message */
{
RTMP_Log(RTMP_LOGDEBUG,
"%s, flex message, size %lu bytes, not fully supported",
__FUNCTION__, packet->m_nBodySize);
- //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
+ /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
- // some DEBUG code
- /*RTMP_LIB_AMFObject obj;
+ /* some DEBUG code */
+#if 0
+ RTMP_LIB_AMFObject obj;
int nRes = obj.Decode(packet.m_body+1, packet.m_nBodySize-1);
if(nRes < 0) {
RTMP_Log(RTMP_LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__);
- //return;
+ /*return; */
}
- obj.Dump(); */
+ obj.Dump();
+#endif
if (HandleInvoke(r, packet->m_body + 1, packet->m_nBodySize - 1) == 1)
bHasMediaPacket = 2;
break;
}
case 0x12:
- // metadata (notify)
+ /* metadata (notify) */
RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %lu bytes", __FUNCTION__,
packet->m_nBodySize);
if (HandleMetadata(r, packet->m_body, packet->m_nBodySize))
@@ -1123,10 +1125,10 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
break;
case 0x14:
- // invoke
+ /* invoke */
RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__,
packet->m_nBodySize);
- //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
+ /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
if (HandleInvoke(r, packet->m_body, packet->m_nBodySize) == 1)
bHasMediaPacket = 2;
@@ -1134,13 +1136,13 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
case 0x16:
{
- // go through FLV packets and handle metadata packets
+ /* go through FLV packets and handle metadata packets */
unsigned int pos = 0;
uint32_t nTimeStamp = packet->m_nTimeStamp;
while (pos + 11 < packet->m_nBodySize)
{
- uint32_t dataSize = AMF_DecodeInt24(packet->m_body + pos + 1); // size without header (11) and prevTagSize (4)
+ uint32_t dataSize = AMF_DecodeInt24(packet->m_body + pos + 1); /* size without header (11) and prevTagSize (4) */
if (pos + 11 + dataSize + 4 > packet->m_nBodySize)
{
@@ -1161,8 +1163,8 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
if (!r->m_pausing)
r->m_mediaStamp = nTimeStamp;
- // FLV tag(s)
- //RTMP_Log(RTMP_LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize);
+ /* FLV tag(s) */
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize); */
bHasMediaPacket = 1;
break;
}
@@ -1248,7 +1250,7 @@ ReadN(RTMP *r, char *buffer, int n)
&& r->m_nBytesIn > r->m_nBytesInSent + r->m_nClientBW / 2)
SendBytesReceived(r);
}
- //RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes);
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */
#ifdef _DEBUG
fwrite(ptr, 1, nBytes, netstackdump_read);
#endif
@@ -1256,7 +1258,7 @@ ReadN(RTMP *r, char *buffer, int n)
if (nBytes == 0)
{
RTMP_Log(RTMP_LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__);
- //goto again;
+ /*goto again; */
RTMP_Close(r);
break;
}
@@ -1305,7 +1307,7 @@ WriteN(RTMP *r, const char *buffer, int
nBytes = HTTP_Post(r, RTMPT_SEND, ptr, n);
else
nBytes = RTMPSockBuf_Send(&r->m_sb, ptr, n);
- //RTMP_Log(RTMP_LOGDEBUG, "%s: %d\n", __FUNCTION__, nBytes);
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d\n", __FUNCTION__, nBytes); */
if (nBytes < 0)
{
@@ -1365,9 +1367,9 @@ SendConnectPacket(RTMP *r, RTMPPacket *c
if (cp)
return RTMP_SendPacket(r, cp, true);
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1430,7 +1432,7 @@ SendConnectPacket(RTMP *r, RTMPPacket *c
}
}
if (r->m_fEncoding != 0.0 || r->m_bSendEncoding)
- { // AMF0, AMF3 not fully supported yet
+ { /* AMF0, AMF3 not fully supported yet */
enc = AMF_EncodeNamedNumber(enc, pend, &av_objectEncoding, r->m_fEncoding);
if (!enc)
return false;
@@ -1438,10 +1440,10 @@ SendConnectPacket(RTMP *r, RTMPPacket *c
if (enc + 3 >= pend)
return false;
*enc++ = 0;
- *enc++ = 0; // end of object - 0x00 0x00 0x09
+ *enc++ = 0; /* end of object - 0x00 0x00 0x09 */
*enc++ = AMF_OBJECT_END;
- // add auth string
+ /* add auth string */
if (r->Link.auth.av_len)
{
enc = AMF_EncodeBoolean(enc, pend, r->Link.authflag);
@@ -1476,9 +1478,9 @@ SendBGHasStream(RTMP *r, double dId, AVa
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1508,9 +1510,9 @@ RTMP_SendCreateStream(RTMP *r)
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1519,7 +1521,7 @@ RTMP_SendCreateStream(RTMP *r)
enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_createStream);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
- *enc++ = AMF_NULL; // NULL
+ *enc++ = AMF_NULL; /* NULL */
packet.m_nBodySize = enc - packet.m_body;
@@ -1534,9 +1536,9 @@ SendFCSubscribe(RTMP *r, AVal *subscribe
RTMPPacket packet;
char pbuf[512], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1566,9 +1568,9 @@ SendReleaseStream(RTMP *r)
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1596,9 +1598,9 @@ SendFCPublish(RTMP *r)
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1626,9 +1628,9 @@ SendFCUnpublish(RTMP *r)
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1658,9 +1660,9 @@ SendPublish(RTMP *r)
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x04; // source channel (invoke)
+ packet.m_nChannel = 0x04; /* source channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = r->m_stream_id;
packet.m_hasAbsTimestamp = 0;
@@ -1693,9 +1695,9 @@ SendDeleteStream(RTMP *r, double dStream
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1722,9 +1724,9 @@ RTMP_SendPause(RTMP *r, bool DoPause, in
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x08; // video channel
+ packet.m_nChannel = 0x08; /* video channel */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // invoke
+ packet.m_packetType = 0x14; /* invoke */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1752,9 +1754,9 @@ RTMP_SendSeek(RTMP *r, int iTime)
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x08; // video channel
+ packet.m_nChannel = 0x08; /* video channel */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // invoke
+ packet.m_packetType = 0x14; /* invoke */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1780,9 +1782,9 @@ RTMP_SendServerBW(RTMP *r)
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
- packet.m_nChannel = 0x02; // control channel (invoke)
+ packet.m_nChannel = 0x02; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
- packet.m_packetType = 0x05; // Server BW
+ packet.m_packetType = 0x05; /* Server BW */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1800,9 +1802,9 @@ RTMP_SendClientBW(RTMP *r)
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
- packet.m_nChannel = 0x02; // control channel (invoke)
+ packet.m_nChannel = 0x02; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
- packet.m_packetType = 0x06; // Client BW
+ packet.m_packetType = 0x06; /* Client BW */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1821,9 +1823,9 @@ SendBytesReceived(RTMP *r)
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
- packet.m_nChannel = 0x02; // control channel (invoke)
+ packet.m_nChannel = 0x02; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x03; // bytes in
+ packet.m_packetType = 0x03; /* bytes in */
packet.m_nTimeStamp = 0;
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1831,10 +1833,10 @@ SendBytesReceived(RTMP *r)
packet.m_nBodySize = 4;
- AMF_EncodeInt32(packet.m_body, pend, r->m_nBytesIn); // hard coded for now
+ AMF_EncodeInt32(packet.m_body, pend, r->m_nBytesIn); /* hard coded for now */
r->m_nBytesInSent = r->m_nBytesIn;
- //RTMP_Log(RTMP_LOGDEBUG, "Send bytes report. 0x%x (%d bytes)", (unsigned int)m_nBytesIn, m_nBytesIn);
+ /*RTMP_Log(RTMP_LOGDEBUG, "Send bytes report. 0x%x (%d bytes)", (unsigned int)m_nBytesIn, m_nBytesIn); */
return RTMP_SendPacket(r, &packet, false);
}
@@ -1847,9 +1849,9 @@ SendCheckBW(RTMP *r)
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
- packet.m_packetType = 0x14; // INVOKE
+ packet.m_packetType = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -1862,7 +1864,7 @@ SendCheckBW(RTMP *r)
packet.m_nBodySize = enc - packet.m_body;
- // triggers _onbwcheck and eventually results in _onbwdone
+ /* triggers _onbwcheck and eventually results in _onbwdone */
return RTMP_SendPacket(r, &packet, false);
}
@@ -1875,10 +1877,10 @@ SendCheckBWResult(RTMP *r, double txn)
char pbuf[256], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x03; // control channel (invoke)
+ packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x14; // INVOKE
- packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; // temp inc value. till we figure it out.
+ packet.m_packetType = 0x14; /* INVOKE */
+ packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; /* temp inc value. till we figure it out. */
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1903,11 +1905,11 @@ SendPlay(RTMP *r)
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
char *enc;
- packet.m_nChannel = 0x08; // we make 8 our stream channel
+ 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 = 0x14; /* INVOKE */
packet.m_nTimeStamp = 0;
- packet.m_nInfoField2 = r->m_stream_id; //0x01000000;
+ packet.m_nInfoField2 = r->m_stream_id; /*0x01000000; */
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1923,29 +1925,32 @@ SendPlay(RTMP *r)
if (!enc)
return false;
- // Optional parameters start and len.
-
- // start: -2, -1, 0, positive number
- // -2: looks for a live stream, then a recorded stream, if not found any open a live stream
- // -1: plays a live stream
- // >=0: plays a recorded streams from 'start' milliseconds
+ /* Optional parameters start and len.
+ *
+ * start: -2, -1, 0, positive number
+ * -2: looks for a live stream, then a recorded stream,
+ * if not found any open a live stream
+ * -1: plays a live stream
+ * >=0: plays a recorded streams from 'start' milliseconds
+ */
if (r->Link.bLiveStream)
enc = AMF_EncodeNumber(enc, pend, -1000.0);
else
{
if (r->Link.seekTime > 0.0)
- enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); // resume from here
+ enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */
else
- enc = AMF_EncodeNumber(enc, pend, 0.0); //-2000.0); // recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found
+ enc = AMF_EncodeNumber(enc, pend, 0.0); /*-2000.0);*/ /* recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found */
}
if (!enc)
return false;
- // len: -1, 0, positive number
- // -1: plays live or recorded stream to the end (default)
- // 0: plays a frame 'start' ms away from the beginning
- // >0: plays a live or recoded stream for 'len' milliseconds
- //enc += EncodeNumber(enc, -1.0); // len
+ /* len: -1, 0, positive number
+ * -1: plays live or recorded stream to the end (default)
+ * 0: plays a frame 'start' ms away from the beginning
+ * >0: plays a live or recoded stream for 'len' milliseconds
+ */
+ /*enc += EncodeNumber(enc, -1.0); */ /* len */
if (r->Link.stopTime)
{
enc = AMF_EncodeNumber(enc, pend, r->Link.stopTime - r->Link.seekTime);
@@ -2012,9 +2017,9 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
- packet.m_nChannel = 0x02; // control channel (ping)
+ packet.m_nChannel = 0x02; /* control channel (ping) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
- packet.m_packetType = 0x04; // ctrl
+ packet.m_packetType = 0x04; /* ctrl */
packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */
packet.m_nInfoField2 = 0;
packet.m_hasAbsTimestamp = 0;
@@ -2037,7 +2042,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
#ifdef CRYPTO
memcpy(buf, r->Link.SWFVerificationResponse, 42);
RTMP_Log(RTMP_LOGDEBUG, "Sending SWFVerification response: ");
- RTMP_LogHex(RTMP_LOGDEBUG, packet.m_body, packet.m_nBodySize);
+ RTMP_LogHex(RTMP_LOGDEBUG, (uint8_t *)packet.m_body, packet.m_nBodySize);
#endif
}
else if (nType == 0x1A)
@@ -2123,7 +2128,7 @@ static const AVal av_NetStream_Play_Unpu
AVC("NetStream.Play.UnpublishNotify");
static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start");
-// Returns 0 for OK/Failed/error, 1 for 'Stop or Complete'
+/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
static int
HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
{
@@ -2131,7 +2136,7 @@ HandleInvoke(RTMP *r, const char *body,
AVal method;
double txn;
int ret = 0, nRes;
- if (body[0] != 0x02) // make sure it is a string method name we start with
+ if (body[0] != 0x02) /* make sure it is a string method name we start with */
{
RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
__FUNCTION__);
@@ -2217,7 +2222,7 @@ HandleInvoke(RTMP *r, const char *body,
}
else if (AVMATCH(&method, &av_onFCSubscribe))
{
- // SendOnFCSubscribe();
+ /* SendOnFCSubscribe(); */
}
else if (AVMATCH(&method, &av_onFCUnsubscribe))
{
@@ -2294,7 +2299,7 @@ HandleInvoke(RTMP *r, const char *body,
}
}
- // Return 1 if this is a Play.Complete or Play.Stop
+ /* Return 1 if this is a Play.Complete or Play.Stop */
else if (AVMATCH(&code, &av_NetStream_Play_Complete)
|| AVMATCH(&code, &av_NetStream_Play_Stop)
|| AVMATCH(&code, &av_NetStream_Play_UnpublishNotify))
@@ -2383,7 +2388,7 @@ DumpMetaData(AMFObject *obj)
}
if (prop->p_name.av_len)
{
- // chomp
+ /* chomp */
if (strlen(str) >= 1 && str[strlen(str) - 1] == '\n')
str[strlen(str) - 1] = '\0';
RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len,
@@ -2406,8 +2411,8 @@ SAVC(duration);
static bool
HandleMetadata(RTMP *r, char *body, unsigned int len)
{
- // allright we get some info here, so parse it and print it
- // also keep duration or filesize to make a nice progress bar
+ /* allright we get some info here, so parse it and print it */
+ /* also keep duration or filesize to make a nice progress bar */
AMFObject obj;
AVal metastring;
@@ -2426,13 +2431,13 @@ HandleMetadata(RTMP *r, char *body, unsi
if (AVMATCH(&metastring, &av_onMetaData))
{
AMFObjectProperty prop;
- // Show metadata
+ /* Show metadata */
RTMP_Log(RTMP_LOGINFO, "Metadata:");
DumpMetaData(&obj);
if (RTMP_FindFirstMatchingProperty(&obj, &av_duration, &prop))
{
r->m_fDuration = prop.p_vu.p_number;
- //RTMP_Log(RTMP_LOGDEBUG, "Set duration: %.2f", m_fDuration);
+ /*RTMP_Log(RTMP_LOGDEBUG, "Set duration: %.2f", m_fDuration); */
}
ret = true;
}
@@ -2470,7 +2475,7 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
nType = AMF_DecodeInt16(packet->m_body);
RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType,
packet->m_nBodySize);
- //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
+ /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
if (packet->m_nBodySize >= 6)
{
@@ -2498,7 +2503,7 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
RTMP_Log(RTMP_LOGDEBUG, "%s, Stream IsRecorded %d", __FUNCTION__, tmp);
break;
- case 6: // server ping. reply with pong.
+ case 6: /* server ping. reply with pong. */
tmp = AMF_DecodeInt32(packet->m_body + 2);
RTMP_Log(RTMP_LOGDEBUG, "%s, Ping %d", __FUNCTION__, tmp);
RTMP_SendCtrl(r, 0x07, tmp, 0);
@@ -2539,9 +2544,9 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
{
RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__);
#ifdef CRYPTO
- //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
+ /*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
+ /* 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)
{
RTMP_SendCtrl(r, 0x1B, 0, 0);
@@ -2649,11 +2654,11 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
nSize = packetSize[packet->m_headerType];
- if (nSize == RTMP_LARGE_HEADER_SIZE) // if we get a full header the timestamp is absolute
+ if (nSize == RTMP_LARGE_HEADER_SIZE) /* if we get a full header the timestamp is absolute */
packet->m_hasAbsTimestamp = true;
else if (nSize < RTMP_LARGE_HEADER_SIZE)
- { // using values from the last message of this channel
+ { /* using values from the last message of this channel */
if (r->m_vecChannelsIn[packet->m_nChannel])
memcpy(packet, r->m_vecChannelsIn[packet->m_nChannel],
sizeof(RTMPPacket));
@@ -2674,7 +2679,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
{
packet->m_nTimeStamp = AMF_DecodeInt24(header);
- //RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nTimeStamp, packet.m_hasAbsTimestamp);
+ /*RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nTimeStamp, packet.m_hasAbsTimestamp); */
if (nSize >= 6)
{
@@ -2703,7 +2708,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
}
}
- RTMP_LogHexString(RTMP_LOGDEBUG2, hbuf, hSize);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)hbuf, hSize);
if (packet->m_nBodySize > 0 && packet->m_body == NULL)
{
@@ -2737,28 +2742,28 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
return false;
}
- RTMP_LogHexString(RTMP_LOGDEBUG2, packet->m_body + packet->m_nBytesRead, nChunk);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)packet->m_body + packet->m_nBytesRead, nChunk);
packet->m_nBytesRead += nChunk;
- // keep the packet as ref for other packets on this channel
+ /* keep the packet as ref for other packets on this channel */
if (!r->m_vecChannelsIn[packet->m_nChannel])
r->m_vecChannelsIn[packet->m_nChannel] = malloc(sizeof(RTMPPacket));
memcpy(r->m_vecChannelsIn[packet->m_nChannel], packet, sizeof(RTMPPacket));
if (RTMPPacket_IsReady(packet))
{
- // make packet's timestamp absolute
+ /* make packet's timestamp absolute */
if (!packet->m_hasAbsTimestamp)
- packet->m_nTimeStamp += r->m_channelTimestamp[packet->m_nChannel]; // timestamps seem to be always relative!!
+ packet->m_nTimeStamp += r->m_channelTimestamp[packet->m_nChannel]; /* timestamps seem to be always relative!! */
r->m_channelTimestamp[packet->m_nChannel] = packet->m_nTimeStamp;
- // reset the data from the stored packet. we keep the header since we may use it later if a new packet for this channel
- // arrives and requests to re-use some info (small packet header)
+ /* reset the data from the stored packet. we keep the header since we may use it later if a new packet for this channel */
+ /* arrives and requests to re-use some info (small packet header) */
r->m_vecChannelsIn[packet->m_nChannel]->m_body = NULL;
r->m_vecChannelsIn[packet->m_nChannel]->m_nBytesRead = 0;
- r->m_vecChannelsIn[packet->m_nChannel]->m_hasAbsTimestamp = false; // can only be false if we reuse header
+ r->m_vecChannelsIn[packet->m_nChannel]->m_hasAbsTimestamp = false; /* can only be false if we reuse header */
}
else
{
@@ -2779,7 +2784,7 @@ HandShake(RTMP *r, bool FP9HandShake)
char clientbuf[RTMP_SIG_SIZE + 1], *clientsig = clientbuf + 1;
char serversig[RTMP_SIG_SIZE];
- clientbuf[0] = 0x03; // not encrypted
+ clientbuf[0] = 0x03; /* not encrypted */
uptime = htonl(RTMP_GetTime());
memcpy(clientsig, &uptime, 4);
@@ -2797,7 +2802,7 @@ HandShake(RTMP *r, bool FP9HandShake)
if (!WriteN(r, clientbuf, RTMP_SIG_SIZE + 1))
return false;
- if (ReadN(r, &type, 1) != 1) // 0x03 or 0x06
+ if (ReadN(r, &type, 1) != 1) /* 0x03 or 0x06 */
return false;
RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer : %02X", __FUNCTION__, type);
@@ -2809,7 +2814,7 @@ HandShake(RTMP *r, bool FP9HandShake)
if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
- // decode server response
+ /* decode server response */
memcpy(&suptime, serversig, 4);
suptime = ntohl(suptime);
@@ -2818,7 +2823,7 @@ HandShake(RTMP *r, bool FP9HandShake)
RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version : %d.%d.%d.%d", __FUNCTION__,
serversig[4], serversig[5], serversig[6], serversig[7]);
- // 2nd part of handshake
+ /* 2nd part of handshake */
if (!WriteN(r, serversig, RTMP_SIG_SIZE))
return false;
@@ -2842,7 +2847,7 @@ SHandShake(RTMP *r)
uint32_t uptime;
bool bMatch;
- if (ReadN(r, serverbuf, 1) != 1) // 0x03 or 0x06
+ if (ReadN(r, serverbuf, 1) != 1) /* 0x03 or 0x06 */
return false;
RTMP_Log(RTMP_LOGDEBUG, "%s: Type Request : %02X", __FUNCTION__, serverbuf[0]);
@@ -2872,7 +2877,7 @@ SHandShake(RTMP *r)
if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
- // decode client response
+ /* decode client response */
memcpy(&uptime, clientsig, 4);
uptime = ntohl(uptime);
@@ -2881,7 +2886,7 @@ SHandShake(RTMP *r)
RTMP_Log(RTMP_LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__,
clientsig[4], clientsig[5], clientsig[6], clientsig[7]);
- // 2nd part of handshake
+ /* 2nd part of handshake */
if (!WriteN(r, clientsig, RTMP_SIG_SIZE))
return false;
@@ -2905,11 +2910,11 @@ RTMP_SendChunk(RTMP *r, RTMPChunk *chunk
RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
chunk->c_chunkSize);
- RTMP_LogHexString(RTMP_LOGDEBUG2, chunk->c_header, chunk->c_headerSize);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)chunk->c_header, chunk->c_headerSize);
if (chunk->c_chunkSize)
{
char *ptr = chunk->c_chunk - chunk->c_headerSize;
- RTMP_LogHexString(RTMP_LOGDEBUG2, chunk->c_chunk, chunk->c_chunkSize);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)chunk->c_chunk, chunk->c_chunkSize);
/* save header bytes we're about to overwrite */
memcpy(hbuf, ptr, chunk->c_headerSize);
memcpy(ptr, chunk->c_header, chunk->c_headerSize);
@@ -2936,7 +2941,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
if (prevPacket && packet->m_headerType != RTMP_PACKET_SIZE_LARGE)
{
- // compress a bit by using the prev packet's attributes
+ /* compress a bit by using the prev packet's attributes */
if (prevPacket->m_nBodySize == packet->m_nBodySize
&& prevPacket->m_packetType == packet->m_packetType
&& packet->m_headerType == RTMP_PACKET_SIZE_MEDIUM)
@@ -2948,7 +2953,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
last = prevPacket->m_nTimeStamp;
}
- if (packet->m_headerType > 3) // sanity
+ if (packet->m_headerType > 3) /* sanity */
{
RTMP_Log(RTMP_LOGERROR, "sanity failed!! trying to send header of type: 0x%02x.",
(unsigned char)packet->m_headerType);
@@ -3051,8 +3056,8 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
if (nSize < nChunkSize)
nChunkSize = nSize;
- RTMP_LogHexString(RTMP_LOGDEBUG2, header, hSize);
- RTMP_LogHexString(RTMP_LOGDEBUG2, buffer, nChunkSize);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)header, hSize);
+ RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)buffer, nChunkSize);
if (tbuf)
{
memcpy(toff, header, nChunkSize + hSize);
@@ -3515,7 +3520,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
if (AVMATCH(&metastring, &av_onMetaData))
{
- // compare
+ /* compare */
if ((r->m_read.nMetaHeaderSize != nPacketLen) ||
(memcmp
(r->m_read.metaHeader, packetBody,
@@ -3737,7 +3742,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
if (r->m_read.buf == 0)
{
RTMP_Log(RTMP_LOGERROR, "Couldn't allocate memory!");
- ret = RTMP_READ_ERROR; // fatal error
+ ret = RTMP_READ_ERROR; /* fatal error */
break;
}
recopy = true;
@@ -3763,22 +3768,24 @@ Read_1_Packet(RTMP *r, char *buf, int bu
ptr++;
ptr = AMF_EncodeInt24(ptr, pend, nPacketLen);
- /*if(packet.m_packetType == 0x09) { // video
+#if 0
+ if(packet.m_packetType == 0x09) { /* video */
- // H264 fix:
- if((packetBody[0] & 0x0f) == 7) { // CodecId = H264
+ /* H264 fix: */
+ if((packetBody[0] & 0x0f) == 7) { /* CodecId = H264 */
uint8_t packetType = *(packetBody+1);
- uint32_t ts = AMF_DecodeInt24(packetBody+2); // composition time
+ uint32_t ts = AMF_DecodeInt24(packetBody+2); /* composition time */
int32_t cts = (ts+0xff800000)^0xff800000;
RTMP_Log(RTMP_LOGDEBUG, "cts : %d\n", cts);
nTimeStamp -= cts;
- // get rid of the composition time
+ /* get rid of the composition time */
CRTMP::EncodeInt24(packetBody+2, 0);
}
RTMP_Log(RTMP_LOGDEBUG, "VIDEO: nTimeStamp: 0x%08X (%d)\n", nTimeStamp, nTimeStamp);
- } */
+ }
+#endif
ptr = AMF_EncodeInt24(ptr, pend, nTimeStamp);
*ptr = (char)((nTimeStamp & 0xFF000000) >> 24);
@@ -3805,7 +3812,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
/*
CRTMP::EncodeInt24(ptr+pos+4, nTimeStamp);
- ptr[pos+7] = (nTimeStamp>>24)&0xff;// */
+ ptr[pos+7] = (nTimeStamp>>24)&0xff; */
/* set data type */
r->m_read.dataType |= (((*(packetBody + pos) == 0x08) << 2) |
@@ -3856,7 +3863,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
}
}
- pos += prevTagSize + 4; //(11+dataSize+4);
+ pos += prevTagSize + 4; /*(11+dataSize+4); */
}
}
ptr += len;
@@ -3871,7 +3878,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
* Update ext timestamp with this absolute offset in non-live mode
* otherwise report the relative one
*/
- // RTMP_LogPrintf("\nDEBUG: type: %02X, size: %d, pktTS: %dms, TS: %dms, bLiveStream: %d", packet.m_packetType, nPacketLen, packet.m_nTimeStamp, nTimeStamp, bLiveStream);
+ /* RTMP_LogPrintf("\nDEBUG: type: %02X, size: %d, pktTS: %dms, TS: %dms, bLiveStream: %d", packet.m_packetType, nPacketLen, packet.m_nTimeStamp, nTimeStamp, bLiveStream); */
r->m_read.timestamp = r->Link.bLiveStream ? packet.m_nTimeStamp : nTimeStamp;
ret = size;
@@ -3998,7 +4005,7 @@ RTMP_Write(RTMP *r, char *buf, int size)
char *pend, *enc;
int s2 = size, ret, num;
- pkt->m_nChannel = 0x04; // source channel
+ pkt->m_nChannel = 0x04; /* source channel */
pkt->m_nInfoField2 = r->m_stream_id;
while (s2)
Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h Wed Apr 14 19:34:14 2010 (r428)
+++ trunk/librtmp/rtmp.h Wed Apr 14 20:58:14 2010 (r429)
@@ -58,7 +58,8 @@ extern "C"
#define RTMP_DEFAULT_CHUNKSIZE 128
-#define RTMP_BUFFER_CACHE_SIZE (16*1024) // needs to fit largest number of bytes recv() may return
+/* needs to fit largest number of bytes recv() may return */
+#define RTMP_BUFFER_CACHE_SIZE (16*1024)
#define RTMP_CHANNELS 65600
@@ -91,10 +92,10 @@ extern "C"
{
uint8_t m_headerType;
uint8_t m_packetType;
- uint8_t m_hasAbsTimestamp; // timestamp absolute or relative?
+ uint8_t m_hasAbsTimestamp; /* timestamp absolute or relative? */
int m_nChannel;
- uint32_t m_nTimeStamp; // timestamp
- int32_t m_nInfoField2; // last 4 bytes in a long header
+ uint32_t m_nTimeStamp; /* timestamp */
+ int32_t m_nInfoField2; /* last 4 bytes in a long header */
uint32_t m_nBodySize;
uint32_t m_nBytesRead;
RTMPChunk *m_chunk;
@@ -145,19 +146,19 @@ extern "C"
int swfAge;
int protocol;
- int timeout; // number of seconds before connection times out
+ int timeout; /* number of seconds before connection times out */
unsigned short socksport;
unsigned short port;
#ifdef CRYPTO
#define RTMP_SWF_HASHLEN 32
- void *dh; // for encryption
+ void *dh; /* for encryption */
void *rc4keyIn;
void *rc4keyOut;
uint32_t SWFSize;
- char SWFHash[RTMP_SWF_HASHLEN];
+ uint8_t SWFHash[RTMP_SWF_HASHLEN];
char SWFVerificationResponse[RTMP_SWF_HASHLEN+10];
#endif
} RTMP_LNK;
@@ -202,7 +203,7 @@ extern "C"
int m_nBytesIn;
int m_nBytesInSent;
int m_nBufferMS;
- int m_stream_id; // returned in _result from invoking createStream
+ int m_stream_id; /* returned in _result from createStream */
int m_mediaChannel;
uint32_t m_mediaStamp;
uint32_t m_pauseStamp;
@@ -221,13 +222,13 @@ extern "C"
RTMP_LNK Link;
RTMPPacket *m_vecChannelsIn[RTMP_CHANNELS];
RTMPPacket *m_vecChannelsOut[RTMP_CHANNELS];
- int m_channelTimestamp[RTMP_CHANNELS]; // abs timestamp of last packet
+ int m_channelTimestamp[RTMP_CHANNELS]; /* abs timestamp of last packet */
- double m_fAudioCodecs; // audioCodecs for the connect packet
- double m_fVideoCodecs; // videoCodecs for the connect packet
+ double m_fAudioCodecs; /* audioCodecs for the connect packet */
+ double m_fVideoCodecs; /* videoCodecs for the connect packet */
double m_fEncoding; /* AMF0 or AMF3 */
- double m_fDuration; // duration of stream in seconds
+ double m_fDuration; /* duration of stream in seconds */
int m_msgCounter; /* RTMPT stuff */
int m_polling;
1
0
14 Apr '10
Author: hyc
Date: Wed Apr 14 19:34:14 2010
New Revision: 428
Log:
C89 compatibility
Modified:
trunk/librtmp/amf.c
trunk/librtmp/amf.h
trunk/librtmp/dh.h
trunk/librtmp/handshake.h
trunk/librtmp/hashswf.c
trunk/librtmp/parseurl.c
trunk/librtmp/rtmp.c
Modified: trunk/librtmp/amf.c
==============================================================================
--- trunk/librtmp/amf.c Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/amf.c Wed Apr 14 19:34:14 2010 (r428)
@@ -448,10 +448,11 @@ AMF3ReadInteger(const char *data, int32_
int
AMF3ReadString(const char *data, AVal *str)
{
+ int32_t ref = 0;
+ int len;
assert(str != 0);
- int32_t ref = 0;
- int len = AMF3ReadInteger(data, &ref);
+ len = AMF3ReadInteger(data, &ref);
data += len;
if ((ref & 0x1) == 0)
@@ -596,6 +597,7 @@ AMFProp_Decode(AMFObjectProperty *prop,
bool bDecodeName)
{
int nOriginalSize = nSize;
+ int nRes;
prop->p_name.av_len = 0;
prop->p_name.av_val = NULL;
@@ -692,7 +694,7 @@ AMFProp_Decode(AMFObjectProperty *prop,
nSize -= 4;
/* next comes the rest, mixed array has a final 0x000009 mark and names, so its an object */
- int 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;
@@ -709,7 +711,7 @@ AMFProp_Decode(AMFObjectProperty *prop,
unsigned int nArrayLen = AMF_DecodeInt32(pBuffer);
nSize -= 4;
- int nRes = AMF_DecodeArray(&prop->p_vu.p_object, pBuffer + 4, nSize,
+ nRes = AMF_DecodeArray(&prop->p_vu.p_object, pBuffer + 4, nSize,
nArrayLen, false);
if (nRes == -1)
return -1;
@@ -899,10 +901,11 @@ AMF_DecodeArray(AMFObject *obj, const ch
obj->o_props = NULL;
while (nArrayLen > 0)
{
+ AMFObjectProperty prop;
+ int nRes;
nArrayLen--;
- AMFObjectProperty prop;
- int nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName);
+ nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName);
if (nRes == -1)
bError = true;
else
Modified: trunk/librtmp/amf.h
==============================================================================
--- trunk/librtmp/amf.h Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/amf.h Wed Apr 14 19:34:14 2010 (r428)
@@ -25,9 +25,7 @@
*/
#include <stdint.h>
-#ifndef _MSC_VER
#include <stdbool.h>
-#endif
#ifdef __cplusplus
extern "C"
Modified: trunk/librtmp/dh.h
==============================================================================
--- trunk/librtmp/dh.h Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/dh.h Wed Apr 14 19:34:14 2010 (r428)
@@ -126,9 +126,10 @@ static bool
isValidPublicKey(MP_t y, MP_t p, MP_t q)
{
int ret = true;
+ MP_t bn;
assert(y);
- MP_t bn = MP_new();
+ bn = MP_new();
assert(bn);
// y must lie in [2,p-1]
@@ -210,16 +211,17 @@ failed:
static int
DHGenerateKey(MDH *dh)
{
+ size_t res = 0;
if (!dh)
return 0;
- size_t res = 0;
while (!res)
{
+ MP_t q1 = NULL;
+
if (!MDH_generate_key(dh))
return 0;
- MP_t q1 = NULL;
MP_gethex(&q1, Q1024, res);
assert(res);
@@ -242,10 +244,11 @@ DHGenerateKey(MDH *dh)
static int
DHGetPublicKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen)
{
+ int len;
if (!dh || !dh->pub_key)
return 0;
- int len = MP_bytes(dh->pub_key);
+ len = MP_bytes(dh->pub_key);
if (len <= 0 || len > (int) nPubkeyLen)
return 0;
Modified: trunk/librtmp/handshake.h
==============================================================================
--- trunk/librtmp/handshake.h Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/handshake.h Wed Apr 14 19:34:14 2010 (r428)
@@ -121,6 +121,7 @@ GetDHOffset2(char *handshake, unsigned i
{
unsigned int offset = 0;
unsigned char *ptr = (unsigned char *) handshake + 768;
+ unsigned int res;
assert(RTMP_SIG_SIZE <= len);
@@ -132,7 +133,7 @@ GetDHOffset2(char *handshake, unsigned i
ptr++;
offset += (*ptr);
- unsigned int res = (offset % 632) + 8;
+ res = (offset % 632) + 8;
if (res + 128 > 767)
{
@@ -149,6 +150,7 @@ GetDigestOffset2(char *handshake, unsign
{
unsigned int offset = 0;
unsigned char *ptr = (unsigned char *) handshake + 772;
+ unsigned int res;
offset += (*ptr);
ptr++;
@@ -158,7 +160,7 @@ GetDigestOffset2(char *handshake, unsign
ptr++;
offset += (*ptr);
- unsigned int res = (offset % 728) + 776;
+ res = (offset % 728) + 776;
if (res + 32 > 1535)
{
@@ -175,6 +177,7 @@ GetDHOffset1(char *handshake, unsigned i
{
unsigned int offset = 0;
unsigned char *ptr = (unsigned char *) handshake + 1532;
+ unsigned int res;
assert(RTMP_SIG_SIZE <= len);
@@ -186,7 +189,7 @@ GetDHOffset1(char *handshake, unsigned i
ptr++;
offset += (*ptr);
- unsigned int res = (offset % 632) + 772;
+ res = (offset % 632) + 772;
if (res + 128 > 1531)
{
@@ -203,6 +206,7 @@ GetDigestOffset1(char *handshake, unsign
{
unsigned int offset = 0;
unsigned char *ptr = (unsigned char *) handshake + 8;
+ unsigned int res;
assert(12 <= len);
@@ -214,7 +218,7 @@ GetDigestOffset1(char *handshake, unsign
ptr++;
offset += (*ptr);
- unsigned int res = (offset % 728) + 12;
+ res = (offset % 728) + 12;
if (res + 32 > 771)
{
@@ -246,7 +250,7 @@ CalculateDigest(unsigned int digestPos,
const char *key, size_t keyLen, char *digest)
{
const int messageLen = RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH;
- char message[messageLen];
+ char message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH];
memcpy(message, handshakeMessage, digestPos);
memcpy(message + digestPos,
@@ -477,8 +481,10 @@ HandShake(RTMP * r, bool FP9HandShake)
#endif
if (FP9HandShake)
- {
- int dhposServer;
+ {
+ int dhposServer;
+ char digestResp[SHA256_DIGEST_LENGTH];
+ char *signatureResp = NULL;
/* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */
int digestPosServer = GetDigestOffset2(serversig, RTMP_SIG_SIZE);
@@ -552,8 +558,7 @@ HandShake(RTMP * r, bool FP9HandShake)
*ip++ = rand();
#endif
/* calculate response now */
- char digestResp[SHA256_DIGEST_LENGTH];
- char *signatureResp = reply+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH;
+ signatureResp = reply+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH;
HMACsha256(&serversig[digestPosServer], SHA256_DIGEST_LENGTH,
GenuineFPKey, sizeof(GenuineFPKey), digestResp);
@@ -675,11 +680,11 @@ HandShake(RTMP * r, bool FP9HandShake)
if (encrypted)
{
+ char buff[RTMP_SIG_SIZE];
/* set keys for encryption from now on */
r->Link.rc4keyIn = keyIn;
r->Link.rc4keyOut = keyOut;
- char buff[RTMP_SIG_SIZE];
/* update the keystreams */
if (r->Link.rc4keyIn)
@@ -842,6 +847,9 @@ SHandShake(RTMP * r)
if (FP9HandShake)
{
+ char digestResp[SHA256_DIGEST_LENGTH];
+ char *signatureResp = NULL;
+
/* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */
int digestPosClient = GetDigestOffset1(clientsig, RTMP_SIG_SIZE);
@@ -906,8 +914,7 @@ SHandShake(RTMP * r)
/* calculate response now */
- char digestResp[SHA256_DIGEST_LENGTH];
- char *signatureResp = clientsig+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH;
+ signatureResp = clientsig+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH;
HMACsha256(&clientsig[digestPosClient], SHA256_DIGEST_LENGTH,
GenuineFMSKey, sizeof(GenuineFMSKey), digestResp);
@@ -1018,12 +1025,11 @@ SHandShake(RTMP * r)
if (encrypted)
{
+ char buff[RTMP_SIG_SIZE];
/* set keys for encryption from now on */
r->Link.rc4keyIn = keyIn;
r->Link.rc4keyOut = keyOut;
- char buff[RTMP_SIG_SIZE];
-
/* update the keystreams */
if (r->Link.rc4keyIn)
{
Modified: trunk/librtmp/hashswf.c
==============================================================================
--- trunk/librtmp/hashswf.c Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/hashswf.c Wed Apr 14 19:34:14 2010 (r428)
@@ -159,13 +159,15 @@ HTTP_get(struct HTTP_ctx *http, const ch
// set timeout
#define HTTP_TIMEOUT 5
- SET_RCVTIMEO(tv, HTTP_TIMEOUT);
- if (setsockopt
- (sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
- {
- RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
- __FUNCTION__, HTTP_TIMEOUT);
- }
+ {
+ SET_RCVTIMEO(tv, HTTP_TIMEOUT);
+ if (setsockopt
+ (sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
+ {
+ RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
+ __FUNCTION__, HTTP_TIMEOUT);
+ }
+ }
sb.sb_size = 0;
sb.sb_timedout = false;
Modified: trunk/librtmp/parseurl.c
==============================================================================
--- trunk/librtmp/parseurl.c Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/parseurl.c Wed Apr 14 19:34:14 2010 (r428)
@@ -111,8 +111,9 @@ parsehost:
// get the port number if available
if(*p == ':') {
+ unsigned int p2;
p++;
- unsigned int p2 = atoi(p);
+ p2 = atoi(p);
if(p2 > 65535) {
RTMP_Log(RTMP_LOGWARNING, "Invalid port number!");
} else {
@@ -196,6 +197,7 @@ void RTMP_ParsePlaypath(AVal *in, AVal *
const char *playpath = in->av_val;
const char *temp, *q, *ext = NULL;
const char *ppstart = playpath;
+ char *streamname, *destptr, *p;
int pplen = in->av_len;
@@ -233,11 +235,11 @@ void RTMP_ParsePlaypath(AVal *in, AVal *
}
}
- char *streamname = (char *)malloc((pplen+4+1)*sizeof(char));
+ streamname = (char *)malloc((pplen+4+1)*sizeof(char));
if (!streamname)
return;
- char *destptr = streamname, *p;
+ destptr = streamname;
if (addMP4 && (strncmp(ppstart, "mp4:", 4) != 0)) {
strcpy(destptr, "mp4:");
destptr += 4;
Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c Wed Apr 14 18:07:19 2010 (r427)
+++ trunk/librtmp/rtmp.c Wed Apr 14 19:34:14 2010 (r428)
@@ -734,6 +734,7 @@ finish:
bool
RTMP_Connect0(RTMP *r, struct sockaddr * service)
{
+ int on = 1;
r->m_sb.sb_timedout = false;
r->m_pausing = 0;
r->m_fDuration = 0.0;
@@ -769,15 +770,16 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
}
// set timeout
- SET_RCVTIMEO(tv, r->Link.timeout);
- if (setsockopt
- (r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
- {
- RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
- __FUNCTION__, r->Link.timeout);
- }
+ {
+ SET_RCVTIMEO(tv, r->Link.timeout);
+ if (setsockopt
+ (r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
+ {
+ RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
+ __FUNCTION__, r->Link.timeout);
+ }
+ }
- int on = 1;
setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
return true;
@@ -865,35 +867,38 @@ RTMP_Connect(RTMP *r, RTMPPacket *cp)
static bool
SocksNegotiate(RTMP *r)
{
+ unsigned long addr;
struct sockaddr_in service;
memset(&service, 0, sizeof(struct sockaddr_in));
add_addr_info(&service, &r->Link.hostname, r->Link.port);
- unsigned long addr = htonl(service.sin_addr.s_addr);
-
- char packet[] = {
- 4, 1, // SOCKS 4, connect
- (r->Link.port >> 8) & 0xFF,
- (r->Link.port) & 0xFF,
- (char)(addr >> 24) & 0xFF, (char)(addr >> 16) & 0xFF,
- (char)(addr >> 8) & 0xFF, (char)addr & 0xFF,
- 0
- }; // NULL terminate
+ addr = htonl(service.sin_addr.s_addr);
- WriteN(r, packet, sizeof packet);
+ {
+ char packet[] = {
+ 4, 1, // SOCKS 4, connect
+ (r->Link.port >> 8) & 0xFF,
+ (r->Link.port) & 0xFF,
+ (char)(addr >> 24) & 0xFF, (char)(addr >> 16) & 0xFF,
+ (char)(addr >> 8) & 0xFF, (char)addr & 0xFF,
+ 0
+ }; // NULL terminate
- if (ReadN(r, packet, 8) != 8)
- return false;
+ WriteN(r, packet, sizeof packet);
- if (packet[0] == 0 && packet[1] == 90)
- {
- return true;
- }
- else
- {
- RTMP_Log(RTMP_LOGERROR, "%s, SOCKS returned error code %d", packet[1]);
+ if (ReadN(r, packet, 8) != 8)
return false;
- }
+
+ if (packet[0] == 0 && packet[1] == 90)
+ {
+ return true;
+ }
+ else
+ {
+ RTMP_Log(RTMP_LOGERROR, "%s, SOCKS returned error code %d", packet[1]);
+ return false;
+ }
+ }
}
bool
@@ -1355,6 +1360,7 @@ SendConnectPacket(RTMP *r, RTMPPacket *c
{
RTMPPacket packet;
char pbuf[4096], *pend = pbuf + sizeof(pbuf);
+ char *enc;
if (cp)
return RTMP_SendPacket(r, cp, true);
@@ -1367,7 +1373,7 @@ SendConnectPacket(RTMP *r, RTMPPacket *c
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_connect);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_OBJECT;
@@ -1468,6 +1474,7 @@ SendBGHasStream(RTMP *r, double dId, AVa
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1477,7 +1484,7 @@ SendBGHasStream(RTMP *r, double dId, AVa
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_bgHasStream);
enc = AMF_EncodeNumber(enc, pend, dId);
*enc++ = AMF_NULL;
@@ -1499,6 +1506,7 @@ RTMP_SendCreateStream(RTMP *r)
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1508,7 +1516,7 @@ RTMP_SendCreateStream(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_createStream);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL; // NULL
@@ -1525,6 +1533,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribe
{
RTMPPacket packet;
char pbuf[512], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
packet.m_packetType = 0x14; // INVOKE
@@ -1534,7 +1543,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribe
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
RTMP_Log(RTMP_LOGDEBUG, "FCSubscribe: %s", subscribepath->av_val);
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_FCSubscribe);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1555,6 +1564,7 @@ SendReleaseStream(RTMP *r)
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1564,7 +1574,7 @@ SendReleaseStream(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_releaseStream);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1584,6 +1594,7 @@ SendFCPublish(RTMP *r)
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1593,7 +1604,7 @@ SendFCPublish(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_FCPublish);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1613,6 +1624,7 @@ SendFCUnpublish(RTMP *r)
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1622,7 +1634,7 @@ SendFCUnpublish(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_FCUnpublish);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1644,6 +1656,7 @@ SendPublish(RTMP *r)
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x04; // source channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
@@ -1653,7 +1666,7 @@ SendPublish(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_publish);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1678,6 +1691,7 @@ SendDeleteStream(RTMP *r, double dStream
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1687,7 +1701,7 @@ SendDeleteStream(RTMP *r, double dStream
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_deleteStream);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1706,6 +1720,7 @@ RTMP_SendPause(RTMP *r, bool DoPause, in
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x08; // video channel
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1715,7 +1730,7 @@ RTMP_SendPause(RTMP *r, bool DoPause, in
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_pause);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1735,6 +1750,7 @@ RTMP_SendSeek(RTMP *r, int iTime)
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x08; // video channel
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1744,7 +1760,7 @@ RTMP_SendSeek(RTMP *r, int iTime)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_seek);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1829,6 +1845,7 @@ SendCheckBW(RTMP *r)
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
@@ -1838,7 +1855,7 @@ SendCheckBW(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av__checkbw);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1856,6 +1873,7 @@ SendCheckBWResult(RTMP *r, double txn)
{
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; // control channel (invoke)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1865,7 +1883,7 @@ SendCheckBWResult(RTMP *r, double txn)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av__result);
enc = AMF_EncodeNumber(enc, pend, txn);
*enc++ = AMF_NULL;
@@ -1883,6 +1901,7 @@ SendPlay(RTMP *r)
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x08; // we make 8 our stream channel
packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
@@ -1892,7 +1911,7 @@ SendPlay(RTMP *r)
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_play);
enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
*enc++ = AMF_NULL;
@@ -1944,6 +1963,7 @@ SendSecureTokenResponse(RTMP *r, AVal *r
{
RTMPPacket packet;
char pbuf[1024], *pend = pbuf + sizeof(pbuf);
+ char *enc;
packet.m_nChannel = 0x03; /* control channel (invoke) */
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1953,7 +1973,7 @@ SendSecureTokenResponse(RTMP *r, AVal *r
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- char *enc = packet.m_body;
+ enc = packet.m_body;
enc = AMF_EncodeString(enc, pend, &av_secureTokenResponse);
enc = AMF_EncodeNumber(enc, pend, 0.0);
*enc++ = AMF_NULL;
@@ -1985,11 +2005,12 @@ The type of Ping packet is 0x4 and conta
bool
RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
{
- RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
-
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
int nSize;
+ char *buf;
+
+ RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
packet.m_nChannel = 0x02; // control channel (ping)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -2008,7 +2029,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
packet.m_nBodySize = nSize;
- char *buf = packet.m_body;
+ buf = packet.m_body;
buf = AMF_EncodeInt16(buf, pend, nType);
if (nType == 0x1B)
@@ -2106,6 +2127,9 @@ static const AVal av_NetStream_Publish_S
static int
HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
{
+ AMFObject obj;
+ AVal method;
+ double txn;
int ret = 0, nRes;
if (body[0] != 0x02) // make sure it is a string method name we start with
{
@@ -2114,7 +2138,6 @@ HandleInvoke(RTMP *r, const char *body,
return 0;
}
- AMFObject obj;
nRes = AMF_Decode(&obj, body, nBodySize, false);
if (nRes < 0)
{
@@ -2123,9 +2146,8 @@ HandleInvoke(RTMP *r, const char *body,
}
AMF_Dump(&obj);
- AVal method;
AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method);
- double txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
+ txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);
if (AVMATCH(&method, &av__result))
@@ -2584,6 +2606,8 @@ bool
RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
{
char hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }, *header = hbuf;
+ int nSize, hSize, nToRead, nChunk;
+ bool didAlloc = false;
RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket);
@@ -2623,7 +2647,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
header += 2;
}
- int nSize = packetSize[packet->m_headerType], hSize;
+ nSize = packetSize[packet->m_headerType];
if (nSize == RTMP_LARGE_HEADER_SIZE) // if we get a full header the timestamp is absolute
packet->m_hasAbsTimestamp = true;
@@ -2681,7 +2705,6 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
RTMP_LogHexString(RTMP_LOGDEBUG2, hbuf, hSize);
- bool didAlloc = false;
if (packet->m_nBodySize > 0 && packet->m_body == NULL)
{
if (!RTMPPacket_Alloc(packet, packet->m_nBodySize))
@@ -2693,8 +2716,8 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
packet->m_headerType = (hbuf[0] & 0xc0) >> 6;
}
- int nToRead = packet->m_nBodySize - packet->m_nBytesRead;
- int nChunk = r->m_inChunkSize;
+ nToRead = packet->m_nBodySize - packet->m_nBytesRead;
+ nChunk = r->m_inChunkSize;
if (nToRead < nChunk)
nChunk = nToRead;
@@ -2750,12 +2773,15 @@ static bool
HandShake(RTMP *r, bool FP9HandShake)
{
int i;
+ uint32_t uptime, suptime;
+ bool bMatch;
+ char type;
char clientbuf[RTMP_SIG_SIZE + 1], *clientsig = clientbuf + 1;
char serversig[RTMP_SIG_SIZE];
clientbuf[0] = 0x03; // not encrypted
- uint32_t uptime = htonl(RTMP_GetTime());
+ uptime = htonl(RTMP_GetTime());
memcpy(clientsig, &uptime, 4);
memset(&clientsig[4], 0, 4);
@@ -2771,7 +2797,6 @@ HandShake(RTMP *r, bool FP9HandShake)
if (!WriteN(r, clientbuf, RTMP_SIG_SIZE + 1))
return false;
- char type;
if (ReadN(r, &type, 1) != 1) // 0x03 or 0x06
return false;
@@ -2785,7 +2810,6 @@ HandShake(RTMP *r, bool FP9HandShake)
return false;
// decode server response
- uint32_t suptime;
memcpy(&suptime, serversig, 4);
suptime = ntohl(suptime);
@@ -2801,7 +2825,7 @@ HandShake(RTMP *r, bool FP9HandShake)
if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
- bool bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
+ bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
if (!bMatch)
{
RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
@@ -2816,6 +2840,7 @@ SHandShake(RTMP *r)
char serverbuf[RTMP_SIG_SIZE + 1], *serversig = serverbuf + 1;
char clientsig[RTMP_SIG_SIZE];
uint32_t uptime;
+ bool bMatch;
if (ReadN(r, serverbuf, 1) != 1) // 0x03 or 0x06
return false;
@@ -2863,7 +2888,7 @@ SHandShake(RTMP *r)
if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
return false;
- bool bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
+ bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
if (!bMatch)
{
RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
@@ -2901,6 +2926,14 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
{
const RTMPPacket *prevPacket = r->m_vecChannelsOut[packet->m_nChannel];
uint32_t last = 0;
+ int nSize;
+ int hSize, cSize;
+ char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE], c;
+ uint32_t t;
+ char *buffer, *tbuf = NULL, *toff = NULL;
+ int nChunkSize;
+ int tlen;
+
if (prevPacket && packet->m_headerType != RTMP_PACKET_SIZE_LARGE)
{
// compress a bit by using the prev packet's attributes
@@ -2922,10 +2955,9 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
return false;
}
- int nSize = packetSize[packet->m_headerType];
- int hSize = nSize, cSize = 0;
- char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE], c;
- uint32_t t = packet->m_nTimeStamp - last;
+ nSize = packetSize[packet->m_headerType];
+ hSize = nSize; cSize = 0;
+ t = packet->m_nTimeStamp - last;
if (packet->m_body)
{
@@ -2994,9 +3026,8 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
hptr = AMF_EncodeInt32(hptr, hend, t);
nSize = packet->m_nBodySize;
- char *buffer = packet->m_body, *tbuf = NULL, *toff = NULL;
- int nChunkSize = r->m_outChunkSize;
- int tlen;
+ buffer = packet->m_body;
+ nChunkSize = r->m_outChunkSize;
RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
nSize);
@@ -3411,6 +3442,10 @@ Read_1_Packet(RTMP *r, char *buf, int bu
int rtnGetNextMediaPacket = 0, ret = RTMP_READ_EOF;
RTMPPacket packet = { 0 };
bool recopy = false;
+ unsigned int size;
+ char *ptr, *pend;
+ uint32_t nTimeStamp = 0;
+ unsigned int len;
rtnGetNextMediaPacket = RTMP_GetNextMediaPacket(r, &packet);
while (rtnGetNextMediaPacket)
@@ -3689,12 +3724,11 @@ Read_1_Packet(RTMP *r, char *buf, int bu
}
/* calculate packet size and allocate slop buffer if necessary */
- unsigned int size = nPacketLen +
+ size = nPacketLen +
((packet.m_packetType == 0x08 || packet.m_packetType == 0x09
|| packet.m_packetType == 0x12) ? 11 : 0) +
(packet.m_packetType != 0x16 ? 4 : 0);
- char *ptr, *pend;
if (size + 4 > buflen)
{
/* the extra 4 is for the case of an FLV stream without a last
@@ -3716,7 +3750,6 @@ Read_1_Packet(RTMP *r, char *buf, int bu
pend = ptr + size + 4;
/* use to return timestamp of last processed packet */
- uint32_t nTimeStamp = 0;
/* audio (0x08), video (0x09) or metadata (0x12) packets :
* construct 11 byte header then add rtmp packet's data */
@@ -3756,7 +3789,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
}
memcpy(ptr, packetBody, nPacketLen);
- unsigned int len = nPacketLen;
+ len = nPacketLen;
/* correct tagSize and obtain timestamp if we have an FLV stream */
if (packet.m_packetType == 0x16)
1
0
Author: hyc
Date: Wed Apr 14 18:07:19 2010
New Revision: 427
Log:
Leave CRYPTO defined by default, use "make CRYPTO=" to turn it off.
Modified:
trunk/Makefile
trunk/librtmp/Makefile
trunk/librtmp/rtmp.h
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Sun Apr 11 07:04:18 2010 (r426)
+++ trunk/Makefile Wed Apr 14 18:07:19 2010 (r427)
@@ -8,8 +8,11 @@ CRYPTO=OPENSSL
LIB_GNUTLS=-lgnutls
LIB_OPENSSL=-lssl -lcrypto
CRYPTO_LIB=$(LIB_$(CRYPTO))
+DEF_=-DNO_CRYPTO
+CRYPTO_DEF=$(DEF_$(CRYPTO))
-DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\"
+
+DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF)
OPT=-O2
CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT)
LDFLAGS=-Wall $(XLDFLAGS)
Modified: trunk/librtmp/Makefile
==============================================================================
--- trunk/librtmp/Makefile Sun Apr 11 07:04:18 2010 (r426)
+++ trunk/librtmp/Makefile Wed Apr 14 18:07:19 2010 (r427)
@@ -7,8 +7,9 @@ LD=$(CROSS_COMPILE)ld
CRYPTO=OPENSSL
#CRYPTO=GNUTLS
-DEF_OPENSSL=-DCRYPTO -DUSE_OPENSSL
-DEF_GNUTLS=-DCRYPTO -DUSE_GNUTLS
+DEF_OPENSSL=-DUSE_OPENSSL
+DEF_GNUTLS=-DUSE_GNUTLS
+DEF_=-DNO_CRYPTO
LIB_GNUTLS=-lgnutls
LIB_OPENSSL=-lssl -lcrypto
REQ_GNUTLS=gnutls
Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h Sun Apr 11 07:04:18 2010 (r426)
+++ trunk/librtmp/rtmp.h Wed Apr 14 18:07:19 2010 (r427)
@@ -24,6 +24,10 @@
* http://www.gnu.org/copyleft/lgpl.html
*/
+#ifndef NO_CRYPTO
+#define CRYPTO
+#endif
+
#include <errno.h>
#include <stdint.h>
#include <stddef.h>
@@ -146,6 +150,7 @@ extern "C"
unsigned short socksport;
unsigned short port;
+#ifdef CRYPTO
#define RTMP_SWF_HASHLEN 32
void *dh; // for encryption
void *rc4keyIn;
@@ -154,6 +159,7 @@ extern "C"
uint32_t SWFSize;
char SWFHash[RTMP_SWF_HASHLEN];
char SWFVerificationResponse[RTMP_SWF_HASHLEN+10];
+#endif
} RTMP_LNK;
/* state for read() wrapper */
1
0
Hi Howard.
I think you need to change line #12 in the Makefile from"
DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\"
to
DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" -DCRYPTO
If you compile it as-is, you won't get the SWF verifying bits (well, not
in MingW anyway).
Regards,
Stefan Zakarias.
2
1
Alright, I've made the necessary modifications to allow librtmp (not the executables, just the
library) to compile as a 32 bit C (not C++) static lib under MS Visual C 2008. The patch (see
attachment) is based on revision 426 of the rtmpdump svn depot.
The change includes two headers found online to simulate stdint and stdbool support under windows,
the headers for any relevant license terms. The Visual Studio project defines CRYPTO, and specifies
an include path for openssl that expects openssl to exist as a sibling directory of the rtmpdump
directory, and for the openssl directory to be named 'openssl-0.9.8k'. Because of this, if you link
the rtmpdump static lib to an application, you must also link openssl-0.9.8k to your application or
you will encounter undefined externals at link time.
In case it matters, I consider my code portions in this patch (everything excluding the stdint.h and
stdbool.h files) to be public domain, and will claim no copyright on them.
Because of MSVC's lack of C99 support, many changes had to be made to variable declarations that
were occurring following statements. If this patch is accepted, it will require effort to maintain
the MSVC support because of the lack of C99. My intent was to make it easy to link in librtmp
support to applications (XBMC specifically) under win32. MinGW might be an alternative way to
achieve that, but I have not explored that option.
I'm hoping to find time in the next couple of days to attempt linking this lib to XBMC under win32.
2
1
Hi,
can anyone assist in streaming this site?
I wish to access BBC News (outside the uk). Prefer not to access
via browser.
Here is the rtmpsuck output:-
RTMP Proxy Server v2.1c
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL
Streaming on rtmp://0.0.0.0:1935
DEBUG: serverThread: accepted connection from 192.168.1.7 to
203.153.50.93
DEBUG: SHandShake: Type Requested : 03
DEBUG: SHandShake: Client Uptime : 461965
DEBUG: SHandShake: Player Version: -128.0.3.2
DEBUG: SHandShake: Handshaking finished....
DEBUG2: RTMP_ReadPacket: fd=4
0000: 03 00 00 00 00 01 b9 14 00 00 00
00 ............
0000: 02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00
00 ...connect.?....
0010: 00 00 00 03 00 03 61 70 70 02 00 32 6c 69 76
65 ......app..2live
0020: 3f 5f 66 63 73 5f 76 68 6f 73 74 3d 63 70 35
32 ?_fcs_vhost=cp52
0030: 31 31 33 2e 6c 69 76 65 2e 65 64 67 65 66 63 73
113.live.edgefcs
0040: 2e 6e 65 74 26 61 6b 6d 66 76 3d 31 2e 38 00
08 .net&akmfv=1.8..
0050: 66 6c 61 73 68 56 65 72 02 00 0e 4c 4e 58 20 31
flashVer...LNX 1
0060: 30 2c 30 2c 33 32 2c 31 38 00 06 73 77 66 55 72
0,0,32,18..swfUr
0070: 6c 02 00 3f 68 74 74 70 3a 2f 2f 6d 65 64 69 61
l..?http://media
DEBUG2: RTMP_ReadPacket: fd=4
0000:
c3 .
0000: 32 2e 6d 79 66 6f 78 74 61 6d 70 61 62 61 79 2e
2.myfoxtampabay.
0010: 63 6f 6d 2f 68 74 6d 6c 2f 6c 69 76 65 2f 41 6b
com/html/live/Ak
0020: 61 6d 61 69 46 6c 61 73 68 50 6c 61 79 65 72 2e
amaiFlashPlayer.
0030: 73 77 66 00 05 74 63 55 72 6c 02 00 4c 72 74 6d
swf..tcUrl..Lrtm
0040: 70 3a 2f 2f 32 30 33 2e 31 35 33 2e 35 30 2e 39
p://203.153.50.9
0050: 33 3a 31 39 33 35 2f 6c 69 76 65 3f 5f 66 63 73
3:1935/live?_fcs
0060: 5f 76 68 6f 73 74 3d 63 70 35 32 31 31 33 2e 6c
_vhost=cp52113.l
0070: 69 76 65 2e 65 64 67 65 66 63 73 2e 6e 65 74 26
ive.edgefcs.net&
DEBUG2: RTMP_ReadPacket: fd=4
0000:
c3 .
0000: 61 6b 6d 66 76 3d 31 2e 38 00 04 66 70 61 64 01
akmfv=1.8..fpad.
0010: 00 00 0c 63 61 70 61 62 69 6c 69 74 69 65 73
00 ...capabilities.
0020: 40 2e 00 00 00 00 00 00 00 0b 61 75 64 69 6f 43
@.........audioC
0030: 6f 64 65 63 73 00 40 a8 ee 00 00 00 00 00 00 0b
odecs.@.........
0040: 76 69 64 65 6f 43 6f 64 65 63 73 00 40 6f 80 00
videoCodecs.@o..
0050: 00 00 00 00 00 0d 76 69 64 65 6f 46 75 6e 63
74 ......videoFunct
0060: 69 6f 6e 00 3f f0 00 00 00 00 00 00 00 07 70 61
ion.?.........pa
0070: 67 65 55 72 6c 02 00 23 68 74 74 70 3a 2f 2f 61
geUrl..#http://a
DEBUG2: RTMP_ReadPacket: fd=4
0000:
c3 .
0000: 74 64 68 65 2e 6e 65 74 2f 77 61 74 63 68 2d 62
tdhe.net/watch-b
0010: 62 63 2d 6e 65 77 73 2e 70 68 70 00 0e 6f 62 6a
bc-news.php..obj
0020: 65 63 74 45 6e 63 6f 64 69 6e 67 00 00 00 00 00
ectEncoding.....
0030: 00 00 00 00 00 00 09 01
00 .........
DEBUG: ServePacket, client sent packet type 14, size 441 bytes
DEBUG: (object begin)
DEBUG: Property: <Name: no-name., STRING: connect>
DEBUG: Property: <Name: no-name., NUMBER: 1.00>
DEBUG: Property: <Name: no-name., OBJECT>
DEBUG: (object begin)
DEBUG: Property: <Name: app, STRING:
live?_fcs_vhost=cp52113.live.edgefcs.net&akmfv=1.8>
DEBUG: Property: <Name: flashVer, STRING: LNX
10,0,32,18>
DEBUG: Property: <Name: swfUrl, STRING:
http://media2.myfoxtampabay.com/html/live/AkamaiFlashPlayer.swf>
DEBUG: Property: <Name: tcUrl, STRING:
rtmp://203.153.50.93:1935/live?_fcs_vhost=cp52113.live.edgefcs.net&akmfv=1.8>
DEBUG: Property: <Name: fpad, BOOLEAN: FALSE>
DEBUG: Property: <Name: capabilities, NUMBER: 15.00>
DEBUG: Property: <Name: audioCodecs, NUMBER: 3191.00>
DEBUG: Property: <Name: videoCodecs, NUMBER: 252.00>
DEBUG: Property: <Name: videoFunction, NUMBER: 1.00>
DEBUG: Property: <Name: pageUrl, STRING:
http://atdhe.net/watch-bbc-news.php>
DEBUG: Property: <Name: objectEncoding, NUMBER: 0.00>
DEBUG: (object end)
DEBUG: Property: <Name: no-name., BOOLEAN: FALSE>
DEBUG: (object end)
DEBUG: ServeInvoke, client invoking <connect>
Processing connect
app: live?_fcs_vhost=cp52113.live.edgefcs.net&akmfv=1.8
flashVer: LNX 10,0,32,18
swfUrl: http://media2.myfoxtampabay.com/html/live/AkamaiFlashPlayer.swf
tcUrl:
rtmp://203.153.50.93:1935/live?_fcs_vhost=cp52113.live.edgefcs.net&akmfv=1.8
pageUrl: http://atdhe.net/watch-bbc-news.php
DEBUG: RTMP_Connect1, ... connected, handshaking
DEBUG: HandShake: Client type: 03
DEBUG: HandShake: Client digest offset: 580
DEBUG: HandShake: Initial client digest:
E1 E5 83 00 6F E7 8F 7A 57 8D 14 2E F5 05 F3 0E 40 DD A9 41 BD 1E 00 33
3D 90 12 2D B2 6D C1 0D
^CCaught signal: 2, cleaning up, just a second...
2
2
Hello,
So I've been experimenting with using librtmp (the latest version from svn) integrated into XBMC.
For the most part things work well, but I've been having a problem trying to connect to a video URL
from a flash based TV website in Canada named CTV (only accessible from Canada I believe). I should
point out that I'm only having these problems because of the different URL format of the RTMPE
streams. RTMP streams work fine, it is only the encrypted streams that fail, and as I said, I think
it is because of the URL format, not an encryption issue. The complete URL looks like this (notice,
I'm breaking it up across multiple lines to avoid 80 char line limits):
rtmpe://cp45924.edgefcs.net/ondemand/s_!ctv/shows/2010/03/31/ALLMYCH-10344-…
?auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt
&aifp=v001
&slist=/s_!ctv/shows/2010/03/31/
So I take this URL and programatically change it to this before it is passed to librtmp:
rtmpe://cp45924.edgefcs.net/ondemand/s_!ctv/shows/2010/03/31/ALLMYCH-10344-…
swfUrl=http://watch.ctv.ca/Flash/player.swf
swfVfy=true
auth=dbEbzdDd4bLcKdgdwcAdKczdsdPaAdTd5dk-blWaqa-eS-iYG-txN4tmKCt
authflag=true
app=ondemand
tcUrl=/s_!ctv/shows/2010/03/31/
So this results in a connect packet like this being sent out:
DEBUG: RTMP_Connect1, handshaked
DEBUG2: RTMP_SendPacket: fd=21152, size=284
0000: 03 00 00 00 00 01 1c 14 00 00 00 00 ............
0000: 02 00 07 63 6f 6e 6e 65 63 74 00 3f f0 00 00 00 ...connect.?....
0010: 00 00 00 03 00 03 61 70 70 02 00 08 6f 6e 64 65 ......app...onde
0020: 6d 61 6e 64 00 06 73 77 66 55 72 6c 02 00 24 68 mand..swfUrl..$h
0030: 74 74 70 3a 2f 2f 77 61 74 63 68 2e 63 74 76 2e ttp://watch.ctv.
0040: 63 61 2f 46 6c 61 73 68 2f 70 6c 61 79 65 72 2e ca/Flash/player.
0050: 73 77 66 00 05 74 63 55 72 6c 02 00 19 2f 73 5f swf..tcUrl.../s_
0060: 21 63 74 76 2f 73 68 6f 77 73 2f 32 30 31 30 2f !ctv/shows/2010/
0070: 30 33 2f 33 31 2f 00 04 66 70 61 64 01 00 00 0c 03/31/..fpad....
0000: c3 .
0000: 63 61 70 61 62 69 6c 69 74 69 65 73 00 40 2e 00 capabilities.@..
0010: 00 00 00 00 00 00 0b 61 75 64 69 6f 43 6f 64 65 .......audioCode
0020: 63 73 00 40 a8 ee 00 00 00 00 00 00 0b 76 69 64 cs.@.........vid
0030: 65 6f 43 6f 64 65 63 73 00 40 6f 80 00 00 00 00 eoCodecs.@o.....
0040: 00 00 0d 76 69 64 65 6f 46 75 6e 63 74 69 6f 6e ...videoFunction
0050: 00 3f f0 00 00 00 00 00 00 00 00 09 01 01 02 00 .?..............
0060: 3b 64 62 45 62 7a 64 44 64 34 62 4c 63 4b 64 67 ;dbEbzdDd4bLcKdg
0070: 64 77 63 41 64 4b 63 7a 64 73 64 50 61 41 64 54 dwcAdKczdsdPaAdT
0000: c3 .
0000: 64 35 64 6b 2d 62 6c 57 61 71 61 2d 65 53 2d 69 d5dk-blWaqa-eS-i
0010: 59 47 2d 74 78 4e 34 74 6d 4b 43 74 YG-txN4tmKCt
DEBUG: Invoking connect
Unfortunately the response from the server is a connection reject message that looks like this:
DEBUG2: RTMP_ReadPacket: fd=21152
0000: 03 00 00 00 00 00 78 14 00 00 00 00 ......x.....
0000: 02 00 06 5f 65 72 72 6f 72 00 3f f0 00 00 00 00 ..._error.?.....
0010: 00 00 05 03 00 05 6c 65 76 65 6c 02 00 05 65 72 ......level...er
0020: 72 6f 72 00 04 63 6f 64 65 02 00 1e 4e 65 74 43 ror..code...NetC
0030: 6f 6e 6e 65 63 74 69 6f 6e 2e 43 6f 6e 6e 65 63 onnection.Connec
0040: 74 2e 52 65 6a 65 63 74 65 64 00 0b 64 65 73 63 t.Rejected..desc
0050: 72 69 70 74 69 6f 6e 02 00 1b 5b 20 41 63 63 65 ription...[ Acce
0060: 73 73 4d 61 6e 61 67 65 72 2e 52 65 6a 65 63 74 ssManager.Reject
0070: 20 5d 20 3a 20 00 00 09 ] : ...
DEBUG: RTMP_ClientPacket, received: invoke 120 bytes
DEBUG: (object begin)
DEBUG: Property: <Name: no-name., STRING: _error>
DEBUG: Property: <Name: no-name., NUMBER: 1.00>
DEBUG: Property: NULL
DEBUG: Property: <Name: no-name., OBJECT>
DEBUG: (object begin)
DEBUG: Property: <Name: level, STRING: error>
DEBUG: Property: <Name: code, STRING: NetConnection.Connect.Rejected>
DEBUG: Property: <Name: description, STRING: [ AccessManager.Reject ] : >
DEBUG: (object end)
Now, I don't think the way this video service is unique in the way it uses auth, aifp, and slist
params, I'm just hoping someone knows how to transform this URL format into a connect packet that
will succeed. Any advice?
Anony
3
9