1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-23 04:24:35 +02:00

avformat/mpeg: fix detection and demuxing of raw AC3 in mpegps

Fixes #4889.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2018-03-30 18:44:34 +02:00
parent 52e97814a1
commit 7643e27528

View File

@ -20,6 +20,7 @@
*/
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "mpeg.h"
@ -128,6 +129,7 @@ typedef struct MpegDemuxContext {
int sofdec;
int dvd;
int imkh_cctv;
int raw_ac3;
#if CONFIG_VOBSUB_DEMUXER
AVFormatContext *sub_ctx;
FFDemuxSubtitlesQueue q[32];
@ -442,9 +444,22 @@ redo:
}
if (startcode == PRIVATE_STREAM_1) {
int ret = ffio_ensure_seekback(s->pb, 2);
if (ret < 0)
return ret;
startcode = avio_r8(s->pb);
if (startcode == 0x0b && avio_r8(s->pb) == 0x77) {
startcode = 0x80;
m->raw_ac3 = 1;
avio_skip(s->pb, -2);
} else {
m->raw_ac3 = 0;
avio_skip(s->pb, -1);
len--;
}
}
if (len < 0)
goto error_redo;
if (dts != AV_NOPTS_VALUE && ppos) {
@ -486,6 +501,7 @@ redo:
if (len < 4)
goto skip;
if (!m->raw_ac3) {
/* audio: skip header */
avio_r8(s->pb);
lpcm_header_len = avio_rb16(s->pb);
@ -496,6 +512,7 @@ redo:
len--;
}
}
}
/* now find stream */
for (i = 0; i < s->nb_streams; i++) {