[FFmpeg-devel] RTMPE support

Howard Chu hyc
Mon Mar 15 09:43:53 CET 2010


Following up on this thread

http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2010-March/064000.html

Here's a librtmp wrapper for libavformat. These diffs are needed as well:

violino:/home/software/ffmpeg/libavformat> svn diff
Index: Makefile
===================================================================
--- Makefile	(revision 21526)
+++ Makefile	(working copy)
@@ -264,7 +264,7 @@
  OBJS-$(CONFIG_GOPHER_PROTOCOL)           += gopher.o
  OBJS-$(CONFIG_HTTP_PROTOCOL)             += http.o
  OBJS-$(CONFIG_PIPE_PROTOCOL)             += file.o
-OBJS-$(CONFIG_RTMP_PROTOCOL)             += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMP_PROTOCOL)             += rtmp2.o # rtmpproto.o rtmppkt.o
  OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
  OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
  OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
Index: allformats.c
===================================================================
--- allformats.c	(revision 21526)
+++ allformats.c	(working copy)
@@ -217,6 +217,10 @@
      REGISTER_PROTOCOL (HTTP, http);
      REGISTER_PROTOCOL (PIPE, pipe);
      REGISTER_PROTOCOL (RTMP, rtmp);
+    REGISTER_PROTOCOL (RTMP, rtmpt);
+    REGISTER_PROTOCOL (RTMP, rtmpe);
+    REGISTER_PROTOCOL (RTMP, rtmpte);
+    REGISTER_PROTOCOL (RTMP, rtmps);
      REGISTER_PROTOCOL (RTP, rtp);
      REGISTER_PROTOCOL (TCP, tcp);
      REGISTER_PROTOCOL (UDP, udp);

And to re-cap - the existing libavformat rtmp code didn't work when I tried 
it, neither in ffplay nor in mplayer. This code works in both, but poorly 
because it doesn't do any caching/pre-buffering. The code I posted for mplayer 
plays smoothly because it uses mplayer's stream cache.

http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2010-March/063988.html

As I discussed with uau on #mplayerdev, seeking doesn't work with this either 
and apparently some other patches to the demuxer are needed to get it to use 
time-based seeks (vs byte seeks; uau has gotten this working already).

At this point I don't really care where it goes, as long as we can get smooth 
playback with properly functioning seeks.

One other comment - currently rtmpdump uses OpenSSL's API for generating the 
keys for the Diffie-Hellman key exchange in the RTMPE handshake. It also uses 
OpenSSL for the RC4 cipher used in the RTMPE session, and for the HMAC-SHA256 
hash used in the RTMP handshake and in SWF Verification. It looks like we 
could use libavutil instead, for RC4 and HMAC-SHA256, but we'd still need a 
BigNum/multi-precision math library to do the DH key handling. And for RTMPS 
support we still need an actual SSL/TLS library. (And if we're going to add 
that, might as well add https to the list of supported protocols too.)
-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtmp2.c
Type: text/x-csrc
Size: 6982 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100315/8eeb00d5/attachment.c>



More information about the ffmpeg-devel mailing list