diff options
author | Rodger Combs <rodger.combs@gmail.com> | 2015-06-23 12:35:33 -0500 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-25 19:17:01 +0200 |
commit | 0643b4bf74a44c9e24cd75a2b99f9d1fd128e4f6 (patch) | |
tree | b4418b0e735c0692e466d61bcb7a99ea2040e91e | |
parent | 2c77ca459e9c9aceee5ed93f8dd8de09e9fbf8df (diff) | |
download | ffmpeg-0643b4bf74a44c9e24cd75a2b99f9d1fd128e4f6.tar.gz |
lavf/brstm: expose the loop point when present
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/brstm.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/brstm.c b/libavformat/brstm.c index b6108e3ec8..f5a4a82d4c 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -93,6 +93,7 @@ static int read_header(AVFormatContext *s) uint32_t size, asize, start = 0; AVStream *st; int ret = AVERROR_EOF; + int loop = 0; int bfstm = !strcmp("bfstm", s->iformat->name); st = avformat_new_stream(s, NULL); @@ -195,7 +196,7 @@ static int read_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } - avio_skip(s->pb, 1); // loop flag + loop = avio_r8(s->pb); // loop flag st->codec->codec_id = codec; st->codec->channels = avio_r8(s->pb); if (!st->codec->channels) @@ -209,7 +210,17 @@ static int read_header(AVFormatContext *s) if (!bfstm) avio_skip(s->pb, 2); // padding - avio_skip(s->pb, 4); // loop start sample + + if (loop) { + if (av_dict_set_int(&s->metadata, "loop_start", + av_rescale(read32(s), AV_TIME_BASE, + st->codec->sample_rate), + 0) < 0) + return AVERROR(ENOMEM); + } else { + avio_skip(s->pb, 4); + } + st->start_time = 0; st->duration = read32(s); avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); |