[FFmpeg-devel] [PATCH 6/6] lavf/brstm: expose the loop point when present

Rodger Combs rodger.combs at gmail.com
Wed Jun 17 00:28:18 CEST 2015


---
 libavformat/brstm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 8adffb8..53d8da9 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -72,6 +72,7 @@ static int read_header(AVFormatContext *s)
     uint32_t size, start, asize;
     AVStream *st;
     int ret = AVERROR_EOF;
+    int loop = 0;
 
     b->bfstm = !strcmp("bfstm", s->iformat->name);
 
@@ -173,7 +174,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)
@@ -189,7 +190,12 @@ static int read_header(AVFormatContext *s)
 
     if (!b->bfstm)
         avio_skip(s->pb, 2); // padding
-    avio_skip(s->pb, 4); // loop start sample
+
+    if (loop)
+        s->loop_start = av_rescale(avio_rb32(s->pb), AV_TIME_BASE, st->codec->sample_rate);
+    else
+        avio_skip(s->pb, 4);
+
     st->start_time = 0;
     st->duration = avio_rb32(s->pb);
     avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
-- 
2.4.1



More information about the ffmpeg-devel mailing list