mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-24 02:20:56 +01:00
avutil: Add functions for allocating opaque contexts for algorithms
The current API where the plain size is exposed is not of much use - in most cases it is allocated dynamically anyway. If allocated e.g. on the stack via an uint8_t array, there's no guarantee that the struct's members are aligned properly (unless the array is overallocated and the opaque pointer within it manually aligned to some unspecified alignment). Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
fb32f31af7
commit
9a92aea27b
10 changed files with 78 additions and 5 deletions
|
|
@ -28,7 +28,14 @@ typedef struct AVTreeNode {
|
|||
int state;
|
||||
} AVTreeNode;
|
||||
|
||||
#if FF_API_CONTEXT_SIZE
|
||||
const int av_tree_node_size = sizeof(AVTreeNode);
|
||||
#endif
|
||||
|
||||
struct AVTreeNode *av_tree_node_alloc(void)
|
||||
{
|
||||
return av_mallocz(sizeof(struct AVTreeNode));
|
||||
}
|
||||
|
||||
void *av_tree_find(const AVTreeNode *t, void *key,
|
||||
int (*cmp)(void *key, const void *b), void *next[2])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue