avfilter/avfilter: Add avfilter_link_get_hw_frames_ctx()

Signed-off-by: softworkz <softworkz@hotmail.com>
This commit is contained in:
softworkz
2025-04-14 05:07:48 +02:00
parent 34bb7f5d87
commit e2f39671ae
3 changed files with 24 additions and 0 deletions

View File

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first: API changes, most recent first:
2025-02-xx - xxxxxxxxxx - lavfi 10.10.100 - avfilter.h
Add avfilter_link_get_hw_frames_ctx().
2025-04-21 - xxxxxxxxxx - lavu 60.2.100 - log.h 2025-04-21 - xxxxxxxxxx - lavu 60.2.100 - log.h
Add AV_CLASS_CATEGORY_HWDEVICE. Add AV_CLASS_CATEGORY_HWDEVICE.

View File

@ -989,6 +989,15 @@ enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
return pads[pad_idx].type; return pads[pad_idx].type;
} }
AVBufferRef *avfilter_link_get_hw_frames_ctx(AVFilterLink *link)
{
FilterLink *plink = ff_filter_link(link);
if (plink->hw_frames_ctx)
return av_buffer_ref(plink->hw_frames_ctx);
return NULL;
}
static int default_filter_frame(AVFilterLink *link, AVFrame *frame) static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
{ {
return ff_filter_frame(link->dst->outputs[0], frame); return ff_filter_frame(link->dst->outputs[0], frame);

View File

@ -96,6 +96,18 @@ const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx);
*/ */
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx);
/**
* Get the hardware frames context of a filter link.
*
* @param link an AVFilterLink
*
* @return a ref-counted copy of the link's hw_frames_ctx field if there is
* a hardware frames context associated with the link or NULL otherwise.
* The returned AVBufferRef needs to be released with av_buffer_unref()
* when it is no longer used.
*/
AVBufferRef* avfilter_link_get_hw_frames_ctx(AVFilterLink *link);
/** /**
* Lists of formats / etc. supported by an end of a link. * Lists of formats / etc. supported by an end of a link.
* *