aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/buffersrc.c
Commit message (Collapse)AuthorAgeFilesLines
* avfilter: signal an empty buffersrc with an explicit activate error codeMarton Balint2025-07-031-2/+2
| | | | | | No change in functionality. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil: remove deprecated FF_API_FRAME_KEYJames Almer2025-03-281-7/+0
| | | | | | Deprecated since 2023-05-04. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove deprecated FF_API_INTERLACED_FRAMEJames Almer2025-03-281-9/+0
| | | | | | Deprecated since 2023-05-04. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersrc: remove unused variableJames Almer2025-01-281-1/+0
| | | | | | Added by mistake in 7a025e1cb5fe61888a3e71a9b33842add02c8340. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersrc: add a side_data fieldJames Almer2025-01-251-0/+26
| | | | | | This will be used to propagate global side data through the filterchain. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/avfilter: Add FFFilter, hide internals of AVFilterAndreas Rheinhardt2025-01-121-10/+8
| | | | | | | | | | This patch is analogous to 20f972701806be20a77f808db332d9489343bb78: It hides the internal part of AVFilter by adding a new internal structure FFFilter (declared in filters.h) that has an AVFilter as its first member; the internal part of AVFilter is moved to this new structure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/buffersrc: make channel_layout a CHLAYOUT type AVOptionJames Almer2025-01-021-12/+2
| | | | | | | The string type is a remnant of the old channel layout API implementation. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersrc: check for valid sample rateJames Almer2024-12-311-0/+5
| | | | | | | | | A sample rate <= 0 is invalid. Fixes an assert in ffmpeg_enc.c that assumed a valid sample rate would be set. Fixes ticket #11385. Signed-off-by: James Almer <jamrial@gmail.com>
* lavfi/buffersrc: switch to query_func2()Anton Khirnov2024-10-041-10/+12
|
* lavfi/buffersrc: validate hw context presence in video_init()Anton Khirnov2024-10-041-7/+8
| | | | That is the more appropriate place for it than query_formats().
* avfilter: fix YUV colorspace negotiation for YUVJNiklas Haas2024-09-121-5/+10
| | | | | | | | | | | | | | | Ironically, despite being introduced to make YUVJ unnecessary, the new YUV negotiation logic failed to actually negotiate YUVJ formats themselves correctly, leading to errors when passing YUVJ frames into a filter graph. (They were effectively treated like RGB or Grayscale formats, rather than as forced-full-range YUV, and hence did not have their colorspace matrix correctly negotiated) Fix this by splitting off the YUVJ check from ff_fmt_is_regular_yuv(). Obviously, we can trivially undo this change again once YUVJ is actually deleted from the codebase. Fixes: #11179
* lavfi: drop internal.hAnton Khirnov2024-08-191-1/+1
| | | | | | All that remains in it are things that belong in avfilter_internal.h. Move them there and remove internal.h
* lavfi/inernal: move ff_fmt_is_regular_yuv() declaration to video.hAnton Khirnov2024-08-191-0/+1
|
* lavfi: move AVFilterLink.frame_rate to FilterLinkAnton Khirnov2024-08-151-1/+1
| | | | Co-developed-by: James Almer <jamrial@gmail.com>
* lavfi: move AVFilterLink.hw_frames_ctx to FilterLinkAnton Khirnov2024-08-151-2/+3
|
* avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flagsMarton Balint2024-04-091-1/+1
| | | | | | | Overriding unknown layouts with the negotiated layout is OK, but the number of channels should match with what was negotiated. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/{buffersrc,vf_setparams}: map IPT-C2, YCgCo-R variantsJan Ekström2024-04-031-0/+3
|
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-4/+2
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/buffersrc: fix overriding unknown channel layouts with negotiated oneMarton Balint2024-03-301-1/+1
| | | | | | | | | | | | | | | | | | Fixes ffplay playback of unknown layouts, when SDL directly supports the audio format, such as: ffplay -f lavfi anullsrc=cl=2C,aformat=s16 Without the patch, "Channel layout change is not supported" errors are generated because buffersrc (unknown 2 channel) and buffersink (stereo) negotiated a stereo layout, but the stereo layout was never stored in the BufferSourceContext. This fixes a regression of 7251f909721a570726775acf61b2b9c28a950c76, but this is more of a regression of the avfilter channel layout conversion (1f96db959c1235bb7079d354e09914a0a2608f62). Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil: remove deprecated FF_API_PKT_DURATIONJames Almer2024-03-071-7/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-42/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-141-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* avfilter/buffersrc: allow promoting color range to MPEGNiklas Haas2024-02-131-2/+8
| | | | | | | | | Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph would trigger insertion of an unnecessary vf_scale filter, which would perform a memcpy to convert between the two. This is safe to do because unspecified YUV frames are already universally assumed to be MPEG range, in particular by swscale.
* avfilter/buffersrc: promote unspecified color metadataNiklas Haas2024-02-131-0/+5
| | | | | | | | | | | | Currently, this only affects untagged RGB/XYZ/Gray, which get forced to their corresponding metadata before entering the filter graph. The main justification for this change, however, is the planned ability to add automatic promotion of unspecified yuv to mpeg range yuv. Notably, this change will never allow accidentally cross-promoting unspecified to jpeg or to a specific YUV matrix, since that is still bound by the constraints of YUV range negotiation as set up by query_formats.
* avfilter/buffersrc: limit link variance logs below debug loglevelGyan Doshi2024-02-011-13/+27
| | | | | | | | | The video param change check will print loglines below debug level for each frame which is different from the inlink parameters. This can spam the console. It is now printed at warning level once for each param change else it is kept at debug level. Partially addresses #10823
* avfilter/buffersrc: add color_space/range parametersNiklas Haas2023-12-311-8/+67
| | | | | | | To allow adding proper negotiation, in particular, to fftools. These values will simply be negotiated downstream for YUV formats, and ignored otherwise.
* avfilter/buffersrc: switch to activatePaul B Mahol2023-11-121-10/+17
| | | | | | Fixes OOM when caller keeps adding frames into filtergraph that reached EOF by other means, for example EOF is signalled by other filter in filtergraph or by buffersink.
* avfilter/buffersrc: Use av_frame_clone() where appropriateAndreas Rheinhardt2023-09-101-8/+5
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/buffersrc: stop passing AV_NOPTS_VALUE on EOFPaul B Mahol2023-06-161-1/+4
|
* avutil/frame: deprecate key_frameJames Almer2023-05-041-0/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: use the new AVFrame key_frame flag in all filtersJames Almer2023-05-041-0/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: deprecate interlaced_frame and top_field_firstJames Almer2023-05-041-0/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: use the new AVFrame interlace flags in all filtersJames Almer2023-05-041-0/+5
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavfi/buffersrc: issue more specific error in case of invalid parametersStefano Sabatini2023-03-051-3/+10
|
* avfilter: remove FF_API_SWS_PARAM_OPTIONJames Almer2023-02-091-11/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavfi: use AVFrame.duration instead of AVFrame.pkt_durationAnton Khirnov2022-07-191-0/+7
|
* avfilter/buffersrc: uninitialize the context ch_layout before overwritting itJames Almer2022-03-271-0/+1
| | | | | | | av_buffersrc_parameters_set() can be called to set paramenters after the filter was initialized with for example avfilter_graph_create_filter(). Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: convert to new channel layout APIJames Almer2022-03-151-24/+71
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one looks at the many query_formats callbacks in existence, one will immediately recognize that there is one type of default callback for video and a slightly different default callback for audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);" for video with a filter-specific pix_fmts list. For audio, it is the same with a filter-specific sample_fmts list together with ff_set_common_all_samplerates() and ff_set_common_all_channel_counts(). This commit allows to remove the boilerplate query_formats callbacks by replacing said callback with a union consisting the old callback and pointers for pixel and sample format arrays. For the not uncommon case in which these lists only contain a single entry (besides the sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also added to the union to store them directly in the AVFilter, thereby avoiding a relocation. The state of said union will be contained in a new, dedicated AVFilter field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t in order to create a hole for this new field; this is no problem, as the maximum of all the nb_inputs is four; for nb_outputs it is only two). The state's default value coincides with the earlier default of query_formats being unset, namely that the filter accepts all formats (and also sample rates and channel counts/layouts for audio) provided that these properties agree coincide for all inputs and outputs. By using different union members for audio and video filters the type-unsafety of using the same functions for audio and video lists will furthermore be more confined to formats.c than before. When the new fields are used, they will also avoid allocations: Currently something nearly equivalent to ff_default_query_formats() is called after every successful call to a query_formats callback; yet in the common case that the newly allocated AVFilterFormats are not used at all (namely if there are no free links) these newly allocated AVFilterFormats are freed again without ever being used. Filters no longer using the callback will not exhibit this any more. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilterAndreas Rheinhardt2021-08-201-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, an AVFilter's lists of input and output AVFilterPads were terminated by a sentinel and the only way to get the length of these lists was by using avfilter_pad_count(). This has two drawbacks: first, sizeof(AVFilterPad) is not negligible (i.e. 64B on 64bit systems); second, getting the size involves a function call instead of just reading the data. This commit therefore changes this. The sentinels are removed and new private fields nb_inputs and nb_outputs are added to AVFilter that contain the number of elements of the respective AVFilterPad array. Given that AVFilter.(in|out)puts are the only arrays of zero-terminated AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads are not zero-terminated and they already have a size field) the argument to avfilter_pad_count() is always one of these lists, so it just has to find the filter the list belongs to and read said number. This is slower than before, but a replacement function that just reads the internal numbers that users are expected to switch to will be added soon; and furthermore, avfilter_pad_count() is probably never called in hot loops anyway. This saves about 49KiB from the binary; notice that these sentinels are not in .bss despite being zeroed: they are in .data.rel.ro due to the non-sentinels. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-221-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-271-2/+2
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersrc: simplify av_buffersrc_add_frame_flags()James Almer2021-02-161-30/+8
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
* lavfi/buffersrc: Remove redundant free after ff_filter_frame() failureJun Zhao2020-01-041-3/+1
| | | | | | | | | ff_filter_frame() always frees the frame in case of error, so we don't need to free the frame after ff_filter_frame() fails. Fix CID 1457230. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avfilter/buffersrc: deprecate sws_param optionZhao Zhili2019-12-301-2/+12
|
* avfilter/buffersrc: Remove unused variablesAndreas Rheinhardt2019-12-261-2/+0
| | | | | | | Unused since f09ae730. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/buffersrc: remove redundant flagZhao Zhili2019-12-231-5/+2
| | | | | | | | | | | | | | | | !(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params) equals (c->pix_fmt == AV_PIX_FMT_NONE) && !c->got_format_from_params 1. When (c->pix_fmt == AV_PIX_FMT_NONE) is true, got_format_from_params is always false, the flag doesn't contribute to the result. 2. When the first part is false, the second part doesn't matter, the flag doesn't contribute to the result. The result only depends on c->pix_fmt.
* lavfi/buffersrc: push frame directly.Nicolas George2019-12-231-16/+8
| | | | This allows to remove the queued frame entirely.
* lavfi/buffersrc: remove poll_frame.Nicolas George2019-12-231-9/+0
|
* lavfi/buffersrc: remove fifo.Nicolas George2019-12-231-34/+11
| | | | The frame is immediately pushed, the fifo has never more than one.