From 96290d295db71daea8240475b6a74cde4a7301ca Mon Sep 17 00:00:00 2001 From: saxon Date: Tue, 14 Aug 2018 12:52:40 +0930 Subject: [PATCH] Marking functions that need to be ported --- rtmp/rtmp.go | 74 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 7fb846df..1af1c9fc 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1929,62 +1929,75 @@ func C_HandleInvoke(r *C.RTMP, body *byte, nBodySize uint32) int32 { //RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); return 0 } - // TODO port this func + // TODO port AMF_Dump C.AMF_Dump(&obj); - // TODO port these two c funcs + // TODO port AMFPRop_GetString + // TODO port AMF_GetProp C.AMFProp_GetString(C.AMF_GetProp(&obj, NULL, 0), &method); - // TODO port this func + // TODO port AMFProp_GetNumber txn = C.AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1)); // TODO use new logger here // RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val); switch{ - case AVMATCH(&method, &av__result): - AVal methodInvoked = {0}; - int i; - - for i=0; i", __FUNCTION__, - methodInvoked.av_val); + // TODO use new logger here + //RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__, + //methodInvoked.av_val); switch { - case AVMATCH(&methodInvoked, &av_connect): - if (r.Link.token.av_len){ - AMFObjectProperty p; - if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p)){ - DecodeTEA(&r.Link.token, &p.p_vu.p_aval); - SendSecureTokenResponse(r, &p.p_vu.p_aval); + case C_AVMATCH(&methodInvoked, &av_connect): + if r.Link.token.av_len != 0 { + var p C.AMFObjectProperty + + // TODO port this func + if C.RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p){ + // TODO port this func + C.DecodeTEA(&r.Link.token, &p.p_vu.p_aval); + // TODO port this func + C.SendSecureTokenResponse(r, &p.p_vu.p_aval); } } if (r.Link.protocol & RTMP_FEATURE_WRITE){ - SendReleaseStream(r); - SendFCPublish(r); + // TODO port this func + C.SendReleaseStream(r); + // TODO port this func + C.SendFCPublish(r); }else{ - RTMP_SendServerBW(r); - RTMP_SendCtrl(r, 3, 0, 300); + // TODO port this func + C.RTMP_SendServerBW(r); + // TODO port this func + C.RTMP_SendCtrl(r, 3, 0, 300); } - RTMP_SendCreateStream(r); + // TODO port this func + C.RTMP_SendCreateStream(r); - if (!(r.Link.protocol & RTMP_FEATURE_WRITE)){ + if (r.Link.protocol & RTMP_FEATURE_WRITE) == 0 { /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ - if (r.Link.usherToken.av_len){ - SendUsherToken(r, &r.Link.usherToken); + if r.Link.usherToken.av_len != 0 { + // TODO port this func + C.SendUsherToken(r, &r.Link.usherToken); } /* Send the FCSubscribe if live stream or if subscribepath is set */ switch{ case r.Link.subscribepath.av_len: - SendFCSubscribe(r, &r.Link.subscribepath); + // TODO port + C.SendFCSubscribe(r, &r.Link.subscribepath); case r.Link.lFlags & RTMP_LF_LIV: SendFCSubscribe(r, &r.Link.playpath); } @@ -2102,7 +2115,6 @@ func C_AVMATCH(a1, a2 C.AVal) int32 { } } - // void RTMPPacket_Free(RTMPPacket* p); // rtmp.c +203 func C_RTMPPacket_Free(p *C.RTMPPacket) {