On Sun, Dec 31, 2017 at 05:46:05PM +0800, mi...@brew.sh wrote: > From: Misty De Meo <mistyde...@gmail.com> > > MPS files are MPEG files used on PSP Video discs. They lack > the PSMF header used by .pms files, and so the special casing > in the original patch fails to support their audio. This patch > fixes this by unconditionally reading a new byte for the startcode > for PRIVATE_STREAM_1 sections, and doing the comparison on that > to find ATRAC-3 streams. In my testing, it works fine for both MPS > and PSMF files. > --- > Changelog | 1 + > libavformat/mpeg.c | 38 ++++++++++++++------------------------ > libavformat/mpeg.h | 1 + > 3 files changed, 16 insertions(+), 24 deletions(-) > > diff --git a/Changelog b/Changelog > index ee48876128..67f28ea839 100644 > --- a/Changelog > +++ b/Changelog > @@ -27,6 +27,7 @@ version <next>: > - video setrange filter > - nsp demuxer > - support LibreSSL (via libtls) > +- ATRAC-3 support for Sony PSP MPEG files > > > version 3.4: > diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c > index 895c6fb231..a366ece0ed 100644 > --- a/libavformat/mpeg.c > +++ b/libavformat/mpeg.c > @@ -128,7 +128,6 @@ typedef struct MpegDemuxContext { > int sofdec; > int dvd; > int imkh_cctv; > - int sony_psmf; // true if Play Station Movie file signature is present > #if CONFIG_VOBSUB_DEMUXER > AVFormatContext *sub_ctx; > FFDemuxSubtitlesQueue q[32]; > @@ -148,8 +147,6 @@ static int mpegps_read_header(AVFormatContext *s) > avio_get_str(s->pb, 6, buffer, sizeof(buffer)); > if (!memcmp("IMKH", buffer, 4)) { > m->imkh_cctv = 1; > - } else if (!memcmp("PSMF00", buffer, 6)) { > - m->sony_psmf = 1; > } else if (!memcmp("Sofdec", buffer, 6)) { > m->sofdec = 1; > } else > @@ -444,7 +441,7 @@ redo: > goto redo; > } > > - if (startcode == PRIVATE_STREAM_1 && !m->sony_psmf) { > + if (startcode == PRIVATE_STREAM_1) { > startcode = avio_r8(s->pb); > len--; > } > @@ -544,28 +541,21 @@ redo: > else > request_probe= 1; > type = AVMEDIA_TYPE_VIDEO; > - } else if (startcode == PRIVATE_STREAM_1 && m->sony_psmf) { > - uint8_t stream_id; > - > - if (len < 2) > - goto skip; > - stream_id = avio_r8(s->pb); > + // Sony PSP video with ATRAC-3 audio
> + } else if (!(startcode & STREAM_TYPE_AUDIO_ATRAC3)) { this looks a bit odd shouldnt this test more than 4 bits of startcode ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment.
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel