Commit Graph

81 Commits

Author SHA1 Message Date
Anton Khirnov
b9c928a486 avfilter: add AVFILTER_FLAG_METADATA_ONLY
This flag allows distinguishing between filters that actually modify the
data and those that only modify metadata or gather some stream
information.
2021-12-04 14:07:19 +01:00
Andreas Rheinhardt
8be701d9f7 avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
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>
2021-08-20 12:53:58 +02:00
Gyan Doshi
b7ba472f43 avfilter/fps: remove unconventional acronyms
In dd770883e9, support for expressions was added. Among the constants
added were labels of qnstc, qpal, sntsc & spal.

These were added in ba2a8cb40b to represent parameter permutations where
only the resolution is different. They don't have any usage currency and
don't represent any industry standards or convention in terms of framerate.
2021-07-06 11:43:31 +05:30
James Almer
dd770883e9 avfilter/vf_fps: extend support for expressions
AV_OPT_TYPE_VIDEO_RATE AVOption types are parsed as expressions, but in a
limited way. For example, name constants can only be parsed alone and not as
part of a longer expression.

This change allows usage like

ffmpeg -i IN -vf fps="if(eq(source_fps\,film)\,ntsc_film\,source_fps)" OUT

Suggested-by: ffmpeg@fb.com
Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-13 17:32:45 -03:00
Andreas Rheinhardt
a04ad248a0 avfilter: Constify all AVFilters
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>
2021-04-27 11:48:05 -03:00
Nikolas Bowe
b794df43f3 avfilter/vf_fps: Avoid inlink fifo build up.
When duplicating frames we need to schedule for activation again, otherwise frames can build up in the inlink fifo.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-10 17:21:54 +02:00
Carl Eugen Hoyos
1893c72086 lavfi/fps: Avoid duplicating Closed Captions when increasing frame rate. 2018-11-27 18:38:03 +01:00
Calvin Walton
2b2c8b22da libavfilter/vf_fps: Minor cleanups
Since the config_props function now references both the input and output
links, rename the 'link' variable to 'outlink'.

Fix up some mismatching indentation.

Don't bother setting the width and height on the outlink; the filter
framework does that for us.
2018-03-08 11:23:34 +01:00
Calvin Walton
e4edc567a0 libavfilter/vf_fps: Rewrite using activate callback
The old version of the filter had a problem where it would queue up
all of the duplicate frames required to fill a timestamp gap in a
single call to filter_frame. In problematic files - I've hit this in
webcam streams with large gaps due to network issues - this will queue
up a potentially huge number of frames. (I've seen it trigger the Linux
OOM-killer on particularly large pts gaps.)

This revised version of the filter using the activate callback will
generate at most 1 frame each time it is called.
2018-03-08 11:23:34 +01:00
Tobias Rapp
62bdec806e avfilter/vf_fps: add eof_action filter option
Allows to specify the action to be performed when reading the last frame
from the internal FIFO buffer. By default the last frame is written to
filter output depending on the timestamp rounding method. When using
"pass" action the last frame is passed through if input duration
has not been reached yet.

Examples using an input file with 25Hz, 1.4sec duration:
 - "fps=fps=1:round=near" generates an output file of 1sec
 - "fps=fps=1:round=near:eof_action=pass" generates an output file of
   2sec

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2017-10-06 17:11:20 +02:00
Tobias Rapp
0a499d6a57 avfilter/vf_fps: clean-up filter options
Add missing AV_OPT_FLAG_FILTERING_PARAM flag to "start_time" option.
Fix indent of "round" named constants and clear unused field values.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2017-10-05 10:33:55 +02:00
Thierry Foucu
42a41c3956 vf_fps: Fix memory leak introduced by eea64ef4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-15 22:40:21 +02:00
Thierry Foucu
eea64ef4cf vf_fps: when reading EOF, using current_pts to duplicate the last frame if needed.
Fix ticket #2674
Tested with examples from ticket 2674.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-15 02:24:31 +02:00
Przemysław Sobala
5fce4753ff avfilter/vf_fps: set fps value boundaries
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-09 15:01:07 +02:00
Nicolas George
4bc7eb2dd2 lavfi/vf_fps: remove looping on request_frame(). 2015-10-07 19:05:13 +02:00
Michael Niedermayer
7801a54ec3 avfilter/vf_fps: update frame drop comment
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 06:03:11 +01:00
Michael Niedermayer
7f02fcd917 avfilter/vf_fps: Do not drop a random subset of frames
This also avoids droping the frame which is closest to the target timestamp

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 18:52:14 +01:00
Lukasz Marek
ce051ceefc lavfi/vf_fps: use av_fifo_alloc_array
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-20 00:00:44 +02:00
Lukasz Marek
70b63419ee lavfi: use av_fifo_freep
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-07 23:39:47 +02:00
Michael Niedermayer
8f33810ed2 avfilter/vf_fps: fix rounding error accumulation
Fixes Ticket3329

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-20 02:36:02 +01:00
Michael Niedermayer
ccdfa3e271 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add missing #includes for *INT64_MAX and *INT64_C

