avcodec/cbs_h264: add support for Alternative Transfer Characteristics SEI message

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-05-26 15:40:35 -03:00
parent 2880a32c66
commit ff2a638c83
3 changed files with 24 additions and 0 deletions

View File

@ -314,6 +314,10 @@ typedef struct H264RawSEIMasteringDisplayColourVolume {
uint32_t min_display_mastering_luminance;
} H264RawSEIMasteringDisplayColourVolume;
typedef struct H264RawSEIAlternativeTransferCharacteristics {
uint8_t preferred_transfer_characteristics;
} H264RawSEIAlternativeTransferCharacteristics;
typedef struct H264RawSEIPayload {
uint32_t payload_type;
uint32_t payload_size;
@ -327,6 +331,8 @@ typedef struct H264RawSEIPayload {
H264RawSEIRecoveryPoint recovery_point;
H264RawSEIDisplayOrientation display_orientation;
H264RawSEIMasteringDisplayColourVolume mastering_display_colour_volume;
H264RawSEIAlternativeTransferCharacteristics
alternative_transfer_characteristics;
struct {
uint8_t *data;
size_t data_length;

View File

@ -458,6 +458,7 @@ static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
case H264_SEI_TYPE_RECOVERY_POINT:
case H264_SEI_TYPE_DISPLAY_ORIENTATION:
case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
break;
case H264_SEI_TYPE_USER_DATA_REGISTERED:
av_buffer_unref(&payload->payload.user_data_registered.data_ref);

View File

@ -815,6 +815,19 @@ static int FUNC(sei_mastering_display_colour_volume)(CodedBitstreamContext *ctx,
return 0;
}
static int FUNC(sei_alternative_transfer_characteristics)(CodedBitstreamContext *ctx,
RWContext *rw,
H264RawSEIAlternativeTransferCharacteristics *current)
{
int err;
HEADER("Alternative Transfer Characteristics");
ub(8, preferred_transfer_characteristics);
return 0;
}
static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIPayload *current)
{
@ -866,6 +879,10 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
CHECK(FUNC(sei_mastering_display_colour_volume)
(ctx, rw, &current->payload.mastering_display_colour_volume));
break;
case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
CHECK(FUNC(sei_alternative_transfer_characteristics)
(ctx, rw, &current->payload.alternative_transfer_characteristics));
break;
default:
{
#ifdef READ