mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-01-12 00:06:51 +08:00
avcodec/cbs_sei: store a pointer to the start of Registered and Unregistered SEI messages
Required for the following commit, where a parsing function expects the buffer to include the country code bytes. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -28,13 +28,13 @@
|
||||
static void cbs_free_user_data_registered(AVRefStructOpaque unused, void *obj)
|
||||
{
|
||||
SEIRawUserDataRegistered *udr = obj;
|
||||
av_refstruct_unref(&udr->data);
|
||||
av_refstruct_unref(&udr->data_ref);
|
||||
}
|
||||
|
||||
static void cbs_free_user_data_unregistered(AVRefStructOpaque unused, void *obj)
|
||||
{
|
||||
SEIRawUserDataUnregistered *udu = obj;
|
||||
av_refstruct_unref(&udu->data);
|
||||
av_refstruct_unref(&udu->data_ref);
|
||||
}
|
||||
|
||||
int ff_cbs_sei_alloc_message_payload(SEIRawMessage *message,
|
||||
|
||||
@@ -33,13 +33,15 @@ 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; ///< RefStruct reference
|
||||
uint8_t *data;
|
||||
uint8_t *data_ref; ///< RefStruct reference
|
||||
size_t data_length;
|
||||
} SEIRawUserDataRegistered;
|
||||
|
||||
typedef struct SEIRawUserDataUnregistered {
|
||||
uint8_t uuid_iso_iec_11578[16];
|
||||
uint8_t *data; ///< RefStruct reference
|
||||
uint8_t *data;
|
||||
uint8_t *data_ref; ///< RefStruct reference
|
||||
size_t data_length;
|
||||
} SEIRawUserDataUnregistered;
|
||||
|
||||
|
||||
@@ -57,9 +57,16 @@ SEI_FUNC(user_data_registered, (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
current->data_length = state->payload_size - i;
|
||||
#endif
|
||||
|
||||
allocate(current->data_ref, state->payload_size);
|
||||
current->data = current->data_ref;
|
||||
|
||||
*current->data++ = current->itu_t_t35_country_code;
|
||||
if (current->itu_t_t35_country_code == 0xff)
|
||||
*current->data++ = current->itu_t_t35_country_code_extension_byte;
|
||||
#else
|
||||
allocate(current->data, current->data_length);
|
||||
#endif
|
||||
for (j = 0; j < current->data_length; j++)
|
||||
xu(8, itu_t_t35_payload_byte[], current->data[j], 0x00, 0xff, 1, i + j);
|
||||
|
||||
@@ -86,7 +93,13 @@ SEI_FUNC(user_data_unregistered, (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
for (i = 0; i < 16; i++)
|
||||
us(8, uuid_iso_iec_11578[i], 0x00, 0xff, 1, i);
|
||||
|
||||
#ifdef READ
|
||||
allocate(current->data_ref, state->payload_size);
|
||||
memcpy(current->data_ref, current->uuid_iso_iec_11578, sizeof(current->uuid_iso_iec_11578));
|
||||
current->data = current->data_ref + 16;
|
||||
#else
|
||||
allocate(current->data, current->data_length);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < current->data_length; i++)
|
||||
xu(8, user_data_payload_byte[i], current->data[i], 0x00, 0xff, 1, i);
|
||||
|
||||
Reference in New Issue
Block a user