]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_sei.h
avcodec/parser: Remove deprecated av_parser_change
[ffmpeg] / libavcodec / h264_sei.h
index 5b7c8ef9d8aa859a792c10566c8e5f35a903ea19..14cc559361d614a4e943e9b47fa9685155c28874 100644 (file)
 #define AVCODEC_H264_SEI_H
 
 #include "get_bits.h"
+#include "h264_ps.h"
+#include "sei.h"
 
-/**
- * SEI message types
- */
-typedef enum {
-    H264_SEI_TYPE_BUFFERING_PERIOD       = 0,   ///< buffering period (H.264, D.1.1)
-    H264_SEI_TYPE_PIC_TIMING             = 1,   ///< picture timing
-    H264_SEI_TYPE_PAN_SCAN_RECT          = 2,   ///< pan-scan rectangle
-    H264_SEI_TYPE_FILLER_PAYLOAD         = 3,   ///< filler data
-    H264_SEI_TYPE_USER_DATA_REGISTERED   = 4,   ///< registered user data as specified by Rec. ITU-T T.35
-    H264_SEI_TYPE_USER_DATA_UNREGISTERED = 5,   ///< unregistered user data
-    H264_SEI_TYPE_RECOVERY_POINT         = 6,   ///< recovery point (frame # to decoder sync)
-    H264_SEI_TYPE_FRAME_PACKING          = 45,  ///< frame packing arrangement
-    H264_SEI_TYPE_DISPLAY_ORIENTATION    = 47,  ///< display orientation
-    H264_SEI_TYPE_GREEN_METADATA         = 56,  ///< GreenMPEG information
-    H264_SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME = 137,  ///< mastering display properties
-    H264_SEI_TYPE_ALTERNATIVE_TRANSFER   = 147, ///< alternative transfer
-} H264_SEI_Type;
 
 /**
  * pic_struct in picture timing SEI message
@@ -67,7 +52,22 @@ typedef enum {
     H264_SEI_FPA_TYPE_2D                  = 6,
 } H264_SEI_FpaType;
 
+typedef struct H264SEITimeCode {
+    /* When not continuously receiving full timecodes, we have to reference
+       the previous timecode received */
+    int full;
+    int frame;
+    int seconds;
+    int minutes;
+    int hours;
+    int dropframe;
+} H264SEITimeCode;
+
 typedef struct H264SEIPictureTiming {
+    // maximum size of pic_timing according to the spec should be 274 bits
+    uint8_t payload[40];
+    int     payload_size_bits;
+
     int present;
     H264_SEI_PicStructType pic_struct;
 
@@ -87,6 +87,16 @@ typedef struct H264SEIPictureTiming {
      * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
      */
     int cpb_removal_delay;
+
+    /**
+     * Maximum three timecodes in a pic_timing SEI.
+     */
+    H264SEITimeCode timecode[3];
+
+    /**
+     * Number of timecode in use
+     */
+    int timecode_cnt;
 } H264SEIPictureTiming;
 
 typedef struct H264SEIAFD {
@@ -100,6 +110,8 @@ typedef struct H264SEIA53Caption {
 
 typedef struct H264SEIUnregistered {
     int x264_build;
+    AVBufferRef **buf_ref;
+    int nb_buf_ref;
 } H264SEIUnregistered;
 
 typedef struct H264SEIRecoveryPoint {
@@ -181,4 +193,10 @@ void ff_h264_sei_uninit(H264SEIContext *h);
  */
 const char *ff_h264_sei_stereo_mode(const H264SEIFramePacking *h);
 
+/**
+ * Parse the contents of a picture timing message given an active SPS.
+ */
+int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps,
+                                       void *logctx);
+
 #endif /* AVCODEC_H264_SEI_H */