Merge commit '187d719760bd130f848194ec4a6bd476341914bb'
authorClément Bœsch <u@pkh.me>
Sat, 9 Jul 2016 13:03:27 +0000 (15:03 +0200)
committerClément Bœsch <u@pkh.me>
Sat, 9 Jul 2016 13:03:27 +0000 (15:03 +0200)
* commit '187d719760bd130f848194ec4a6bd476341914bb':
  h264: Support AV_PKT_DATA_NEW_EXTRADATA

Merged-by: Clément Bœsch <u@pkh.me>
1  2 
libavcodec/h264.c

@@@ -1232,9 -1003,9 +1232,11 @@@ static int h264_decode_frame(AVCodecCon
      H264Context *h     = avctx->priv_data;
      AVFrame *pict      = data;
      int buf_index      = 0;
 +    H264Picture *out;
 +    int i, out_idx;
      int ret;
+     const uint8_t *new_extradata;
+     int new_extradata_size;
  
      h->flags = avctx->flags;
      h->setup_finished = 0;
  
          return buf_index;
      }
 +    if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
 +        int side_size;
 +        uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
 +        if (is_extra(side, side_size))
 +            ff_h264_decode_extradata(side, side_size,
 +                                     &h->ps, &h->is_avc, &h->nal_length_size,
 +                                     avctx->err_recognition, avctx);
 +    }
 +    if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
 +        if (is_extra(buf, buf_size))
 +            return ff_h264_decode_extradata(buf, buf_size,
 +                                            &h->ps, &h->is_avc, &h->nal_length_size,
 +                                            avctx->err_recognition, avctx);
 +    }
  
+     new_extradata_size = 0;
+     new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
+                                             &new_extradata_size);
+     if (new_extradata_size > 0 && new_extradata) {
+         ret = ff_h264_decode_extradata(new_extradata, new_extradata_size,
+                                        &h->ps, &h->is_avc, &h->nal_length_size,
+                                        avctx->err_recognition, avctx);
+         if (ret < 0)
+             return ret;
+     }
      buf_index = decode_nal_units(h, buf, buf_size);
      if (buf_index < 0)
          return AVERROR_INVALIDDATA;