Merge commit 'bd255f9feb4deea4c990e582f0ba3b90d7b64b4c'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Dec 2012 14:30:12 +0000 (15:30 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Dec 2012 14:30:12 +0000 (15:30 +0100)
* commit 'bd255f9feb4deea4c990e582f0ba3b90d7b64b4c':
  lavc: set frame parameters after decoding only if necessary

Conflicts:
libavcodec/utils.c

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

@@@ -1602,27 -1276,21 +1602,30 @@@ int attribute_align_arg avcodec_decode_
      avcodec_get_frame_defaults(picture);
  
      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);
 +        apply_param_change(avctx, &tmp);
 +        avctx->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;
+             picture->pkt_dts = avpkt->dts;
 +
 +            if(!avctx->has_b_frames){
 +                picture->pkt_pos         = avpkt->pos;
 +            }
 +            //FIXME these should be under if(!avctx->has_b_frames)
-             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;
+             /* 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);
  
          emms_c(); //needed to avoid an emms_c() call before every return;