diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-03-04 23:57:39 +0000 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-04-30 16:13:56 +0100 |
commit | 27978155bc661eec9f22bcf82c9cfc099cff4365 (patch) | |
tree | 74cfc02e043b35c37e481a27837f03ef46579025 /libavutil/hwcontext.c | |
parent | aa51bb3d2756ed912ee40645efccf5f4a9609696 (diff) | |
download | ffmpeg-27978155bc661eec9f22bcf82c9cfc099cff4365.tar.gz |
hwcontext: Add frame context mapping for nontrivial contexts
Some frames contexts are not usable without additional format-specific
state in hwctx. This change adds new functions frames_derive_from and
frames_derive_to to initialise this state appropriately when deriving
a frames context which will require it to be set.
Diffstat (limited to 'libavutil/hwcontext.c')
-rw-r--r-- | libavutil/hwcontext.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ff9fe99aba..a6d88421d8 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -816,7 +816,14 @@ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, goto fail; } - ret = av_hwframe_ctx_init(dst_ref); + ret = AVERROR(ENOSYS); + if (src->internal->hw_type->frames_derive_from) + ret = src->internal->hw_type->frames_derive_from(dst, src, flags); + if (ret == AVERROR(ENOSYS) && + dst->internal->hw_type->frames_derive_to) + ret = dst->internal->hw_type->frames_derive_to(dst, src, flags); + if (ret == AVERROR(ENOSYS)) + ret = 0; if (ret) goto fail; |