Conflicts:
	ffmpeg.c
	ffmpeg_filter.c
	ffplay.c
	libavformat/assdec.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-24 05:21:19 +01:00
Diego Biurrun
8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Michael Niedermayer
325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Anton Khirnov
cd43ca0443 lavfi: do not export the filters from shared objects 2013-10-28 15:29:54 +01:00
Paul B Mahol
b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Michael Niedermayer
cdd5df8189 avfilter/vf_fps: make sure the fifo is not empty before using it
Fixes Ticket2905

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-02 04:32:23 +02:00
Michael Niedermayer
8b79a458c0 avfilter/vf_fps: fix ABI compatibility with AV_NOPTS starttime
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-29 13:12:09 +02:00
Michael Niedermayer
88262e1c1d Merge commit 'cb8f70c96e14c1b4824ef23d21d78d10fc5a4b93'
* commit 'cb8f70c96e14c1b4824ef23d21d78d10fc5a4b93':
  vf_fps: use double constants for default/min/max for start_time

Conflicts:
	libavfilter/vf_fps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-29 13:02:28 +02:00
Hendrik Leppkes
cb8f70c96e vf_fps: use double constants for default/min/max for start_time
When using AV_NOPTS_VALUE (which expands to INT64_C(0x8000000000000000))
as union initializer for a double field, the c99 converter needs to
interpret this constant when filling the union initializer, and it is
interpreted as a positive value.

When converting AV_NOPTS_VALUE to a double, MSVC 2010 ends up with
the same positive value as the c99 converter, while MSVC 2012 gets
a negative value.

This results in an infite loop in various FATE tests on MSVC 2012.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-28 17:54:47 +03:00
Pavel Koshevoy
185fc52f19 avfilter/vf_fps: Work around msvc (c99wrap) build failure
c99wrap choked on initialization of .dbl start_time option with
AV_NOPTS_VALUE: Unable to parse int64_t as expression primary

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-26 15:23:45 +02:00
Michael Niedermayer
b69b075ac6 Merge commit '545a0b807cf45b2bbc4c9087a297b741ce00f508'
* commit '545a0b807cf45b2bbc4c9087a297b741ce00f508':
  vf_fps: add 'start_time' option

Conflicts:
	doc/filters.texi
	libavfilter/vf_fps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-21 11:37:10 +02:00
Justin Ruggles
545a0b807c vf_fps: add 'start_time' option
This allows for dropping or duplication to match a particular start time.
2013-08-20 14:10:02 -04:00
Michael Niedermayer
c7078f4907 Merge commit '4c205f42c86ccefa093c59434669af34ad14a52b'
* commit '4c205f42c86ccefa093c59434669af34ad14a52b':
  vf_drawbox: make config_props work properly when called multiple times.
  vf_drawtext: do not reset the frame number in config_input.
  vf_fps: move initializing pts from config_props to init.

Conflicts:
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-17 11:05:18 +02:00
Anton Khirnov
7727be79d1 vf_fps: move initializing pts from config_props to init.
It should not be reinitialized if the link properties change.
2013-05-17 07:42:55 +02:00
Clément Bœsch
dfac37afd2 lavfi: add missing periods in filter descriptions. 2013-04-14 20:58:31 +02:00
Anton Khirnov
d69a4177b9 lavfi: remove now unused args parameter from AVFilter.init
Conflicts:

	libavfilter/avfilter.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_lut.c
	libavfilter/vf_select.c
	libavfilter/vf_setpts.c
	libavfilter/vsrc_color.c
	libavfilter/vsrc_movie.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-12 11:54:39 +02:00
Michael Niedermayer
81c1ed748b Merge commit 'f13ab29925883b4245da4129694af3af378d67be'
* commit 'f13ab29925883b4245da4129694af3af378d67be':
  vf_fps: switch to an AVOptions-based system.

Conflicts:
	libavfilter/vf_fps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-10 19:21:59 +02:00
