Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-05-04 Thread Zane van Iperen
On Sun, 3 May 2020 19:10:51 +0200
"Michael Niedermayer"  wrote:

> > > just tried, and as expected this doesnt work
> > >
> > > ./ffmpeg -i pinball/ie74.5C -map 0 test.nut
> > > ...
> > > Press [q] to stop, [?] for help
> > > Too many packets buffered for output stream 0:1.
> > > [libvorbis @ 0x557f49f3da40] 16 frames left in the queue on
> > > closing [libvorbis @ 0x557f49f3f340] 14 frames left in the queue
> > > on closing Conversion failed!
> > >  
> >
> > Interesting... that worked for me :/
> >
> > ./ffmpeg -y -i pp/ie74.5C -map 0 test.nut
> > ...
> > [nut @ 0x55615988d700] Multiple keyframes with same PTS
> > Last message repeated 5 times
> > size= 632kB time=00:00:06.37 bitrate= 812.2kbits/s speed=59.8x
> > video:0kB audio:630kB subtitle:0kB other streams:0kB global
> > headers:0kB muxing overhead: 0.366753%  
> 
> Interresting, but the problem with 100% uninterleaved streams remains
> applications will have issues with this, and the more the longer
> these are
> 

Yeah, I was able to reproduce this with a longer file.

Have fixed it by reading packets from the streams in a round-robin
manner. A bit nasty, but I don't see any nicer way of doing it.

Zane

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-05-03 Thread Michael Niedermayer
On Sun, May 03, 2020 at 01:43:24PM +, Zane van Iperen wrote:
> On Sun, 3 May 2020 15:23:19 +0200
> "Michael Niedermayer"  wrote:
> 
> > On Fri, May 01, 2020 at 12:55:18AM +, Zane van Iperen wrote:
> > > On Fri, 01 May 2020 00:36:57 +
> > > "Zane van Iperen"  wrote:
> > >  
> > > > On Fri, 1 May 2020 01:09:17 +0200
> > > > "Michael Niedermayer"  wrote:
> > > >  
> > > > > > +size = FFMIN(trk->data_size - ctx->bytes_read,
> > > > > > PP_BNK_MAX_READ_SIZE); +
> > > > > > +if ((ret = av_get_packet(s->pb, pkt, size)) < 0)
> > > > > > +return ret;
> > > > > > +
> > > > > > +ctx->bytes_read+= ret;
> > > > > > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > > > > > +pkt->stream_index   = ctx->current_track;
> > > > > > +pkt->duration   = ret * 2;  
> > > > >
> > > > > With this each stream would be returned completely before the
> > > > > next such non interleaved output is a bit odd.
> > > > >  
> > > >
> > > > Yep, it's an odd format.  Some files are meant to be stereo, but I
> > > > can't present them as such. I have to present them as separate
> > > > mono streams and merge them with a filter.
> > > >  
> > > > > also where can i find such a file ?
> > > > >  
> > > >
> > > > Here's a file I trimmed for FATE:
> > > >
> > > > https://0x0.st/ie7O.11c
> > > >  
> > > Probably should have mentioned that first file is meant to be stereo
> > > music.
> > >
> > > Here's one that's meant to be just a bunch of mono tracks:
> > > https://0x0.st/ie74.5C  
> > 
> > just tried, and as expected this doesnt work
> > 
> > ./ffmpeg -i pinball/ie74.5C -map 0 test.nut
> > ...
> > Press [q] to stop, [?] for help
> > Too many packets buffered for output stream 0:1.
> > [libvorbis @ 0x557f49f3da40] 16 frames left in the queue on closing
> > [libvorbis @ 0x557f49f3f340] 14 frames left in the queue on closing
> > Conversion failed!
> > 
> 
> Interesting... that worked for me :/
> 
> ./ffmpeg -y -i pp/ie74.5C -map 0 test.nut
> ...
> [nut @ 0x55615988d700] Multiple keyframes with same PTS
> Last message repeated 5 times
> size= 632kB time=00:00:06.37 bitrate= 812.2kbits/s speed=59.8x
> video:0kB audio:630kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 0.366753%

Interresting, but the problem with 100% uninterleaved streams remains
applications will have issues with this, and the more the longer these are


> 
> 
> This isn't a valid use case for this file format regardless, as they're 
> soundbanks.

Well, if -map 0 is not a valid use case then how would you
convert such a pinball file to a new pinball file ?
(maybe with some audio filter adding echo or whatever)
Theres no muxer currently but if there was one that seems a valid use
case to me


> Each stream should be split into a separate file, and it's almost guaranteed 
> that they're all different lengths.
> 

> If this is required, then I'm not sure of the best course of action is.

iam also not sure but maybe looking at what exists could lead to some
inspiration
audio streams with concatenated songs, chapters, slide shows, mpeg ts which
stores several independant programms, ...


> Unless I constantly seek back and forth in the file, but that seems messy...

streams can be set to AVDISCARD_ALL when they are unneeded. So at least this
should not happen when parts are unused. Still not sure thats a solution

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-05-03 Thread Zane van Iperen
On Sun, 3 May 2020 15:23:19 +0200
"Michael Niedermayer"  wrote:

> On Fri, May 01, 2020 at 12:55:18AM +, Zane van Iperen wrote:
> > On Fri, 01 May 2020 00:36:57 +
> > "Zane van Iperen"  wrote:
> >  
> > > On Fri, 1 May 2020 01:09:17 +0200
> > > "Michael Niedermayer"  wrote:
> > >  
> > > > > +size = FFMIN(trk->data_size - ctx->bytes_read,
> > > > > PP_BNK_MAX_READ_SIZE); +
> > > > > +if ((ret = av_get_packet(s->pb, pkt, size)) < 0)
> > > > > +return ret;
> > > > > +
> > > > > +ctx->bytes_read+= ret;
> > > > > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > > > > +pkt->stream_index   = ctx->current_track;
> > > > > +pkt->duration   = ret * 2;  
> > > >
> > > > With this each stream would be returned completely before the
> > > > next such non interleaved output is a bit odd.
> > > >  
> > >
> > > Yep, it's an odd format.  Some files are meant to be stereo, but I
> > > can't present them as such. I have to present them as separate
> > > mono streams and merge them with a filter.
> > >  
> > > > also where can i find such a file ?
> > > >  
> > >
> > > Here's a file I trimmed for FATE:
> > >
> > > https://0x0.st/ie7O.11c
> > >  
> > Probably should have mentioned that first file is meant to be stereo
> > music.
> >
> > Here's one that's meant to be just a bunch of mono tracks:
> > https://0x0.st/ie74.5C  
> 
> just tried, and as expected this doesnt work
> 
> ./ffmpeg -i pinball/ie74.5C -map 0 test.nut
> ...
> Press [q] to stop, [?] for help
> Too many packets buffered for output stream 0:1.
> [libvorbis @ 0x557f49f3da40] 16 frames left in the queue on closing
> [libvorbis @ 0x557f49f3f340] 14 frames left in the queue on closing
> Conversion failed!
> 

Interesting... that worked for me :/

./ffmpeg -y -i pp/ie74.5C -map 0 test.nut
...
[nut @ 0x55615988d700] Multiple keyframes with same PTS
Last message repeated 5 times
size= 632kB time=00:00:06.37 bitrate= 812.2kbits/s speed=59.8x
video:0kB audio:630kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: 0.366753%


This isn't a valid use case for this file format regardless, as they're 
soundbanks.
Each stream should be split into a separate file, and it's almost guaranteed 
that they're all different lengths.

If this is required, then I'm not sure of the best course of action is.
Unless I constantly seek back and forth in the file, but that seems messy...

Zane

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-05-03 Thread Michael Niedermayer
On Fri, May 01, 2020 at 12:55:18AM +, Zane van Iperen wrote:
> On Fri, 01 May 2020 00:36:57 +
> "Zane van Iperen"  wrote:
> 
> > On Fri, 1 May 2020 01:09:17 +0200
> > "Michael Niedermayer"  wrote:
> > 
> > > > +size = FFMIN(trk->data_size - ctx->bytes_read,
> > > > PP_BNK_MAX_READ_SIZE); +
> > > > +if ((ret = av_get_packet(s->pb, pkt, size)) < 0)
> > > > +return ret;
> > > > +
> > > > +ctx->bytes_read+= ret;
> > > > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > > > +pkt->stream_index   = ctx->current_track;
> > > > +pkt->duration   = ret * 2;  
> > >
> > > With this each stream would be returned completely before the next
> > > such non interleaved output is a bit odd.
> > >  
> > 
> > Yep, it's an odd format.  Some files are meant to be stereo, but I
> > can't present them as such. I have to present them as separate mono
> > streams and merge them with a filter.
> > 
> > > also where can i find such a file ?
> > >  
> > 
> > Here's a file I trimmed for FATE:
> > 
> > https://0x0.st/ie7O.11c
> > 
> Probably should have mentioned that first file is meant to be stereo
> music.
> 
> Here's one that's meant to be just a bunch of mono tracks:
> https://0x0.st/ie74.5C

