aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2021-01-21 14:37:49 +0000
committerMark Thompson <sw@jkqxz.net>2021-01-21 17:13:54 +0000
commit64b3aac8d07a8744656737619b70977359d9a6a5 (patch)
treeaa63fcbe0ae131157dd24567b7a56b729d6668d0 /libavcodec
parent9ef32649d02109c364387edcbb55932491f1dcf1 (diff)
downloadffmpeg-64b3aac8d07a8744656737619b70977359d9a6a5.tar.gz
h264: Use common SEI types
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cbs_h2645.c18
-rw-r--r--libavcodec/cbs_h264_syntax_template.c20
-rw-r--r--libavcodec/h264_metadata_bsf.c8
-rw-r--r--libavcodec/h264_sei.c18
-rw-r--r--libavcodec/h264_sei.h18
-rw-r--r--libavcodec/vaapi_encode_h264.c8
-rw-r--r--libavcodec/videotoolboxenc.c6
7 files changed, 40 insertions, 56 deletions
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 9e210abba4..d26d85bcd3 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1384,18 +1384,18 @@ static void cbs_h265_close(CodedBitstreamContext *ctx)
static void cbs_h264_free_sei_payload(H264RawSEIPayload *payload)
{
switch (payload->payload_type) {
- case H264_SEI_TYPE_BUFFERING_PERIOD:
- case H264_SEI_TYPE_PIC_TIMING:
- case H264_SEI_TYPE_PAN_SCAN_RECT:
- 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:
+ case SEI_TYPE_BUFFERING_PERIOD:
+ case SEI_TYPE_PIC_TIMING:
+ case SEI_TYPE_PAN_SCAN_RECT:
+ case SEI_TYPE_RECOVERY_POINT:
+ case SEI_TYPE_DISPLAY_ORIENTATION:
+ case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
+ case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
break;
- case H264_SEI_TYPE_USER_DATA_REGISTERED:
+ case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
av_buffer_unref(&payload->payload.user_data_registered.data_ref);
break;
- case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
+ case SEI_TYPE_USER_DATA_UNREGISTERED:
av_buffer_unref(&payload->payload.user_data_unregistered.data_ref);
break;
default:
diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 76ed51cc7b..37047dc30b 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -747,45 +747,45 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
#endif
switch (current->payload_type) {
- case H264_SEI_TYPE_BUFFERING_PERIOD:
+ case SEI_TYPE_BUFFERING_PERIOD:
CHECK(FUNC(sei_buffering_period)
(ctx, rw, &current->payload.buffering_period));
break;
- case H264_SEI_TYPE_PIC_TIMING:
+ case SEI_TYPE_PIC_TIMING:
CHECK(FUNC(sei_pic_timing)
(ctx, rw, &current->payload.pic_timing));
break;
- case H264_SEI_TYPE_PAN_SCAN_RECT:
+ case SEI_TYPE_PAN_SCAN_RECT:
CHECK(FUNC(sei_pan_scan_rect)
(ctx, rw, &current->payload.pan_scan_rect));
break;
- case H264_SEI_TYPE_FILLER_PAYLOAD:
+ case SEI_TYPE_FILLER_PAYLOAD:
{
for (i = 0; i < current->payload_size; i++)
fixed(8, ff_byte, 0xff);
}
break;
- case H264_SEI_TYPE_USER_DATA_REGISTERED:
+ case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
CHECK(FUNC_SEI(sei_user_data_registered)
(ctx, rw, &current->payload.user_data_registered, &current->payload_size));
break;
- case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
+ case SEI_TYPE_USER_DATA_UNREGISTERED:
CHECK(FUNC_SEI(sei_user_data_unregistered)
(ctx, rw, &current->payload.user_data_unregistered, &current->payload_size));
break;
- case H264_SEI_TYPE_RECOVERY_POINT:
+ case SEI_TYPE_RECOVERY_POINT:
CHECK(FUNC(sei_recovery_point)
(ctx, rw, &current->payload.recovery_point));
break;
- case H264_SEI_TYPE_DISPLAY_ORIENTATION:
+ case SEI_TYPE_DISPLAY_ORIENTATION:
CHECK(FUNC(sei_display_orientation)
(ctx, rw, &current->payload.display_orientation));
break;
- case H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
+ case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
CHECK(FUNC_SEI(sei_mastering_display_colour_volume)
(ctx, rw, &current->payload.mastering_display_colour_volume));
break;
- case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
+ case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
CHECK(FUNC_SEI(sei_alternative_transfer_characteristics)
(ctx, rw, &current->payload.alternative_transfer_characteristics));
break;
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index f39e649ac6..2228761113 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -435,7 +435,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
for (j = sei->payload_count - 1; j >= 0; j--) {
if (sei->payload[j].payload_type ==
- H264_SEI_TYPE_FILLER_PAYLOAD)
+ SEI_TYPE_FILLER_PAYLOAD)
ff_cbs_h264_delete_sei_message(au, &au->units[i], j);
}
}
@@ -454,7 +454,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
int32_t *matrix;
if (sei->payload[j].payload_type !=
- H264_SEI_TYPE_DISPLAY_ORIENTATION)
+ SEI_TYPE_DISPLAY_ORIENTATION)
continue;
disp = &sei->payload[j].payload.display_orientation;
@@ -492,7 +492,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
}
if (ctx->display_orientation == INSERT) {
H264RawSEIPayload payload = {
- .payload_type = H264_SEI_TYPE_DISPLAY_ORIENTATION,
+ .payload_type = SEI_TYPE_DISPLAY_ORIENTATION,
};
H264RawSEIDisplayOrientation *disp =
&payload.payload.display_orientation;
@@ -590,7 +590,7 @@ static int h264_metadata_init(AVBSFContext *bsf)
int j;
ctx->sei_user_data_payload.payload_type =
- H264_SEI_TYPE_USER_DATA_UNREGISTERED;
+ SEI_TYPE_USER_DATA_UNREGISTERED;
// Parse UUID. It must be a hex string of length 32, possibly
// containing '-'s between hex digits (which we ignore).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 793446be84..ca2ca59e1f 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -444,31 +444,31 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
return ret;
switch (type) {
- case H264_SEI_TYPE_PIC_TIMING: // Picture timing SEI
+ case SEI_TYPE_PIC_TIMING: // Picture timing SEI
ret = decode_picture_timing(&h->picture_timing, &gb_payload, logctx);
break;
- case H264_SEI_TYPE_USER_DATA_REGISTERED:
+ case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
ret = decode_registered_user_data(h, &gb_payload, logctx, size);
break;
- case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
+ case SEI_TYPE_USER_DATA_UNREGISTERED:
ret = decode_unregistered_user_data(&h->unregistered, &gb_payload, logctx, size);
break;
- case H264_SEI_TYPE_RECOVERY_POINT:
+ case SEI_TYPE_RECOVERY_POINT:
ret = decode_recovery_point(&h->recovery_point, &gb_payload, logctx);
break;
- case H264_SEI_TYPE_BUFFERING_PERIOD:
+ case SEI_TYPE_BUFFERING_PERIOD:
ret = decode_buffering_period(&h->buffering_period, &gb_payload, ps, logctx);
break;
- case H264_SEI_TYPE_FRAME_PACKING:
+ case SEI_TYPE_FRAME_PACKING_ARRANGEMENT:
ret = decode_frame_packing_arrangement(&h->frame_packing, &gb_payload);
break;
- case H264_SEI_TYPE_DISPLAY_ORIENTATION:
+ case SEI_TYPE_DISPLAY_ORIENTATION:
ret = decode_display_orientation(&h->display_orientation, &gb_payload);
break;
- case H264_SEI_TYPE_GREEN_METADATA:
+ case SEI_TYPE_GREEN_METADATA:
ret = decode_green_metadata(&h->green_metadata, &gb_payload);
break;
- case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
+ case SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
ret = decode_alternative_transfer(&h->alternative_transfer, &gb_payload);
break;
default:
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index 4fdcf4ed3f..14cc559361 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -21,24 +21,8 @@
#include "get_bits.h"
#include "h264_ps.h"
+#include "sei.h"
-/**
- * SEI message types
- */
-typedef enum {
- H264_SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
- H264_SEI_TYPE_PIC_TIMING = 1, ///< picture timing
- H264_SEI_TYPE_PAN_SCAN_RECT = 2, ///< pan-scan rectangle
- H264_SEI_TYPE_FILLER_PAYLOAD = 3, ///< filler data
- H264_SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
- H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
- H264_SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
- H264_SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
- H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
- H264_SEI_TYPE_GREEN_METADATA = 56, ///< GreenMPEG information
- H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137, ///< mastering display properties
- H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, ///< alternative transfer
-} H264_SEI_Type;
/**
* pic_struct in picture timing SEI message
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index b577d09caf..13120b05af 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -231,22 +231,22 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
i = 0;
if (priv->sei_needed & SEI_IDENTIFIER) {
- sei->payload[i].payload_type = H264_SEI_TYPE_USER_DATA_UNREGISTERED;
+ sei->payload[i].payload_type = SEI_TYPE_USER_DATA_UNREGISTERED;
sei->payload[i].payload.user_data_unregistered = priv->sei_identifier;
++i;
}
if (priv->sei_needed & SEI_TIMING) {
if (pic->type == PICTURE_TYPE_IDR) {
- sei->payload[i].payload_type = H264_SEI_TYPE_BUFFERING_PERIOD;
+ sei->payload[i].payload_type = SEI_TYPE_BUFFERING_PERIOD;
sei->payload[i].payload.buffering_period = priv->sei_buffering_period;
++i;
}
- sei->payload[i].payload_type = H264_SEI_TYPE_PIC_TIMING;
+ sei->payload[i].payload_type = SEI_TYPE_PIC_TIMING;
sei->payload[i].payload.pic_timing = priv->sei_pic_timing;
++i;
}
if (priv->sei_needed & SEI_RECOVERY_POINT) {
- sei->payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
+ sei->payload[i].payload_type = SEI_TYPE_RECOVERY_POINT;
sei->payload[i].payload.recovery_point = priv->sei_recovery_point;
++i;
}
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 400401550a..a333a9a10c 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1751,7 +1751,7 @@ static int copy_replace_length_codes(
remaining_dst_size--;
wrote_bytes = write_sei(sei,
- H264_SEI_TYPE_USER_DATA_REGISTERED,
+ SEI_TYPE_USER_DATA_REGISTERED,
dst_data,
remaining_dst_size);
@@ -1807,7 +1807,7 @@ static int copy_replace_length_codes(
return status;
wrote_bytes = write_sei(sei,
- H264_SEI_TYPE_USER_DATA_REGISTERED,
+ SEI_TYPE_USER_DATA_REGISTERED,
new_sei,
remaining_dst_size - old_sei_length);
if (wrote_bytes < 0)
@@ -1903,7 +1903,7 @@ static int vtenc_cm_to_avpacket(
if (sei) {
size_t msg_size = get_sei_msg_bytes(sei,
- H264_SEI_TYPE_USER_DATA_REGISTERED);
+ SEI_TYPE_USER_DATA_REGISTERED);
sei_nalu_size = sizeof(start_code) + 1 + msg_size + 1;
}