FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h264_sei.h
Go to the documentation of this file.
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 
24 /**
25  * SEI message types
26  */
27 typedef enum {
28  SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
29  SEI_TYPE_PIC_TIMING = 1, ///< picture timing
30  SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
31  SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
32  SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
33  SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
34  SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
35  SEI_TYPE_GREEN_METADATA = 56 ///< GreenMPEG information
36 } SEI_Type;
37 
38 /**
39  * pic_struct in picture timing SEI message
40  */
41 typedef enum {
42  SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
43  SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
44  SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
45  SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
46  SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
47  SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
48  SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
49  SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
50  SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
52 
53 /**
54  * frame_packing_arrangement types
55  */
56 typedef enum {
64 } SEI_FpaType;
65 
66 typedef struct H264SEIPictureTiming {
67  int present;
69 
70  /**
71  * Bit set of clock types for fields/frames in picture timing SEI message.
72  * For each found ct_type, appropriate bit is set (e.g., bit 1 for
73  * interlaced).
74  */
75  int ct_type;
76 
77  /**
78  * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
79  */
81 
82  /**
83  * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
84  */
87 
88 typedef struct H264SEIAFD {
89  int present;
91 } H264SEIAFD;
92 
93 typedef struct H264SEIA53Caption {
97 
98 typedef struct H264SEIUnregistered {
101 
102 typedef struct H264SEIRecoveryPoint {
103  /**
104  * recovery_frame_cnt
105  *
106  * Set to -1 if no recovery point SEI message found or to number of frames
107  * before playback synchronizes. Frames having recovery point are key
108  * frames.
109  */
112 
113 typedef struct H264SEIBufferingPeriod {
114  int present; ///< Buffering period SEI flag
115  int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
117 
118 typedef struct H264SEIFramePacking {
119  int present;
121  int frame_packing_arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received
127 
129  int present;
131  int hflip, vflip;
133 
134 typedef struct H264SEIGreenMetaData {
137  uint16_t num_seconds;
138  uint16_t num_pictures;
146 
147 typedef struct H264SEIContext {
158 
159 struct H264ParamSets;
160 
162  const struct H264ParamSets *ps, void *logctx);
163 
164 /**
165  * Reset SEI values at the beginning of the frame.
166  */
168 
169 /**
170  * Get stereo_mode string from the h264 frame_packing_arrangement
171  */
172 const char *ff_h264_sei_stereo_mode(const H264SEIFramePacking *h);
173 
174 #endif /* AVCODEC_H264_SEI_H */
int recovery_frame_cnt
recovery_frame_cnt
Definition: h264_sei.h:110
uint16_t num_pictures
Definition: h264_sei.h:138
const char * ff_h264_sei_stereo_mode(const H264SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
Definition: h264_sei.c:457
SEI_Type
SEI message types.
Definition: h264_sei.h:27
int frame_packing_arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
Definition: h264_sei.h:121
GreenMPEG information.
Definition: h264_sei.h:35
picture timing
Definition: h264_sei.h:29
display orientation
Definition: h264_sei.h:34
3: top field, bottom field, in that order
Definition: h264_sei.h:45
H264SEIDisplayOrientation display_orientation
Definition: h264_sei.h:155
8: frame tripling
Definition: h264_sei.h:50
int frame_packing_arrangement_repetition_period
Definition: h264_sei.h:123
H264SEIGreenMetaData green_metadata
Definition: h264_sei.h:156
uint8_t
uint8_t green_metadata_type
Definition: h264_sei.h:135
SEI_PicStructType
pic_struct in picture timing SEI message
Definition: h264_sei.h:41
bitstream reader API header.
H264SEIAFD afd
Definition: h264_sei.h:149
7: frame doubling
Definition: h264_sei.h:49
uint16_t num_seconds
Definition: h264_sei.h:137
uint8_t percent_six_tap_filtering
Definition: h264_sei.h:141
SEI_FpaType frame_packing_arrangement_type
Definition: h264_sei.h:122
int frame_packing_arrangement_id
Definition: h264_sei.h:120
int a53_caption_size
Definition: h264_sei.h:94
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
Definition: h264_sei.c:41
int present
Buffering period SEI flag.
Definition: h264_sei.h:114
registered user data as specified by Rec. ITU-T T.35
Definition: h264_sei.h:30
H264SEIUnregistered unregistered
Definition: h264_sei.h:151
uint8_t active_format_description
Definition: h264_sei.h:90
uint8_t percent_non_zero_macroblocks
Definition: h264_sei.h:139
recovery point (frame # to decoder sync)
Definition: h264_sei.h:32
int ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
Definition: h264_sei.h:75
SEI_FpaType
frame_packing_arrangement types
Definition: h264_sei.h:56
int initial_cpb_removal_delay[32]
Initial timestamps for CPBs.
Definition: h264_sei.h:115
buffering period (H.264, D.1.1)
Definition: h264_sei.h:28
int cpb_removal_delay
cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
Definition: h264_sei.h:85
uint8_t * a53_caption
Definition: h264_sei.h:95
int quincunx_sampling_flag
Definition: h264_sei.h:125
2: bottom field
Definition: h264_sei.h:44
SEI_PicStructType pic_struct
Definition: h264_sei.h:68
H264SEIA53Caption a53_caption
Definition: h264_sei.h:150
5: top field, bottom field, top field repeated, in that order
Definition: h264_sei.h:47
int content_interpretation_type
Definition: h264_sei.h:124
H264SEIBufferingPeriod buffering_period
Definition: h264_sei.h:153
uint8_t percent_intra_coded_macroblocks
Definition: h264_sei.h:140
H264SEIPictureTiming picture_timing
Definition: h264_sei.h:148
H264SEIRecoveryPoint recovery_point
Definition: h264_sei.h:152
uint8_t xsd_metric_type
Definition: h264_sei.h:143
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const struct H264ParamSets *ps, void *logctx)
uint16_t xsd_metric_value
Definition: h264_sei.h:144
int dpb_output_delay
dpb_output_delay in picture timing SEI message, see H.264 C.2.2
Definition: h264_sei.h:80
H264SEIFramePacking frame_packing
Definition: h264_sei.h:154
unregistered user data
Definition: h264_sei.h:31
int present
Definition: h264_sei.h:89
4: bottom field, top field, in that order
Definition: h264_sei.h:46
frame packing arrangement
Definition: h264_sei.h:33
1: top field
Definition: h264_sei.h:43
6: bottom field, top field, bottom field repeated, in that order
Definition: h264_sei.h:48
uint8_t percent_alpha_point_deblocking_instance
Definition: h264_sei.h:142