Merge commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c'
authorMark Thompson <sw@jkqxz.net>
Thu, 30 Mar 2017 21:00:03 +0000 (22:00 +0100)
committerMark Thompson <sw@jkqxz.net>
Thu, 30 Mar 2017 21:00:03 +0000 (22:00 +0100)
* commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c':
  qsv{dec,enc}: always use an internal mfxFrameSurface1

Minor fixups for differences in the QSV encoder because of a53cc.

Merged-by: Mark Thompson <sw@jkqxz.net>
1  2 
libavcodec/qsv_internal.h
libavcodec/qsvdec.c
libavcodec/qsvenc.c

  
  typedef struct QSVFrame {
      AVFrame *frame;
-     mfxFrameSurface1 *surface;
+     mfxFrameSurface1 surface;
 +    mfxEncodeCtrl enc_ctrl;
  
-     mfxFrameSurface1 surface_internal;
      int queued;
+     int used;
  
      struct QSVFrame *next;
  } QSVFrame;
Simple merge
@@@ -814,10 -813,9 +814,10 @@@ static void clear_unused_frames(QSVEncC
  {
      QSVFrame *cur = q->work_frames;
      while (cur) {
-         if (cur->surface && !cur->surface->Data.Locked) {
-             cur->surface = NULL;
+         if (cur->used && !cur->surface.Data.Locked) {
 +            free_encoder_ctrl_payloads(&cur->enc_ctrl);
              av_frame_unref(cur->frame);
+             cur->used = 0;
          }
          cur = cur->next;
      }
@@@ -907,22 -902,20 +909,20 @@@ static int submit_frame(QSVEncContext *
              frame->top_field_first   ? MFX_PICSTRUCT_FIELD_TFF :
                                         MFX_PICSTRUCT_FIELD_BFF;
          if (frame->repeat_pict == 1)
-             qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED;
+             qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED;
          else if (frame->repeat_pict == 2)
-             qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING;
+             qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING;
          else if (frame->repeat_pict == 4)
-             qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING;
+             qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING;
  
-         qf->surface_internal.Data.PitchLow  = qf->frame->linesize[0];
-         qf->surface_internal.Data.Y         = qf->frame->data[0];
-         qf->surface_internal.Data.UV        = qf->frame->data[1];
-         qf->surface = &qf->surface_internal;
+         qf->surface.Data.PitchLow  = qf->frame->linesize[0];
+         qf->surface.Data.Y         = qf->frame->data[0];
+         qf->surface.Data.UV        = qf->frame->data[1];
      }
  
-     qf->surface->Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000});
+     qf->surface.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000});
  
 -    *surface = &qf->surface;
 +    *new_frame = qf;
  
      return 0;
  }
@@@ -958,10 -949,6 +958,10 @@@ static int encode_frame(AVCodecContext 
              return ret;
          }
      }
-         surf = qsv_frame->surface;
 +    if (qsv_frame) {
++        surf = &qsv_frame->surface;
 +        enc_ctrl = &qsv_frame->enc_ctrl;
 +    }
  
      ret = av_new_packet(&new_pkt, q->packet_size);
      if (ret < 0) {