aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/buffersink.c
Commit message (Collapse)AuthorAgeFilesLines
* avfilter/buffersink: keep requesting frames if one activation of the graph ↵Marton Balint2025-07-031-1/+6
| | | | | | | | | | | | | | | | | does not provide one A frame graph activation might not produce a frame in the requested sink, so keep on requesting a frame there unless we encounter a filter activation with buffersrc empty error. This makes av_buffersink_get_frame(_flags) work according to its documentation which claims that EAGAIN is only returned if additional frames must be inserted into the graph. Fate changes are because audio frames will have different sizes at segment boundaries, but content is the same. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter: signal an empty buffersrc with an explicit activate error codeMarton Balint2025-07-031-1/+4
| | | | | | No change in functionality. Signed-off-by: Marton Balint <cus@passwd.hu>
* avfilter/buffersink: add av_buffersink_get_side_data()James Almer2025-01-251-0/+8
| | | | | | | This will be used to get global side data that was propagated through the filterchain. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/avfilter: Add FFFilter, hide internals of AVFilterAndreas Rheinhardt2025-01-121-15/+15
| | | | | | | | | | 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/buffersink: don't leak the reallocated channel layouts arrayJames Almer2025-01-011-1/+2
| | | | | | | | And ensure the last element is the zeroed terminator. Fixes ticket #11392. Signed-off-by: James Almer <jamrial@gmail.com>
* lavfi/buffersink: switch to query_func2()Anton Khirnov2024-10-041-18/+22
|
* lavfi/buffersink: move channel layout parsing to initAnton Khirnov2024-10-041-33/+42
| | | | | That is a more appropriate place for this, and will also be useful in future commits.
* lavfi/buffersink: move the option sanity check to initAnton Khirnov2024-10-041-25/+35
| | | | | Options are set before init, so that is the appropriate place to validate them.
* lavfi/buffersink: add array-type options to replace "int-list" onesAnton Khirnov2024-09-301-14/+148
| | | | | | | | "int-list" options are a hack that provides rudimentary support for array-type options by treating them as byte arrays (i.e. AV_OPT_TYPE_BINARY). Since we now have proper array-type options, they should replace "int-list" everywhere (which happens to be just buffersink).
* lavfi/buffersink: allow av_buffersink_set_frame_size() to be called earlierAnton Khirnov2024-09-281-3/+26
| | | | | | | | The function currently writes directly into the input link, which requires it to be called after the filter has been linked. However, the documentation does not mention this restriction and the natural place to call av_buffersink_set_frame_size() during the options-setting stage, that is before filter init (and so before the input link exists).
* lavfi: drop internal.hAnton Khirnov2024-08-191-1/+0
| | | | | | All that remains in it are things that belong in avfilter_internal.h. Move them there and remove internal.h
* lavfi: move AVFilterLink.frame_wanted_out to FilterLinkInternalAnton Khirnov2024-08-151-1/+2
|
* lavfi: move AVFilterLink.frame_rate to FilterLinkAnton Khirnov2024-08-151-1/+7
| | | | Co-developed-by: James Almer <jamrial@gmail.com>
* lavfi: move AVFilterLink.hw_frames_ctx to FilterLinkAnton Khirnov2024-08-151-1/+6
|
* lavfi: move AVFilterLink.m{ax,in}_samples to FilterLinkAnton Khirnov2024-08-151-2/+3
| | | | Also, document who sets these fields and when.
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-69/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: Add a header for internal generic-layer APIsAndreas Rheinhardt2024-02-181-1/+1
| | | | | | | | | This commit moves the generic-layer stuff (that is not used by filters) to a new header of its own, similarly to 5e7b5b0090bdf68e0897fe55ee657fdccc0cbca2 for libavcodec. thread.h and link_internal.h are merged into this header. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavfi: get rid of FF_INTERNAL_FIELDSAnton Khirnov2024-02-141-4/+4
| | | | | | | This hack is used to limit the visibility of some AVFilterLink fields to only certain files. Replace it with the same pattern that is used e.g. in lavf AVStream/FFStream and avoid exposing these internal fields in a public header completely.
* avfilter/buffersink: add color_spaces, color_ranges paramsNiklas Haas2024-02-091-3/+26
| | | | | | An oversight in my previous series. This omission slipped under the radar because fftools/ffmpeg_filter.c did not use these options, instead preferring to insert an explicit format filter.
* avfilter/buffersink: add color space/range accessorsNiklas Haas2023-12-311-0/+2
| | | | Needed for fftools.
* lavfi/buffersink: avoid leaking peeked_frame on uninitAnton Khirnov2023-12-061-0/+9
|
* avfilter/buffersink: fix order of operation with = and <0Michael Niedermayer2023-11-031-1/+1
| | | | | | Reviewed-by: Sean McGovern <gseanmcg@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/internal: Don't include formats.hAndreas Rheinhardt2023-08-071-0/+1
| | | | | | | | | internal.h doesn't rely on it; instead include it directly in every user that needs it (a filter needing it is basically equivalent to it using FILTER_QUERY_FUNC, i.e. a majority of filters doesn't need it). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Deduplicate default video inputs/outputsAndreas Rheinhardt2023-08-071-8/+2
| | | | | | | | | | | | | | | | | Lots of video filters use a very simple input or output: An array with a single AVFilterPad whose name is "default" and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset. Given that we never use pointer equality for inputs or outputs*, we can simply use a single AVFilterPad instead of dozens; this even saves .data.rel.ro (8312B here) as well as relocations. *: In fact, several filters (like the filters in vf_lut.c) already use the same outputs; furthermore, ff_filter_alloc() duplicates the input and output pads so that we do not even work with the pads directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Deduplicate default audio inputs/outputsAndreas Rheinhardt2023-08-071-8/+1
| | | | | | | | | | | | | | | | | Lots of audio filters use very simple inputs or outputs: An array with a single AVFilterPad whose name is "default" and whose type is AVMEDIA_TYPE_AUDIO; everything else is unset. Given that we never use pointer equality for inputs or outputs*, we can simply use a single AVFilterPad instead of dozens; this even saves .data.rel.ro (4784B here) as well as relocations. *: In fact, several filters (like the filters in af_biquads.c) already use the same inputs; furthermore, ff_filter_alloc() duplicates the input and output pads so that we do not even work with the pads directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: remove FF_API_BUFFERSINK_ALLOCJames Almer2023-02-091-22/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersink: simplify parsing the input channel layout stringJames Almer2022-03-151-11/+9
| | | | | | And remove a stray comma in the list of supported separators. Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: convert to new channel layout APIJames Almer2022-03-151-9/+84
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/buffersink: Remove outdated commentsAndreas Rheinhardt2021-12-031-5/+5
| | | | | | | | These lists have size fields since e48ded8551172b58a78f30303a81dfce125344e0. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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>
* avfilter/avfilter: Remove unused partial_bufAndreas Rheinhardt2021-08-051-2/+1
| | | | | | | | It is unused since 02aa0701ae0dc2def8db640c9e3c06dc1b5de70c. The corresponding size field is write-only since then. Reviewed-by: Nicolas George <george@nsup.org> 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/buffersink: Postpone removal of av_[a]buffersink_params_allocAndreas Rheinhardt2021-03-071-1/+1
| | | | | | | | | They have been deprecated in 61097535cdaa91fea0d62c567b3af02a940f6c2d, yet this was less than two years ago. Removing them will therefore have to wait. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavfi/buffersink: cast to uint64_t before shifting.Nicolas George2020-09-091-2/+2
| | | | Fix CID 1466666.
* lavfi/buffersink: remove redundant channel layouts.Nicolas George2020-09-081-0/+24
| | | | | | | | The channel_layouts and channel_counts options set what buffersink is supposed to accept. If channel_counts contains 2, then stereo is already accepted, there is no point in having it in channel_layouts too. This was not properly documented until now, so only print a warning.
* avfilter/buffersink: deprecate AVBufferSinkParams and AVABufferSinkParamsZhao Zhili2019-12-231-0/+2
|
* avfilter/buffersink: replace init_opaque by initZhao Zhili2019-12-231-33/+2
| | | | | The argument 'opaque' is always NULL since 0acf7e2 (2013), and avfilter_init_filter() was removed in 52067b3c0e (2016).
* avfilter/buffersink: remove unused macrosZhao Zhili2019-12-231-2/+0
|
* avfilter/buffersink: cosmeticsPaul B Mahol2019-10-181-22/+20
|
* lavfi/buffersink: fix abuffersink flag setting issueJun Zhao2018-12-091-1/+1
| | | | | | | abuffersink need to setting AV_OPT_FLAG_AUDIO_PARAM flag. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* lavfi: remove stray semicolons.Nicolas George2017-01-121-11/+11
| | | | Hopefully fix compilation with suncc.
* lavfi/buffersink: move to the new design.Nicolas George2017-01-121-158/+57
|
* lavfi/buffersink: add accessors for the stream properties.Nicolas George2017-01-121-6/+19
| | | | av_buffersink_get_frame_rate() did already exist; its argument becomes const.
* lavfi: make filter_frame non-recursive.Nicolas George2016-12-181-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | A lot of changes happen at the same time: - Add a framequeue fifo to AVFilterLink. - split AVFilterLink.status into status_in and status_out: requires changes to the few filters and programs that use it directly (f_interleave, split, filtfmts). - Add a field ready to AVFilterContext, marking when the filter is ready and its activation priority. - Add flags to mark blocked links. - Change ff_filter_frame() to enqueue the frame. - Change all filtering functions to update the ready field and the blocked flags. - Update ff_filter_graph_run_once() to use the ready field. - buffersrc: always push the frame immediately.
* lavfi: make request_frame() non-recursive.Nicolas George2015-12-221-0/+5
| | | | | | | Instead of calling the input filter request_frame() method, ff_request_frame() now marks the link and returns immediately. buffersink is changed to activate the marked filters until a frame is obtained.
* lavfi: replace link.closed by link.status.Nicolas George2015-12-221-2/+2
| | | | | | The status field can carry any error code instead of just EOF. Also only update it through a wrapper function and provide a timestamp. Update the few filters that used it directly.
* avfilter/all: propagate errors of functions from avfilter/formatsGanesh Ajjanagadde2015-10-141-20/+15
| | | | | | | | | | | | | | | | | | Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM). This propagates the return values. All of these were found by using av_warn_unused_result, demonstrating its utility. Tested with FATE. I am least sure of the changes to avfilter/filtergraph, since I don't know what/how reduce_format is intended to behave and how it should react to errors. Fixes: CID 1325680, 1325679, 1325678. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Previous version Reviewed-by: Nicolas George <george@nsup.org> Previous version Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
* lavfi/buffersink: loop over ff_request_frame().Nicolas George2015-09-201-4/+1
| | | | | | | | Do not assume that ff_request_frame() returning success implies a frame has arrived in the FIFO. Instead, just loop until a frame is in the FIFO. It does not change anything since the same loop is present in ff_request_frame(), confirmed by an assertion.
* avfilter/abuffersink: use AV_OPT_TYPE_BOOL for all_channel_counts optionClément Bœsch2015-09-081-1/+1
|