Commit ff821fdf authored by Mark Thompson's avatar Mark Thompson

Merge commit '4ab61cd9'

* commit '4ab61cd9':
  qsv{enc,dec}: extend the internal frame allocator
Merged-by: 's avatarMark Thompson <sw@jkqxz.net>
parents c0f2a8ea 4ab61cd9
This diff is collapsed.
...@@ -39,7 +39,12 @@ ...@@ -39,7 +39,12 @@
MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR))
typedef struct QSVMid { typedef struct QSVMid {
AVBufferRef *hw_frames_ref;
mfxHDL handle; mfxHDL handle;
AVFrame *locked_frame;
AVFrame *hw_frame;
mfxFrameSurface1 surf;
} QSVMid; } QSVMid;
typedef struct QSVFrame { typedef struct QSVFrame {
...@@ -55,7 +60,13 @@ typedef struct QSVFrame { ...@@ -55,7 +60,13 @@ typedef struct QSVFrame {
typedef struct QSVFramesContext { typedef struct QSVFramesContext {
AVBufferRef *hw_frames_ctx; AVBufferRef *hw_frames_ctx;
mfxFrameInfo info; void *logctx;
/* The memory ids for the external frames.
* Refcounted, since we need one reference owned by the QSVFramesContext
* (i.e. by the encoder/decoder) and another one given to the MFX session
* from the frame allocator. */
AVBufferRef *mids_buf;
QSVMid *mids; QSVMid *mids;
int nb_mids; int nb_mids;
} QSVFramesContext; } QSVFramesContext;
......
...@@ -433,8 +433,7 @@ int ff_qsv_decode_close(QSVContext *q) ...@@ -433,8 +433,7 @@ int ff_qsv_decode_close(QSVContext *q)
MFXClose(q->internal_session); MFXClose(q->internal_session);
av_buffer_unref(&q->frames_ctx.hw_frames_ctx); av_buffer_unref(&q->frames_ctx.hw_frames_ctx);
av_freep(&q->frames_ctx.mids); av_buffer_unref(&q->frames_ctx.mids_buf);
q->frames_ctx.nb_mids = 0;
return 0; return 0;
} }
......
...@@ -1110,8 +1110,7 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q) ...@@ -1110,8 +1110,7 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
q->internal_session = NULL; q->internal_session = NULL;
av_buffer_unref(&q->frames_ctx.hw_frames_ctx); av_buffer_unref(&q->frames_ctx.hw_frames_ctx);
av_freep(&q->frames_ctx.mids); av_buffer_unref(&q->frames_ctx.mids_buf);
q->frames_ctx.nb_mids = 0;
cur = q->work_frames; cur = q->work_frames;
while (cur) { while (cur) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment