[FFmpeg-cvslog] avformat/pp_bnk: allow seeking to start
Zane van Iperen
git at videolan.org
Thu Mar 25 08:39:04 EET 2021
ffmpeg | branch: release/4.4 | Zane van Iperen <zane at zanevaniperen.com> | Tue Mar 23 21:51:57 2021 +1000| [df9fbc442d47d3067f6dd978d54431567c8bf3f2] | committer: Zane van Iperen
avformat/pp_bnk: allow seeking to start
Allows "ffplay -loop" to work.
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
(cherry picked from commit 64fb63411de8b6970dda385bf87d4a70ce357602)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df9fbc442d47d3067f6dd978d54431567c8bf3f2
---
libavformat/pp_bnk.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
index 5c89295d27..07eeca3cd5 100644
--- a/libavformat/pp_bnk.c
+++ b/libavformat/pp_bnk.c
@@ -313,6 +313,25 @@ static int pp_bnk_read_close(AVFormatContext *s)
return 0;
}
+static int pp_bnk_seek(AVFormatContext *s, int stream_index,
+ int64_t pts, int flags)
+{
+ PPBnkCtx *ctx = s->priv_data;
+
+ if (pts != 0)
+ return AVERROR(EINVAL);
+
+ if (ctx->is_music) {
+ av_assert0(stream_index == 0);
+ ctx->tracks[0].bytes_read = 0;
+ ctx->tracks[1].bytes_read = 0;
+ } else {
+ ctx->tracks[stream_index].bytes_read = 0;
+ }
+
+ return 0;
+}
+
AVInputFormat ff_pp_bnk_demuxer = {
.name = "pp_bnk",
.long_name = NULL_IF_CONFIG_SMALL("Pro Pinball Series Soundbank"),
@@ -320,5 +339,6 @@ AVInputFormat ff_pp_bnk_demuxer = {
.read_probe = pp_bnk_probe,
.read_header = pp_bnk_read_header,
.read_packet = pp_bnk_read_packet,
- .read_close = pp_bnk_read_close
+ .read_close = pp_bnk_read_close,
+ .read_seek = pp_bnk_seek,
};
More information about the ffmpeg-cvslog
mailing list