[FFmpeg-devel] [PATCH] RTSP-MS 13/15: add RTSP demuxer AVFormatContext to parse_packet() function pointer (was: transport context)

Ronald S. Bultje rsbultje
Sun Feb 1 15:19:13 CET 2009


Hello,

On Sat, Jan 31, 2009 at 8:00 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Jan 31, 2009 at 07:35:28PM -0500, Ronald S. Bultje wrote:
>> store the ASF demuxer context in the RTSP demuxer "private" context
>> (RTSPState)->asf_ctx, so that it's shared between all streams in the
>> session. That value needs to be accessible from the streams.
[..]
> why do they not have access to it? I mean why is RTSPState / AVFormatContext
> not passed to the respective functions?
>
> It seems that either
[..]
> B. RTSPState / AVFormatContext should be passed directly

Attached patch does this.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rdt.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rdt.c	2009-02-01 09:14:06.000000000 -0500
+++ ffmpeg-svn/libavformat/rdt.c	2009-02-01 09:14:38.000000000 -0500
@@ -295,7 +295,7 @@
 
 /**< 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 @@
     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 @@
          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);
 
Index: ffmpeg-svn/libavformat/rtp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtp.h	2009-02-01 09:14:06.000000000 -0500
+++ ffmpeg-svn/libavformat/rtp.h	2009-02-01 09:14:38.000000000 -0500
@@ -109,6 +109,7 @@
 /**
  * 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
@@ -117,7 +118,8 @@
  * @param len length of buf
  * @param flags flags from the RTP packet header (RTP_FLAG_*)
  */
-typedef int (*DynamicPayloadPacketHandlerProc) (PayloadContext *s,
+typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
+                                                PayloadContext *s,
                                                 AVStream *st,
                                                 AVPacket * pkt,
                                                 uint32_t *timestamp,
Index: ffmpeg-svn/libavformat/rtp_h264.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtp_h264.c	2009-02-01 09:14:06.000000000 -0500
+++ ffmpeg-svn/libavformat/rtp_h264.c	2009-02-01 09:14:38.000000000 -0500
@@ -159,7 +159,8 @@
 }
 
 // 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,
Index: ffmpeg-svn/libavformat/rtpdec.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtpdec.c	2009-02-01 09:14:24.000000000 -0500
+++ ffmpeg-svn/libavformat/rtpdec.c	2009-02-01 09:14:38.000000000 -0500
@@ -414,7 +414,7 @@
         /* 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;
@@ -481,7 +481,7 @@
             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.



More information about the ffmpeg-devel mailing list