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

mstorsjo subversion
Mon Jun 28 13:24:12 CEST 2010


Author: mstorsjo
Date: Mon Jun 28 13:24:12 2010
New Revision: 23847

Log:
rtpdec: Add generic function for iterating over FMTP configuration lines

This will be used for cleaning up code that is common among RTP depacketizers.

Patch by Josh Allmann, joshua dot allmann at gmail

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

Modified: trunk/libavformat/rtpdec.c
==============================================================================
--- trunk/libavformat/rtpdec.c	Mon Jun 28 13:21:34 2010	(r23846)
+++ trunk/libavformat/rtpdec.c	Mon Jun 28 13:24:12 2010	(r23847)
@@ -531,3 +531,28 @@ void rtp_parse_close(RTPDemuxContext *s)
     }
     av_free(s);
 }
+
+int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
+                  int (*parse_fmtp)(AVStream *stream,
+                                    PayloadContext *data,
+                                    char *attr, char *value))
+{
+    char attr[256];
+    char value[4096];
+    int res;
+
+    // remove protocol identifier
+    while (*p && *p == ' ') p++; // strip spaces
+    while (*p && *p != ' ') p++; // eat protocol identifier
+    while (*p && *p == ' ') p++; // strip trailing spaces
+
+    while (ff_rtsp_next_attr_and_value(&p,
+                                       attr, sizeof(attr),
+                                       value, sizeof(value))) {
+
+        res = parse_fmtp(stream, data, attr, value);
+        if (res < 0)
+            return res;
+    }
+    return 0;
+}

Modified: trunk/libavformat/rtpdec.h
==============================================================================
--- trunk/libavformat/rtpdec.h	Mon Jun 28 13:21:34 2010	(r23846)
+++ trunk/libavformat/rtpdec.h	Mon Jun 28 13:24:12 2010	(r23847)
@@ -172,6 +172,11 @@ void ff_register_dynamic_payload_handler
 
 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.
 
+int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
+                  int (*parse_fmtp)(AVStream *stream,
+                                    PayloadContext *data,
+                                    char *attr, char *value));
+
 void av_register_rtp_dynamic_payload_handlers(void);
 
 #endif /* AVFORMAT_RTPDEC_H */



More information about the ffmpeg-cvslog mailing list