diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2002-11-20 14:54:13 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2002-11-20 14:54:13 +0000 |
commit | cb1fdc61047f1c25b7fd4e7113ba20ebfced1d2f (patch) | |
tree | b099070ad0eef40c24a2a1201e084d7d524c03ff | |
parent | 5d3cea3a86a9b994591998fb05cacfc16ae4852d (diff) | |
download | ffmpeg-cb1fdc61047f1c25b7fd4e7113ba20ebfced1d2f.tar.gz |
match SDP based on content instead of extension
Originally committed as revision 1255 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libav/rtsp.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libav/rtsp.c b/libav/rtsp.c index ba87469d60..c173cb89b7 100644 --- a/libav/rtsp.c +++ b/libav/rtsp.c @@ -984,12 +984,22 @@ static AVInputFormat rtsp_demux = { .flags = AVFMT_NOFILE, }; - -/* XXX: add mime type support */ -static int sdp_probe(AVProbeData *p) +static int sdp_probe(AVProbeData *p1) { - if (match_ext(p->filename, "sdp")) - return AVPROBE_SCORE_MAX; + const char *p; + + /* we look for a line beginning "c=IN IP4" */ + p = p1->buf; + while (*p != '\0') { + if (strstart(p, "c=IN IP4", NULL)) + return AVPROBE_SCORE_MAX / 2; + p = strchr(p, '\n'); + if (!p) + break; + p++; + if (*p == '\r') + p++; + } return 0; } |