diff options
author | wm4 <wm4@nowhere> | 2017-10-16 16:56:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-16 17:00:38 +0200 |
commit | 1ff6a1c8c7eae341a4052b115083005663c44503 (patch) | |
tree | 65ac79f7872ec630c39946eb734eca084dc49ba4 /video/mp_image.c | |
parent | 0a7c5a130e73c7c96faafc7da80fa56ee9b7bf00 (diff) | |
download | mpv-1ff6a1c8c7eae341a4052b115083005663c44503.tar.bz2 mpv-1ff6a1c8c7eae341a4052b115083005663c44503.tar.xz |
video: make previously added hwdec params mechanism more generic
The mechanism introduced in b135af6842bf assumed AVHWFramesContext would
be enough. Apparently it's not - the intended use with Rockchip (not
Rokchip btw.) requires accessing actual frame data in order to access
the AVDRMFrameDescriptor struct.
Just pass the entire mp_image to the new function. This is more
flexible, although it slightly worries me that it will be less reusable
for things which require setting up mp_image_params before any real
frames are processed (such as filters).
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 18d700df15..63670a6726 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -855,15 +855,6 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src) if (src->repeat_pict == 1) dst->fields |= MP_IMGFIELD_REPEAT_FIRST; - if (src->hw_frames_ctx) { - AVHWFramesContext *fctx = (void *)src->hw_frames_ctx->data; - dst->params.hw_subfmt = pixfmt2imgfmt(fctx->sw_format); - const struct hwcontext_fns *fns = - hwdec_get_hwcontext_fns(fctx->device_ctx->type); - if (fns && fns->complete_image_params) - fns->complete_image_params(fctx, &dst->params); - } - dst->params.color = (struct mp_colorspace){ .space = avcol_spc_to_mp_csp(src->colorspace), .levels = avcol_range_to_mp_csp_levels(src->color_range), @@ -888,6 +879,15 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src) dst->icc_profile = av_buffer_ref(sd->buf); #endif + if (dst->hwctx) { + AVHWFramesContext *fctx = (void *)dst->hwctx->data; + dst->params.hw_subfmt = pixfmt2imgfmt(fctx->sw_format); + const struct hwcontext_fns *fns = + hwdec_get_hwcontext_fns(fctx->device_ctx->type); + if (fns && fns->complete_image_params) + fns->complete_image_params(dst); + } + return mp_image_new_ref(dst); } |