*libRTMP study

来自个人维基
2020年4月7日 (二) 22:20free6d1823讨论 | 贡献的版本

跳转至: 导航搜索

source code download:

git clone git://git.ffmpeg.org/rtmpdump

Calling flow:
1. Init

   RTMP_LogSetLevel(level);
   RTMP_LogSetCallback(rtmp_log);
     static void rtmp_log(int level, const char *fmt, va_list args)
   RTMP *r = {};
   RTMP_Init(r); //init RTMP. BufferMS=30000,

filename = " "+ 
app=   
tcUrl= 
pageUrl=
swfUrl=
flashVer=
conn=
live=1
subscribe=
buffer=
swfUrl=
swfVfy=1
  

2. Setup

   RTMP_SetupURL(r, filename)
   RTMP_EnableWrite(r); //r->Link.protocol |= RTMP_FEATURE_WRITE;
   RTMP_Connect(r, NULL)
   RTMP_ConnectStream(r, 0)
   //
   setsockopt()

3. write

   RTMP_Write(r, buf, size);

4. read

   RTMP_Read(r, buf, size);
   RTMP_Pause(r, pause);
   RTMP_SendSeek(r, timestamp);

5. close

  RTMP_Close(r)
  RTMP_Free(RTMP *r) // free(r)