diff options
author | Martin Storsjö <martin@martin.st> | 2011-04-20 10:10:10 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-04-21 14:13:09 +0300 |
commit | fe8e039460064ad765c37736dadd123478c5ff1f (patch) | |
tree | 83bf4833d776d2cf821186d7be4f92dc46b59020 /libavformat/applehttp.c | |
parent | cac275791994be44b7a6d11a3878646e78ab5653 (diff) | |
download | ffmpeg-fe8e039460064ad765c37736dadd123478c5ff1f.tar.gz |
applehttp: Expose the stream bitrate via metadata
This helps callers to intelligently switch between bitrate
variants.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/applehttp.c')
-rw-r--r-- | libavformat/applehttp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index df4494a785..90b86a8733 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -367,6 +367,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; AVInputFormat *in_fmt = NULL; + char bitrate_str[20]; if (v->n_segments == 0) continue; @@ -393,6 +394,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) if (ret < 0) goto fail; v->stream_offset = stream_offset; + snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = av_new_stream(s, i); @@ -401,6 +403,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; } avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); + av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str, 0); } stream_offset += v->ctx->nb_streams; } |