diff options
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/hwcontext.c | 14 | ||||
-rw-r--r-- | libavutil/hwcontext.h | 4 | ||||
-rw-r--r-- | libavutil/hwcontext_internal.h | 5 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
4 files changed, 22 insertions, 3 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ed09c49..5a22194 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -458,6 +458,11 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) // and map the frame immediately. AVFrame *src_frame; + frame->format = ctx->format; + frame->hw_frames_ctx = av_buffer_ref(hwframe_ref); + if (!frame->hw_frames_ctx) + return AVERROR(ENOMEM); + src_frame = av_frame_alloc(); if (!src_frame) return AVERROR(ENOMEM); @@ -467,7 +472,8 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags) if (ret < 0) return ret; - ret = av_hwframe_map(frame, src_frame, 0); + ret = av_hwframe_map(frame, src_frame, + ctx->internal->source_allocation_map_flags); if (ret) { av_log(ctx, AV_LOG_ERROR, "Failed to map frame into derived " "frame context: %d.\n", ret); @@ -819,6 +825,12 @@ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, goto fail; } + dst->internal->source_allocation_map_flags = + flags & (AV_HWFRAME_MAP_READ | + AV_HWFRAME_MAP_WRITE | + AV_HWFRAME_MAP_OVERWRITE | + AV_HWFRAME_MAP_DIRECT); + ret = AVERROR(ENOSYS); if (src->internal->hw_type->frames_derive_from) ret = src->internal->hw_type->frames_derive_from(dst, src, flags); diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h index 37e8831..edf12cc 100644 --- a/libavutil/hwcontext.h +++ b/libavutil/hwcontext.h @@ -566,7 +566,9 @@ int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags); * AVHWFramesContext on. * @param source_frame_ctx A reference to an existing AVHWFramesContext * which will be mapped to the derived context. - * @param flags Currently unused; should be set to zero. + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the + * mapping parameters to apply to frames which are allocated + * in the derived device. * @return Zero on success, negative AVERROR code on failure. */ int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h index 0a0c4e8..68f78c0 100644 --- a/libavutil/hwcontext_internal.h +++ b/libavutil/hwcontext_internal.h @@ -121,6 +121,11 @@ struct AVHWFramesInternal { * context it was derived from. */ AVBufferRef *source_frames; + /** + * Flags to apply to the mapping from the source to the derived + * frame context when trying to allocate in the derived context. + */ + int source_allocation_map_flags; }; typedef struct HWMapDescriptor { diff --git a/libavutil/version.h b/libavutil/version.h index 322b683..308d16f 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 65 +#define LIBAVUTIL_VERSION_MINOR 66 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |