h264: add H264_ prefix to the NAL unit types
[ffmpeg.git] / libavcodec / h264dec.c
index b4b78bd..52cb9ae 100644 (file)
@@ -639,13 +639,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:
             init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8);
             if (!get_ue_golomb(&gb))
                 nals_needed = i;
@@ -686,7 +686,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;
 
         // FIXME these should stop being context-global variables
@@ -695,15 +695,15 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
 
         err = 0;
         switch (nal->type) {
-        case NAL_IDR_SLICE:
-            if (nal->type != NAL_IDR_SLICE) {
+        case H264_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;
                 goto end;
             }
             idr(h); // FIXME ensure we don't lose some frames if there is reordering
-        case NAL_SLICE:
+        case H264_NAL_SLICE:
             sl->gb = nal->gb;
 
             if ((err = ff_h264_decode_slice_header(h, sl, nal)))
@@ -715,15 +715,15 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
             }
 
             h->cur_pic_ptr->f->key_frame |=
-                (nal->type == NAL_IDR_SLICE) || (h->sei.recovery_point.recovery_frame_cnt >= 0);
+                (nal->type == H264_NAL_IDR_SLICE) || (h->sei.recovery_point.recovery_frame_cnt >= 0);
 
-            if (nal->type == NAL_IDR_SLICE || h->recovery_frame == h->poc.frame_num) {
+            if (nal->type == H264_NAL_IDR_SLICE || h->recovery_frame == h->poc.frame_num) {
                 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;
             h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
 
@@ -751,35 +751,35 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
                     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");
             ret = AVERROR(ENOSYS);
             goto end;
             break;
-        case NAL_SEI:
+        case H264_NAL_SEI:
             ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx);
             if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
                 goto end;
             break;
-        case NAL_SPS:
+        case H264_NAL_SPS:
             ret = ff_h264_decode_seq_parameter_set(&nal->gb, avctx, &h->ps);
             if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
                 goto end;
             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",
@@ -912,7 +912,7 @@ out:
     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) {
         buf_size = 0;
         goto out;
     }