[FFmpeg-cvslog] r25891 - in trunk/libavformat: rtpdec.c rtpdec.h

mstorsjo subversion
Sun Dec 5 20:39:51 CET 2010


Author: mstorsjo
Date: Sun Dec  5 20:39:50 2010
New Revision: 25891

Log:
rtpdec: Add functions for finding depacketizers by name or payload id

Modified:
   trunk/libavformat/rtpdec.c
   trunk/libavformat/rtpdec.h

Modified: trunk/libavformat/rtpdec.c
==============================================================================
--- trunk/libavformat/rtpdec.c	Sun Dec  5 20:38:55 2010	(r25890)
+++ trunk/libavformat/rtpdec.c	Sun Dec  5 20:39:50 2010	(r25891)
@@ -27,6 +27,7 @@
 #include "mpegts.h"
 
 #include <unistd.h>
+#include <strings.h>
 #include "network.h"
 
 #include "rtpdec.h"
@@ -78,6 +79,30 @@ void av_register_rtp_dynamic_payload_han
     ff_register_dynamic_payload_handler(&ff_quicktime_rtp_vid_handler);
 }
 
+RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
+                                                  enum AVMediaType codec_type)
+{
+    RTPDynamicProtocolHandler *handler;
+    for (handler = RTPFirstDynamicPayloadHandler;
+         handler; handler = handler->next)
+        if (!strcasecmp(name, handler->enc_name) &&
+            codec_type == handler->codec_type)
+            return handler;
+    return NULL;
+}
+
+RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
+                                                enum AVMediaType codec_type)
+{
+    RTPDynamicProtocolHandler *handler;
+    for (handler = RTPFirstDynamicPayloadHandler;
+         handler; handler = handler->next)
+        if (handler->static_payload_id && handler->static_payload_id == id &&
+            codec_type == handler->codec_type)
+            return handler;
+    return NULL;
+}
+
 static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
 {
     int payload_len;

Modified: trunk/libavformat/rtpdec.h
==============================================================================
--- trunk/libavformat/rtpdec.h	Sun Dec  5 20:38:55 2010	(r25890)
+++ trunk/libavformat/rtpdec.h	Sun Dec  5 20:39:50 2010	(r25891)
@@ -190,6 +190,10 @@ struct RTPDemuxContext {
 
 extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
 void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
+RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
+                                                  enum AVMediaType codec_type);
+RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
+                                                enum AVMediaType codec_type);
 
 int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers.
 



More information about the ffmpeg-cvslog mailing list