Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 15 Feb 2014 20:05:31 +0000 (21:05 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 15 Feb 2014 20:05:31 +0000 (21:05 +0100)
* qatar/master:
  h264_parser: use enum values in h264_find_frame_end()

Conflicts:
libavcodec/h264_parser.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264_parser.c

@@@ -82,29 -65,19 +83,30 @@@ static int h264_find_frame_end(H264Cont
                      i++;
                      goto found;
                  }
-             } else if (v == 1 || v == 2 || v == 5) {
+             } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA ||
+                        nalu_type == NAL_IDR_SLICE) {
 +                state += 8;
 +                continue;
 +            }
 +            state = 7;
 +        } else {
 +            h->parse_history[h->parse_history_count++]= buf[i];
 +            if (h->parse_history_count>3) {
 +                unsigned int mb, last_mb= h->parse_last_mb;
 +                GetBitContext gb;
 +
 +                init_get_bits(&gb, h->parse_history, 8*h->parse_history_count);
 +                h->parse_history_count=0;
 +                mb= get_ue_golomb_long(&gb);
 +                last_mb= h->parse_last_mb;
 +                h->parse_last_mb= mb;
                  if (pc->frame_start_found) {
 -                    state += 8;
 -                    continue;
 +                    if (mb <= last_mb)
 +                        goto found;
                  } else
                      pc->frame_start_found = 1;
 +                state = 7;
              }
 -            state = 7;
 -        } else {
 -            if (buf[i] & 0x80)
 -                goto found;
 -            state = 7;
          }
      }
      pc->state = state;