Commit 6eb102a6 authored by Mark Thompson's avatar Mark Thompson

h264_sei: Add namespace prefix to all SEI values

This avoids confusion with equivalent H.265 SEI values when both are
being used at the same time.

(cherry picked from commit 6ea220cb)
parent 1db03e95
...@@ -473,23 +473,23 @@ static inline int parse_nal_units(AVCodecParserContext *s, ...@@ -473,23 +473,23 @@ static inline int parse_nal_units(AVCodecParserContext *s,
if (sps->pic_struct_present_flag && p->sei.picture_timing.present) { if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
switch (p->sei.picture_timing.pic_struct) { switch (p->sei.picture_timing.pic_struct) {
case SEI_PIC_STRUCT_TOP_FIELD: case H264_SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_BOTTOM_FIELD: case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
s->repeat_pict = 0; s->repeat_pict = 0;
break; break;
case SEI_PIC_STRUCT_FRAME: case H264_SEI_PIC_STRUCT_FRAME:
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
s->repeat_pict = 1; s->repeat_pict = 1;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
s->repeat_pict = 2; s->repeat_pict = 2;
break; break;
case SEI_PIC_STRUCT_FRAME_DOUBLING: case H264_SEI_PIC_STRUCT_FRAME_DOUBLING:
s->repeat_pict = 3; s->repeat_pict = 3;
break; break;
case SEI_PIC_STRUCT_FRAME_TRIPLING: case H264_SEI_PIC_STRUCT_FRAME_TRIPLING:
s->repeat_pict = 5; s->repeat_pict = 5;
break; break;
default: default:
...@@ -504,12 +504,12 @@ static inline int parse_nal_units(AVCodecParserContext *s, ...@@ -504,12 +504,12 @@ static inline int parse_nal_units(AVCodecParserContext *s,
s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
if (sps->pic_struct_present_flag && p->sei.picture_timing.present) { if (sps->pic_struct_present_flag && p->sei.picture_timing.present) {
switch (p->sei.picture_timing.pic_struct) { switch (p->sei.picture_timing.pic_struct) {
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
s->field_order = AV_FIELD_TT; s->field_order = AV_FIELD_TT;
break; break;
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
s->field_order = AV_FIELD_BB; s->field_order = AV_FIELD_BB;
break; break;
default: default:
......
...@@ -81,7 +81,7 @@ static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb, ...@@ -81,7 +81,7 @@ static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
h->pic_struct = get_bits(gb, 4); h->pic_struct = get_bits(gb, 4);
h->ct_type = 0; h->ct_type = 0;
if (h->pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) if (h->pic_struct > H264_SEI_PIC_STRUCT_FRAME_TRIPLING)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
num_clock_ts = sei_num_clock_ts_table[h->pic_struct]; num_clock_ts = sei_num_clock_ts_table[h->pic_struct];
...@@ -421,31 +421,31 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, ...@@ -421,31 +421,31 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
next = get_bits_count(gb) + 8 * size; next = get_bits_count(gb) + 8 * size;
switch (type) { switch (type) {
case SEI_TYPE_PIC_TIMING: // Picture timing SEI case H264_SEI_TYPE_PIC_TIMING: // Picture timing SEI
ret = decode_picture_timing(&h->picture_timing, gb, ps, logctx); ret = decode_picture_timing(&h->picture_timing, gb, ps, logctx);
break; break;
case SEI_TYPE_USER_DATA_REGISTERED: case H264_SEI_TYPE_USER_DATA_REGISTERED:
ret = decode_registered_user_data(h, gb, logctx, size); ret = decode_registered_user_data(h, gb, logctx, size);
break; break;
case SEI_TYPE_USER_DATA_UNREGISTERED: case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size); ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size);
break; break;
case SEI_TYPE_RECOVERY_POINT: case H264_SEI_TYPE_RECOVERY_POINT:
ret = decode_recovery_point(&h->recovery_point, gb); ret = decode_recovery_point(&h->recovery_point, gb);
break; break;
case SEI_TYPE_BUFFERING_PERIOD: case H264_SEI_TYPE_BUFFERING_PERIOD:
ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx); ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx);
break; break;
case SEI_TYPE_FRAME_PACKING: case H264_SEI_TYPE_FRAME_PACKING:
ret = decode_frame_packing_arrangement(&h->frame_packing, gb); ret = decode_frame_packing_arrangement(&h->frame_packing, gb);
break; break;
case SEI_TYPE_DISPLAY_ORIENTATION: case H264_SEI_TYPE_DISPLAY_ORIENTATION:
ret = decode_display_orientation(&h->display_orientation, gb); ret = decode_display_orientation(&h->display_orientation, gb);
break; break;
case SEI_TYPE_GREEN_METADATA: case H264_SEI_TYPE_GREEN_METADATA:
ret = decode_green_metadata(&h->green_metadata, gb); ret = decode_green_metadata(&h->green_metadata, gb);
break; break;
case SEI_TYPE_ALTERNATIVE_TRANSFER: case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
ret = decode_alternative_transfer(&h->alternative_transfer, gb); ret = decode_alternative_transfer(&h->alternative_transfer, gb);
break; break;
default: default:
......
...@@ -25,31 +25,32 @@ ...@@ -25,31 +25,32 @@
* SEI message types * SEI message types
*/ */
typedef enum { typedef enum {
SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) H264_SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
SEI_TYPE_PIC_TIMING = 1, ///< picture timing H264_SEI_TYPE_PIC_TIMING = 1, ///< picture timing
SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35 H264_SEI_TYPE_FILLER_PAYLOAD = 3, ///< filler data
SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data H264_SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync) H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement H264_SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation H264_SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
SEI_TYPE_GREEN_METADATA = 56, ///< GreenMPEG information H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
SEI_TYPE_ALTERNATIVE_TRANSFER = 147, ///< alternative transfer H264_SEI_TYPE_GREEN_METADATA = 56, ///< GreenMPEG information
} SEI_Type; H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, ///< alternative transfer
} H264_SEI_Type;
/** /**
* pic_struct in picture timing SEI message * pic_struct in picture timing SEI message
*/ */
typedef enum { typedef enum {
SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame H264_SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field H264_SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
} SEI_PicStructType; } H264_SEI_PicStructType;
/** /**
* frame_packing_arrangement types * frame_packing_arrangement types
...@@ -66,7 +67,7 @@ typedef enum { ...@@ -66,7 +67,7 @@ typedef enum {
typedef struct H264SEIPictureTiming { typedef struct H264SEIPictureTiming {
int present; int present;
SEI_PicStructType pic_struct; H264_SEI_PicStructType pic_struct;
/** /**
* Bit set of clock types for fields/frames in picture timing SEI message. * Bit set of clock types for fields/frames in picture timing SEI message.
......
...@@ -1150,37 +1150,37 @@ static int h264_export_frame_props(H264Context *h) ...@@ -1150,37 +1150,37 @@ static int h264_export_frame_props(H264Context *h)
if (sps->pic_struct_present_flag && h->sei.picture_timing.present) { if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
H264SEIPictureTiming *pt = &h->sei.picture_timing; H264SEIPictureTiming *pt = &h->sei.picture_timing;
switch (pt->pic_struct) { switch (pt->pic_struct) {
case SEI_PIC_STRUCT_FRAME: case H264_SEI_PIC_STRUCT_FRAME:
break; break;
case SEI_PIC_STRUCT_TOP_FIELD: case H264_SEI_PIC_STRUCT_TOP_FIELD:
case SEI_PIC_STRUCT_BOTTOM_FIELD: case H264_SEI_PIC_STRUCT_BOTTOM_FIELD:
cur->f->interlaced_frame = 1; cur->f->interlaced_frame = 1;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
case SEI_PIC_STRUCT_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
if (FIELD_OR_MBAFF_PICTURE(h)) if (FIELD_OR_MBAFF_PICTURE(h))
cur->f->interlaced_frame = 1; cur->f->interlaced_frame = 1;
else else
// try to flag soft telecine progressive // try to flag soft telecine progressive
cur->f->interlaced_frame = h->prev_interlaced_frame; cur->f->interlaced_frame = h->prev_interlaced_frame;
break; break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
/* Signal the possibility of telecined film externally /* Signal the possibility of telecined film externally
* (pic_struct 5,6). From these hints, let the applications * (pic_struct 5,6). From these hints, let the applications
* decide if they apply deinterlacing. */ * decide if they apply deinterlacing. */
cur->f->repeat_pict = 1; cur->f->repeat_pict = 1;
break; break;
case SEI_PIC_STRUCT_FRAME_DOUBLING: case H264_SEI_PIC_STRUCT_FRAME_DOUBLING:
cur->f->repeat_pict = 2; cur->f->repeat_pict = 2;
break; break;
case SEI_PIC_STRUCT_FRAME_TRIPLING: case H264_SEI_PIC_STRUCT_FRAME_TRIPLING:
cur->f->repeat_pict = 4; cur->f->repeat_pict = 4;
break; break;
} }
if ((pt->ct_type & 3) && if ((pt->ct_type & 3) &&
pt->pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP) pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP)
cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0; cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0;
} else { } else {
/* Derive interlacing flag from used decoding process. */ /* Derive interlacing flag from used decoding process. */
...@@ -1195,8 +1195,8 @@ static int h264_export_frame_props(H264Context *h) ...@@ -1195,8 +1195,8 @@ static int h264_export_frame_props(H264Context *h)
if (sps->pic_struct_present_flag && h->sei.picture_timing.present) { if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
/* Use picture timing SEI information. Even if it is a /* Use picture timing SEI information. Even if it is a
* information of a past frame, better than nothing. */ * information of a past frame, better than nothing. */
if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM || if (h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP) h->sei.picture_timing.pic_struct == H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->f->top_field_first = 1; cur->f->top_field_first = 1;
else else
cur->f->top_field_first = 0; cur->f->top_field_first = 0;
......
...@@ -644,18 +644,18 @@ static void vaapi_encode_h264_write_sei(PutBitContext *pbc, ...@@ -644,18 +644,18 @@ static void vaapi_encode_h264_write_sei(PutBitContext *pbc,
for (payload_type = 0; payload_type < 64; payload_type++) { for (payload_type = 0; payload_type < 64; payload_type++) {
switch (payload_type) { switch (payload_type) {
case SEI_TYPE_BUFFERING_PERIOD: case H264_SEI_TYPE_BUFFERING_PERIOD:
if (!priv->send_timing_sei || if (!priv->send_timing_sei ||
pic->type != PICTURE_TYPE_IDR) pic->type != PICTURE_TYPE_IDR)
continue; continue;
write_payload = &vaapi_encode_h264_write_buffering_period; write_payload = &vaapi_encode_h264_write_buffering_period;
break; break;
case SEI_TYPE_PIC_TIMING: case H264_SEI_TYPE_PIC_TIMING:
if (!priv->send_timing_sei) if (!priv->send_timing_sei)
continue; continue;
write_payload = &vaapi_encode_h264_write_pic_timing; write_payload = &vaapi_encode_h264_write_pic_timing;
break; break;
case SEI_TYPE_USER_DATA_UNREGISTERED: case H264_SEI_TYPE_USER_DATA_UNREGISTERED:
if (pic->encode_order != 0) if (pic->encode_order != 0)
continue; continue;
write_payload = &vaapi_encode_h264_write_identifier; write_payload = &vaapi_encode_h264_write_identifier;
......
...@@ -1599,7 +1599,7 @@ static int copy_replace_length_codes( ...@@ -1599,7 +1599,7 @@ static int copy_replace_length_codes(
remaining_dst_size--; remaining_dst_size--;
wrote_bytes = write_sei(sei, wrote_bytes = write_sei(sei,
SEI_TYPE_USER_DATA_REGISTERED, H264_SEI_TYPE_USER_DATA_REGISTERED,
dst_data, dst_data,
remaining_dst_size); remaining_dst_size);
...@@ -1655,7 +1655,7 @@ static int copy_replace_length_codes( ...@@ -1655,7 +1655,7 @@ static int copy_replace_length_codes(
return status; return status;
wrote_bytes = write_sei(sei, wrote_bytes = write_sei(sei,
SEI_TYPE_USER_DATA_REGISTERED, H264_SEI_TYPE_USER_DATA_REGISTERED,
new_sei, new_sei,
remaining_dst_size - old_sei_length); remaining_dst_size - old_sei_length);
if (wrote_bytes < 0) if (wrote_bytes < 0)
...@@ -1751,7 +1751,7 @@ static int vtenc_cm_to_avpacket( ...@@ -1751,7 +1751,7 @@ static int vtenc_cm_to_avpacket(
if (sei) { if (sei) {
size_t msg_size = get_sei_msg_bytes(sei, size_t msg_size = get_sei_msg_bytes(sei,
SEI_TYPE_USER_DATA_REGISTERED); H264_SEI_TYPE_USER_DATA_REGISTERED);
sei_nalu_size = sizeof(start_code) + 1 + msg_size + 1; sei_nalu_size = sizeof(start_code) + 1 + msg_size + 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment