aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_sei.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-13 01:01:16 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-07 22:35:14 +0200
commit3ba4f9c21e8bd78386738324d8767d74d75eec53 (patch)
treec0c9127edbbeaad333ffb4bcb2e5bc78b7b2c6a7 /libavcodec/cbs_sei.h
parent3e9b8d14e5d0df72765a1c9ca683c9d0f1d51e1a (diff)
downloadffmpeg-3ba4f9c21e8bd78386738324d8767d74d75eec53.tar.gz
avcodec/cbs_sei: Use RefStruct API for SEI messages
The SEI message code uses the AVBuffer API for its SEI messages and contained buffers (like the extension buffer for HEVC or the user data (un)registered payload buffers). Contrary to the ordinary CBS code (where some of these contained buffer references are actually references to the provided AVPacket's data so that one can't replace them with the RefStruct API), the CBS SEI code never uses outside buffers at all and can therefore be switched entirely to the RefStruct API. This avoids the overhead inherent in the AVBuffer API (namely the separate allocations etc.). Notice that the refcounting here is actually currently unused; the refcounts are always one (or zero in case of no refcounting); its only advantage is the flexibility provided by custom free functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/cbs_sei.h')
-rw-r--r--libavcodec/cbs_sei.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index 1c327a4689..4511c506cc 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -22,8 +22,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "libavutil/buffer.h"
-
#include "cbs.h"
#include "sei.h"
@@ -35,15 +33,13 @@ typedef struct SEIRawFillerPayload {
typedef struct SEIRawUserDataRegistered {
uint8_t itu_t_t35_country_code;
uint8_t itu_t_t35_country_code_extension_byte;
- uint8_t *data;
- AVBufferRef *data_ref;
+ uint8_t *data; ///< RefStruct reference
size_t data_length;
} SEIRawUserDataRegistered;
typedef struct SEIRawUserDataUnregistered {
uint8_t uuid_iso_iec_11578[16];
- uint8_t *data;
- AVBufferRef *data_ref;
+ uint8_t *data; ///< RefStruct reference
size_t data_length;
} SEIRawUserDataUnregistered;
@@ -75,9 +71,8 @@ typedef struct SEIRawMessage {
uint32_t payload_type;
uint32_t payload_size;
void *payload;
- AVBufferRef *payload_ref;
- uint8_t *extension_data;
- AVBufferRef *extension_data_ref;
+ void *payload_ref; ///< RefStruct reference
+ uint8_t *extension_data; ///< RefStruct reference
size_t extension_bit_length;
} SEIRawMessage;
@@ -174,15 +169,16 @@ void ff_cbs_sei_free_message_list(SEIRawMessageList *list);
* Will add to an existing SEI NAL unit, or create a new one for the
* message if there is no suitable existing one.
*
- * Takes a new reference to payload_buf, if set. If payload_buf is
- * NULL then the new message will not be reference counted.
+ * If set, payload_ref must be a RefStruct reference backing payload_data.
+ * This function creates a new reference to payload_ref in this case.
+ * If payload_ref is NULL, the new message will not be reference counted.
*/
int ff_cbs_sei_add_message(CodedBitstreamContext *ctx,
CodedBitstreamFragment *au,
int prefix,
uint32_t payload_type,
void *payload_data,
- AVBufferRef *payload_buf);
+ void *payload_ref);
/**
* Iterate over messages with the given payload type in an access unit.