Reimar Döffinger
3cc0f335fe
af_aresample: remove only use of array compound literals with non-const initializers in FFmpeg.
Some older compilers might have particular trouble with them,
and they do not really seem worth it to me.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
11 years ago
Alex Sukhanov
86b3435fc0
af_aresample: Fix timestamp of first padded PCM audio packet
Problem:
ffmpeg generated video file which had two audio packets with the same timestamp: last original audio packet and first padded audio packet.
Timestamp of first added audio packet by 'apad' fitler had the same value as last original audio packet. The problem was in 'aresample' fitler, which used next pts instead of current one.
As long as 'apad' and 'aresample' filters have separate mechanisms of timestamp calculation, they got the same values.
Command line:
ffmpeg -i <input_filename> -shortest -apad 512 -af asetnsamples=n=512 -b:a 1058400 -ac 1 -ar 44100 -async 0 -acodec pcm_s16le -sn -f matroska -y <output_file>
Fix:
Call swr_next_pts() function before swr_convert()
Tested:
FATE tests passed.
Fix has been tested in our Transcoder regression framework on ~10k test videos. It's about ~500k transcodes.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
ea6331b2c6
avfilter/af_aresample: Calculate output buffer size more precisely.
Fixes accumulation of data in case of significant silence injections
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Paul B Mahol
b211607b5c
avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Michael Niedermayer
ec0e0eb4c1
avfilter/vf_scale+aresample: minor simpification
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
4f43e9b4af
avfilter/aresample: use init_dict system and set child AVOption context correctly
Parts of this commit are based on: 4fa1f52e
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
cd5f50a255
avfilter: avoid direct access to AVFrame.channels
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Clément Bœsch
c82bb2815b
lavfi/aresample: raise filter_frame() error.
12 years ago
Nicolas George
3d2adeb6f8
lavfi/af_aresample: fix info log for unknown layouts.
12 years ago
Nicolas George
2bd104c72a
lavfi/af_aresample: fix layout consistency check.
If the channel layout is unknown, lswr will internally use
the default one for the corresponding number of channels.
12 years ago
Nicolas George
b00502457a
lavfi/af_aresample: accept unknown channel layouts.
12 years ago
Stefano Sabatini
e06c147581
lavfi/aresample: fix style
Improve overall consistency/improve readability.
12 years ago
Nicolas George
238edd2fe3
lavfi: add a channels field to AVFilterLink.
Also: fix af_pan and af_aresample, that forgot to update
audio->channels.
12 years ago
Michael Niedermayer
616e6ffac6
aresample: increase n_out buffer size a bit to reduce delay in some corner cases
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Clément Bœsch
2d9d444051
lavfi: convert remaining input/output list compound literals to named objects.
This is following 568c70e79e
.
12 years ago
Michael Niedermayer
cd7febd33f
lavfi: replace filter_samples by filter_frame
Based on patch by Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
8d231e37af
af_aresample: consistently use ROUNDED_DIV
This fixes issues with negative timestamps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
4b5a12a2cb
af_aresample: fix rounding of negative timestamps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
014058abea
af_aresample: check ff_get_audio_buffer() failure
Fixes null pointer dereference
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
c44a028e19
af_aresample: allocate at least 1 sample buffer. Fix null ptr dereference.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
1acd2f6ba7
Replace rest of libavutil/audioconvert.h with libavutil/channel_layout.h
Also remove it in once case when it is not needed.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
9ba2484ece
af_aresample: fix leak on alloc failure
Fixes CID733798
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Nicolas George
b5bea2f960
lavfi/aresample: set buffer properties after copy.
The aresample filter changes the format, layout and/or sample rate,
it can not copy them blindly from its input.
Related to trac ticket #1671 .
12 years ago
Stefano Sabatini
fda968aa8f
lavfi: decrease logging level of message showing initial parameters
Reduce log clutter, consistent with 1a49a169eb
.
13 years ago
Stefano Sabatini
972cad77fa
lavfi: remove unnecessary inclusion of libavcodec/avcodec.h in avfilter.h
libavfilter API was designed in order to be clarly distinguished from the
libavcodec API, including avcodec.h in avfilter.h is not going to help to
stick to this principle.
The inclusion of libavutil/audioconvert.h in many files was required
because avcodec.h includes audioconvert.h.
libavfilter/avcodec.h is where the lavc/lavfi interface should be
entirely placed.
13 years ago
Michael Niedermayer
62975afa68
af_aresample: fix sample_rate type.
should fix fate failures on 32bit x86 linux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Paul B Mahol
c9e183b490
lavfi: update some deprecated functions
Signed-off-by: Paul B Mahol <onemda@gmail.com>
13 years ago
Michael Niedermayer
be97675e6c
af_aresample: fix pts, they where off by a packet in the -async >0 case.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
411689b5e1
af_aresample: fix request_frame()
Fixes part of Ticket1341
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Clément Bœsch
b0b7a89b07
lavfi/aresample: print channel layouts and formats along with the rate.
13 years ago
Michael Niedermayer
21d8a80e30
af_aresample: use new swr API to pass and compensate PTS
This code is not only much more powerfull its also simpler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
087d09b6d5
af_aresample: allocate a larger buffer so accumulated data can be returned quicker
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
e17a039647
af_aresample: use extended_data
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
96ac8663de
af_aresample: Consider the swresample delay during calculating timestamps.
The difference from this should be pretty small.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
6ba692f8a7
af_aresample: fix rounding that led to sample accumulation in the buffers.
This fixes a regression that apparently was missed when switching to the
in af resampler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
db6ef054f5
af_aresample: 10l fix, wrong timebase for next_pts.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
847943bc51
aresample: add code to flush the internal swr buffer.
Inspired-by code from af_resample.c written by Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
b3e1b95afa
aresample: check return code of swr_convert()
Issue found by comparing af_resample.c and af_aresample.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
b13d39bd81
av_aresample: Allow changing sample format and channel layout as well
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
e3c6b61263
af_aresample: support all swresample parameters.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
47c2e52bc6
af_aresample: fix typo in query formats
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
efdc895fbd
lavfi: fix pts rescaling in the resampler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
75492cce8e
lavfi: fix resample with differing formats
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Clément Bœsch
4522df52aa
lavfi: remove audio.h include from avfilter.h.
avfilter.h is a public header and the unexported audio.h header contains
only internal prototypes.
13 years ago
Robert Nagy
ed66bbfcb9
lavfi/aresample: properly propagate pts == AV_NOPTS_VALUE;
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
13 years ago
Clément Bœsch
e96be8409f
lavfi/aresample: use libswresample.
13 years ago
Reimar Döffinger
5af7daabc4
Mark AVFilterPad[] compound literals as const.
GCC 4.6.2 at least still seems to fail to put them in .rodata though,
see also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37303
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
13 years ago
Stefano Sabatini
22137bb5c2
af_aresample: fix properties setting in the output buffer
In particular: set output timebase to 1/output_sample_rate, fix output
PTS computation, and do not forget to copy properties values from the
input buffer.
13 years ago
Stefano Sabatini
db79d04173
af_aresample: do not request a buffer with AV_PERM_REUSE2 permissions in filter_samples()
That was pointless. Simplify.
13 years ago
Stefano Sabatini
9899037dc6
lavfi: rename avfilter_all_* function names to avfilter_make_all_*
A function name should tell what the function does rather than what
the function returns. This also avoids possible conflicts
(e.g. between a function and a public list of all supported formats),
and clarifies the code.
Breaks audio API/ABI, add a backward compatibility layer for video
API/ABI.
13 years ago