FFmpeg
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 #include "h264_ps.h"
24 #include "sei.h"
25 
26 
27 /**
28  * pic_struct in picture timing SEI message
29  */
30 typedef enum {
31  H264_SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame
32  H264_SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field
33  H264_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field
34  H264_SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order
35  H264_SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order
36  H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order
37  H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order
38  H264_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling
39  H264_SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling
41 
42 /**
43  * frame_packing_arrangement types
44  */
45 typedef enum {
54 
55 typedef struct H264SEITimeCode {
56  /* When not continuously receiving full timecodes, we have to reference
57  the previous timecode received */
58  int full;
59  int frame;
60  int seconds;
61  int minutes;
62  int hours;
63  int dropframe;
65 
66 typedef struct H264SEIPictureTiming {
67  // maximum size of pic_timing according to the spec should be 274 bits
68  uint8_t payload[40];
70 
71  int present;
73 
74  /**
75  * Bit set of clock types for fields/frames in picture timing SEI message.
76  * For each found ct_type, appropriate bit is set (e.g., bit 1 for
77  * interlaced).
78  */
79  int ct_type;
80 
81  /**
82  * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
83  */
85 
86  /**
87  * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
88  */
90 
91  /**
92  * Maximum three timecodes in a pic_timing SEI.
93  */
94  H264SEITimeCode timecode[3];
95 
96  /**
97  * Number of timecode in use
98  */
101 
102 typedef struct H264SEIAFD {
103  int present;
105 } H264SEIAFD;
106 
107 typedef struct H264SEIA53Caption {
110 
111 typedef struct H264SEIUnregistered {
116 
117 typedef struct H264SEIRecoveryPoint {
118  /**
119  * recovery_frame_cnt
120  *
121  * Set to -1 if no recovery point SEI message found or to number of frames
122  * before playback synchronizes. Frames having recovery point are key
123  * frames.
124  */
127 
128 typedef struct H264SEIBufferingPeriod {
129  int present; ///< Buffering period SEI flag
130  int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
132 
133 typedef struct H264SEIFramePacking {
134  int present;
136  int arrangement_cancel_flag; ///< is previous arrangement canceled, -1 if never received
143 
145  int present;
147  int hflip, vflip;
149 
150 typedef struct H264SEIGreenMetaData {
153  uint16_t num_seconds;
154  uint16_t num_pictures;
162 
164  int present;
167 
168 typedef struct H264SEIContext {
180 
181 struct H264ParamSets;
182 
184  const struct H264ParamSets *ps, void *logctx);
185 
186 /**
187  * Reset SEI values at the beginning of the frame.
188  */
190 
191 /**
192  * Get stereo_mode string from the h264 frame_packing_arrangement
193  */
194 const char *ff_h264_sei_stereo_mode(const H264SEIFramePacking *h);
195 
196 /**
197  * Parse the contents of a picture timing message given an active SPS.
198  */
200  void *logctx);
201 
202 #endif /* AVCODEC_H264_SEI_H */
int recovery_frame_cnt
recovery_frame_cnt
Definition: h264_sei.h:125
H264_SEI_PicStructType
pic_struct in picture timing SEI message
Definition: h264_sei.h:30
uint16_t num_pictures
Definition: h264_sei.h:154
const char * ff_h264_sei_stereo_mode(const H264SEIFramePacking *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
Definition: h264_sei.c:493
Sequence parameter set.
Definition: h264_ps.h:44
H264SEIAlternativeTransfer alternative_transfer
Definition: h264_sei.h:178
H264SEIDisplayOrientation display_orientation
Definition: h264_sei.h:176
int current_frame_is_frame0_flag
Definition: h264_sei.h:141
H264SEIGreenMetaData green_metadata
Definition: h264_sei.h:177
H264_SEI_FpaType
frame_packing_arrangement types
Definition: h264_sei.h:45
AVBufferRef * buf_ref
Definition: h264_sei.h:108
4: bottom field, top field, in that order
Definition: h264_sei.h:35
uint8_t
uint8_t green_metadata_type
Definition: h264_sei.h:151
bitstream reader API header.
H264SEIAFD afd
Definition: h264_sei.h:170
uint16_t num_seconds
Definition: h264_sei.h:153
uint8_t percent_six_tap_filtering
Definition: h264_sei.h:157
int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps, void *logctx)
Parse the contents of a picture timing message given an active SPS.
Definition: h264_sei.c:62
int timecode_cnt
Number of timecode in use.
Definition: h264_sei.h:99
H.264 parameter set handling.
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
Definition: h264_sei.c:42
H264_SEI_FpaType arrangement_type
Definition: h264_sei.h:137
int present
Buffering period SEI flag.
Definition: h264_sei.h:129
int arrangement_repetition_period
Definition: h264_sei.h:138
H264SEIUnregistered unregistered
Definition: h264_sei.h:172
uint8_t active_format_description
Definition: h264_sei.h:104
uint8_t percent_non_zero_macroblocks
Definition: h264_sei.h:155
H264_SEI_PicStructType pic_struct
Definition: h264_sei.h:72
int ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
Definition: h264_sei.h:79
int cpb_removal_delay
cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
Definition: h264_sei.h:89
int quincunx_sampling_flag
Definition: h264_sei.h:140
5: top field, bottom field, top field repeated, in that order
Definition: h264_sei.h:36
H264SEIA53Caption a53_caption
Definition: h264_sei.h:171
int content_interpretation_type
Definition: h264_sei.h:139
H264SEIBufferingPeriod buffering_period
Definition: h264_sei.h:174
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
uint8_t percent_intra_coded_macroblocks
Definition: h264_sei.h:156
H264SEIPictureTiming picture_timing
Definition: h264_sei.h:169
H264SEIRecoveryPoint recovery_point
Definition: h264_sei.h:173
3: top field, bottom field, in that order
Definition: h264_sei.h:34
uint8_t xsd_metric_type
Definition: h264_sei.h:159
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const struct H264ParamSets *ps, void *logctx)
uint16_t xsd_metric_value
Definition: h264_sei.h:160
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:84
H264SEIFramePacking frame_packing
Definition: h264_sei.h:175
AVBufferRef ** buf_ref
Definition: h264_sei.h:113
int present
Definition: h264_sei.h:103
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
Definition: h264_sei.h:136
6: bottom field, top field, bottom field repeated, in that order
Definition: h264_sei.h:37
uint8_t percent_alpha_point_deblocking_instance
Definition: h264_sei.h:158