cbs: Describe allocate/free methods in tabular form

Unit types are split into three categories, depending on how their
content is managed:
* POD structure - these require no special treatment.
* Structure containing references to refcounted buffers - these can use
  a common free function when the offsets of all the internal references
  are known.
* More complex structures - these still require ad-hoc treatment.

For each codec we can then maintain a table of descriptors for each set of
equivalent unit types, defining the mechanism needed to allocate/free that
unit content.  This is not required to be used immediately - a new alloc
function supports this, but does not replace the old one which works without
referring to these tables.
This commit is contained in:
Mark Thompson
2020-07-27 17:32:18 +01:00
parent 1fe77d4a63
commit bc7a7e0d65
3 changed files with 139 additions and 0 deletions

View File

@@ -349,6 +349,15 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit,
size_t size,
void (*free)(void *opaque, uint8_t *content));
/**
* Allocate a new internal content buffer matching the type of the unit.
*
* The content will be zeroed.
*/
int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx,
CodedBitstreamUnit *unit);
/**
* Allocate a new internal data buffer of the given size in the unit.
*