Browse Source

hwcontext: Perform usual initialisation on derived device contexts

The initialisation should be common.  For libmfx, it was previously
happening in the derivation function and this moves it out.
tags/n4.0
Mark Thompson 8 years ago
parent
commit
caecb85014
2 changed files with 4 additions and 11 deletions
  1. +4
    -0
      libavutil/hwcontext.c
  2. +0
    -11
      libavutil/hwcontext_qsv.c

+ 4
- 0
libavutil/hwcontext.c View File

@@ -645,6 +645,10 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr,
goto fail; goto fail;


done: done:
ret = av_hwdevice_ctx_init(dst_ref);
if (ret < 0)
goto fail;

*dst_ref_ptr = dst_ref; *dst_ref_ptr = dst_ref;
return 0; return 0;




+ 0
- 11
libavutil/hwcontext_qsv.c View File

@@ -989,7 +989,6 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx,
int flags) int flags)
{ {
AVQSVDeviceContext *hwctx = ctx->hwctx; AVQSVDeviceContext *hwctx = ctx->hwctx;
QSVDeviceContext *s = ctx->internal->priv;


mfxVersion ver = { { 3, 1 } }; mfxVersion ver = { { 3, 1 } };
mfxHDL handle; mfxHDL handle;
@@ -1058,16 +1057,6 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx,
goto fail; goto fail;
} }


ret = qsv_device_init(ctx);
if (ret < 0)
goto fail;
if (s->handle_type != handle_type) {
av_log(ctx, AV_LOG_ERROR, "Error in child device handle setup: "
"type mismatch (%d != %d).\n", s->handle_type, handle_type);
err = AVERROR_UNKNOWN;
goto fail;
}

return 0; return 0;


fail: fail:


Loading…
Cancel
Save