diff mbox series

[FFmpeg-devel] avcodec/ac3_parser: recognize LE bitstream variant

Message ID 20200221213210.23251-1-onemda@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/ac3_parser: recognize LE bitstream variant
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Paul B Mahol Feb. 21, 2020, 9:32 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/ac3_parser.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Paul B Mahol Feb. 23, 2020, 2:33 p.m. UTC | #1
will apply

On 2/21/20, Paul B Mahol <onemda@gmail.com> wrote:
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/ac3_parser.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
> index 1e203ae6ac..ba171653ef 100644
> --- a/libavcodec/ac3_parser.c
> +++ b/libavcodec/ac3_parser.c
> @@ -201,6 +201,12 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext
> *hdr_info,
>      AC3HeaderInfo hdr;
>      GetBitContext gbc;
>
> +    if (tmp.u8[1] == 0x77 && tmp.u8[2] == 0x0b) {
> +        FFSWAP(uint8_t, tmp.u8[1], tmp.u8[2]);
> +        FFSWAP(uint8_t, tmp.u8[3], tmp.u8[4]);
> +        FFSWAP(uint8_t, tmp.u8[5], tmp.u8[6]);
> +    }
> +
>      init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
>      err = ff_ac3_parse_header(&gbc, &hdr);
>
> --
> 2.17.1
>
>
diff mbox series

Patch

diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 1e203ae6ac..ba171653ef 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -201,6 +201,12 @@  static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
     AC3HeaderInfo hdr;
     GetBitContext gbc;
 
+    if (tmp.u8[1] == 0x77 && tmp.u8[2] == 0x0b) {
+        FFSWAP(uint8_t, tmp.u8[1], tmp.u8[2]);
+        FFSWAP(uint8_t, tmp.u8[3], tmp.u8[4]);
+        FFSWAP(uint8_t, tmp.u8[5], tmp.u8[6]);
+    }
+
     init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
     err = ff_ac3_parse_header(&gbc, &hdr);