[FFmpeg-devel] [PATCH] avformat/mpeg: fix detection and demuxing of raw AC3 in mpegps

Michael Niedermayer michael at niedermayer.cc
Sun Apr 1 17:35:37 EEST 2018


On Fri, Mar 30, 2018 at 06:46:06PM +0200, Paul B Mahol wrote:
> Fixes #4889.
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavformat/mpeg.c | 27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> index 69d4a9d8ac..f6e3439e68 100644
> --- a/libavformat/mpeg.c
> +++ b/libavformat/mpeg.c
> @@ -128,6 +128,7 @@ typedef struct MpegDemuxContext {
>      int sofdec;
>      int dvd;
>      int imkh_cctv;
> +    int raw_ac3;
>  #if CONFIG_VOBSUB_DEMUXER
>      AVFormatContext *sub_ctx;
>      FFDemuxSubtitlesQueue q[32];
> @@ -443,7 +444,15 @@ redo:
>  
>      if (startcode == PRIVATE_STREAM_1) {
>          startcode = avio_r8(s->pb);
> -        len--;
> +        if (avio_r8(s->pb) == 0x77 && startcode == 0x0b) {
> +            startcode = 0x80;
> +            m->raw_ac3 = 1;
> +            avio_skip(s->pb, -2);
> +        } else {
> +            m->raw_ac3 = 0;
> +            avio_skip(s->pb, -1);

I think these seekbacks are not safe, they could fail once every few thousand
times depending on buffer positions if the underlaying input is not seekable

a ffio_ensure_seekback() call should avoid this

thats unless iam missing something ...

[...]

thx

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180401/672a3af9/attachment.sig>


More information about the ffmpeg-devel mailing list