Commit Graph

965 Commits

Author SHA1 Message Date
Anton Khirnov
a2cd9be212 lavfi: add an audio buffer sink. 2012-05-14 21:36:11 +02:00
Anton Khirnov
4c66c40718 lavfi: add an audio buffer source. 2012-05-14 21:36:11 +02:00
Anton Khirnov
720c6b78d1 buffersrc: add av_buffersrc_write_frame().
It's the same as av_vsrc_buffer_add_frame(), except it doesn't take pts
or pixel_aspect parameters. Those are read from AVFrame.

Deprecate av_vsrc_buffer_add_frame().
2012-05-14 21:36:11 +02:00
Anton Khirnov
8b05e13df3 buffersrc: fix invalid read in uninit if the fifo hasn't been allocated 2012-05-14 21:36:10 +02:00
Anton Khirnov
fad729fa50 lavfi: rename vsrc_buffer.c to buffersrc.c
Most of the code will be shared for both audio and video version.
2012-05-14 21:36:10 +02:00
Anton Khirnov
fd127ede62 avfiltergraph: reindent 2012-05-14 21:36:10 +02:00
Anton Khirnov
ff1f51a8aa lavfi: add channel layout/sample rate negotiation. 2012-05-14 21:36:10 +02:00
Anton Khirnov
5775a1832c lavfi: add types and functions for channel layout/samplerate negotiation 2012-05-14 21:36:10 +02:00
Robert Nagy
394a0267ab yadif: Flush filter on eof.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-14 21:36:10 +02:00
Robert Nagy
7dd56d411e yadif: Improve pts accuracy.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-14 21:36:10 +02:00
Anton Khirnov
012f04a277 lavfi: autoinsert resample filter when necessary. 2012-05-12 18:09:29 +02:00
Anton Khirnov
d371e7b988 lavfi: add lavr-based audio resampling filter. 2012-05-12 18:09:28 +02:00
Anton Khirnov
0b45334a58 lavfi: move audio-related functions to a separate file.
This is easier to follow than having them randomly scattered in
avfilter.c and defaults.c.
2012-05-09 20:32:49 +02:00
Anton Khirnov
472fb3bbfa lavfi: remove some audio-related function from public API.
Those functions are only useful inside filters. It is better to not
support user filters until the API is more stable.

This breaks audio filtering API and ABI in theory, but since it's
unusable right now this shouldn't be a problem.
2012-05-09 20:31:56 +02:00
Anton Khirnov
f20ab492ac lavfi: change AVFilterLink.sample_rate from int64_t to int on next bump
There is no real reason for it to be 64bit, it's just a plain int in the
rest of Libav.
2012-05-09 20:31:26 +02:00
Anton Khirnov
a6bdfc2a92 lavfi: change AVFilterBufferRefAudioProps.sample_rate from uint32_t to int
There's no reason for it to be explicitly 32 bits. It's declared as a
plain int in all other places in Libav.

This breaks audio filtering API and ABI in theory, but since it's
unusable right now this shouldn't be a problem.
2012-05-09 20:30:28 +02:00
Stefano Sabatini
7ef0adcc2e lavfi: simplify signature for avfilter_get_audio_buffer() and friends
The additional parameters are just complicating the function interface.

Assume that a requested samples buffer will *always* have the format
specified in the requested link.

This breaks audio filtering API and ABI in theory, but since it's
unusable right now this shouldn't be a problem.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-09 20:29:53 +02:00
Stefano Sabatini
6735534f19 lavfi: use avfilter_get_audio_buffer_ref_from_arrays() in avfilter_default_get_audio_buffer 2012-05-09 20:28:56 +02:00
Stefano Sabatini
e727bca392 lavfi: cleanup avfilter_get_audio_buffer() and pals.
Remove AVFilterBufferRefAudioProps.size, and use nb_samples in its place
everywhere.
This is required as the size in the audio buffer may be aligned, so it
may not contain a well defined number of samples.

Also remove the useless planar parameter, which can be deduced from the
sample format.

This is technically an API and ABI break, but since the audio part of
lavfi is not usable now, this should not be a problem in practice.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-09 20:26:19 +02:00
Stefano Sabatini
1b8c9271bd lavfi: add avfilter_get_audio_buffer_ref_from_arrays().
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-09 17:51:13 +02:00
Anton Khirnov
9453c9e1de lavfi: add extended_data to AVFilterBuffer.
This is similar to what has previously been done in AVFrame to allow
dealing with more than 8 channels.
2012-05-09 17:47:53 +02:00
Anton Khirnov
ac71230902 lavfi: add video buffer sink, and use it in avtools
Also add the public interface libavfilter/buffersink.h.

Based on a commit by Stefano Sabatini.
2012-05-09 08:59:37 +02:00
Anton Khirnov
ab165047a6 lavfi: add a function for copying properties from AVFilterBufferRef->AVFrame
Based on a commit by Stefano Sabatini <stefano.sabatini-lala@poste.it>
2012-05-09 08:49:36 +02:00
Anton Khirnov
8134fafe9b lavfi: uninline avfilter_copy_buffer_ref_props().
A nontrivial public function such as this should most certainly NOT be
inline.
2012-05-07 14:23:36 +02:00
Diego Biurrun
dbe6ba55a3 build: cosmetics: Add missing end-of-line backslashes to item lists. 2012-05-07 14:17:40 +02:00
Diego Biurrun
9eb83a56aa build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. 2012-05-07 14:01:32 +02:00
Robert Nagy
a07578f3f2 vf_yadif: fix missing error handling for avfilter_poll_frame() 2012-05-07 10:26:57 +02:00
Anton Khirnov
0bbd874743 lavfi: support audio in avfilter_copy_frame_props(). 2012-05-07 07:10:48 +02:00
Mina Nagy Zaki
11b6a82412 lavfi: avfilter_merge_formats: handle case where inputs are same
This fixes a double-free crash if lists are the same due to the two
merge_ref() calls at the end of the (useless) merging that happens.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-07 07:08:59 +02:00
Anton Khirnov
d4ac703c7f lavfi/formats: use sizeof(var) instead of sizeof(type). 2012-05-06 16:26:41 +02:00
Stefano Sabatini
f10530b78a lavfi: remove avfilter_default_config_input_link() declaration
The function is not implemented (and possibly useless).
2012-05-06 16:26:41 +02:00
Anton Khirnov
25b3babe11 lavfi: always enable the scale filter and depend on sws.
The scale filter is used for internal colorspace conversions, so it must
always be present.
2012-05-06 16:22:29 +02:00
Anton Khirnov
fd18ee0ff6 vf_split: support user-specifiable number of outputs. 2012-05-06 16:21:00 +02:00
Nicolas George
5cb4f1a127 vsrc_buffer: return EAGAIN if no frame is available.
This is not an erroneous condition, do not print a warning.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-05-05 12:59:18 +02:00
Anton Khirnov
aff01de641 graphparser: set next to NULL on an entry extracted from inputs list
Prevents it from referring to the rest of the list.
2012-04-16 09:28:34 +02:00
Anton Khirnov
7af99a01c4 graphparser: fix the order in which unlabeled input links are returned. 2012-04-15 20:20:03 +02:00
Anton Khirnov
7bf9e3391f vsrc_buffer: fix check from 7ae7c41.
The user submitted variable in this function is frame, not buf.
2012-04-14 18:58:20 +02:00
Stefano Sabatini
91d3cbe0fd avfiltergraph: make the AVFilterInOut alloc/free API public
This is required for letting applications to create and destroy
AVFilterInOut structs in a convenient way.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-14 09:25:46 +02:00
Anton Khirnov
12e7e1d03e graphparser: allow specifying sws flags in the graph description. 2012-04-14 09:25:46 +02:00
Anton Khirnov
4e781c25b7 graphparser: fix the order of connecting unlabeled links.
Right now, e.g. scale,[in]overlay would connect scale to the first
overlay input and [in] to the second, which goes against the
documentation and is unintuitive.

The bug happens because of the ordering mess in curr_inputs variable:
1) the unlabeled links from the previous filter are added to it in
correct order
2) input labels are parsed and inserted to the beginning one by one
(i.e. in reverse order)
3) curr_inputs is matched against filter inputs in reverse order

Fix the problem by always using proper ordering without trying to be
clever.
2012-04-14 09:25:46 +02:00
Anton Khirnov
d7bcc71dad graphparser: add avfilter_graph_parse2().
Unlike avfilter_graph_parse(), it returns unlinked inputs and outputs
to the caller, which allows parsing of graphs where inputs/outputs are
not known in advance.
2012-04-14 09:25:46 +02:00
Anton Khirnov
7ae7c41413 vsrc_buffer: allow using a NULL buffer to signal EOF. 2012-04-14 09:25:46 +02:00
Anton Khirnov
e36b25d1df vf_overlay: implement poll_frame()
Signal that it can output a frame when there are frames on the main
input and EOF on the overlay input, but a frame is buffered -- e.g.
single picture overlay.
2012-04-09 21:30:21 +02:00
Anton Khirnov
90f65dc6cf vf_scale: support named constants for sws flags. 2012-04-09 21:29:05 +02:00
Anton Khirnov
a03f8ea0a8 vsrc_buffer: when no frame is available, return an error instead of segfaulting. 2012-04-05 09:30:09 +02:00
Diego Biurrun
1f068e4450 vf_unsharp: Mark readonly variable as const.
This fixes the following warning:
libavfilter/vf_unsharp.c:106: warning: initialization discards qualifiers from pointer target type
2012-04-04 19:34:40 +02:00
Anton Khirnov
95587d29d7 vsrc_buffer: allow buffering arbitrary number of frames. 2012-04-01 09:04:19 +02:00
Anton Khirnov
416fd90ead vf_scale: avoid a pointless memcpy in no-op conversion.
I.e. just pass the buffer along when src parameters == dst parameters.
2012-04-01 09:04:14 +02:00
Anton Khirnov
63736fe48c avfiltergraph: try to reduce format conversions in filters.
Current code, with a filterchain such as
(input - yuv411) -> (scale - any) -> (sink - any)
will result in yuv420 being chosen for the second link, which is clearly
not right.

This commit attempts to improve in the following way:
repeat until convergence:
  loop over all filters
    find input link with exactly one format
    force this format on all output links of the same type (if possible)
2012-04-01 09:04:09 +02:00
Anton Khirnov
996f9f0c32 avfiltergraph: add an AVClass to AVFilterGraph on next major bump.
It will be used for logging, possibly also AVOptions.
2012-04-01 09:03:35 +02:00