Message ID | 20180403103527.20364-1-h.leppkes@gmail.com |
---|---|
State | Accepted |
Commit | 3e9d676192fc6ef719a904f8a2d114efec03d7c1 |
Headers | show |
Hi, Hendrik Leppkes kirjoitti 2018-04-03 13:35: > Such streams are found on Blu-ray, and identified as EAC3 type in > avformat, while the bitstream of the core stream is actually a pure AC3 > frame. > > Adjust the parsing accordingly, since AC3 frames always hold 6 blocks > and the numblkscod syntax element is not present. > --- > libavformat/spdifenc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c > index 3a50aebbef..9514ff8e10 100644 > --- a/libavformat/spdifenc.c > +++ b/libavformat/spdifenc.c > @@ -118,7 +118,8 @@ static int spdif_header_eac3(AVFormatContext *s, > AVPacket *pkt) > static const uint8_t eac3_repeat[4] = {6, 3, 2, 1}; > int repeat = 1; > > - if ((pkt->data[4] & 0xc0) != 0xc0) /* fscod */ > + int bsid = pkt->data[5] >> 3; > + if (bsid > 10 && (pkt->data[4] & 0xc0) != 0xc0) /* fscod */ > repeat = eac3_repeat[(pkt->data[4] & 0x30) >> 4]; /* > numblkscod */ > > ctx->hd_buf = av_fast_realloc(ctx->hd_buf, &ctx->hd_buf_size, > ctx->hd_buf_filled + pkt->size); Looks good to me. Thanks,
On Tue, Apr 3, 2018 at 4:06 PM, Anssi Hannula <anssi.hannula@iki.fi> wrote: > Hi, > > Hendrik Leppkes kirjoitti 2018-04-03 13:35: >> >> Such streams are found on Blu-ray, and identified as EAC3 type in >> avformat, while the bitstream of the core stream is actually a pure AC3 >> frame. >> >> Adjust the parsing accordingly, since AC3 frames always hold 6 blocks >> and the numblkscod syntax element is not present. >> --- >> libavformat/spdifenc.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c >> index 3a50aebbef..9514ff8e10 100644 >> --- a/libavformat/spdifenc.c >> +++ b/libavformat/spdifenc.c >> @@ -118,7 +118,8 @@ static int spdif_header_eac3(AVFormatContext *s, >> AVPacket *pkt) >> static const uint8_t eac3_repeat[4] = {6, 3, 2, 1}; >> int repeat = 1; >> >> - if ((pkt->data[4] & 0xc0) != 0xc0) /* fscod */ >> + int bsid = pkt->data[5] >> 3; >> + if (bsid > 10 && (pkt->data[4] & 0xc0) != 0xc0) /* fscod */ >> repeat = eac3_repeat[(pkt->data[4] & 0x30) >> 4]; /* numblkscod >> */ >> >> ctx->hd_buf = av_fast_realloc(ctx->hd_buf, &ctx->hd_buf_size, >> ctx->hd_buf_filled + pkt->size); > > > > Looks good to me. > Pushed.
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 3a50aebbef..9514ff8e10 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -118,7 +118,8 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt) static const uint8_t eac3_repeat[4] = {6, 3, 2, 1}; int repeat = 1; - if ((pkt->data[4] & 0xc0) != 0xc0) /* fscod */ + int bsid = pkt->data[5] >> 3; + if (bsid > 10 && (pkt->data[4] & 0xc0) != 0xc0) /* fscod */ repeat = eac3_repeat[(pkt->data[4] & 0x30) >> 4]; /* numblkscod */ ctx->hd_buf = av_fast_realloc(ctx->hd_buf, &ctx->hd_buf_size, ctx->hd_buf_filled + pkt->size);