[FFmpeg-devel] [PATCH] FTR decoder

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Aug 31 20:55:05 EEST 2022


Paul B Mahol:
> Patch attached.

> +    union {
> +        uint64_t u64;
> +        uint8_t  u8[8 + AV_INPUT_BUFFER_PADDING_SIZE];
> +    } tmp;
> +
> +    *poutbuf_size = 0;
> +    *poutbuf = NULL;
> +
> +    if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
> +        next = buf_size;
> +    } else {
> +        for (int i = 0; i < buf_size; i++) {
> +            if (ftr->skip > 0) {
> +                ftr->skip--;
> +                if (ftr->skip == 0 && ftr->split) {
> +                    ftr->split = 0;
> +                    next = i;
> +                    break;
> +                } else if (ftr->skip > 0) {
> +                    continue;
> +                }
> +            }
> +
> +            state = (state << 8) | buf[i];
> +            tmp.u64 = av_be2ne64(state);

It is simpler to just use an uint8_t buf[8 +
AV_INPUT_BUFFER_PADDING_SIZE] that is set via AV_RB64(buf, state).

> +            init_get_bits(&bits, tmp.u8 + 8 - AV_AAC_ADTS_HEADER_SIZE,
> +                          AV_AAC_ADTS_HEADER_SIZE * 8);
> +




More information about the ffmpeg-devel mailing list