summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec.c
diff options
context:
space:
mode:
authorJosh Allmann <joshua.allmann@gmail.com>2010-06-28 11:24:12 +0000
committerMartin Storsjö <martin@martin.st>2010-06-28 11:24:12 +0000
commit016bc031ebe5c3e75809749a3f409f9f2c4a1d7a (patch)
treec89e5948aad66be30ad00638e9039bd968963dfc /libavformat/rtpdec.c
parent8b114d85ba3bd8694dbba076647f346d11dbe327 (diff)
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 Originally committed as revision 23847 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtpdec.c')
-rw-r--r--libavformat/rtpdec.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 456e2e42de..74858f638a 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -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;
+}