just tried, and as expected this doesnt work

./ffmpeg -i pinball/ie74.5C -map 0 test.nut
...
Press [q] to stop, [?] for help
Too many packets buffered for output stream 0:1.
[libvorbis @ 0x557f49f3da40] 16 frames left in the queue on closing
[libvorbis @ 0x557f49f3f340] 14 frames left in the queue on closing
Conversion failed!


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-30 Thread Zane van Iperen
On Fri, 01 May 2020 00:36:57 +
"Zane van Iperen"  wrote:

> On Fri, 1 May 2020 01:09:17 +0200
> "Michael Niedermayer"  wrote:
> 
> > > +size = FFMIN(trk->data_size - ctx->bytes_read,
> > > PP_BNK_MAX_READ_SIZE); +
> > > +if ((ret = av_get_packet(s->pb, pkt, size)) < 0)
> > > +return ret;
> > > +
> > > +ctx->bytes_read+= ret;
> > > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > > +pkt->stream_index   = ctx->current_track;
> > > +pkt->duration   = ret * 2;  
> >
> > With this each stream would be returned completely before the next
> > such non interleaved output is a bit odd.
> >  
> 
> Yep, it's an odd format.  Some files are meant to be stereo, but I
> can't present them as such. I have to present them as separate mono
> streams and merge them with a filter.
> 
> > also where can i find such a file ?
> >  
> 
> Here's a file I trimmed for FATE:
> 
> https://0x0.st/ie7O.11c
> 
Probably should have mentioned that first file is meant to be stereo
music.

Here's one that's meant to be just a bunch of mono tracks:
https://0x0.st/ie74.5C

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-30 Thread Zane van Iperen
On Fri, 1 May 2020 01:09:17 +0200
"Michael Niedermayer"  wrote:

> > +size = FFMIN(trk->data_size - ctx->bytes_read,
> > PP_BNK_MAX_READ_SIZE); +
> > +if ((ret = av_get_packet(s->pb, pkt, size)) < 0)
> > +return ret;
> > +
> > +ctx->bytes_read+= ret;
> > +pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
> > +pkt->stream_index   = ctx->current_track;
> > +pkt->duration   = ret * 2;  
> 
> With this each stream would be returned completely before the next
> such non interleaved output is a bit odd.
> 

Yep, it's an odd format.  Some files are meant to be stereo, but I
can't present them as such. I have to present them as separate mono
streams and merge them with a filter.

> also where can i find such a file ?
> 

Here's a file I trimmed for FATE:

https://0x0.st/ie7O.11c


