On 9/19/2023 4:56 PM, Andreas Rheinhardt wrote:
+
+/**
+ * Allocate a refcounted object of usable size `size` managed via
+ * the RefStruct API.
+ *
+ * By default (in the absence of flags to the contrary),
+ * the returned object is initially zeroed.
+ *
+ * @param size Desired usable size of the returned object.
+ * @param flags A bitwise combination of FF_REFSTRUCT_FLAG_* flags.
+ * @param opaque A pointer that will be passed to the free_cb callback.
+ * @param free_cb A callback for freeing this object's content
+ * when its reference count reaches zero;
+ * it must not free the object itself.
+ * @return A pointer to an object of the desired size or NULL on failure.
+ */
+void *ff_refstruct_alloc_ext_c(size_t size, unsigned flags, FFRefStructOpaque
opaque,
+ void (*free_cb)(FFRefStructOpaque opaque, void
*obj));
+
+/**
+ * A wrapper around ff_refstruct_alloc_ext_c() for the common case
+ * of a non-const qualified opaque.
+ *
+ * @see ff_refstruct_alloc_ext_c()
+ */
+static inline
+void *ff_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque,
+ void (*free_cb)(FFRefStructOpaque opaque, void
*obj))
+{
+ return ff_refstruct_alloc_ext_c(size, flags, (FFRefStructOpaque){.nc =
opaque},
+ free_cb);
+}
+
+/**
+ * Equivalent to ff_refstruct_alloc_ext(size, 0, NULL, NULL)
Why is this not inlined, then?
+ */
+void *ff_refstruct_allocz(size_t size);
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".