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  H264_SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
29  H264_SEI_TYPE_PIC_TIMING = 1, ///< picture timing
30  H264_SEI_TYPE_PAN_SCAN_RECT = 2, ///< pan-scan rectangle
31  H264_SEI_TYPE_FILLER_PAYLOAD = 3, ///< filler data
32  H264_SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
33  H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
34  H264_SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
35  H264_SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
36  H264_SEI_TYPE_DISPLAY_ORIENTATION = 47, ///< display orientation
37  H264_SEI_TYPE_GREEN_METADATA = 56, ///< GreenMPEG information
38  H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137, ///< mastering display properties
39  H264_SEI_TYPE_ALTERNATIVE_TRANSFER = 147, ///< alternative transfer
41 
42 /**
43  * pic_struct in picture timing SEI message
44  */
45 typedef enum {
46  H264_SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
47  H264_SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
48  H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
49  H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
50  H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
51  H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
52  H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
53  H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
54  H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
56 
57 /**
58  * frame_packing_arrangement types
59  */
60 typedef enum {
69 
70 typedef struct H264SEITimeCode {
71  /* When not continuously receiving full timecodes, we have to reference
72  the previous timecode received */
73  int full;
74  int frame;
75  int seconds;
76  int minutes;
77  int hours;
78  int dropframe;
80 
81 typedef struct H264SEIPictureTiming {
82  int present;
84 
85  /**
86  * Bit set of clock types for fields/frames in picture timing SEI message.
87  * For each found ct_type, appropriate bit is set (e.g., bit 1 for
88  * interlaced).
89  */
90  int ct_type;
91 
92  /**
93  * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
94  */
96 
97  /**
98  * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
99  */
101 
102  /**
103  * Maximum three timecodes in a pic_timing SEI.
104  */
106 
107  /**
108  * Number of timecode in use
109  */
112 
113 typedef struct H264SEIAFD {
114  int present;
116 } H264SEIAFD;
117 
118 typedef struct H264SEIA53Caption {
121 
122 typedef struct H264SEIUnregistered {
125 
126 typedef struct H264SEIRecoveryPoint {
127  /**
128  * recovery_frame_cnt
129  *
130  * Set to -1 if no recovery point SEI message found or to number of frames
131  * before playback synchronizes. Frames having recovery point are key
132  * frames.
133  */
136 
137 typedef struct H264SEIBufferingPeriod {
138  int present; ///< Buffering period SEI flag
139  int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
141 
142 typedef struct H264SEIFramePacking {
143  int present;
145  int arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received
152 
154  int present;
156  int hflip, vflip;
158 
159 typedef struct H264SEIGreenMetaData {
162  uint16_t num_seconds;
163  uint16_t num_pictures;
171 
173  int present;
176 
177 typedef struct H264SEIContext {
189 
190 struct H264ParamSets;
191 
193  const struct H264ParamSets *ps, void *logctx);
194 
195 /**
196  * Reset SEI values at the beginning of the frame.
197  */
199 
200 /**
201  * Get stereo_mode string from the h264 frame_packing_arrangement
202  */
203 const char *ff_h264_sei_stereo_mode(const H264SEIFramePacking *h);
204 
205 #endif /* AVCODEC_H264_SEI_H */
int recovery_frame_cnt
recovery_frame_cnt
Definition: h264_sei.h:134
H264_SEI_PicStructType
pic_struct in picture timing SEI message
Definition: h264_sei.h:45
uint16_t num_pictures
Definition: h264_sei.h:163
const char * ff_h264_sei_stereo_mode(const H264SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
Definition: h264_sei.c:479
H264SEIAlternativeTransfer alternative_transfer
Definition: h264_sei.h:187
H264SEIDisplayOrientation display_orientation
Definition: h264_sei.h:185
int current_frame_is_frame0_flag
Definition: h264_sei.h:150
H264SEIGreenMetaData green_metadata
Definition: h264_sei.h:186
H264_SEI_FpaType
frame_packing_arrangement types
Definition: h264_sei.h:60
pan-scan rectangle
Definition: h264_sei.h:30
AVBufferRef * buf_ref
Definition: h264_sei.h:119
4: bottom field, top field, in that order
Definition: h264_sei.h:50
uint8_t
uint8_t green_metadata_type
Definition: h264_sei.h:160
unregistered user data
Definition: h264_sei.h:33
display orientation
Definition: h264_sei.h:36
bitstream reader API header.
H264SEIAFD afd
Definition: h264_sei.h:179
alternative transfer
Definition: h264_sei.h:39
uint16_t num_seconds
Definition: h264_sei.h:162
uint8_t percent_six_tap_filtering
Definition: h264_sei.h:166
int timecode_cnt
Number of timecode in use.
Definition: h264_sei.h:110
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
Definition: h264_sei.c:41
buffering period (H.264, D.1.1)
Definition: h264_sei.h:28
H264_SEI_FpaType arrangement_type
Definition: h264_sei.h:146
int present
Buffering period SEI flag.
Definition: h264_sei.h:138
int arrangement_repetition_period
Definition: h264_sei.h:147
H264SEIUnregistered unregistered
Definition: h264_sei.h:181
uint8_t active_format_description
Definition: h264_sei.h:115
uint8_t percent_non_zero_macroblocks
Definition: h264_sei.h:164
H264_SEI_PicStructType pic_struct
Definition: h264_sei.h:83
int ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
Definition: h264_sei.h:90
picture timing
Definition: h264_sei.h:29
int initial_cpb_removal_delay[32]
Initial timestamps for CPBs.
Definition: h264_sei.h:139
int cpb_removal_delay
cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
Definition: h264_sei.h:100
H264_SEI_Type
SEI message types.
Definition: h264_sei.h:27
int quincunx_sampling_flag
Definition: h264_sei.h:149
5: top field, bottom field, top field repeated, in that order
Definition: h264_sei.h:51
H264SEITimeCode timecode[3]
Maximum three timecodes in a pic_timing SEI.
Definition: h264_sei.h:105
GreenMPEG information.
Definition: h264_sei.h:37
H264SEIA53Caption a53_caption
Definition: h264_sei.h:180
int content_interpretation_type
Definition: h264_sei.h:148
H264SEIBufferingPeriod buffering_period
Definition: h264_sei.h:183
recovery point (frame # to decoder sync)
Definition: h264_sei.h:34
uint8_t percent_intra_coded_macroblocks
Definition: h264_sei.h:165
registered user data as specified by Rec. ITU-T T.35
Definition: h264_sei.h:32
H264SEIPictureTiming picture_timing
Definition: h264_sei.h:178
H264SEIRecoveryPoint recovery_point
Definition: h264_sei.h:182
3: top field, bottom field, in that order
Definition: h264_sei.h:49
uint8_t xsd_metric_type
Definition: h264_sei.h:168
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const struct H264ParamSets *ps, void *logctx)
uint16_t xsd_metric_value
Definition: h264_sei.h:169
A reference to a data buffer.
Definition: buffer.h:81
int dpb_output_delay
dpb_output_delay in picture timing SEI message, see H.264 C.2.2
Definition: h264_sei.h:95
H264SEIFramePacking frame_packing
Definition: h264_sei.h:184
int present
Definition: h264_sei.h:114
mastering display properties
Definition: h264_sei.h:38
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
Definition: h264_sei.h:145
6: bottom field, top field, bottom field repeated, in that order
Definition: h264_sei.h:52
frame packing arrangement
Definition: h264_sei.h:35
uint8_t percent_alpha_point_deblocking_instance
Definition: h264_sei.h:167