[FFmpeg-devel] [PATCH v3 2/7] lavc/cbs: APV support

James Almer jamrial at gmail.com
Thu Apr 24 03:02:29 EEST 2025


On 4/23/2025 5:45 PM, Mark Thompson wrote:
> +static int cbs_apv_split_fragment(CodedBitstreamContext *ctx,
> +                                  CodedBitstreamFragment *frag,
> +                                  int header)
> +{
> +    uint8_t *data = frag->data;
> +    size_t   size = frag->data_size;
> +    uint32_t signature;
> +    int err, trace;

To prepare CBS for the presence of extradata, make this function a no-op 
when header != 0.

> +
> +    // Don't include parsing here in trace output.
> +    trace = ctx->trace_enable;
> +    ctx->trace_enable = 0;
> +
> +    signature = AV_RB32(data);
> +    if (signature != APV_SIGNATURE) {
> +        av_log(ctx->log_ctx, AV_LOG_ERROR,
> +               "Invalid APV access unit: bad signature %08x.\n",
> +               signature);
> +        err = AVERROR_INVALIDDATA;
> +        goto fail;
> +    }
> +    data += 4;
> +    size -= 4;
> +
> +    while (size > 0) {
> +        GetBitContext   gbc;
> +        uint32_t        pbu_size;
> +        APVRawPBUHeader pbu_header;
> +
> +        if (size < 8) {
> +            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid PBU: "
> +                   "fragment too short (%"SIZE_SPECIFIER" bytes).\n",
> +                   size);
> +            err = AVERROR_INVALIDDATA;
> +            goto fail;
> +        }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250423/f8e8a491/attachment.sig>


More information about the ffmpeg-devel mailing list