> thx
> 
> [...]
> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> There will always be a question for which you do not know the correct
> answer. ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-30 Thread Michael Niedermayer
On Tue, Apr 28, 2020 at 12:10:33PM +, Zane van Iperen wrote:
> Signed-off-by: Zane van Iperen 
> ---
>  Changelog|   1 +
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/pp_bnk.c | 289 +++
>  libavformat/version.h|   4 +-
>  5 files changed, 294 insertions(+), 2 deletions(-)
>  create mode 100644 libavformat/pp_bnk.c
> 
> diff --git a/Changelog b/Changelog
> index 83b8a4a46e..4cd324ffc2 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -63,6 +63,7 @@ version :
>  - maskedthreshold filter
>  - Support for muxing pcm and pgs in m2ts
>  - Cunning Developments ADPCM decoder
> +- Pro Pinball Series Soundbank demuxer
>  
>  
>  version 4.2:
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index d4bed3c113..b744eb69b2 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -428,6 +428,7 @@ OBJS-$(CONFIG_PCM_VIDC_DEMUXER)  += pcmdec.o pcm.o
>  OBJS-$(CONFIG_PCM_VIDC_MUXER)+= pcmenc.o rawenc.o
>  OBJS-$(CONFIG_PJS_DEMUXER)   += pjsdec.o subtitles.o
>  OBJS-$(CONFIG_PMP_DEMUXER)   += pmpdec.o
> +OBJS-$(CONFIG_PP_BNK_DEMUXER)+= pp_bnk.o
>  OBJS-$(CONFIG_PVA_DEMUXER)   += pva.o
>  OBJS-$(CONFIG_PVF_DEMUXER)   += pvfdec.o pcm.o
>  OBJS-$(CONFIG_QCP_DEMUXER)   += qcp.o
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 39d2c352f5..3919c9e4c1 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -341,6 +341,7 @@ extern AVInputFormat  ff_pcm_u8_demuxer;
>  extern AVOutputFormat ff_pcm_u8_muxer;
>  extern AVInputFormat  ff_pjs_demuxer;
>  extern AVInputFormat  ff_pmp_demuxer;
> +extern AVInputFormat  ff_pp_bnk_demuxer;
>  extern AVOutputFormat ff_psp_muxer;
>  extern AVInputFormat  ff_pva_demuxer;
>  extern AVInputFormat  ff_pvf_demuxer;
> diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
> new file mode 100644
> index 00..5f9fc2d373
> --- /dev/null
> +++ b/libavformat/pp_bnk.c
> @@ -0,0 +1,289 @@
> +/*
> + * Pro Pinball Series Soundbank (44c, 22c, 11c, 5c) demuxer.
> + *
> + * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com)
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +#include "avformat.h"
> +#include "internal.h"
> +#include "libavutil/intreadwrite.h"
> +#include "libavutil/avassert.h"
> +#include "libavutil/internal.h"
> +
> +#define PP_BNK_MAX_READ_SIZE4096
> +#define PP_BNK_FILE_HEADER_SIZE 20
> +#define PP_BNK_TRACK_SIZE   20
> +
> +typedef struct PPBnkHeader {
> +uint32_tbank_id;/*< Bank ID, useless for our purposes. */
> +uint32_tsample_rate;/*< Sample rate of the contained tracks. 
> */
> +uint32_talways1;/*< Unknown, always seems to be 1. */
> +uint32_ttrack_count;/*< Number of tracks in the file. */
> +uint32_tflags;  /*< Flags. */
> +} PPBnkHeader;
> +
> +typedef struct PPBnkTrack {
> +uint32_tid; /*< Track ID. Usually track[i].id == 
> track[i-1].id + 1, but not always */
> +uint32_tsize;   /*< Size of the data in bytes. */
> +uint32_tsample_rate;/*< Sample rate. */
> +uint32_talways1_1;  /*< Unknown, always seems to be 1. */
> +uint32_talways1_2;  /*< Unknown, always seems to be 1. */
> +} PPBnkTrack;
> +
> +typedef struct PPBnkCtxTrack {
> +int64_t data_offset;
> +uint32_tdata_size;
> +} PPBnkCtxTrack;
> +
> +typedef struct PPBnkCtx {
> +int track_count;
> +PPBnkCtxTrack   *tracks;
> +uint32_tcurrent_track;
> +uint32_tbytes_read;
> +} PPBnkCtx;
> +
> +enum {
> +PP_BNK_FLAG_PERSIST = (1 << 0), /*< This is a large file, keep in 
> memory. */
> +PP_BNK_FLAG_MUSIC   = (1 << 1), /*< This is music. */
> +PP_BNK_FLAG_MASK= (PP_BNK_FLAG_PERSIST | PP_BNK_FLAG_MUSIC)
> +};
> +
> +static void pp_bnk_parse_header(PPBnkHeader *hdr, const uint8_t *buf)
> +{
> +hdr->bank_id= AV_RL32(buf +  0);
> +hdr->sample_rate= AV_RL32(buf +  4);
> +hdr->always1= AV_RL32(buf +  8);
> +  

Re: [FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-30 Thread Zane van Iperen
On Tue, 28 Apr 2020 12:10:33 +
"Zane van Iperen"  wrote:

> Signed-off-by: Zane van Iperen 
> ---
>  Changelog|   1 +
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/pp_bnk.c | 289
> +++ libavformat/version.h|
> 4 +- 5 files changed, 294 insertions(+), 2 deletions(-)
>  create mode 100644 libavformat/pp_bnk.c
> 

Ping.

Btw, Michael, this has the probe change we discussed.

Zane

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v11] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-04-28 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/pp_bnk.c | 289 +++
 libavformat/version.h|   4 +-
 5 files changed, 294 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/pp_bnk.c

diff --git a/Changelog b/Changelog
index 83b8a4a46e..4cd324ffc2 100644
--- a/Changelog
+++ b/Changelog
@@ -63,6 +63,7 @@ version :
 - maskedthreshold filter
 - Support for muxing pcm and pgs in m2ts
 - Cunning Developments ADPCM decoder
+- Pro Pinball Series Soundbank demuxer
 
 
 version 4.2:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index d4bed3c113..b744eb69b2 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -428,6 +428,7 @@ OBJS-$(CONFIG_PCM_VIDC_DEMUXER)  += pcmdec.o pcm.o
 OBJS-$(CONFIG_PCM_VIDC_MUXER)+= pcmenc.o rawenc.o
 OBJS-$(CONFIG_PJS_DEMUXER)   += pjsdec.o subtitles.o
 OBJS-$(CONFIG_PMP_DEMUXER)   += pmpdec.o
+OBJS-$(CONFIG_PP_BNK_DEMUXER)+= pp_bnk.o
 OBJS-$(CONFIG_PVA_DEMUXER)   += pva.o
 OBJS-$(CONFIG_PVF_DEMUXER)   += pvfdec.o pcm.o
 OBJS-$(CONFIG_QCP_DEMUXER)   += qcp.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 39d2c352f5..3919c9e4c1 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -341,6 +341,7 @@ extern AVInputFormat  ff_pcm_u8_demuxer;
 extern AVOutputFormat ff_pcm_u8_muxer;
 extern AVInputFormat  ff_pjs_demuxer;
 extern AVInputFormat  ff_pmp_demuxer;
+extern AVInputFormat  ff_pp_bnk_demuxer;
 extern AVOutputFormat ff_psp_muxer;
 extern AVInputFormat  ff_pva_demuxer;
 extern AVInputFormat  ff_pvf_demuxer;
diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
new file mode 100644
index 00..5f9fc2d373
--- /dev/null
+++ b/libavformat/pp_bnk.c
@@ -0,0 +1,289 @@
+/*
+ * Pro Pinball Series Soundbank (44c, 22c, 11c, 5c) demuxer.
+ *
+ * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "avformat.h"
+#include "internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avassert.h"
+#include "libavutil/internal.h"
+
+#define PP_BNK_MAX_READ_SIZE4096
+#define PP_BNK_FILE_HEADER_SIZE 20
+#define PP_BNK_TRACK_SIZE   20
+
+typedef struct PPBnkHeader {
+uint32_tbank_id;/*< Bank ID, useless for our purposes. */
+uint32_tsample_rate;/*< Sample rate of the contained tracks. */
+uint32_talways1;/*< Unknown, always seems to be 1. */
+uint32_ttrack_count;/*< Number of tracks in the file. */
+uint32_tflags;  /*< Flags. */
+} PPBnkHeader;
+
+typedef struct PPBnkTrack {
+uint32_tid; /*< Track ID. Usually track[i].id == 
track[i-1].id + 1, but not always */
+uint32_tsize;   /*< Size of the data in bytes. */
+uint32_tsample_rate;/*< Sample rate. */
+uint32_talways1_1;  /*< Unknown, always seems to be 1. */
+uint32_talways1_2;  /*< Unknown, always seems to be 1. */
+} PPBnkTrack;
+
+typedef struct PPBnkCtxTrack {
+int64_t data_offset;
+uint32_tdata_size;
+} PPBnkCtxTrack;
+
+typedef struct PPBnkCtx {
+int track_count;
+PPBnkCtxTrack   *tracks;
+uint32_tcurrent_track;
+uint32_tbytes_read;
+} PPBnkCtx;
+
+enum {
+PP_BNK_FLAG_PERSIST = (1 << 0), /*< This is a large file, keep in memory. 
*/
+PP_BNK_FLAG_MUSIC   = (1 << 1), /*< This is music. */
+PP_BNK_FLAG_MASK= (PP_BNK_FLAG_PERSIST | PP_BNK_FLAG_MUSIC)
+};
+
+static void pp_bnk_parse_header(PPBnkHeader *hdr, const uint8_t *buf)
+{
+hdr->bank_id= AV_RL32(buf +  0);
+hdr->sample_rate= AV_RL32(buf +  4);
+hdr->always1= AV_RL32(buf +  8);
+hdr->track_count= AV_RL32(buf + 12);
+hdr->flags  = AV_RL32(buf + 16);
+}
+
+static void pp_bnk_parse_track(PPBnkTrack *trk, const uint8_t *buf)
+{
+trk->id = AV_RL32(buf +  0);
+trk->size   = AV_RL32(buf +  4);
+trk->sample_rate= AV_RL32(buf +  8);
+