Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'
[ffmpeg.git] / libavcodec / h264dec.c
index 91bc38dcc1571aff00ce4a2ac032b3d63a69af40..d944a8ce934b2857feec4a891d9ae447a5b55b24 100644 (file)
@@ -674,13 +674,13 @@ static int get_last_needed_nal(H264Context *h)
          * which splits NALs strangely if so, when frame threading we
          * can't start the next thread until we've read all of them */
         switch (nal->type) {
-        case NAL_SPS:
-        case NAL_PPS:
+        case H264_NAL_SPS:
+        case H264_NAL_PPS:
             nals_needed = i;
             break;
-        case NAL_DPA:
-        case NAL_IDR_SLICE:
-        case NAL_SLICE:
+        case H264_NAL_DPA:
+        case H264_NAL_IDR_SLICE:
+        case H264_NAL_SLICE:
             ret = init_get_bits8(&gb, nal->data + 1, (nal->size - 1));
             if (ret < 0)
                 return ret;
@@ -768,7 +768,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
         int err;
 
         if (avctx->skip_frame >= AVDISCARD_NONREF &&
-            nal->ref_idc == 0 && nal->type != NAL_SEI)
+            nal->ref_idc == 0 && nal->type != H264_NAL_SEI)
             continue;
 
 again:
@@ -778,14 +778,14 @@ again:
 
         err = 0;
         switch (nal->type) {
-        case NAL_IDR_SLICE:
+        case H264_NAL_IDR_SLICE:
             if ((nal->data[1] & 0xFC) == 0x98) {
                 av_log(h->avctx, AV_LOG_ERROR, "Invalid inter IDR frame\n");
                 h->next_outputed_poc = INT_MIN;
                 ret = -1;
                 goto end;
             }
-            if (nal->type != NAL_IDR_SLICE) {
+            if (nal->type != H264_NAL_IDR_SLICE) {
                 av_log(h->avctx, AV_LOG_ERROR,
                        "Invalid mix of idr and non-idr slices\n");
                 ret = -1;
@@ -801,7 +801,7 @@ again:
             }
             idr_cleared = 1;
             h->has_recovery_point = 1;
-        case NAL_SLICE:
+        case H264_NAL_SLICE:
             sl->gb = nal->gb;
 
             if ((err = ff_h264_decode_slice_header(h, sl, nal)))
@@ -822,16 +822,16 @@ again:
                 }
             }
 
-            h->cur_pic_ptr->f->key_frame |= (nal->type == NAL_IDR_SLICE);
+            h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
 
-            if (nal->type == NAL_IDR_SLICE ||
+            if (nal->type == H264_NAL_IDR_SLICE ||
                 (h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
                 h->recovery_frame         = -1;
                 h->cur_pic_ptr->recovered = 1;
             }
             // If we have an IDR, all frames after it in decoded order are
             // "recovered".
-            if (nal->type == NAL_IDR_SLICE)
+            if (nal->type == H264_NAL_IDR_SLICE)
                 h->frame_recovered |= FRAME_RECOVERED_IDR;
 #if 1
             h->cur_pic_ptr->recovered |= h->frame_recovered;
@@ -874,12 +874,12 @@ again:
                     context_count++;
             }
             break;
-        case NAL_DPA:
-        case NAL_DPB:
-        case NAL_DPC:
+        case H264_NAL_DPA:
+        case H264_NAL_DPB:
+        case H264_NAL_DPC:
             avpriv_request_sample(avctx, "data partitioning");
             break;
-        case NAL_SEI:
+        case H264_NAL_SEI:
             ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx);
             h->has_recovery_point = h->has_recovery_point || h->sei.recovery_point.recovery_frame_cnt != -1;
             if (avctx->debug & FF_DEBUG_GREEN_MD)
@@ -892,7 +892,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
                 goto end;
             break;
-        case NAL_SPS: {
+        case H264_NAL_SPS: {
             GetBitContext tmp_gb = nal->gb;
             if (ff_h264_decode_seq_parameter_set(&tmp_gb, avctx, &h->ps, 0) >= 0)
                 break;
@@ -904,18 +904,18 @@ FF_ENABLE_DEPRECATION_WARNINGS
             ff_h264_decode_seq_parameter_set(&nal->gb, avctx, &h->ps, 1);
             break;
         }
-        case NAL_PPS:
+        case H264_NAL_PPS:
             ret = ff_h264_decode_picture_parameter_set(&nal->gb, avctx, &h->ps,
                                                        nal->size_bits);
             if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
                 goto end;
             break;
-        case NAL_AUD:
-        case NAL_END_SEQUENCE:
-        case NAL_END_STREAM:
-        case NAL_FILLER_DATA:
-        case NAL_SPS_EXT:
-        case NAL_AUXILIARY_SLICE:
+        case H264_NAL_AUD:
+        case H264_NAL_END_SEQUENCE:
+        case H264_NAL_END_STREAM:
+        case H264_NAL_FILLER_DATA:
+        case H264_NAL_SPS_EXT:
+        case H264_NAL_AUXILIARY_SLICE:
             break;
         default:
             av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n",
@@ -1157,7 +1157,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
     if (buf_index < 0)
         return AVERROR_INVALIDDATA;
 
-    if (!h->cur_pic_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
+    if (!h->cur_pic_ptr && h->nal_unit_type == H264_NAL_END_SEQUENCE) {
         av_assert0(buf_index <= buf_size);
         goto out;
     }