1 /* 2 * HEVC Supplementary Enhancement Information messages 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef AVCODEC_HEVC_SEI_H 22 #define AVCODEC_HEVC_SEI_H 23 24 #include <stdint.h> 25 26 #include "get_bits.h" 27 #include "sei.h" 28 29 30 typedef enum { 31 HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, 32 HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 33 } HEVC_SEI_PicStructType; 34 35 typedef struct HEVCSEIPictureHash { 36 uint8_t md5[3][16]; 37 uint8_t is_md5; 38 } HEVCSEIPictureHash; 39 40 typedef struct HEVCSEIFramePacking { 41 int present; 42 int arrangement_type; 43 int content_interpretation_type; 44 int quincunx_subsampling; 45 int current_frame_is_frame0_flag; 46 } HEVCSEIFramePacking; 47 48 typedef struct HEVCSEIDisplayOrientation { 49 int present; 50 int anticlockwise_rotation; 51 int hflip, vflip; 52 } HEVCSEIDisplayOrientation; 53 54 typedef struct HEVCSEIPictureTiming { 55 int picture_struct; 56 } HEVCSEIPictureTiming; 57 58 typedef struct HEVCSEIA53Caption { 59 AVBufferRef *buf_ref; 60 } HEVCSEIA53Caption; 61 62 typedef struct HEVCSEIUnregistered { 63 AVBufferRef **buf_ref; 64 int nb_buf_ref; 65 } HEVCSEIUnregistered; 66 67 typedef struct HEVCSEIMasteringDisplay { 68 int present; 69 uint16_t display_primaries[3][2]; 70 uint16_t white_point[2]; 71 uint32_t max_luminance; 72 uint32_t min_luminance; 73 } HEVCSEIMasteringDisplay; 74 75 typedef struct HEVCSEIDynamicHDRPlus { 76 AVBufferRef *info; 77 } HEVCSEIDynamicHDRPlus; 78 79 typedef struct HEVCSEIContentLight { 80 int present; 81 uint16_t max_content_light_level; 82 uint16_t max_pic_average_light_level; 83 } HEVCSEIContentLight; 84 85 typedef struct HEVCSEIAlternativeTransfer { 86 int present; 87 int preferred_transfer_characteristics; 88 } HEVCSEIAlternativeTransfer; 89 90 typedef struct HEVCSEITimeCode { 91 int present; 92 uint8_t num_clock_ts; 93 uint8_t clock_timestamp_flag[3]; 94 uint8_t units_field_based_flag[3]; 95 uint8_t counting_type[3]; 96 uint8_t full_timestamp_flag[3]; 97 uint8_t discontinuity_flag[3]; 98 uint8_t cnt_dropped_flag[3]; 99 uint16_t n_frames[3]; 100 uint8_t seconds_value[3]; 101 uint8_t minutes_value[3]; 102 uint8_t hours_value[3]; 103 uint8_t seconds_flag[3]; 104 uint8_t minutes_flag[3]; 105 uint8_t hours_flag[3]; 106 uint8_t time_offset_length[3]; 107 int32_t time_offset_value[3]; 108 } HEVCSEITimeCode; 109 110 typedef struct HEVCSEI { 111 HEVCSEIPictureHash picture_hash; 112 HEVCSEIFramePacking frame_packing; 113 HEVCSEIDisplayOrientation display_orientation; 114 HEVCSEIPictureTiming picture_timing; 115 HEVCSEIA53Caption a53_caption; 116 HEVCSEIUnregistered unregistered; 117 HEVCSEIMasteringDisplay mastering_display; 118 HEVCSEIDynamicHDRPlus dynamic_hdr_plus; 119 HEVCSEIContentLight content_light; 120 int active_seq_parameter_set_id; 121 HEVCSEIAlternativeTransfer alternative_transfer; 122 HEVCSEITimeCode timecode; 123 } HEVCSEI; 124 125 struct HEVCParamSets; 126 127 int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, 128 const struct HEVCParamSets *ps, int type); 129 130 /** 131 * Reset SEI values that are stored on the Context. 132 * e.g. Caption data that was extracted during NAL 133 * parsing. 134 * 135 * @param s HEVCContext. 136 */ 137 void ff_hevc_reset_sei(HEVCSEI *s); 138 139 #endif /* AVCODEC_HEVC_SEI_H */ 140