Anton Khirnov
c43a7ecad9 lavfi: remove now unused args parameter from AVFilter.init 2013-04-09 19:12:38 +02:00
Anton Khirnov
f13ab29925 vf_fps: switch to an AVOptions-based system. 2013-04-09 19:04:15 +02:00
Paul B Mahol
7606f4a1af lavfi/fps: make use of AV_OPT_TYPE_VIDEO_RATE
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-03-26 13:23:41 +00:00
Nicolas George
b201c167d0 lavfi/vf_fps: use standard options parsing. 2013-03-20 21:13:56 +01:00
Clément Bœsch
96e4b00d62 lavfi: remove remaining forgotten min/rej perms. 2013-03-10 02:38:21 +01:00
Michael Niedermayer
a05a44e205 Merge commit '7e350379f87e7f74420b4813170fe808e2313911'
* commit '7e350379f87e7f74420b4813170fe808e2313911':
  lavfi: switch to AVFrame.

Conflicts:
	doc/filters.texi
	libavfilter/af_ashowinfo.c
	libavfilter/audio.c
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/buffersink.c
	libavfilter/buffersrc.c
	libavfilter/buffersrc.h
	libavfilter/f_select.c
	libavfilter/f_setpts.c
	libavfilter/fifo.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/version.h
	libavfilter/vf_aspect.c
	libavfilter/vf_bbox.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_fieldorder.c
	libavfilter/vf_fps.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_gradfun.c
	libavfilter/vf_hqdn3d.c
	libavfilter/vf_lut.c
	libavfilter/vf_overlay.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_transpose.c
	libavfilter/vf_vflip.c
	libavfilter/vf_yadif.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavfilter/yadif.h

Following are notes about the merge authorship and various technical details.

Michael Niedermayer:
  * Main merge operation, notably avfilter.c and video.c
  * Switch to AVFrame:
    - afade
    - anullsrc
    - apad
    - aresample
    - blackframe
    - deshake
    - idet
    - il
    - mandelbrot
    - mptestsrc
    - noise
    - setfield
    - smartblur
    - tinterlace
  * various merge changes and fixes in:
    - ashowinfo
    - blackdetect
    - field
    - fps
    - select
    - testsrc
    - yadif

Nicolas George:
  * Switch to AVFrame:
    - make rawdec work with refcounted frames. Adapted from commit
      759001c534 by Anton Khirnov.
      Also, fix the use of || instead of | in a flags check.
    - make buffer sink and src, audio and video work all together

Clément Bœsch:
  * Switch to AVFrame:
    - aevalsrc
    - alphaextract
    - blend
    - cellauto
    - colormatrix
    - concat
    - earwax
    - ebur128
    - edgedetect
    - geq
    - histeq
    - histogram
    - hue
    - kerndeint
    - life
    - movie
    - mp (with the help of Michael)
    - overlay
    - pad
    - pan
    - pp
    - pp
    - removelogo
    - sendcmd
    - showspectrum
    - showwaves
    - silencedetect
    - stereo3d
    - subtitles
    - super2xsai
    - swapuv
    - thumbnail
    - tile

Hendrik Leppkes:
  * Switch to AVFrame:
    - aconvert
    - amerge
    - asetnsamples
    - atempo
    - biquads

Matthieu Bouron:
  * Switch to AVFrame
    - alphamerge
    - decimate
    - volumedetect

Stefano Sabatini:
  * Switch to AVFrame:
    - astreamsync
    - flite
    - framestep

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Clément Bœsch <ubitux@gmail.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-10 01:40:35 +01:00
Anton Khirnov
7e350379f8 lavfi: switch to AVFrame.
Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it
and use AVFrame instead.
2013-03-08 07:37:18 +01:00
Michael Niedermayer
68f92a70f1 Merge commit 'dae1d507af94261bafd3b11549884e5d1eca590e'
* commit 'dae1d507af94261bafd3b11549884e5d1eca590e':
  x86: Add PAVGB macro to abstract pavgb/pavgusb instruction via cpuflags
  vf_fps: add final flushed frames to the dropped frame count
  rv34_parser: Adjust #if for disabling individual parsers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-16 11:44:45 +01:00
Justin Ruggles
23098bbd50 vf_fps: add final flushed frames to the dropped frame count 2013-01-15 11:26:46 -05:00
Clément Bœsch
4b4f16cdc0 lavfi/fps: remove parse opt error message.
See cc650cf0 for more info.
2012-12-11 18:14:08 +01:00
Clément Bœsch
0e0e3db189 lavfi/fps: add shorthand. 2012-12-11 18:12:11 +01:00
Anton Khirnov
92b57e8dac vf_fps: switch to filter_frame
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-28 19:28:41 +01:00
Anton Khirnov
565e4993c6 lavfi: merge start_frame/draw_slice/end_frame
Any alleged performance benefits gained from the split are purely
mythological and do not justify added code complexity.
2012-11-28 08:50:19 +01:00