Quoting Mark Thompson (2016-03-07 11:20:35)
> On 07/03/16 07:49, Luca Barbato wrote:
> > On 07/03/16 00:03, Mark Thompson wrote:
> >> ---
> >> libavutil/hwcontext.c | 44 +++++++++++++++++++++++++++++++
> >> libavutil/hwcontext.h | 60
> >> ++++++++++++++++++++++++++++++++++++++++++
> >> libavutil/hwcontext_internal.h | 10 +++++++
> >> 3 files changed, 114 insertions(+)
> >>
> >> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> >> index b6d0518..e373504 100644
> >> --- a/libavutil/hwcontext.c
> >> +++ b/libavutil/hwcontext.c
> >> @@ -400,3 +400,47 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref,
> >> AVFrame *frame, int flags)
> >>
> >> return 0;
> >> }
> >> +
> >> +void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
> >> +{
> >> + AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
> >> + const HWContextType *hw_type = ctx->internal->hw_type;
> >> +
> >> + if (hw_type->device_hwconfig_size == 0)
> >> + return NULL;
> >> +
> >> + return av_mallocz(hw_type->device_hwconfig_size);
> >> +}
> >
> > Not sure using the AVBufferRef is really needed here.
> >
>
> No preference; if anyone has a opinion I can change it. (All the other
> functions use the AVBufferRef as the handle, so it seemed easier to just be
> consistent even though we don't actually need it in this case.)
I think it's simpler for the caller, since he always has the ref and not
always stores the data pointer separately. It's also more consistent,
since in some cases you do need the reference.
--
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel