mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
avfilter/buffersrc: add av_buffersrc_get_status()
There is currently no way for API users to know that a buffersrc is no longer accepting input, except by trying to feed it a frame and seeing what happens. Of course, this is not possible if the user does not *have* a frame to feed, but may still wish to know if the filter is still accepting input or not. Since passing `frame == NULL` to `av_buffersrc_add_frame()` is already treated as closing the input, we are left with no choice but to introduce a new function for this. We don't explicitly return the result of `ff_outlink_get_status()` to avoid leaking internal status codes, and instead translate them all to AVERROR(EOF).
This commit is contained in:
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2025-09-xx - xxxxxxxxxx - lavfi 11.10.100 - buffersrc.h
|
||||
Add av_buffersrc_get_status().
|
||||
|
||||
2025-11-18 - xxxxxxxxxx - lavu 60.19.100 - hwcontext_amf.h
|
||||
avutil/hwcontext_amf: add lock and unlock for AVAMFDeviceContext.
|
||||
|
||||
|
||||
@@ -286,6 +286,16 @@ int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, unsigned flags)
|
||||
return (flags & AV_BUFFERSRC_FLAG_PUSH) ? push_frame(ctx->graph) : 0;
|
||||
}
|
||||
|
||||
int av_buffersrc_get_status(AVFilterContext *ctx)
|
||||
{
|
||||
BufferSourceContext *s = ctx->priv;
|
||||
|
||||
if (!s->eof && ff_outlink_get_status(ctx->outputs[0]))
|
||||
s->eof = 1;
|
||||
|
||||
return s->eof ? AVERROR(EOF) : 0;
|
||||
}
|
||||
|
||||
static av_cold int init_video(AVFilterContext *ctx)
|
||||
{
|
||||
BufferSourceContext *c = ctx->priv;
|
||||
|
||||
@@ -216,6 +216,14 @@ int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src,
|
||||
*/
|
||||
int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, unsigned flags);
|
||||
|
||||
/**
|
||||
* Returns 0 or a negative AVERROR code. Currently, this will only ever
|
||||
* return AVERROR(EOF), to indicate that the buffer source has been closed,
|
||||
* either as a result of av_buffersrc_close(), or because the downstream
|
||||
* filter is no longer accepting new data.
|
||||
*/
|
||||
int av_buffersrc_get_status(AVFilterContext *ctx);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFILTER_VERSION_MINOR 9
|
||||
#define LIBAVFILTER_VERSION_MINOR 10
|
||||
#define LIBAVFILTER_VERSION_MICRO 100
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user