# HG changeset patch # User rbultje # Date 1231339300 0 # Node ID 56b7ebdf9ef4dcfe5788228f495130f8008ea4f7 # Parent 8d6512cbd657832df6eb3e3f097e27d47331047f 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. diff -r 8d6512cbd657 -r 56b7ebdf9ef4 rdt.c --- a/rdt.c Wed Jan 07 14:38:44 2009 +0000 +++ b/rdt.c Wed Jan 07 14:41:40 2009 +0000 @@ -428,6 +428,19 @@ 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 @@ st = add_dstream(s, orig_st); else st = orig_st; + real_parse_asm_rule(st, p, end); n_rules++; } p = end + 1;