[FFmpeg-cvslog] rtpdec: Store the dynamic payload handler in the rtpdec context

Martin Storsjö git at videolan.org
Wed Jan 9 11:47:19 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Dec 11 15:52:18 2012 +0200| [42805eda554a7fc44341282771531e7837ac72b7] | committer: Martin Storsjö

rtpdec: Store the dynamic payload handler in the rtpdec context

This allows calling other dynamic payload handler functions if
needed.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42805eda554a7fc44341282771531e7837ac72b7
---

 libavformat/rtpdec.c |   17 +++++++++--------
 libavformat/rtpdec.h |    2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 08150b7..348b796 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -425,7 +425,7 @@ void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
                                        RTPDynamicProtocolHandler *handler)
 {
     s->dynamic_protocol_context = ctx;
-    s->parse_packet             = handler->parse_packet;
+    s->handler                  = handler;
 }
 
 /**
@@ -540,9 +540,10 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
             return 1;
         }
         return 0;
-    } else if (s->parse_packet) {
-        rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
-                             s->st, pkt, &timestamp, buf, len, seq, flags);
+    } else if (s->handler && s->handler->parse_packet) {
+        rv = s->handler->parse_packet(s->ic, s->dynamic_protocol_context,
+                                      s->st, pkt, &timestamp, buf, len, seq,
+                                      flags);
     } else {
         /* At this point, the RTP header has been stripped;
          * This is ASSUMING that there is only 1 CSRC, which isn't wise. */
@@ -680,13 +681,13 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
         if (s->prev_ret <= 0)
             return rtp_parse_queued_packet(s, pkt);
         /* return the next packets, if any */
-        if (s->st && s->parse_packet) {
+        if (s->st && s->handler && s->handler->parse_packet) {
             /* timestamp should be overwritten by parse_packet, if not,
              * the packet is left with pts == AV_NOPTS_VALUE */
             timestamp = RTP_NOTS_VALUE;
-            rv        = s->parse_packet(s->ic, s->dynamic_protocol_context,
-                                        s->st, pkt, &timestamp, NULL, 0, 0,
-                                        flags);
+            rv        = s->handler->parse_packet(s->ic, s->dynamic_protocol_context,
+                                                 s->st, pkt, &timestamp, NULL, 0, 0,
+                                                 flags);
             finalize_packet(s, pkt, timestamp);
             return rv;
         } else {
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 7c51f5a..75863b8 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -184,7 +184,7 @@ struct RTPDemuxContext {
     uint8_t buf[RTP_MAX_PACKET_LENGTH];
 
     /* dynamic payload stuff */
-    DynamicPayloadPacketHandlerProc parse_packet;
+    const RTPDynamicProtocolHandler *handler;
     PayloadContext *dynamic_protocol_context;
 };
 



More information about the ffmpeg-cvslog mailing list