]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264.h
avfilter/af_sidechaincompress: Also assert that i < 2
[ffmpeg] / libavcodec / h264.h
index f0d569b65f3a097745fe4ffc93a5ed95034d43a3..73562882cdbf8c3604596b4d6fafaf63a1c1c23b 100644 (file)
@@ -137,6 +137,7 @@ typedef enum {
     SEI_TYPE_RECOVERY_POINT         = 6,   ///< recovery point (frame # to decoder sync)
     SEI_TYPE_FRAME_PACKING          = 45,  ///< frame packing arrangement
     SEI_TYPE_DISPLAY_ORIENTATION    = 47,  ///< display orientation
+    SEI_TYPE_GREEN_METADATA         = 56   ///< GreenMPEG information
 } SEI_Type;
 
 /**
@@ -267,6 +268,22 @@ typedef struct FPA {
     int         quincunx_sampling_flag;
 } FPA;
 
+/**
+ *     Green MetaData Information Type
+ */
+typedef struct GreenMetaData {
+    uint8_t  green_metadata_type;
+    uint8_t  period_type;
+    uint16_t  num_seconds;
+    uint16_t  num_pictures;
+    uint8_t percent_non_zero_macroblocks;
+    uint8_t percent_intra_coded_macroblocks;
+    uint8_t percent_six_tap_filtering;
+    uint8_t percent_alpha_point_deblocking_instance;
+    uint8_t xsd_metric_type;
+    uint16_t xsd_metric_value;
+} GreenMetaData;
+
 /**
  * Memory management control operation opcode.
  */
@@ -729,6 +746,8 @@ typedef struct H264Context {
      */
     int sei_reguserdata_afd_present;
     uint8_t active_format_description;
+    int a53_caption_size;
+    uint8_t *a53_caption;
 
     /**
      * Bit set of clock types for fields/frames in picture timing SEI message.
@@ -788,7 +807,6 @@ typedef struct H264Context {
 
     int missing_fields;
 
-
 /* for frame threading, this is set to 1
      * after finish_setup() has been called, so we cannot modify
      * some context properties (which are supposed to stay constant between
@@ -817,6 +835,10 @@ typedef struct H264Context {
     /* Motion Estimation */
     qpel_mc_func (*qpel_put)[16];
     qpel_mc_func (*qpel_avg)[16];
+
+    /*Green Metadata */
+    GreenMetaData sei_green_metadata;
+
 } H264Context;
 
 extern const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM + 1]; ///< One chroma qp table for each possible bit depth (8-14).
@@ -1169,15 +1191,17 @@ static inline int get_avc_nalsize(H264Context *h, const uint8_t *buf,
 {
     int i, nalsize = 0;
 
-    if (*buf_index >= buf_size - h->nal_length_size)
-        return -1;
+    if (*buf_index >= buf_size - h->nal_length_size) {
+        // the end of the buffer is reached, refill it.
+        return AVERROR(EAGAIN);
+    }
 
     for (i = 0; i < h->nal_length_size; i++)
         nalsize = ((unsigned)nalsize << 8) | buf[(*buf_index)++];
     if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
         av_log(h->avctx, AV_LOG_ERROR,
                "AVC: nal size %d\n", nalsize);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     return nalsize;
 }