mirror of https://bitbucket.org/ausocean/av.git
Merged in librtmpPorting (pull request #41)
LibrtmpPorting Approved-by: saxon.milton@gmail.com <saxon.milton@gmail.com>
This commit is contained in:
commit
d813a56ad6
|
@ -209,7 +209,7 @@ func (s *ffmpegSender) close() error {
|
||||||
|
|
||||||
// rtmpSender implements loadSender for a native RTMP destination.
|
// rtmpSender implements loadSender for a native RTMP destination.
|
||||||
type rtmpSender struct {
|
type rtmpSender struct {
|
||||||
sess rtmp.Session
|
sess *rtmp.Session
|
||||||
|
|
||||||
url string
|
url string
|
||||||
timeout uint
|
timeout uint
|
||||||
|
@ -222,7 +222,7 @@ type rtmpSender struct {
|
||||||
var _ restarter = (*rtmpSender)(nil)
|
var _ restarter = (*rtmpSender)(nil)
|
||||||
|
|
||||||
func newRtmpSender(url string, timeout uint, retries int, log func(lvl, msg string)) (*rtmpSender, error) {
|
func newRtmpSender(url string, timeout uint, retries int, log func(lvl, msg string)) (*rtmpSender, error) {
|
||||||
var sess rtmp.Session
|
var sess *rtmp.Session
|
||||||
var err error
|
var err error
|
||||||
for n := 0; n < retries; n++ {
|
for n := 0; n < retries; n++ {
|
||||||
sess = rtmp.NewSession(url, timeout)
|
sess = rtmp.NewSession(url, timeout)
|
||||||
|
|
4050
rtmp/rtmp.go
4050
rtmp/rtmp.go
File diff suppressed because it is too large
Load Diff
|
@ -70,16 +70,17 @@ extern "C"
|
||||||
struct AMFObjectProperty *o_props;
|
struct AMFObjectProperty *o_props;
|
||||||
} AMFObject;
|
} AMFObject;
|
||||||
|
|
||||||
|
typedef struct P_vu {
|
||||||
|
double p_number;
|
||||||
|
AVal p_aval;
|
||||||
|
AMFObject p_object;
|
||||||
|
} P_vu;
|
||||||
|
|
||||||
typedef struct AMFObjectProperty
|
typedef struct AMFObjectProperty
|
||||||
{
|
{
|
||||||
AVal p_name;
|
AVal p_name;
|
||||||
AMFDataType p_type;
|
AMFDataType p_type;
|
||||||
union
|
P_vu p_vu;
|
||||||
{
|
|
||||||
double p_number;
|
|
||||||
AVal p_aval;
|
|
||||||
AMFObject p_object;
|
|
||||||
} p_vu;
|
|
||||||
int16_t p_UTCoffset;
|
int16_t p_UTCoffset;
|
||||||
} AMFObjectProperty;
|
} AMFObjectProperty;
|
||||||
|
|
||||||
|
|
|
@ -109,37 +109,37 @@ typedef enum {
|
||||||
} RTMPTCmd;
|
} RTMPTCmd;
|
||||||
|
|
||||||
static int DumpMetaData(AMFObject *obj);
|
static int DumpMetaData(AMFObject *obj);
|
||||||
static int HandShake(RTMP *r, int FP9HandShake);
|
int HandShake(RTMP *r, int FP9HandShake);
|
||||||
static int SocksNegotiate(RTMP *r);
|
int SocksNegotiate(RTMP *r);
|
||||||
|
|
||||||
static int SendConnectPacket(RTMP *r, RTMPPacket *cp);
|
int SendConnectPacket(RTMP *r, RTMPPacket *cp);
|
||||||
static int SendCheckBW(RTMP *r);
|
int SendCheckBW(RTMP *r);
|
||||||
static int SendCheckBWResult(RTMP *r, double txn);
|
int SendCheckBWResult(RTMP *r, double txn);
|
||||||
static int SendDeleteStream(RTMP *r, double dStreamId);
|
int SendDeleteStream(RTMP *r, double dStreamId);
|
||||||
static int SendFCSubscribe(RTMP *r, AVal *subscribepath);
|
int SendFCSubscribe(RTMP *r, AVal *subscribepath);
|
||||||
static int SendPlay(RTMP *r);
|
int SendPlay(RTMP *r);
|
||||||
static int SendBytesReceived(RTMP *r);
|
int SendBytesReceived(RTMP *r);
|
||||||
static int SendUsherToken(RTMP *r, AVal *usherToken);
|
int SendUsherToken(RTMP *r, AVal *usherToken);
|
||||||
|
|
||||||
#if 0 /* unused */
|
#if 0 /* unused */
|
||||||
static int SendBGHasStream(RTMP *r, double dId, AVal *playpath);
|
static int SendBGHasStream(RTMP *r, double dId, AVal *playpath);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize);
|
int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize);
|
||||||
static int HandleMetadata(RTMP *r, char *body, unsigned int len);
|
int HandleMetadata(RTMP *r, char *body, unsigned int len);
|
||||||
static void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet);
|
void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet);
|
||||||
static void HandleAudio(RTMP *r, const RTMPPacket *packet);
|
void HandleAudio(RTMP *r, const RTMPPacket *packet);
|
||||||
static void HandleVideo(RTMP *r, const RTMPPacket *packet);
|
void HandleVideo(RTMP *r, const RTMPPacket *packet);
|
||||||
static void HandleCtrl(RTMP *r, const RTMPPacket *packet);
|
void HandleCtrl(RTMP *r, const RTMPPacket *packet);
|
||||||
static void HandleServerBW(RTMP *r, const RTMPPacket *packet);
|
void HandleServerBW(RTMP *r, const RTMPPacket *packet);
|
||||||
static void HandleClientBW(RTMP *r, const RTMPPacket *packet);
|
void HandleClientBW(RTMP *r, const RTMPPacket *packet);
|
||||||
|
|
||||||
static int ReadN(RTMP *r, char *buffer, int n);
|
int ReadN(RTMP *r, char *buffer, int n);
|
||||||
static int WriteN(RTMP *r, const char *buffer, int n);
|
int WriteN(RTMP *r, const char *buffer, int n);
|
||||||
|
|
||||||
static void DecodeTEA(AVal *key, AVal *text);
|
void DecodeTEA(AVal *key, AVal *text);
|
||||||
|
|
||||||
static int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len);
|
int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len);
|
||||||
static int HTTP_read(RTMP *r, int fill);
|
static int HTTP_read(RTMP *r, int fill);
|
||||||
|
|
||||||
static void CloseInternal(RTMP *r, int reconnect);
|
static void CloseInternal(RTMP *r, int reconnect);
|
||||||
|
@ -406,7 +406,7 @@ static const char DEFAULT_FLASH_VER[] = DEF_VERSTR;
|
||||||
const AVal RTMP_DefaultFlashVer =
|
const AVal RTMP_DefaultFlashVer =
|
||||||
{ (char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER) - 1 };
|
{ (char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER) - 1 };
|
||||||
|
|
||||||
static void
|
void
|
||||||
SocksSetup(RTMP *r, AVal *sockshost)
|
SocksSetup(RTMP *r, AVal *sockshost)
|
||||||
{
|
{
|
||||||
if (sockshost->av_len)
|
if (sockshost->av_len)
|
||||||
|
@ -866,7 +866,7 @@ int RTMP_SetupURL(RTMP *r, char *url)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
add_addr_info(struct sockaddr_in *service, AVal *host, int port)
|
add_addr_info(struct sockaddr_in *service, AVal *host, int port)
|
||||||
{
|
{
|
||||||
char *hostname;
|
char *hostname;
|
||||||
|
@ -946,6 +946,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr * service)
|
||||||
if (setsockopt
|
if (setsockopt
|
||||||
(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
|
(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
|
||||||
{
|
{
|
||||||
|
printf("int here\n"); fflush(stdout);
|
||||||
RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
|
RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
|
||||||
__FUNCTION__, r->Link.timeout);
|
__FUNCTION__, r->Link.timeout);
|
||||||
}
|
}
|
||||||
|
@ -1058,8 +1059,7 @@ RTMP_Connect(RTMP *r, RTMPPacket *cp)
|
||||||
return RTMP_Connect1(r, cp);
|
return RTMP_Connect1(r, cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int SocksNegotiate(RTMP *r)
|
||||||
SocksNegotiate(RTMP *r)
|
|
||||||
{
|
{
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
struct sockaddr_in service;
|
struct sockaddr_in service;
|
||||||
|
@ -1386,7 +1386,7 @@ extern FILE *netstackdump;
|
||||||
extern FILE *netstackdump_read;
|
extern FILE *netstackdump_read;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
int
|
||||||
ReadN(RTMP *r, char *buffer, int n)
|
ReadN(RTMP *r, char *buffer, int n)
|
||||||
{
|
{
|
||||||
int nOriginalSize = n;
|
int nOriginalSize = n;
|
||||||
|
@ -1498,7 +1498,7 @@ ReadN(RTMP *r, char *buffer, int n)
|
||||||
return nOriginalSize - n;
|
return nOriginalSize - n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
WriteN(RTMP *r, const char *buffer, int n)
|
WriteN(RTMP *r, const char *buffer, int n)
|
||||||
{
|
{
|
||||||
const char *ptr = buffer;
|
const char *ptr = buffer;
|
||||||
|
@ -1575,7 +1575,7 @@ SAVC(secureTokenResponse);
|
||||||
SAVC(type);
|
SAVC(type);
|
||||||
SAVC(nonprivate);
|
SAVC(nonprivate);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendConnectPacket(RTMP *r, RTMPPacket *cp)
|
SendConnectPacket(RTMP *r, RTMPPacket *cp)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1748,7 +1748,7 @@ RTMP_SendCreateStream(RTMP *r)
|
||||||
|
|
||||||
SAVC(FCSubscribe);
|
SAVC(FCSubscribe);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendFCSubscribe(RTMP *r, AVal *subscribepath)
|
SendFCSubscribe(RTMP *r, AVal *subscribepath)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1780,7 +1780,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribepath)
|
||||||
/* Justin.tv specific authentication */
|
/* Justin.tv specific authentication */
|
||||||
static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken");
|
static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken");
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendUsherToken(RTMP *r, AVal *usherToken)
|
SendUsherToken(RTMP *r, AVal *usherToken)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1812,7 +1812,7 @@ SendUsherToken(RTMP *r, AVal *usherToken)
|
||||||
|
|
||||||
SAVC(releaseStream);
|
SAVC(releaseStream);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendReleaseStream(RTMP *r)
|
SendReleaseStream(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1842,7 +1842,7 @@ SendReleaseStream(RTMP *r)
|
||||||
|
|
||||||
SAVC(FCPublish);
|
SAVC(FCPublish);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendFCPublish(RTMP *r)
|
SendFCPublish(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1872,7 +1872,7 @@ SendFCPublish(RTMP *r)
|
||||||
|
|
||||||
SAVC(FCUnpublish);
|
SAVC(FCUnpublish);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendFCUnpublish(RTMP *r)
|
SendFCUnpublish(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1904,7 +1904,7 @@ SAVC(publish);
|
||||||
SAVC(live);
|
SAVC(live);
|
||||||
SAVC(record);
|
SAVC(record);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendPublish(RTMP *r)
|
SendPublish(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -1939,7 +1939,7 @@ SendPublish(RTMP *r)
|
||||||
|
|
||||||
SAVC(deleteStream);
|
SAVC(deleteStream);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendDeleteStream(RTMP *r, double dStreamId)
|
SendDeleteStream(RTMP *r, double dStreamId)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2076,7 +2076,7 @@ RTMP_SendClientBW(RTMP *r)
|
||||||
return RTMP_SendPacket(r, &packet, FALSE);
|
return RTMP_SendPacket(r, &packet, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendBytesReceived(RTMP *r)
|
SendBytesReceived(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2101,7 +2101,7 @@ SendBytesReceived(RTMP *r)
|
||||||
|
|
||||||
SAVC(_checkbw);
|
SAVC(_checkbw);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendCheckBW(RTMP *r)
|
SendCheckBW(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2129,7 +2129,7 @@ SendCheckBW(RTMP *r)
|
||||||
|
|
||||||
SAVC(_result);
|
SAVC(_result);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendCheckBWResult(RTMP *r, double txn)
|
SendCheckBWResult(RTMP *r, double txn)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2158,7 +2158,7 @@ SendCheckBWResult(RTMP *r, double txn)
|
||||||
SAVC(ping);
|
SAVC(ping);
|
||||||
SAVC(pong);
|
SAVC(pong);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendPong(RTMP *r, double txn)
|
SendPong(RTMP *r, double txn)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2185,7 +2185,7 @@ SendPong(RTMP *r, double txn)
|
||||||
|
|
||||||
SAVC(play);
|
SAVC(play);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendPlay(RTMP *r)
|
SendPlay(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2253,7 +2253,7 @@ SendPlay(RTMP *r)
|
||||||
SAVC(set_playlist);
|
SAVC(set_playlist);
|
||||||
SAVC(0);
|
SAVC(0);
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendPlaylist(RTMP *r)
|
SendPlaylist(RTMP *r)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2291,7 +2291,7 @@ SendPlaylist(RTMP *r)
|
||||||
return RTMP_SendPacket(r, &packet, TRUE);
|
return RTMP_SendPacket(r, &packet, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
SendSecureTokenResponse(RTMP *r, AVal *resp)
|
SendSecureTokenResponse(RTMP *r, AVal *resp)
|
||||||
{
|
{
|
||||||
RTMPPacket packet;
|
RTMPPacket packet;
|
||||||
|
@ -2389,7 +2389,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
|
||||||
return RTMP_SendPacket(r, &packet, FALSE);
|
return RTMP_SendPacket(r, &packet, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit)
|
AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit)
|
||||||
{
|
{
|
||||||
if (freeit)
|
if (freeit)
|
||||||
|
@ -2410,7 +2410,7 @@ RTMP_DropRequest(RTMP *r, int i, int freeit)
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, freeit);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, freeit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
AV_queue(RTMP_METHOD **vals, int *num, AVal *av, int txn)
|
AV_queue(RTMP_METHOD **vals, int *num, AVal *av, int txn)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
@ -2424,7 +2424,7 @@ AV_queue(RTMP_METHOD **vals, int *num, AVal *av, int txn)
|
||||||
(*vals)[(*num)++].name.av_val = tmp;
|
(*vals)[(*num)++].name.av_val = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
AV_clear(RTMP_METHOD *vals, int num)
|
AV_clear(RTMP_METHOD *vals, int num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2907,8 +2907,11 @@ static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start");
|
||||||
static const AVal av_NetConnection_Connect_Rejected =
|
static const AVal av_NetConnection_Connect_Rejected =
|
||||||
AVC("NetConnection.Connect.Rejected");
|
AVC("NetConnection.Connect.Rejected");
|
||||||
|
|
||||||
|
void sp(int n){
|
||||||
|
printf("%d\n",n);fflush(stdout);
|
||||||
|
}
|
||||||
/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
|
/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
|
||||||
static int
|
int
|
||||||
HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
{
|
{
|
||||||
AMFObject obj;
|
AMFObject obj;
|
||||||
|
@ -2917,6 +2920,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
int ret = 0, nRes;
|
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 */
|
||||||
{
|
{
|
||||||
|
sp(1);
|
||||||
RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
|
RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2925,6 +2929,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
nRes = AMF_Decode(&obj, body, nBodySize, FALSE);
|
nRes = AMF_Decode(&obj, body, nBodySize, FALSE);
|
||||||
if (nRes < 0)
|
if (nRes < 0)
|
||||||
{
|
{
|
||||||
|
sp(2);
|
||||||
RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
|
RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2936,17 +2941,20 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|
|
||||||
if (AVMATCH(&method, &av__result))
|
if (AVMATCH(&method, &av__result))
|
||||||
{
|
{
|
||||||
|
sp(3);
|
||||||
AVal methodInvoked = {0};
|
AVal methodInvoked = {0};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<r->m_numCalls; i++) {
|
for (i=0; i<r->m_numCalls; i++) {
|
||||||
if (r->m_methodCalls[i].num == (int)txn) {
|
if (r->m_methodCalls[i].num == (int)txn) {
|
||||||
|
sp(4);
|
||||||
methodInvoked = r->m_methodCalls[i].name;
|
methodInvoked = r->m_methodCalls[i].name;
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!methodInvoked.av_val) {
|
if (!methodInvoked.av_val) {
|
||||||
|
sp(5);
|
||||||
RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
|
RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
|
||||||
__FUNCTION__, txn);
|
__FUNCTION__, txn);
|
||||||
goto leave;
|
goto leave;
|
||||||
|
@ -2957,22 +2965,27 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|
|
||||||
if (AVMATCH(&methodInvoked, &av_connect))
|
if (AVMATCH(&methodInvoked, &av_connect))
|
||||||
{
|
{
|
||||||
|
sp(6);
|
||||||
if (r->Link.token.av_len)
|
if (r->Link.token.av_len)
|
||||||
{
|
{
|
||||||
|
sp(7);
|
||||||
AMFObjectProperty p;
|
AMFObjectProperty p;
|
||||||
if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p))
|
if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p))
|
||||||
{
|
{
|
||||||
|
sp(8);
|
||||||
DecodeTEA(&r->Link.token, &p.p_vu.p_aval);
|
DecodeTEA(&r->Link.token, &p.p_vu.p_aval);
|
||||||
SendSecureTokenResponse(r, &p.p_vu.p_aval);
|
SendSecureTokenResponse(r, &p.p_vu.p_aval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r->Link.protocol & RTMP_FEATURE_WRITE)
|
if (r->Link.protocol & RTMP_FEATURE_WRITE)
|
||||||
{
|
{
|
||||||
|
sp(9);
|
||||||
SendReleaseStream(r);
|
SendReleaseStream(r);
|
||||||
SendFCPublish(r);
|
SendFCPublish(r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sp(10);
|
||||||
RTMP_SendServerBW(r);
|
RTMP_SendServerBW(r);
|
||||||
RTMP_SendCtrl(r, 3, 0, 300);
|
RTMP_SendCtrl(r, 3, 0, 300);
|
||||||
}
|
}
|
||||||
|
@ -2980,6 +2993,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|
|
||||||
if (!(r->Link.protocol & RTMP_FEATURE_WRITE))
|
if (!(r->Link.protocol & RTMP_FEATURE_WRITE))
|
||||||
{
|
{
|
||||||
|
sp(11);
|
||||||
/* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
|
/* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
|
||||||
if (r->Link.usherToken.av_len)
|
if (r->Link.usherToken.av_len)
|
||||||
SendUsherToken(r, &r->Link.usherToken);
|
SendUsherToken(r, &r->Link.usherToken);
|
||||||
|
@ -2992,14 +3006,17 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&methodInvoked, &av_createStream))
|
else if (AVMATCH(&methodInvoked, &av_createStream))
|
||||||
{
|
{
|
||||||
|
sp(12);
|
||||||
r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
|
r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
|
||||||
|
|
||||||
if (r->Link.protocol & RTMP_FEATURE_WRITE)
|
if (r->Link.protocol & RTMP_FEATURE_WRITE)
|
||||||
{
|
{
|
||||||
|
sp(13);
|
||||||
SendPublish(r);
|
SendPublish(r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sp(14);
|
||||||
if (r->Link.lFlags & RTMP_LF_PLST)
|
if (r->Link.lFlags & RTMP_LF_PLST)
|
||||||
SendPlaylist(r);
|
SendPlaylist(r);
|
||||||
SendPlay(r);
|
SendPlay(r);
|
||||||
|
@ -3009,44 +3026,53 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
else if (AVMATCH(&methodInvoked, &av_play) ||
|
else if (AVMATCH(&methodInvoked, &av_play) ||
|
||||||
AVMATCH(&methodInvoked, &av_publish))
|
AVMATCH(&methodInvoked, &av_publish))
|
||||||
{
|
{
|
||||||
|
sp(15);
|
||||||
r->m_bPlaying = TRUE;
|
r->m_bPlaying = TRUE;
|
||||||
}
|
}
|
||||||
free(methodInvoked.av_val);
|
free(methodInvoked.av_val);
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_onBWDone))
|
else if (AVMATCH(&method, &av_onBWDone))
|
||||||
{
|
{
|
||||||
|
sp(16);
|
||||||
if (!r->m_nBWCheckCounter)
|
if (!r->m_nBWCheckCounter)
|
||||||
SendCheckBW(r);
|
SendCheckBW(r);
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_onFCSubscribe))
|
else if (AVMATCH(&method, &av_onFCSubscribe))
|
||||||
{
|
{
|
||||||
|
sp(17);
|
||||||
/* SendOnFCSubscribe(); */
|
/* SendOnFCSubscribe(); */
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_onFCUnsubscribe))
|
else if (AVMATCH(&method, &av_onFCUnsubscribe))
|
||||||
{
|
{
|
||||||
|
sp(18);
|
||||||
RTMP_Close(r);
|
RTMP_Close(r);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_ping))
|
else if (AVMATCH(&method, &av_ping))
|
||||||
{
|
{
|
||||||
|
sp(19);
|
||||||
SendPong(r, txn);
|
SendPong(r, txn);
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av__onbwcheck))
|
else if (AVMATCH(&method, &av__onbwcheck))
|
||||||
{
|
{
|
||||||
|
sp(20);
|
||||||
SendCheckBWResult(r, txn);
|
SendCheckBWResult(r, txn);
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av__onbwdone))
|
else if (AVMATCH(&method, &av__onbwdone))
|
||||||
{
|
{
|
||||||
|
sp(21);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < r->m_numCalls; i++)
|
for (i = 0; i < r->m_numCalls; i++)
|
||||||
if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw))
|
if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw))
|
||||||
{
|
{
|
||||||
|
sp(22);
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av__error))
|
else if (AVMATCH(&method, &av__error))
|
||||||
{
|
{
|
||||||
|
sp(23);
|
||||||
#ifdef CRYPTO
|
#ifdef CRYPTO
|
||||||
AVal methodInvoked = {0};
|
AVal methodInvoked = {0};
|
||||||
int i;
|
int i;
|
||||||
|
@ -3096,16 +3122,19 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
}
|
}
|
||||||
free(methodInvoked.av_val);
|
free(methodInvoked.av_val);
|
||||||
#else
|
#else
|
||||||
|
sp(24);
|
||||||
RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
|
RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_close))
|
else if (AVMATCH(&method, &av_close))
|
||||||
{
|
{
|
||||||
|
sp(25);
|
||||||
RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
|
RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
|
||||||
RTMP_Close(r);
|
RTMP_Close(r);
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_onStatus))
|
else if (AVMATCH(&method, &av_onStatus))
|
||||||
{
|
{
|
||||||
|
sp(26);
|
||||||
AMFObject obj2;
|
AMFObject obj2;
|
||||||
AVal code, level;
|
AVal code, level;
|
||||||
AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2);
|
AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2);
|
||||||
|
@ -3118,6 +3147,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|| AVMATCH(&code, &av_NetStream_Play_StreamNotFound)
|
|| AVMATCH(&code, &av_NetStream_Play_StreamNotFound)
|
||||||
|| AVMATCH(&code, &av_NetConnection_Connect_InvalidApp))
|
|| AVMATCH(&code, &av_NetConnection_Connect_InvalidApp))
|
||||||
{
|
{
|
||||||
|
sp(27);
|
||||||
r->m_stream_id = -1;
|
r->m_stream_id = -1;
|
||||||
RTMP_Close(r);
|
RTMP_Close(r);
|
||||||
RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val);
|
RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val);
|
||||||
|
@ -3126,12 +3156,14 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
else if (AVMATCH(&code, &av_NetStream_Play_Start)
|
else if (AVMATCH(&code, &av_NetStream_Play_Start)
|
||||||
|| AVMATCH(&code, &av_NetStream_Play_PublishNotify))
|
|| AVMATCH(&code, &av_NetStream_Play_PublishNotify))
|
||||||
{
|
{
|
||||||
|
sp(28);
|
||||||
int i;
|
int i;
|
||||||
r->m_bPlaying = TRUE;
|
r->m_bPlaying = TRUE;
|
||||||
for (i = 0; i < r->m_numCalls; i++)
|
for (i = 0; i < r->m_numCalls; i++)
|
||||||
{
|
{
|
||||||
if (AVMATCH(&r->m_methodCalls[i].name, &av_play))
|
if (AVMATCH(&r->m_methodCalls[i].name, &av_play))
|
||||||
{
|
{
|
||||||
|
sp(29);
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3140,12 +3172,14 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|
|
||||||
else if (AVMATCH(&code, &av_NetStream_Publish_Start))
|
else if (AVMATCH(&code, &av_NetStream_Publish_Start))
|
||||||
{
|
{
|
||||||
|
sp(30);
|
||||||
int i;
|
int i;
|
||||||
r->m_bPlaying = TRUE;
|
r->m_bPlaying = TRUE;
|
||||||
for (i = 0; i < r->m_numCalls; i++)
|
for (i = 0; i < r->m_numCalls; i++)
|
||||||
{
|
{
|
||||||
if (AVMATCH(&r->m_methodCalls[i].name, &av_publish))
|
if (AVMATCH(&r->m_methodCalls[i].name, &av_publish))
|
||||||
{
|
{
|
||||||
|
sp(31);
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3157,19 +3191,23 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
|| AVMATCH(&code, &av_NetStream_Play_Stop)
|
|| AVMATCH(&code, &av_NetStream_Play_Stop)
|
||||||
|| AVMATCH(&code, &av_NetStream_Play_UnpublishNotify))
|
|| AVMATCH(&code, &av_NetStream_Play_UnpublishNotify))
|
||||||
{
|
{
|
||||||
|
sp(32);
|
||||||
RTMP_Close(r);
|
RTMP_Close(r);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (AVMATCH(&code, &av_NetStream_Seek_Notify))
|
else if (AVMATCH(&code, &av_NetStream_Seek_Notify))
|
||||||
{
|
{
|
||||||
|
sp(33);
|
||||||
r->m_read.flags &= ~RTMP_READ_SEEKING;
|
r->m_read.flags &= ~RTMP_READ_SEEKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (AVMATCH(&code, &av_NetStream_Pause_Notify))
|
else if (AVMATCH(&code, &av_NetStream_Pause_Notify))
|
||||||
{
|
{
|
||||||
|
sp(34);
|
||||||
if (r->m_pausing == 1 || r->m_pausing == 2)
|
if (r->m_pausing == 1 || r->m_pausing == 2)
|
||||||
{
|
{
|
||||||
|
sp(35);
|
||||||
RTMP_SendPause(r, FALSE, r->m_pauseStamp);
|
RTMP_SendPause(r, FALSE, r->m_pauseStamp);
|
||||||
r->m_pausing = 3;
|
r->m_pausing = 3;
|
||||||
}
|
}
|
||||||
|
@ -3177,11 +3215,13 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
}
|
}
|
||||||
else if (AVMATCH(&method, &av_playlist_ready))
|
else if (AVMATCH(&method, &av_playlist_ready))
|
||||||
{
|
{
|
||||||
|
sp(36);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < r->m_numCalls; i++)
|
for (i = 0; i < r->m_numCalls; i++)
|
||||||
{
|
{
|
||||||
if (AVMATCH(&r->m_methodCalls[i].name, &av_set_playlist))
|
if (AVMATCH(&r->m_methodCalls[i].name, &av_set_playlist))
|
||||||
{
|
{
|
||||||
|
sp(37);
|
||||||
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3189,9 +3229,11 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sp(38);
|
||||||
}
|
}
|
||||||
|
sp(39);
|
||||||
leave:
|
leave:
|
||||||
|
sp(40);
|
||||||
AMF_Reset(&obj);
|
AMF_Reset(&obj);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3299,7 +3341,7 @@ SAVC(duration);
|
||||||
SAVC(video);
|
SAVC(video);
|
||||||
SAVC(audio);
|
SAVC(audio);
|
||||||
|
|
||||||
static int
|
int
|
||||||
HandleMetadata(RTMP *r, char *body, unsigned int len)
|
HandleMetadata(RTMP *r, char *body, unsigned int len)
|
||||||
{
|
{
|
||||||
/* allright we get some info here, so parse it and print it */
|
/* allright we get some info here, so parse it and print it */
|
||||||
|
@ -3341,7 +3383,7 @@ HandleMetadata(RTMP *r, char *body, unsigned int len)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet)
|
HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
if (packet->m_nBodySize >= 4)
|
if (packet->m_nBodySize >= 4)
|
||||||
|
@ -3352,17 +3394,17 @@ HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleAudio(RTMP *r, const RTMPPacket *packet)
|
HandleAudio(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleVideo(RTMP *r, const RTMPPacket *packet)
|
HandleVideo(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleCtrl(RTMP *r, const RTMPPacket *packet)
|
HandleCtrl(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
short nType = -1;
|
short nType = -1;
|
||||||
|
@ -3504,14 +3546,14 @@ HandleCtrl(RTMP *r, const RTMPPacket *packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleServerBW(RTMP *r, const RTMPPacket *packet)
|
HandleServerBW(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
r->m_nServerBW = AMF_DecodeInt32(packet->m_body);
|
r->m_nServerBW = AMF_DecodeInt32(packet->m_body);
|
||||||
RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW);
|
RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
HandleClientBW(RTMP *r, const RTMPPacket *packet)
|
HandleClientBW(RTMP *r, const RTMPPacket *packet)
|
||||||
{
|
{
|
||||||
r->m_nClientBW = AMF_DecodeInt32(packet->m_body);
|
r->m_nClientBW = AMF_DecodeInt32(packet->m_body);
|
||||||
|
@ -3523,7 +3565,7 @@ HandleClientBW(RTMP *r, const RTMPPacket *packet)
|
||||||
r->m_nClientBW2);
|
r->m_nClientBW2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
DecodeInt32LE(const char *data)
|
DecodeInt32LE(const char *data)
|
||||||
{
|
{
|
||||||
unsigned char *c = (unsigned char *)data;
|
unsigned char *c = (unsigned char *)data;
|
||||||
|
@ -3533,7 +3575,7 @@ DecodeInt32LE(const char *data)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
EncodeInt32LE(char *output, int nVal)
|
EncodeInt32LE(char *output, int nVal)
|
||||||
{
|
{
|
||||||
output[0] = nVal;
|
output[0] = nVal;
|
||||||
|
@ -3740,7 +3782,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CRYPTO
|
#ifndef CRYPTO
|
||||||
static int
|
int
|
||||||
HandShake(RTMP *r, int FP9HandShake)
|
HandShake(RTMP *r, int FP9HandShake)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -4333,7 +4375,7 @@ RTMPSockBuf_Close(RTMPSockBuf *sb)
|
||||||
|
|
||||||
#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf))
|
#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf))
|
||||||
|
|
||||||
static void
|
void
|
||||||
DecodeTEA(AVal *key, AVal *text)
|
DecodeTEA(AVal *key, AVal *text)
|
||||||
{
|
{
|
||||||
uint32_t *v, k[4] = { 0 }, u;
|
uint32_t *v, k[4] = { 0 }, u;
|
||||||
|
@ -4403,7 +4445,7 @@ DecodeTEA(AVal *key, AVal *text)
|
||||||
free(out);
|
free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len)
|
HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len)
|
||||||
{
|
{
|
||||||
char hbuf[512];
|
char hbuf[512];
|
||||||
|
|
|
@ -289,6 +289,25 @@ extern "C"
|
||||||
void RTMP_SetBufferMS(RTMP *r, int size);
|
void RTMP_SetBufferMS(RTMP *r, int size);
|
||||||
void RTMP_UpdateBufferMS(RTMP *r);
|
void RTMP_UpdateBufferMS(RTMP *r);
|
||||||
|
|
||||||
|
void AV_clear(RTMP_METHOD *vals, int num);
|
||||||
|
|
||||||
|
void SocksSetup(RTMP *r, AVal *sockshost);
|
||||||
|
int SocksNegotiate(RTMP *r);
|
||||||
|
int SendFCUnpublish(RTMP *r);
|
||||||
|
int HandShake(RTMP *r, int FP9HandShake);
|
||||||
|
int DecodeInt32LE(const char *data);
|
||||||
|
int SendBytesReceived(RTMP *r);
|
||||||
|
int SendConnectPacket(RTMP *r, RTMPPacket *cp);
|
||||||
|
int SendDeleteStream(RTMP *r, double dStreamId);
|
||||||
|
int ReadN(RTMP *r, char *buffer, int n);
|
||||||
|
int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize);
|
||||||
|
int HandleMetadata(RTMP *r, char *body, unsigned int len);
|
||||||
|
void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet);
|
||||||
|
void HandleAudio(RTMP *r, const RTMPPacket *packet);
|
||||||
|
void HandleVideo(RTMP *r, const RTMPPacket *packet);
|
||||||
|
void HandleCtrl(RTMP *r, const RTMPPacket *packet);
|
||||||
|
void HandleServerBW(RTMP *r, const RTMPPacket *packet);
|
||||||
|
void HandleClientBW(RTMP *r, const RTMPPacket *packet);
|
||||||
int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg);
|
int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg);
|
||||||
int RTMP_SetupURL(RTMP *r, char *url);
|
int RTMP_SetupURL(RTMP *r, char *url);
|
||||||
void RTMP_SetupStream(RTMP *r, int protocol,
|
void RTMP_SetupStream(RTMP *r, int protocol,
|
||||||
|
@ -308,14 +327,19 @@ extern "C"
|
||||||
AVal *usherToken,
|
AVal *usherToken,
|
||||||
int dStart,
|
int dStart,
|
||||||
int dStop, int bLiveStream, long int timeout);
|
int dStop, int bLiveStream, long int timeout);
|
||||||
|
|
||||||
int RTMP_Connect(RTMP *r, RTMPPacket *cp);
|
int RTMP_Connect(RTMP *r, RTMPPacket *cp);
|
||||||
struct sockaddr;
|
struct sockaddr;
|
||||||
int RTMP_Connect0(RTMP *r, struct sockaddr *svc);
|
int RTMP_Connect0(RTMP *r, struct sockaddr *svc);
|
||||||
int RTMP_Connect1(RTMP *r, RTMPPacket *cp);
|
int RTMP_Connect1(RTMP *r, RTMPPacket *cp);
|
||||||
int RTMP_Serve(RTMP *r);
|
int RTMP_Serve(RTMP *r);
|
||||||
int RTMP_TLS_Accept(RTMP *r, void *ctx);
|
int RTMP_TLS_Accept(RTMP *r, void *ctx);
|
||||||
|
int SendCheckBW(RTMP *r);
|
||||||
|
int SendCheckBWResult(RTMP *r, double txn);
|
||||||
|
int SendDeleteStream(RTMP *r, double dStreamId);
|
||||||
|
int SendFCSubscribe(RTMP *r, AVal *subscribepath);
|
||||||
|
int SendPlay(RTMP *r);
|
||||||
|
int SendBytesReceived(RTMP *r);
|
||||||
|
int SendUsherToken(RTMP *r, AVal *usherToken);
|
||||||
int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet);
|
int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet);
|
||||||
int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue);
|
int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue);
|
||||||
int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk);
|
int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk);
|
||||||
|
@ -324,25 +348,20 @@ extern "C"
|
||||||
int RTMP_IsTimedout(RTMP *r);
|
int RTMP_IsTimedout(RTMP *r);
|
||||||
double RTMP_GetDuration(RTMP *r);
|
double RTMP_GetDuration(RTMP *r);
|
||||||
int RTMP_ToggleStream(RTMP *r);
|
int RTMP_ToggleStream(RTMP *r);
|
||||||
|
|
||||||
int RTMP_ConnectStream(RTMP *r, int seekTime);
|
int RTMP_ConnectStream(RTMP *r, int seekTime);
|
||||||
int RTMP_ReconnectStream(RTMP *r, int seekTime);
|
int RTMP_ReconnectStream(RTMP *r, int seekTime);
|
||||||
void RTMP_DeleteStream(RTMP *r);
|
void RTMP_DeleteStream(RTMP *r);
|
||||||
int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet);
|
int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet);
|
||||||
int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet);
|
int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet);
|
||||||
|
|
||||||
void RTMP_Init(RTMP *r);
|
void RTMP_Init(RTMP *r);
|
||||||
void RTMP_Close(RTMP *r);
|
void RTMP_Close(RTMP *r);
|
||||||
RTMP *RTMP_Alloc(void);
|
RTMP *RTMP_Alloc(void);
|
||||||
void RTMP_Free(RTMP *r);
|
void RTMP_Free(RTMP *r);
|
||||||
void RTMP_EnableWrite(RTMP *r);
|
void RTMP_EnableWrite(RTMP *r);
|
||||||
|
|
||||||
void *RTMP_TLS_AllocServerContext(const char* cert, const char* key);
|
void *RTMP_TLS_AllocServerContext(const char* cert, const char* key);
|
||||||
void RTMP_TLS_FreeServerContext(void *ctx);
|
void RTMP_TLS_FreeServerContext(void *ctx);
|
||||||
|
|
||||||
int RTMP_LibVersion(void);
|
int RTMP_LibVersion(void);
|
||||||
void RTMP_UserInterrupt(void); /* user typed Ctrl-C */
|
void RTMP_UserInterrupt(void); /* user typed Ctrl-C */
|
||||||
|
|
||||||
int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject,
|
int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject,
|
||||||
unsigned int nTime);
|
unsigned int nTime);
|
||||||
|
|
||||||
|
@ -351,14 +370,11 @@ extern "C"
|
||||||
*/
|
*/
|
||||||
int RTMP_SendPause(RTMP *r, int DoPause, int dTime);
|
int RTMP_SendPause(RTMP *r, int DoPause, int dTime);
|
||||||
int RTMP_Pause(RTMP *r, int DoPause);
|
int RTMP_Pause(RTMP *r, int DoPause);
|
||||||
|
|
||||||
int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name,
|
int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name,
|
||||||
AMFObjectProperty * p);
|
AMFObjectProperty * p);
|
||||||
|
|
||||||
int RTMPSockBuf_Fill(RTMPSockBuf *sb);
|
int RTMPSockBuf_Fill(RTMPSockBuf *sb);
|
||||||
int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len);
|
int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len);
|
||||||
int RTMPSockBuf_Close(RTMPSockBuf *sb);
|
int RTMPSockBuf_Close(RTMPSockBuf *sb);
|
||||||
|
|
||||||
int RTMP_SendCreateStream(RTMP *r);
|
int RTMP_SendCreateStream(RTMP *r);
|
||||||
int RTMP_SendSeek(RTMP *r, int dTime);
|
int RTMP_SendSeek(RTMP *r, int dTime);
|
||||||
int RTMP_SendServerBW(RTMP *r);
|
int RTMP_SendServerBW(RTMP *r);
|
||||||
|
@ -366,7 +382,14 @@ extern "C"
|
||||||
void RTMP_DropRequest(RTMP *r, int i, int freeit);
|
void RTMP_DropRequest(RTMP *r, int i, int freeit);
|
||||||
int RTMP_Read(RTMP *r, char *buf, int size);
|
int RTMP_Read(RTMP *r, char *buf, int size);
|
||||||
int RTMP_Write(RTMP *r, const char *buf, int size);
|
int RTMP_Write(RTMP *r, const char *buf, int size);
|
||||||
|
void AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit);
|
||||||
|
void DecodeTEA(AVal *key, AVal *text);
|
||||||
|
int SendFCPublish(RTMP *r);
|
||||||
|
int SendPlaylist(RTMP *r);
|
||||||
|
int SendPong(RTMP *r, double txn);
|
||||||
|
int SendPublish(RTMP *r);
|
||||||
|
int SendReleaseStream(RTMP *r);
|
||||||
|
int SendSecureTokenResponse(RTMP *r, AVal *resp);
|
||||||
/* hashswf.c */
|
/* hashswf.c */
|
||||||
int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash,
|
int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash,
|
||||||
int age);
|
int age);
|
||||||
|
|
Loading…
Reference in New Issue