]> granicus.if.org Git - rtmpdump/commitdiff
Expand public API
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Thu, 25 Feb 2010 23:26:33 +0000 (23:26 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Thu, 25 Feb 2010 23:26:33 +0000 (23:26 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@274 400ebc74-4327-4243-bc38-086b20814532

rtmp.c
rtmp.h

diff --git a/rtmp.c b/rtmp.c
index f3d3971468acc6a1b1a1673ef66539679157d493..3139e26600924ccdd1b433c3de12f38ee357a258 100644 (file)
--- a/rtmp.c
+++ b/rtmp.c
 
 static const int packetSize[] = { 12, 8, 4, 1 };
 
-#define RTMP_PACKET_SIZE_LARGE    0
-#define RTMP_PACKET_SIZE_MEDIUM   1
-#define RTMP_PACKET_SIZE_SMALL    2
-#define RTMP_PACKET_SIZE_MINIMUM  3
-
 bool RTMP_ctrlC;
 
 const char RTMPProtocolStrings[][7] = {
@@ -68,10 +63,8 @@ static bool HandShake(RTMP * r, bool FP9HandShake);
 static bool SocksNegotiate(RTMP * r);
 
 static bool SendConnectPacket(RTMP * r, RTMPPacket *cp);
-static bool SendServerBW(RTMP * r);
 static bool SendCheckBW(RTMP * r);
 static bool SendCheckBWResult(RTMP * r, double txn);
-static bool SendCreateStream(RTMP * r, double dStreamId);
 static bool SendDeleteStream(RTMP * r, double dStreamId);
 static bool SendFCSubscribe(RTMP * r, AVal * subscribepath);
 static bool SendPlay(RTMP * r);
@@ -512,7 +505,7 @@ RTMP_ReconnectStream(RTMP * r, int bufferTime, double seekTime,
 {
   RTMP_DeleteStream(r);
 
-  SendCreateStream(r, 2.0);
+  RTMP_SendCreateStream(r, 2.0);
 
   RTMP_SetBufferMS(r, bufferTime);
 
@@ -1024,8 +1017,8 @@ SendBGHasStream(RTMP * r, double dId, AVal * playpath)
 
 SAVC(createStream);
 
-static bool
-SendCreateStream(RTMP * r, double dStreamId)
+bool
+RTMP_SendCreateStream(RTMP * r, double dCmdID)
 {
   RTMPPacket packet;
   char pbuf[256], *pend = pbuf+sizeof(pbuf);
@@ -1040,7 +1033,7 @@ SendCreateStream(RTMP * r, double dStreamId)
 
   char *enc = packet.m_body;
   enc = AMF_EncodeString(enc, pend, &av_createStream);
-  enc = AMF_EncodeNumber(enc, pend, dStreamId);
+  enc = AMF_EncodeNumber(enc, pend, dCmdID);
   *enc++ = AMF_NULL;           // NULL
 
   packet.m_nBodySize = enc - packet.m_body;
@@ -1165,8 +1158,8 @@ SendSeek(RTMP * r, double dTime)
 }
 #endif
 
-static bool
-SendServerBW(RTMP * r)
+bool
+RTMP_SendServerBW(RTMP * r)
 {
   RTMPPacket packet;
   char pbuf[256], *pend = pbuf+sizeof(pbuf);
@@ -1427,6 +1420,12 @@ AV_erase(AVal * vals, int *num, int i, bool freeit)
   vals[i].av_len = 0;
 }
 
+void
+RTMP_DropRequest(RTMP *r, int i, bool freeit)
+{
+  AV_erase(r->m_methodCalls, &r->m_numCalls, i, freeit);
+}
+
 static void
 AV_queue(AVal ** vals, int *num, AVal * av)
 {
@@ -1514,10 +1513,10 @@ HandleInvoke(RTMP * r, const char *body, unsigned int nBodySize)
                   SendSecureTokenResponse(r, &p.p_vu.p_aval);
                 }
             }
-         SendServerBW(r);
+         RTMP_SendServerBW(r);
          RTMP_SendCtrl(r, 3, 0, 300);
 
-         SendCreateStream(r, 2.0);
+         RTMP_SendCreateStream(r, 2.0);
 
          /* Send the FCSubscribe if live stream or if subscribepath is set */
          if (r->Link.subscribepath.av_len)
diff --git a/rtmp.h b/rtmp.h
index e11a455c02865ddd6b9e4d711aa9d217e9b8161e..06c8c27c0e70e24caf28d9e49adab2209daeb6ea 100644 (file)
--- a/rtmp.h
+++ b/rtmp.h
@@ -78,6 +78,11 @@ uint32_t RTMP_GetTime();
 
 #define RTMP_MAX_HEADER_SIZE 18
 
+#define RTMP_PACKET_SIZE_LARGE    0
+#define RTMP_PACKET_SIZE_MEDIUM   1
+#define RTMP_PACKET_SIZE_SMALL    2
+#define RTMP_PACKET_SIZE_MINIMUM  3
+
 typedef unsigned char BYTE;
 
 typedef struct RTMPChunk
@@ -248,6 +253,10 @@ bool RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name,
 
 bool RTMPSockBuf_Fill(RTMPSockBuf *sb);
 
+bool RTMP_SendCreateStream(RTMP * r, double dCmdID);
+bool RTMP_SendServerBW(RTMP * r);
+void RTMP_DropRequest(RTMP *r, int i, bool freeit);
+
 #ifdef CRYPTO
 /* hashswf.c */
 #define HASHLEN        32