aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2009-01-07 14:41:40 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2009-01-07 14:41:40 +0000
commit530bca94390adb946f21c767f5eafda522c826b1 (patch)
treea302638e2dd5d515c14b7b25f18ab0527c16526a /libavformat
parent3ca45429fea4edb64daf3e6dd11e40ee23bc484b (diff)
downloadffmpeg-530bca94390adb946f21c767f5eafda522c826b1.tar.gz
Parse the bitrate field in the ASMRuleBook ("AverageBandwidth") to fill in
the AVStream->AVCodecContext->bit_rate field, which is not in the MDPR block (the "OpaqueData" SDP field). This allows clients to choose streams based on their bitrate, which is what most network-players base stream selection on. (Of course, it is also possible to select based on anything else, that is entirely up to the client.) See "[PATCH] rdt.c: ASM rulebook bitrate reading" thread on mailinglist. Originally committed as revision 16467 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rdt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index bbf930c1a6..9d6e193449 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -428,6 +428,19 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index,
return 0;
}
+static void
+real_parse_asm_rule(AVStream *st, const char *p, const char *end)
+{
+ do {
+ /* can be either averagebandwidth= or AverageBandwidth= */
+ if (sscanf(p, " %*1[Aa]verage%*1[Bb]andwidth=%d", &st->codec->bit_rate) == 1)
+ break;
+ if (!(p = strchr(p, ',')) || p > end)
+ p = end;
+ p++;
+ } while (p < end);
+}
+
static AVStream *
add_dstream(AVFormatContext *s, AVStream *orig_st)
{
@@ -473,6 +486,7 @@ real_parse_asm_rulebook(AVFormatContext *s, AVStream *orig_st,
st = add_dstream(s, orig_st);
else
st = orig_st;
+ real_parse_asm_rule(st, p, end);
n_rules++;
}
p = end + 1;