RTMPDump是基于librtmp库实现的一个RTMP客户端,可以认为是通过librtmp调用实现的典型的客户端,
RTMPDump其主页为:http://rtmpdump.mplayerhq.hu/rtmpdump.1.html
其中在librtmp的主页当中介绍librtmp的API的时候介绍了RTMPdump, 详细http://rtmpdump.mplayerhq.hu/librtmp.3.html。
The RTMPDump software package includes a basic client utility program in rtmpdump(1), some sample servers, and a library used to provide programmatic access to the RTMP protocol. This man page gives an overview of the RTMP library routines. These routines are found in the -lrtmp library. Many other routines are also available, but they are not documented yet.
The basic interaction is as follows. A session handle is created using RTMP_Alloc() and initialized using RTMP_Init(). All session parameters are provided usingRTMP_SetupURL(). The network connection is established using RTMP_Connect(), and then the RTMP session is established using RTMP_ConnectStream(). The stream is read using RTMP_Read(). A client can publish a stream by calling RTMP_EnableWrite() before the RTMP_Connect() call, and then using RTMP_Write() after the session is established. While a stream is playing it may be paused and unpaused using RTMP_Pause(). The stream playback position can be moved using RTMP_Seek(). When RTMP_Read() returns 0 bytes, the stream is complete and may be closed using RTMP_Close(). The session handle is freed using RTMP_Free().
RTMPDump.c中Download函数的调用就是从Socket中读取数据:
RTMP的NetConnection的过程就是调用librtmp的RTMP_Connect:
建立NetStream的过程就是调用librtmp的RTMP_ConnectStream: