[vlc-devel] [PATCH] decode an RTP/H264 elementary stream without using SDP

Tony Vankrunkelsven Tony.Vankrunkelsven at otnsystems.com
Tue Sep 21 13:21:11 CEST 2010


For H264 (without transport stream TS) the RTP payload type is in the dynamic range (not static assigned, http://www.iana.org/assignments/rtp-parameters) and in some cases other protocols (like SDP) for exchanging the payload format are not available. This modification allows to decode these kind of H264 (which are compatible with Annex B "Byte stream format" of ISO/IEC 14496-10) if the demux "h264" is specified in the MRL. An example of an MRL: "rtp/h264://@239.168.100.100:1234"

---
 modules/access/rtp/rtp.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 modules/access/rtp/rtp.c

diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
old mode 100644
new mode 100755
index 32e13b3..672808d
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -431,7 +431,6 @@ static void codec_decode (demux_t *demux, void *data, block_t *block)
         block_Release (block);
 }
 
-
 static void *stream_init (demux_t *demux, const char *name)
 {
     return stream_DemuxNew (demux, name, demux->out);
@@ -454,6 +453,11 @@ static void stream_decode (demux_t *demux, void *data, block_t *block)
     (void)demux;
 }
 
+static void *demux_init (demux_t *demux)
+{
+    return stream_init (demux, *demux->psz_demux ? demux->psz_demux : "unknown");
+}
+
 /*
  * Static payload types handler
  */
@@ -679,7 +683,28 @@ int rtp_autodetect (demux_t *demux, rtp_session_t *session,
         break;
 
       default:
-        return -1;
+        /*
+         * If the rtp payload type is unknown then check demux if it is specified
+         */
+        if (*demux->psz_demux)
+        {
+          if ((strcmp(demux->psz_demux, "h264") == 0) || (strcmp(demux->psz_demux, "ts") == 0))
+          {
+            msg_Dbg (demux, "rtp autodetect specified demux=%s", demux->psz_demux);
+            pt.init = demux_init;
+            pt.destroy = stream_destroy;
+            pt.decode = stream_decode;
+            pt.frequency = 90000;
+            break;
+          }
+          else
+          {
+            return -1;
+          }
+        }
+        else {
+          return -1;
+        }
     }
     rtp_add_type (demux, session, &pt);
     return 0;
-- 
1.7.1




More information about the vlc-devel mailing list