[FFmpeg-devel] [PATCH v3 07/11] avcodec: add cbs for h266/vvc

James Almer jamrial at gmail.com
Thu Jan 14 00:25:16 EET 2021


On 1/12/2021 11:34 PM, James Almer wrote:
>> +            if (err < 0)
>> +                return err;
>> +        }
>> +        break;
>> +
>> +    case VVC_TRAIL_NUT:
>> +    case VVC_STSA_NUT:
>> +    case VVC_RADL_NUT:
>> +    case VVC_RASL_NUT:
>> +    case VVC_IDR_W_RADL:
>> +    case VVC_IDR_N_LP:
>> +    case VVC_CRA_NUT:
>> +    case VVC_GDR_NUT:
>> +        {
>> +            H266RawSlice *slice = unit->content;
>> +            int pos, len;
>> +
>> +            err = cbs_h266_read_slice_header(ctx, &gbc, &slice->header);
>> +            if (err < 0)
>> +                return err;
> 
> Add a call to cbs_h266_replace_ph() here when 
> slice->header.sh_picture_header_in_slice_header_flag is true, and pass a 
> pointer to slice->header.sh_picture_header to it.

Actually no, this wouldn't work as is in the cases where 
ff_cbs_make_unit_refcounted() makes it refcounted. Neither slice or the 
pointer passed to  cbs_h266_replace_ph() would be valid.

You'd have ensure the slice variable points the new unit->content after 
a successful call to cbs_h266_replace_ph() (Which you can leave 
untouched), and then make priv->ph point to the H266RawPH struct within 
slice.


More information about the ffmpeg-devel mailing list