Merge commit 'd4f0f2d1e80b76260eb6b9cdde472ac069dfda56'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Dec 2013 15:07:17 +0000 (16:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Dec 2013 15:07:17 +0000 (16:07 +0100)
* commit 'd4f0f2d1e80b76260eb6b9cdde472ac069dfda56':
  lavc: use buf[0] instead of data[0] as the indicator of an allocated frame

Conflicts:
libavcodec/utils.c

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

@@@ -2049,48 -1398,25 +2049,48 @@@ int attribute_align_arg avcodec_decode_
          av_frame_unref(&avci->to_free);
  
      if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
 +        int did_split = av_packet_split_side_data(&tmp);
 +        ret = apply_param_change(avctx, &tmp);
 +        if (ret < 0) {
 +            av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
 +            if (avctx->err_recognition & AV_EF_EXPLODE)
 +                goto fail;
 +        }
 +
 +        avctx->internal->pkt = &tmp;
          if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
              ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
 -                                         avpkt);
 +                                         &tmp);
          else {
              ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
 -                                       avpkt);
 +                                       &tmp);
              picture->pkt_dts = avpkt->dts;
 +
 +            if(!avctx->has_b_frames){
 +                av_frame_set_pkt_pos(picture, avpkt->pos);
 +            }
 +            //FIXME these should be under if(!avctx->has_b_frames)
              /* get_buffer is supposed to set frame parameters */
              if (!(avctx->codec->capabilities & CODEC_CAP_DR1)) {
 -                picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
 -                picture->width               = avctx->width;
 -                picture->height              = avctx->height;
 -                picture->format              = avctx->pix_fmt;
 +                if (!picture->sample_aspect_ratio.num)    picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
 +                if (!picture->width)                      picture->width               = avctx->width;
 +                if (!picture->height)                     picture->height              = avctx->height;
 +                if (picture->format == AV_PIX_FMT_NONE)   picture->format              = avctx->pix_fmt;
              }
          }
 +        add_metadata_from_side_data(avctx, picture);
  
 +fail:
          emms_c(); //needed to avoid an emms_c() call before every return;
  
-         if (ret < 0 && picture->data[0])
 +        avctx->internal->pkt = NULL;
 +        if (did_split) {
 +            av_packet_free_side_data(&tmp);
 +            if(ret == tmp.size)
 +                ret = avpkt->size;
 +        }
 +
+         if (ret < 0 && picture->buf[0])
              av_frame_unref(picture);
  
          if (*got_picture_ptr) {