FFmpeg
h264_sei.h
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_H264_SEI_H
20 #define AVCODEC_H264_SEI_H
21 
22 #include "get_bits.h"
23 
27 typedef enum {
28  H264_SEI_TYPE_BUFFERING_PERIOD = 0,
29  H264_SEI_TYPE_PIC_TIMING = 1,
30  H264_SEI_TYPE_FILLER_PAYLOAD = 3,
31  H264_SEI_TYPE_USER_DATA_REGISTERED = 4,
32  H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5,
33  H264_SEI_TYPE_RECOVERY_POINT = 6,
34  H264_SEI_TYPE_FRAME_PACKING = 45,
35  H264_SEI_TYPE_DISPLAY_ORIENTATION = 47,
36  H264_SEI_TYPE_GREEN_METADATA = 56,
37  H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147,
38 } H264_SEI_Type;
39 
43 typedef enum {
44  H264_SEI_PIC_STRUCT_FRAME = 0,
45  H264_SEI_PIC_STRUCT_TOP_FIELD = 1,
46  H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
47  H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
48  H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
49  H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
50  H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
51  H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
52  H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
53 } H264_SEI_PicStructType;
54 
58 typedef enum {
59  H264_SEI_FPA_TYPE_CHECKERBOARD = 0,
60  H264_SEI_FPA_TYPE_INTERLEAVE_COLUMN = 1,
61  H264_SEI_FPA_TYPE_INTERLEAVE_ROW = 2,
62  H264_SEI_FPA_TYPE_SIDE_BY_SIDE = 3,
63  H264_SEI_FPA_TYPE_TOP_BOTTOM = 4,
64  H264_SEI_FPA_TYPE_INTERLEAVE_TEMPORAL = 5,
65  H264_SEI_FPA_TYPE_2D = 6,
66 } H264_SEI_FpaType;
67 
68 typedef struct H264SEIPictureTiming {
69  int present;
70  H264_SEI_PicStructType pic_struct;
71 
77  int ct_type;
78 
83 
89 
90 typedef struct H264SEIAFD {
91  int present;
92  uint8_t active_format_description;
93 } H264SEIAFD;
94 
95 typedef struct H264SEIA53Caption {
96  int a53_caption_size;
97  uint8_t *a53_caption;
99 
100 typedef struct H264SEIUnregistered {
101  int x264_build;
103 
104 typedef struct H264SEIRecoveryPoint {
114 
115 typedef struct H264SEIBufferingPeriod {
116  int present;
117  int initial_cpb_removal_delay[32];
119 
120 typedef struct H264SEIFramePacking {
121  int present;
122  int arrangement_id;
124  H264_SEI_FpaType arrangement_type;
125  int arrangement_repetition_period;
126  int content_interpretation_type;
127  int quincunx_sampling_flag;
128  int current_frame_is_frame0_flag;
130 
132  int present;
133  int anticlockwise_rotation;
134  int hflip, vflip;
136 
137 typedef struct H264SEIGreenMetaData {
138  uint8_t green_metadata_type;
139  uint8_t period_type;
140  uint16_t num_seconds;
141  uint16_t num_pictures;
142  uint8_t percent_non_zero_macroblocks;
143  uint8_t percent_intra_coded_macroblocks;
144  uint8_t percent_six_tap_filtering;
145  uint8_t percent_alpha_point_deblocking_instance;
146  uint8_t xsd_metric_type;
147  uint16_t xsd_metric_value;
149 
151  int present;
152  int preferred_transfer_characteristics;
154 
155 typedef struct H264SEIContext {
156  H264SEIPictureTiming picture_timing;
157  H264SEIAFD afd;
158  H264SEIA53Caption a53_caption;
159  H264SEIUnregistered unregistered;
160  H264SEIRecoveryPoint recovery_point;
161  H264SEIBufferingPeriod buffering_period;
162  H264SEIFramePacking frame_packing;
163  H264SEIDisplayOrientation display_orientation;
164  H264SEIGreenMetaData green_metadata;
165  H264SEIAlternativeTransfer alternative_transfer;
167 
168 struct H264ParamSets;
169 
170 int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
171  const struct H264ParamSets *ps, void *logctx);
172 
177 
181 const char *ff_h264_sei_stereo_mode(const H264SEIFramePacking *h);
182 
183 #endif /* AVCODEC_H264_SEI_H */
int recovery_frame_cnt
recovery_frame_cnt
Definition: h264_sei.h:112
Definition: h264_sei.h:120
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
Definition: h264_sei.c:41
Definition: h264_sei.h:90
const char * ff_h264_sei_stereo_mode(const H264SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
Definition: h264_sei.c:466
bitstream reader API header.
Definition: h264_sei.h:131
int present
Buffering period SEI flag.
Definition: h264_sei.h:116
Definition: h264_sei.h:150
int ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
Definition: h264_sei.h:77
Definition: h264_sei.h:155
Definition: h264_sei.h:104
int cpb_removal_delay
cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
Definition: h264_sei.h:87
Definition: h264_sei.h:100
Definition: h264_sei.h:137
Definition: h264_sei.h:68
Definition: h264_ps.h:137
Definition: h264_sei.h:95
Definition: get_bits.h:56
int dpb_output_delay
dpb_output_delay in picture timing SEI message, see H.264 C.2.2
Definition: h264_sei.h:82
Definition: h264_sei.h:115
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
Definition: h264_sei.h:123