[SCM] libav/experimental: Add "AVFormatContext *ctx" (that being the RTSP demuxer's) as first argument to the parse_packet() function pointer in RTPDynamicProtocolHandlers. This allows these functions to peek back and retrieve values from the demuxer's context (or RTSPState). The ASF/RTP payload parser will use this to be able to parse SDP values (which occur even before the payload ID is given), store them in the RTSPState and then retrieve them while parsing payload data. See "[PATCH] RTSP-MS 13/15: add RTSP demuxer AVFormatContext to parse_packet() function pointer (was: transport context)" mailinglist thread.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:36:59 UTC 2013


The following commit has been merged in the experimental branch:
commit 1a45a9f4c06bbbaa322ba744e658491df44f2c2a
Author: Ronald S. Bultje <rsbultje at gmail.com>
Date:   Fri Feb 6 01:37:19 2009 +0000

    Add "AVFormatContext *ctx" (that being the RTSP demuxer's) as first argument
    to the parse_packet() function pointer in RTPDynamicProtocolHandlers. This
    allows these functions to peek back and retrieve values from the demuxer's
    context (or RTSPState). The ASF/RTP payload parser will use this to be able
    to parse SDP values (which occur even before the payload ID is given), store
    them in the RTSPState and then retrieve them while parsing payload data. See
    "[PATCH] RTSP-MS 13/15: add RTSP demuxer AVFormatContext to parse_packet()
    function pointer (was: transport context)" mailinglist thread.
    
    Originally committed as revision 17015 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 2865b42..ce8903d 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -295,7 +295,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
 
 /**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */
 static int
-rdt_parse_packet (PayloadContext *rdt, AVStream *st,
+rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
                   AVPacket *pkt, uint32_t *timestamp,
                   const uint8_t *buf, int len, int flags)
 {
@@ -347,7 +347,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
     if (!buf && s->prev_stream_id != -1) {
         /* return the next packets, if any */
         timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
-        rv= s->parse_packet(s->dynamic_protocol_context,
+        rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
                             s->streams[s->prev_stream_id],
                             pkt, &timestamp, NULL, 0, flags);
         return rv;
@@ -374,7 +374,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
          return -1;
      }
 
-    rv = s->parse_packet(s->dynamic_protocol_context,
+    rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
                          s->streams[s->prev_stream_id],
                          pkt, &timestamp, buf, len, flags);
 
diff --git a/libavformat/rtp.h b/libavformat/rtp.h
index 1690be2..c66a0c7 100644
--- a/libavformat/rtp.h
+++ b/libavformat/rtp.h
@@ -107,6 +107,7 @@ typedef struct {
 /**
  * Packet parsing for "private" payloads in the RTP specs.
  *
+ * @param ctx RTSP demuxer context
  * @param s stream context
  * @param st stream that this packet belongs to
  * @param pkt packet in which to write the parsed data
@@ -115,7 +116,8 @@ typedef struct {
  * @param len length of buf
  * @param flags flags from the RTP packet header (PKT_FLAG_*)
  */
-typedef int (*DynamicPayloadPacketHandlerProc) (PayloadContext *s,
+typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
+                                                PayloadContext *s,
                                                 AVStream *st,
                                                 AVPacket * pkt,
                                                 uint32_t *timestamp,
diff --git a/libavformat/rtp_h264.c b/libavformat/rtp_h264.c
index 18f0e8e..4b89ea6 100644
--- a/libavformat/rtp_h264.c
+++ b/libavformat/rtp_h264.c
@@ -159,7 +159,8 @@ static void sdp_parse_fmtp_config_h264(AVStream * stream,
 }
 
 // return 0 on packet, no more left, 1 on packet, 1 on partial packet...
-static int h264_handle_packet(PayloadContext *data,
+static int h264_handle_packet(AVFormatContext *ctx,
+                              PayloadContext *data,
                               AVStream *st,
                               AVPacket * pkt,
                               uint32_t * timestamp,
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index f59484e..8297b1e 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -407,7 +407,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
         /* return the next packets, if any */
         if(s->st && s->parse_packet) {
             timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
-            rv= s->parse_packet(s->dynamic_protocol_context,
+            rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
                                 s->st, pkt, &timestamp, NULL, 0, flags);
             finalize_packet(s, pkt, timestamp);
             return rv;
@@ -472,7 +472,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
             return 1;
         }
     } else if (s->parse_packet) {
-        rv = s->parse_packet(s->dynamic_protocol_context,
+        rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
                              s->st, pkt, &timestamp, buf, len, flags);
     } else {
         // at this point, the RTP header has been stripped;  This is ASSUMING that there is only 1 CSRC, which in't wise.

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list