Commit graph

1420 commits

Author SHA1 Message Date
Arun Raghavan
f4cba79063 audioresample: Fix some gobject introspection warnings 2016-09-28 19:09:26 +05:30
Nirbheek Chauhan
5c4f4ac1bd Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:09:51 +01:00
Michael Olbrich
44da322083 audioclock: use GST_STIME_FORMAT for the correct argument
GST_STIME_ARGS is used for time_offset not for last_time.
This fixes the format string accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=768990
2016-07-20 12:28:54 +01:00
Sebastian Dröge
61f59857a7 audio: Ship audio-resampler-neon.h 2016-07-07 00:27:18 +03:00
Sebastian Dröge
e5d7064b29 audiodecoder: Protect samples_in/bytes_out and audio info with object lock
It might cause invalid calculations during the CONVERT query otherwise.
2016-07-04 11:12:55 +02:00
Sebastian Dröge
5cbd1a7bca audioencoder: Protect samples_in/bytes_out and audio info with object lock
It might cause invalid calculations during the CONVERT query otherwise.
2016-07-04 11:12:55 +02:00
Sebastian Dröge
8d8262a00c audioencoder/decoder: Move encoded audio conversion function to a common place
No need to duplicate this non-trivial function.
2016-07-04 11:12:55 +02:00
Vincent Penquerc'h
c76e8c77eb audiodecoder: fix criticals fixating a non existent field
https://bugzilla.gnome.org/show_bug.cgi?id=766970
2016-07-04 10:05:45 +01:00
Sebastian Dröge
5de9d5809b audioconvert: Handle fallback channel mask for mono correctly
It's 0 and no mask should be set for mono at all.

https://bugzilla.gnome.org/show_bug.cgi?id=757472
2016-06-29 18:14:51 +02:00
Guillaume Desmottes
937a42247a audioaggregator: fix buffer leak
If the pad was still owning a buffer when being destroyed it was leaked.

Fix a leak with the test_flush_start_flush_stop test.

https://bugzilla.gnome.org/show_bug.cgi?id=766663
2016-06-21 10:52:47 +03:00
Mikhail Fludkov
8d4f79b640 audiodecoder: fix invalid timestamps when PLC and delay
Elements inherited from GstAudioDecoder, supporting PLC and introducing
delay produce invalid timestamps. Good example is opusdec with in-band FEC
enabled. After receiving GAP event it delays the audio concealment until
the next buffer arrives. The next buffer will have DISCONT flag set which
will make GstAudioDecoder to reset it's internal state, thus forgetting
the timestamp of GAP event. As a result the concealed audio will have the
timestamp of the next buffer (with DISCONT flag) but not the timestamp
from the event.
2016-06-16 11:01:04 +01:00
Tim-Philipp Müller
d52a74f32e g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous.
2016-05-24 00:44:21 +01:00
Kipp Cannon
f7a31a79f4 audio: Add const to segment parameter of gst_audio_buffer_clip()
e.g., allows this to be used with the reference retrieved by
gst_event_parse_segment().

https://bugzilla.gnome.org/show_bug.cgi?id=765663
2016-04-27 12:26:07 +03:00
Jan Schmidt
802eae296a Revert "audioringbuffer: start ringbuffer if needed upon commit"
This reverts commit 13ee94ef10.

Causes audio glitches at startup by starting to output segments
from the ringbuffer before it has been filled / fully prerolled.

https://bugzilla.gnome.org/show_bug.cgi?id=657076
2016-04-16 02:13:15 +10:00
Guillaume Desmottes
7c5dfd713c audioringbuffer: don't attempt to reorder position-less channels
As said in its doc GST_AUDIO_CHANNEL_POSITION_NONE is meant to be used
for "position-less channels, e.g. from a sound card that records 1024
channels; mutually exclusive with any other channel position".

But at the moment using such positions would raise a
'g_return_if_reached' warning as gst_audio_get_channel_reorder_map()
would reject it.

Fix this by preventing any attempt to reorder in such case as that's not
what we want anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=763799
2016-04-12 14:48:30 -04:00
Guillaume Desmottes
1c56cfa144 audio: add debug output if channels mapping does not match
https://bugzilla.gnome.org/show_bug.cgi?id=763985
2016-04-12 14:48:30 -04:00
Guillaume Desmottes
3cb08304da gst-audio: add gst_audio_channel_positions_to_string()
We currently don't log much about channel positions making debugging
harder as it should be. This is the first step in my attempt to improve
this.

https://bugzilla.gnome.org/show_bug.cgi?id=763985
2016-04-12 14:48:30 -04:00
Fabrice Bellet
bfcd0737b7 audio: Fix a race with the audioringbuffer thread
There is a small window of time where the audio ringbuffer thread
can access the parent thread variable, before it's initialized
by the parent thread. The patch replaces this variable use by
g_thread_self().

https://bugzilla.gnome.org/show_bug.cgi?id=764865
2016-04-11 21:43:13 +10:00
Víctor Manuel Jáquez Leal
37c4915109 libs: audio: split allocation query caps and pad caps
Since the allocation query caps contains memory size and the pad's caps
contains the display size, an audio encoder or decoder might need to allocate
a different buffer size than the size negotiated in the caps.

This patch splits this logic distinction for audiodecoder and audioencoder.

Thus the user, if needs a different allocation caps, should set it through
gst_audio_{encoder,decoder}_set_allocation_cap() before calling the negotiate()
vmethod. Otherwise the allocation_caps will be the same as the caps in the
src pad.

https://bugzilla.gnome.org/show_bug.cgi?id=764421
2016-04-05 11:37:15 +02:00
Víctor Manuel Jáquez Leal
052fe11949 audioencoder: fix gtk-doc comment format 2016-04-04 17:12:16 +02:00
Alessandro Decina
74efde50ad audio-resampler: disable neon on arm64
Fix the build on arm64 by using HAVE_ARM_NEON instead of __ARM_NEON__.
2016-03-30 11:16:49 +11:00
Sebastian Dröge
0582d5a1bc audio-resampler: Use _mm_set_epi64x(0, x) instead of _mm_cvtsi64_si128(x) in more places 2016-03-29 12:11:48 +03:00
Sebastian Dröge
38a5a3614e resampler: Use _mm_set_epi64x(0, x) instead of _mm_cvtsi64_si128(x)
The latter is only available on x86-64 for some reason.
2016-03-29 10:15:07 +03:00
Edward Hervey
de2ded9557 audio: Fix distcheck
Don't forget to dist the needed files (which don't need to be installed)
2016-03-29 08:22:29 +02:00
Wim Taymans
19f7d9ca46 audio-resampler: estimate memory usage in auto mode
Estimate the memory usage and use this to decide between full or
interpolated filter.
2016-03-28 15:37:36 +02:00
Wim Taymans
984ee8a3f6 audio-resampler: small optimizations 2016-03-28 13:25:55 +02:00
Wim Taymans
cf9059f070 audio-resampler: improve non-interleaved flags
Make it possible to have different interleaving on input and output
because we can quite trivially do that.
2016-03-28 13:25:55 +02:00
Wim Taymans
33855f0fe1 audio-resampler: unroll some more loops
Unroll some loops.
2016-03-28 13:25:55 +02:00
Wim Taymans
90a41b81dc audio-resampler: keep precision
Transpose and add before applying the cubic interpolation to avoid
overflows when using full precision.
2016-03-28 13:25:55 +02:00
Wim Taymans
cc9d8594fe audio-resampler: small cleanups 2016-03-28 13:25:55 +02:00
Wim Taymans
e209c0d565 audio-resampler: optimize no resampling
Switch to the faster nearest resample method when are doing no rate
conversion.
2016-03-28 13:25:54 +02:00
Wim Taymans
f692d5e459 audio-resampler: add VARIABLE_RATE flag
Add a VARIABLE rate flag that selects an interpolating filter.
Move some function setup code in the _new function.
2016-03-28 13:25:54 +02:00
Wim Taymans
7bb149dcc1 audio-resampler: more neon optimizations 2016-03-28 13:25:54 +02:00
Wim Taymans
6dd5e5259f audio-resampler: avoid overflow in cubic interpolation
Shift out an extra bit to have some more headroom when doing cubic
interpolation.
2016-03-28 13:25:54 +02:00
Wim Taymans
61460fdfad audio-resampler: overread only 8 taps
We only need 8 taps of zeroes as headroom for the SIMD optimized
functions.
2016-03-28 13:25:54 +02:00
Wim Taymans
4772ebbddf audio-converter: use helper to check intermediate format 2016-03-28 13:25:54 +02:00
Wim Taymans
00e5a8bab8 audio-resampler: fix phase 2016-03-28 13:25:54 +02:00
Wim Taymans
9182ea17b5 audio-resampler: fix neon assembler 2016-03-28 13:25:53 +02:00
Wim Taymans
027165621b audio-resampler: avoid some format conversion
Store the filter in the desired sample format so that we can simply do a
linear or cubic interpolation to get the new filter instead of having to
go through gdouble and then convert.
2016-03-28 13:25:53 +02:00
Wim Taymans
2c33c2134c audio-resampler: fix neon linear float interpolation 2016-03-28 13:25:53 +02:00
Wim Taymans
d969a7a9d8 audio-resampler: reorder filter coefficients for more speed
Reorder the filter coefficients to make it easier to use SIMD for
interpolation.
Fix orc flags a little.
Add specialized nearest resampling function.
2016-03-28 13:25:53 +02:00
Wim Taymans
107f53ea0a audio-resampler: remove stereo optimizations
The stereo optimizations don't give enough benefit.
Rename none to full to make it clear that we use a full filter instead
of an interpolated one
2016-03-28 13:25:53 +02:00
Wim Taymans
b820074a49 audio-resample: remove neon double stubs
NEON does not have double types.
2016-03-28 13:25:53 +02:00
Wim Taymans
6f9237dfb5 audio-resampler: add more neon optimizations 2016-03-28 13:25:53 +02:00
Wim Taymans
307f360cca audio-resampler: add more neon optimizations 2016-03-28 13:25:53 +02:00
Wim Taymans
d5abdd83c9 audio-resampler: add neon optimizations
Unroll some more loops in the fallback code that seems to work fine
for ARM.
Add some simple ARM optimizations taken from speex.
2016-03-28 13:25:53 +02:00
Wim Taymans
25d81ffb55 audio-resampler: give better hints about the precision
Give better hints to the compiler about the precision we expect from
the multiplications.
2016-03-28 13:25:53 +02:00
Wim Taymans
ea497b509f audio-resample: small optimizations
Remove some inline functions that are called in the slow path.
Unroll C fallback functions a little.
2016-03-28 13:25:52 +02:00
Wim Taymans
167a415717 audio-resampler: Use n_phases when calculating taps offset
Tweak linear interpolation oversampling.
Clear filter cache on rate changes when using a full filter.
2016-03-28 13:25:52 +02:00
Wim Taymans
524ea147cc audio-resampler: improve filter construction
Remove some unused variables from the inner product functions.
Make filter coefficients by interpolating if required.
Rename some fields.
Try hard to not recalculate filters when just chaging the rate.
Add more proprties to audioresample.
2016-03-28 13:25:52 +02:00
Wim Taymans
0f3ff9177f audio-resampler: avoid overflow in fraction calculation 2016-03-28 13:25:52 +02:00
Wim Taymans
651ae201bc audio-resampler: increase precision 2016-03-28 13:25:52 +02:00
Wim Taymans
4cb52f1831 audio-resampler: add more optimizations 2016-03-28 13:25:52 +02:00
Wim Taymans
bdf194a09a audio-resample: fix taps conversion
We do taps conversion in place so make sure we don't overwrite the
input with temporary data.
Optimize some more gint16 functions.
2016-03-28 13:25:52 +02:00
Wim Taymans
f6e0481ab5 audio-resampler: Improve taps memory layout
Rearrange the oversampled taps in memory to make it easier to use
SIMD instructions on them. this simplifies some sse code.
Add some more optimizations
2016-03-28 13:25:52 +02:00
Wim Taymans
e9fc039bb1 audio-resampler: add cubic interpolation 2016-03-28 13:25:52 +02:00
Wim Taymans
58dcd0587d audio-resampler: add more functions
Use some macros to generate more functions
2016-03-28 13:25:51 +02:00
Wim Taymans
e02af5c534 audio-resampler: add linear interpolation method
Make more functions into macros.
Add linear interpolation of filter coefficients.
2016-03-28 13:25:51 +02:00
Wim Taymans
05d238def9 audio-resampler: add max-phase-error config 2016-03-28 13:25:51 +02:00
Wim Taymans
13e5b986cd audio-resampler: improve tap calculation
Return the taps from make_taps, this makes it possible to not actually
have to cache the taps when we want to.
Fix overflow in phase calculation.
2016-03-28 13:25:51 +02:00
Wim Taymans
6397db74cd audio-resampler: fix guint -> gint 2016-03-28 13:25:51 +02:00
Wim Taymans
45574ba4f4 audio-resampler: improve phase error
Accept a phase error of maximum 10%, which turns out to be inaudible.
2016-03-28 13:25:51 +02:00
Wim Taymans
b0b3350717 audio-resampler: improve phase calculation
Also calculate the GCD with the current phase so that we can accurately
represent the current phase with the new resample rates.
2016-03-28 13:25:51 +02:00
Wim Taymans
bbdb447b2b audio-resampler: fix history after buffer resize
When we resize the temp buffer, move the history in its new place.
2016-03-28 13:25:51 +02:00
Wim Taymans
ed747492ef audio-resampler: add reset function
Add a function to reset the audio-resampler.
Use new function in audio-converter
Use the new functions in gstaudioresample and fixup drain functions.
2016-03-28 13:25:51 +02:00
Wim Taymans
ea469ad9a8 audio-resampler: Small fixes
Fix the phase.
Reset the new sample buffer with 0.
Move samples around when we change the filter size.
2016-03-28 13:25:51 +02:00
Wim Taymans
a489f9ddb3 audio-resampler: Rework make_taps
Make it return a pointer to the generated taps. That way we can later
decide to actually cache it or not.
2016-03-28 13:25:51 +02:00
Wim Taymans
05eb109c0d audio-resampler: handle filter length changes
Update the buffer with history samples when the filter length changes
because of an update of the parameters or sample rates.
2016-03-28 13:25:51 +02:00
Wim Taymans
8dfb3ffb99 audio-resampler: fix samples_avail
We only know the taps after we calculate them.
2016-03-28 13:25:51 +02:00
Wim Taymans
c8fc9d88a7 audio-resampler: work on dynamically changing the samplerate
Calculate the new phase for the new sample rate.
Fix some docs.
2016-03-28 13:25:51 +02:00
Wim Taymans
4e48867097 audio-resampler: small cleanups 2016-03-28 13:25:51 +02:00
Wim Taymans
85c77659b9 audio-resampler: add fallback to mono function
Remove stereo implementations. Implement fall back to mono functions
when the stereo function is missing.
2016-03-28 13:25:50 +02:00
Wim Taymans
2555317a71 audio-resampler: add float stereo SSE function 2016-03-28 13:25:50 +02:00
Wim Taymans
e74c207433 audio-resampler: Fix compilation of intrinsics
Only compile intrinsics when we are building for the selected
architecture.
Add sse4.1 optimized int32 resampler code.
2016-03-28 13:25:50 +02:00
Wim Taymans
98bd349b88 audioconvert: only resample on supported formats 2016-03-28 13:25:50 +02:00
Wim Taymans
d348fbb9b9 audio-converter: make some optimized functions
Make an optimized function that just calls the resampler when possible.
Optimize the resampler transform_size function a little.
2016-03-28 13:25:50 +02:00
Wim Taymans
23531bdc93 audio-resampler: remove mirror function
We don't need to mirror the input, just assume 0 samples.
Always move the processed samples to the start of the buffer.
Add some G_LIKELY
2016-03-28 13:25:50 +02:00
Wim Taymans
6f685410b1 audio-resampler: also enable sse when sse2 is available 2016-03-28 13:25:50 +02:00
Wim Taymans
71871c5048 audio-resampler: optimizations
Improve int16 resampling by using pmaddwd
Use intrinsics to scale and pack int16 samples
Align the coefficients so that we can use aligned loads
Add padding to taps and samples so that we don't have to use partial
loads for the remainder of the loops.
Remove copy_n, we can reuse the plain copy function with some new
parameters.
Align and pad the sample array.
2016-03-28 13:25:50 +02:00
Wim Taymans
f55a67ca7c audio-resampler: make pluggable optimized functions
Add support for x86 specialized functions and select them at runtime.
2016-03-28 13:25:50 +02:00
Wim Taymans
819c4c26c7 audio-resampler: combine functions 2016-03-28 13:25:50 +02:00
Wim Taymans
de37491662 audio-converter: simplify API
Remove the consumed/produced output fields from the resampler and
converter. Let the caler specify the right number of input/output
samples so we can be more optimal.
Use just one function to update the converter configuration.
Simplify some things internally.
Make it possible to use writable input as temp space in audioconvert.
2016-03-28 13:25:50 +02:00
Wim Taymans
1d9a793545 audio-converter: more work on resampling
- Fix the resampler in the audio converter
- fix memory leaks
2016-03-28 13:13:59 +02:00
Wim Taymans
75d668e152 audio-converter: add resampler
Add a resampler to the processing chain when needed.
port the audio resampler to the new audioconverter library
2016-03-28 13:13:59 +02:00
Tim-Philipp Müller
f4fb623aba audiodecoder: avoid unnecessary gst_pad_has_current_caps() checks
No need to do this for each input buffer, we have the input caps
stored somewhere already.

https://bugzilla.gnome.org/show_bug.cgi?id=763337
2016-03-24 14:49:12 +02:00
Vineeth TM
44b70ca3a1 base: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763075
2016-03-24 14:25:41 +02:00
Wim Taymans
c0ef1ea553 audio-channel-mixer: improve non-interleaved flags
Make separate flags for non-interleaved input and output because the
channel mixer should be able to convert between the two layouts in the
future.
2016-03-04 17:17:33 +01:00
Wim Taymans
221e661f07 audio-quantize: fix feedback dither
Make sure we allocated enough extra space in the error buffer to
store the feedback error.
2016-02-24 14:57:31 +01:00
Wim Taymans
3e8cf31a96 audio-converter: perform dithering on the current format
Use the current (intermediate) format to decide how to set up dithering
instead of the input format.
2016-02-24 14:57:31 +01:00
Tim-Philipp Müller
ddfe7a2808 win32: remove outdated build cruft
This hasn't been touched for generations, doesn't work,
and is just causing confusion. We also don't want to
maintain these files manually.
2016-02-20 10:05:17 +00:00
Wim Taymans
5cef3f31ad audio-converter: make a copy if we can't write in unpack
If we don't have writable memory, make sure to make a copy of the input
samples into a temporary (writable) buffer, even if we are dealing with
a native intermediate format that we don't need to call the unpack
function for.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=761655
2016-02-10 12:51:23 +01:00
HoonHee Lee
dfa2f49523 audio/videodecoder: Minor cleanup of last commit
https://bugzilla.gnome.org/show_bug.cgi?id=761218
2016-01-28 13:21:49 +01:00
HoonHee Lee
15df3c812b audio/videodecoder: use gst_pad_peer_query_caps to make output caps
gst_pad_get_allowed_caps() will return NULL if the srcpad has no peer.
In that case, use gst_pad_peer_query_caps() with template caps as filter
to have negotiated output caps properly before forwarding GAP event.

https://bugzilla.gnome.org/show_bug.cgi?id=761218
2016-01-28 11:34:22 +01:00
Wim Taymans
03566e5002 audio-converter: add reset function 2016-01-26 17:19:34 +01:00
Wim Taymans
2d971df593 audio-converter: handle NULL input
Allow NULL as input to mean silence samples.
2016-01-26 17:19:34 +01:00
Wim Taymans
6050509b65 audio-converter: improve _update_config
Allow NULL config to keep the existing parameters.
Fix the docs.
2016-01-26 17:19:34 +01:00
Wim Taymans
0f757bc23c audio-converter: audio-converter: make some optimized functions
Make optimized functions for generic and passthrough conversion.
2016-01-26 17:19:34 +01:00
Wim Taymans
cde091ae81 audio-quantize: add _reset function
Add a reset function that clears any history.
2016-01-26 16:45:44 +01:00
Sebastian Dröge
a7b86878fb audio: Move audioaggregator base class to a library
It's useful enough already to be used in other elements for audio aggregation,
let's give people the opportunity to use it and give it some API testing.

https://bugzilla.gnome.org/show_bug.cgi?id=760733
2016-01-22 12:39:48 +02:00
Wim Taymans
3674742957 audio-converter: ensure correct alignment of samples
Make sure that the data we allocate for our temporary buffers is
properly aligned.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=760938
2016-01-21 16:27:50 +01:00
Sebastian Dröge
761142e15a audioencoder: Add note to the documentation about various settings being reset before set_format()
It's quite unexpected behaviour that various subclass settings are just
reset before set_format(). Unfortunately changing this now has the risk
of breaking existing code but we should reconsider this for 2.0.
2016-01-16 11:05:13 +01:00
Wim Taymans
1b412a523d audio-channel-mixer: round before truncating
Round the result before truncating for int channel mixing.
2016-01-12 15:56:36 +01:00
Wim Taymans
ef3844cf6f audio-converter: Avoid conversion when possible
When the input and output formats are the same and in a possible
intermediate format, avoid unpack and pack.
Never do passthrough channel mixing.
Only do dithering and noise shaping in S32 format
2016-01-12 15:27:16 +01:00
Wim Taymans
4d47d43a13 audio-channel-mixer: add more formats
Add support for float and int16 mixing
Remove in-place processing, this simplifies things as we won't be using it.
Don't do clipping for float audio formats
2016-01-12 11:43:20 +01:00
Wim Taymans
8a8b12189e audio-converter: improve processing loop
Process as many samples as we can from the input and return the number
of processed samples from the chain. This simplifies some code.
Fix the IN_WRITABLE handling, don't overwrite the flags.
2016-01-12 11:37:17 +01:00
Wim Taymans
85afad72ec audio-converter: small API tweaks
Pass flags in _converter_new() so that we can configure ourselves
differently depending on some options.
SOURCE_WRITABLE -> IN_WRITABLE because the array is called 'in'
2016-01-08 17:34:50 +01:00
Wim Taymans
7f49b946cc audio-converter: prepare API for rate changes
Use the update function to update the sample rates along with the config
once we implement resampling.
2016-01-08 17:28:31 +01:00
Wim Taymans
980163457e audio-convert: simplify API
Simplify the API, we don't need the consumed and produced output
arguments. The caller needs to use the _get_in_frames/get_out_frames API
to check how much input is needed and how much output will be produced.
2016-01-08 17:19:58 +01:00
Sebastian Dröge
0da2709d0c audio/video: Use G_GNUC_INTERNAL for internal functions 2016-01-08 17:50:50 +02:00
Wim Taymans
40f4c5e352 audio: GstAudioChannelMix -> GstAudioChannelMixer
Rename the GstAudioChannelMix object to GstAudioChannelMixer because it
looks better and to avoid a conflict with a library in -bad.
2016-01-08 16:41:17 +01:00
Stefan Sauer
7bbfa39ada audioconvert: fix passthrough operation
We did not take the sample size into account. Rearrange the tests to have more
conversion test and an extra test case for passthrough operations.

Fixes #759890
2015-12-29 14:40:32 +01:00
Stefan Sauer
0bd3f818bb audio-converter: code cleanup
Rename samples to num_samples, since we also have samples in chain, but that is
the data pointer. Always use gzize for num_samples. Make the log output a bit
more homogenous.
2015-12-27 19:25:20 +01:00
Sebastian Dröge
3459bd6854 audio: Fix some documentation warnings
Remove/rename function parameters and skip some functions that can't
be used by bindings as they are now.
2015-12-26 09:43:56 +01:00
Wim Taymans
08734e7598 audio-converter: rework the main processing loop
Rework the main processing loop. We now create an audio processing
chain from small core functions. This is very similar to how the
video-converter core works and allows us to statically calculate an
optimal allocation strategy for all possible combinations of operations.
Make sure we support non-interleaved data everywhere.
Add functions to calculate in and out frames and latency.
2015-12-16 11:13:15 +01:00
Xavier Claessens
429860e51f base: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 13:39:43 -05:00
Wim Taymans
f5a3f70571 audio: adapt API for non-interleaved formats
Allow an array of sample blocks to be passed to the channel mix and
quantizer functions to support non-interleaved formats.
2015-12-14 09:16:08 +01:00
Wim Taymans
aec17c63fd audio-converter: improve API for non-interleaved formats
Make it possible to pass an array of sample blocks when dealing with
non-interleaved formats.
2015-12-14 09:16:08 +01:00
Wim Taymans
5e55968546 audio-convert: improve converter API
Improve the converter API to allow for an max input and output number of
samples and return the number of consumed/produced samples.
2015-12-09 17:16:26 +01:00
Reynaldo H. Verdejo Pinochet
4ed7b0a0e6 Drop usage of deprecated g-ir-scanner --strip-prefix flag 2015-12-02 20:19:43 -08:00
Sebastian Dröge
2f3eb47a95 audiobasesrc: Post latency message on the bus after set_caps()
The latency is only known once the caps are known, and might change
whenever the caps are changing.

https://bugzilla.gnome.org/show_bug.cgi?id=758911
2015-12-01 19:58:25 +02:00
Michael Olbrich
43155807cd audiobasesink: Post latency message on the bus after set_caps()
Any latency query before this will not get the correct latency so a new
latency query should be triggered once the audio sink know its own latency.

Without this the initial latency query from the pipeline arrives too early
sometimes and the resulting latency is too short.

https://bugzilla.gnome.org/show_bug.cgi?id=758911
2015-12-01 19:58:25 +02:00
Luis de Bethencourt
df16e8dd5a audio-converter: remove unneeded check for unsigned < 0
Commit ff6d1a2a25 changed sample's type from
gint to gsize (and renamed it to in_samples). gsize is an unsigned long,
which means it can never be a negative value and the check making sure that
in_samples is >= 0 is never going to be false. Removing it.

CID 1338689
2015-11-12 14:18:30 +00:00
Vineeth TM
b61e1465b7 audio-quantize: Fix dither_buffer memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=757928
2015-11-11 15:01:08 +01:00
Wim Taymans
ff6d1a2a25 audio-converter: add output size argument
Make it possible to have a different number of output samples than input
samples when we, for example, want to add resampling later.
2015-11-10 09:53:59 +01:00
Wim Taymans
30977cf1a5 audio-converter: require interleaved samples and no resampling
We can't yet do resampling or anything other than interleaved audio.
2015-11-06 18:00:41 +01:00
Wim Taymans
7abed02858 audio: update ORC dist files 2015-11-06 17:54:21 +01:00
Wim Taymans
e3f0f3b91e audio-converter: move audio converter to audio libs
Move the audio-converter helper to the audio library.
2015-11-06 17:53:22 +01:00
Wim Taymans
dfa25a40fc audio-channel-mix: move channel mixer to audio libs
Move the channel mixer code to the audio library
2015-11-06 17:39:33 +01:00
Wim Taymans
b8bea9d8be audio: add debug categories 2015-11-06 17:29:22 +01:00
Wim Taymans
59db8ce542 audio-quantize: update docs
Update docs
Add another flag for the quantizer
2015-11-06 13:02:19 +01:00
Wim Taymans
dfbeb78342 audio: update orc files 2015-11-06 12:37:14 +01:00
Wim Taymans
c36ac3ce45 audioconvert: move audio quantize code to libs
Move the audio quantize code from audioconvert to the audio library.
work on making an audio converter helper function similar to the video
converter.
Fold fastrandom directly into the quantizer, add some ORC code to
optimize this later.
2015-11-06 12:10:48 +01:00
Wim Taymans
a7789854d5 audio-channels: rename get_default_mask
Rename _get_default_mask() to _get_fallback_mask() to make it more
clear that the function only provides a fallback if nothing else can be
done. Also clarify this in the documentation.

API: gst_audio_channel_get_fallback_mask()
2015-11-05 12:50:18 +01:00
Wim Taymans
f86ed8cdf6 audio-channels: make method to get default channel-mask
Add a new method to get the default channel-mask.
Use the new method on audiodecoder and audioconvert.

API: gst_audio_channel_get_default_mask()
2015-11-05 10:52:53 +01:00
Sebastian Dröge
35ea6fdddf audio: Add GstAudioClippingMeta for specifying clipping on encoded audio buffers
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:33 +02:00
Tim-Philipp Müller
1f2fdd3789 audio: update disted orc backup files 2015-11-03 16:38:09 +00:00
Luis de Bethencourt
94a7f9fc4e audioclock: use GST_STIME_FORMAT for GstClockTimeDiff
GST_STIME_FORMAT is more appropriate for GstClockTimeDiff since it can
handle negative values better.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-03 14:08:29 +00:00
Wim Taymans
801f7ca464 audio-format: add TRUNCATE_RANGE flag
Add a TRUNCATE_RANGE flag for unpack functions to fill the least
significate bits with 0 (as did the old code). Also add functions
that don't truncate. Use the TRUNC flag in audioconvert for
backwards compatibility for now.
2015-11-03 12:12:08 +01:00
Wim Taymans
914aa4aed1 audiopack: improve pack functions
Avoid shifts by using convh functions.
2015-11-03 12:12:08 +01:00
Luis de Bethencourt
fe62e797d5 audiobasesink: use GST_STIME_ARGS for GstClockTimeDiff
No need to use G_GINT64_FORMAT for potentially negative values of
GstClockTimeDiff. Since 1.6 these can be handled with GST_STIME_ARGS.
Plus it creates more readable values in the logs.

https://bugzilla.gnome.org/show_bug.cgi?id=757480
2015-11-02 17:35:20 +00:00
Sebastian Dröge
443171bb4c audio: Fix parameters to gst_buffer_get_audio_downmix_meta() in macro 2015-11-02 17:35:45 +02:00
Sebastian Dröge
736a27fe1e audiofilter: Clip input buffers to the segment before handling them
https://bugzilla.gnome.org/show_bug.cgi?id=757068
2015-11-02 10:20:37 +02:00
eunhae choi
e98b96247f audiobasesink: fix issue about eos handling during flushing
If the flush-start is arrived during _eos_wait() in basesink,
the 'eos' flag is overwritten to TRUE after exiting the _eos_wait().
To resolve the overwritten issue,
the subclass doing the _eos_wait() call should return the right value.
If the eos flag is set to TRUE again, it will cause error(enter the eos flow)
of the following state changing from PAUSED to PLAYING in basesink.

https://bugzilla.gnome.org/show_bug.cgi?id=754980
2015-10-19 12:12:12 -03:00
Sebastian Dröge
b60ab758e4 Revert "audioencoder: timestamp headers same as first buffer and use duration 0"
This reverts commit dd4d6d9ed5.

It breaks ogg muxing and the vorbisenc unit test.
2015-10-12 14:02:58 +03:00
Havard Graff
dd4d6d9ed5 audioencoder: timestamp headers same as first buffer and use duration 0
https://bugzilla.gnome.org/show_bug.cgi?id=754224
2015-10-11 11:04:53 +01:00
Vineeth T M
060f0c21f2 audiosink, multisocketsink: Fix error leak during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755143
2015-09-17 11:59:35 +02:00
Tim-Philipp Müller
7dac2e1eb1 audiobasesink: fix misleading error message debug detail
https://bugzilla.gnome.org/show_bug.cgi?id=754260
2015-08-29 10:44:28 +01:00
Carlos Rafael Giani
c95d809a96 audiobasesink: Fix incorrect/missing custom slaving method documentation
https://bugzilla.gnome.org/show_bug.cgi?id=754199
2015-08-28 10:13:44 +03:00
Sebastian Dröge
6cda5d3494 audiodecoder: If there are no tags, don't try to do event handling on a NULL event
Fixes some crashes.
2015-08-18 16:01:28 +03:00
Sebastian Dröge
2de91c32e4 audioencoder: If there are no tags, don't try to do event handling on a NULL event
Fixes some crashes.
2015-08-18 15:58:57 +03:00
Tim-Philipp Müller
4c00709e22 audioencoder: fix tag handling
Merge upstream tags with encoder tags and update whenever
any of those changes.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-18 11:46:21 +01:00
Tim-Philipp Müller
135cad5b6e audiodecoder: try harder to avoid sending unnecessary tag updates 2015-08-16 18:28:09 +01:00
Tim-Philipp Müller
5ccc8432e0 audiodecoder: fix tag handling
Before we just merged everything in pretty much random ways
ad-hoc instead of keeping state properly. In 0.10 that was
how it worked, but in 1.x the tag events sent should always
reflect the latest state and replace any previous tags.

So save the upstream (stream) tags, and save the tags set
by the decoder subclass with merge mode, and then update
the merged tags whenever either of those two changes.

This slightly changes the behaviour of gst_audio_decoder_merge_tags()
in case it is called multiple times, since now any call replaces
the previously-set tags. However, it leads to much more predictable
outcomes, and also we are not aware of any subclass which sets this
multiple times and expects all the tags set to be merged.

If more complex tag merging scenarios are required, we'll have
to add a new vfunc for that or the subclass has to intercept
the upstream tags itself and send merged tags itself.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-16 16:34:31 +01:00
Thiago Santos
5a0bee3f13 audioencoder: add src and sink query methods
Allows subclasses to do their own handling of GstQuery and still
chain up to the parent class to handle the ones that they don't want
to handle
2015-08-16 08:14:35 -03:00
Thiago Santos
d19f347223 Revert "audiodecoder: expose default query handling function"
Apparently I forgot how gobject works, there is no need to expose
it directly as one can call it from the parent_class pointer

This reverts commit 8a64592481.
2015-08-15 13:44:35 -03:00
Thiago Santos
33b1da7b80 audiodecoder: add option to use default pad accept-caps handling
Add gst_audio_decoder_set_use_default_pad_acceptcaps() to allow
subclasses to make videodecoder use the default pad acceptcaps
handling instead of resorting to the caps query that is, usually,
less efficient and unecessary

API: gst_audio_decoder_set_use_default_pad_acceptcaps
2015-08-15 13:44:34 -03:00
Thiago Santos
8a64592481 audiodecoder: expose default query handling function
Subclasses can use it to select what queries they want to handle
and forward the rest to the default handling function.

API: gst_audio_decoder_sink_query_default

https://bugzilla.gnome.org/show_bug.cgi?id=753623
2015-08-14 13:41:58 -03:00
Hyunjun Ko
9dc463346e video/audio meta: transform_func: return FALSE if not supported or failed
https://bugzilla.gnome.org/show_bug.cgi?id=751778
2015-07-07 16:41:23 +03:00
Sebastian Dröge
b495dfa5e6 {audio,video}info: Add GST_TYPE_{AUDIO,VIDEO}_INFO macros 2015-07-06 12:53:15 +03:00
Sebastian Dröge
56add20dc7 audioencoder: Don't try to get buffers from an empty adapter 2015-07-02 13:16:15 +02:00
Sebastian Dröge
f5eebb27a2 {audio,video}{en,de}oder: Also copy POOL metas and make sure to copy over metas when creating subbuffers
POOL meta just means that this specific instance of the meta is related to a
pool, a copy should be made when reasonable and the flag should just not be
set in the copy.
2015-07-01 10:58:07 +02:00
Sebastian Dröge
844fa28c67 audiodecoder: Add transform_meta() vfunc with default implementation
The default implementation copies all metadata without tags, and metadata
with only the audio tag. Same behaviour as in GstAudioFilter.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 10:40:10 +02:00
Sebastian Dröge
cc1719130b audioencoder: Add transform_meta() vfunc with default implementation
The default implementation copies all metadata without tags, and metadata
with only the audio tag. Same behaviour as in GstAudioFilter.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 10:40:10 +02:00
Sebastian Dröge
0acdfeed69 audiofilter: Also copy metas if their API has no tags attached to it
This is the default basetransform behaviour, being more strict than that
is not really useful.
2015-06-29 13:06:33 +02:00
Lyon Wang
829b7298e9 audioringbuffer: Fix alaw/mulaw channel positions
For alaw/mulaw we should also try to initialize the channel positions in the
ringbuffer's audio info. This allow pulsesink to directly use the channel
positions instead of using the default zero-initialized ones, which doesn't
work well.

https://bugzilla.gnome.org/show_bug.cgi?id=751144
2015-06-22 18:29:00 +02:00
Nicolas Dufresne
c101452a4a gi: Use INTROSPECTION_INIT for --add-init-section
This new define was added to common. The new init section fixed
compilation warning found in the init line that was spread across
all files.
2015-06-16 18:04:57 -04:00
Nicolas Dufresne
e8aba7db8b gi: Fix warnings in libgstaudio
* Duplicate section
* Miss-named parameter
* Missing transfer none annotation for meta
2015-06-16 14:34:04 -04:00
Carlos Rafael Giani
c5b75394a9 audiobasesink: added custom clock slaving method
This new clock slaving method allows for installing a callback that is
invoked during playback. Inside this callback, a custom slaving
mechanism can be used (for example, a control loop adjusting a PLL or an
asynchronous resampler). Upon request, it can skew the playout pointer
just like the "skew" method. This is useful if the clocks drifted apart
too much, and a quick reset is necessary.

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>

https://bugzilla.gnome.org/show_bug.cgi?id=708362
2015-06-09 21:51:05 +10:00
Mathieu Duponchelle
579967278a audiofilter: copy metadata that only has the "audio" tag.
https://bugzilla.gnome.org/show_bug.cgi?id=750406
2015-06-04 19:16:40 +02:00
Sebastian Dröge
0c43005f54 audiodecoder: Also negotiate with downstream if needed before handling a GAP event 2015-05-08 15:07:56 +02:00
Sebastian Dröge
9e480d11a2 audio: Change the remaining "samples" in the ::delay() vfunc docs to "frames"
https://bugzilla.gnome.org/show_bug.cgi?id=748289
2015-04-27 10:08:17 +02:00
Sebastian Dröge
531b9ba951 audio: The delay vfunc returns the number of frames, not samples
https://bugzilla.gnome.org/show_bug.cgi?id=748289
2015-04-26 21:08:14 +02:00
Tim-Philipp Müller
c680e324bc Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:42:34 +01:00
Wonchul Lee
5dffb8a311 audiodecoder: Add sink and src query virtual method
API: GstAudioDecoderClass::src_query()
API: GstAudioDecoderClass::sink_query()

https://bugzilla.gnome.org/show_bug.cgi?id=747293
2015-04-23 19:29:20 +01:00
Vincent Penquerc'h
5cb40d7320 audiobasesink: fix ring buffer leak on open failure 2015-04-09 13:00:58 +01:00
Vincent Penquerc'h
4e6b917ba3 audiobasesrc: fix ring buffer leak on open failure 2015-04-09 13:00:57 +01:00
Sebastian Dröge
a21795260f audiodecoder: Don't post error messages while holding the stream lock 2015-04-08 20:49:39 -07:00
Sebastian Dröge
9196c3dcca audiodecoder: Don't get and parse the current srcpad caps
We only get here if we don't have any srcpad caps, and we're going
to override the GstAudioInfo a few lines below anyway without ever
using it if for whatever reason we get caps here.
2015-04-08 20:49:39 -07:00
Sebastian Dröge
0c72d0acdf {audio,video}decoder: Forward SEGMENT_DONE events immediately and drain decoders
Otherwise we're going to wait with draining until the next data comes, which
is a bit suboptimal and might take a long time... or maybe never happens.
2015-04-06 19:20:51 -07:00
Vincent Penquerc'h
2954813b86 audio,video: use gst_segment_is_equal instead of memcmp
memcmp will blindly compare the reserved fields, as well as any
padding the compiler may choose to sprinkle in GstSegment.

Fixes valgrind complaints in unit tests, as well as some found via
https://bugzilla.gnome.org/show_bug.cgi?id=738216
2015-04-03 12:09:41 +01:00
Edward Hervey
3eb35c77cc introspection: Don't use g-ir-scanner cache at compile time
It pollutes user directories and we don't need to cache it

https://bugzilla.gnome.org/show_bug.cgi?id=747095
2015-03-31 11:21:43 +02:00
Arun Raghavan
592fc9cdba audioringbuffer: Log with the ringbuffer object where possible 2015-03-13 23:24:58 +05:30
Mark Nauwelaerts
eeeb2eab82 audiodecoder: only return EOS upon clipping if applicable
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-03-07 20:10:31 +01:00
Arun Raghavan
557c2c9be1 audiobasesink: Reset audio clock if necessary
When the ringbuffer is deactivated and then acquired, if the audio clock
provided by the sink gets reset to zero, we need to add an offset to the
clock to make sure that subsequent samples are written out at the right
times. While we need to leave this to derived classes to take care of
when they provide their own clock (since that clock may or may not be
reset to zero), we can do this ourselves if we know the provided clock
is our own (which does reset to zero on a re-acquire).
2015-03-03 23:26:54 +05:30
Jan Schmidt
b3053925ac audiodecoder: Don't send pending events before decode
Make sure to update the output segment to track the segment
we're decoding in, but don't actually push it downstream until
after buffers are decoded.

https://bugzilla.gnome.org/show_bug.cgi?id=744806
2015-02-24 01:36:44 +11:00
Mark Nauwelaerts
c321b6bd81 Revert "audiodecoder: drain current segment upon new one to ensure correct flow return"
This reverts commit 696b8cdc40.

See https://bugzilla.gnome.org/show_bug.cgi?id=734617
2015-02-22 16:58:33 +01:00
Mark Nauwelaerts
696b8cdc40 audiodecoder: drain current segment upon new one to ensure correct flow return
See also https://bugzilla.gnome.org/show_bug.cgi?id=709224
2015-02-22 13:23:44 +01:00
Thiago Santos
7e39a51a50 audio: video: fix a few GI annotations
transfer-full -> transfer full
@Since -> Since
2015-02-19 15:51:42 -03:00
Sebastian Dröge
8547594727 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:49 +02:00
Jan Schmidt
4f961e6d95 audiodecoder: Where possible, skip decode for GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO
If we have timestamps on input buffers and are in trickmode no-audio
mode, then don't pass anything to the subclass for decode and simply
send gap events downstream

Only for forward playback for now - reverse requires accumulating
GAP events and pushing out in reverse order.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-02-06 04:09:37 +11:00
Jan Schmidt
ca231ce321 audiobasesink: Re-work GAP buffer and trick-mode handling
In trickmode no-audio mode, or when receiving a GAP buffer,
discard the contents and render as a GAP event instead.

Make sure when rendering a gap event that the ring buffer will
restart on PAUSED->PLAYING by setting the eos_rendering flag.

This mostly reverts commit 8557ee and replaces it. The problem
with the previous approach is that it hangs in wait_preroll()
on a PLAYING-PAUSED transition because it doesn't commit state
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-02-06 04:09:37 +11:00
Jan Schmidt
c35e3e7c7d audiodecoder: Remove pointless else{} around some code 2015-02-06 04:02:48 +11:00
Jan Schmidt
7c0f885ad2 audiodecoder: Fix reverse playback when there's only one gather set.
The decoder can fail to drain on EOS if there was only one gather
set, because it will never have sent the segment event downstream
and set the output segment, and fail to detect that the rate < 0.0

Make sure to send pending events before sending all the gather data
for decode.
2015-02-06 04:02:48 +11:00
Sebastian Dröge
823cb40642 audio{enc,dec}oder: Always directly post latency messages on the bus when the subclass sets the latency
Instead of doing it only in setcaps for the encoder, and never at all for the
decoder.
2015-02-03 12:15:25 +01:00
Sebastian Dröge
f2a762a3a0 audio{enc,dec}oder: Handle max_latency == GST_CLOCK_TIME_NONE
And initialize the latencies with 0 and NONE.
2015-02-03 12:12:18 +01:00
Jan Schmidt
efe54e50e9 audiobasesink: Don't render a GAP silence buffer
Don't render out silence samples to a buffer, just
start the clock running, since any buffer with the
GAP flag will be discarded in render() now anyway.
2015-01-31 00:45:33 +11:00
Jan Schmidt
1df69786c3 audiobasesink: Make sure the ringbuffer is started before waiting
Don't call the basesink wait_event implementation until we're sure
the ringbuffer is running, because it might wait on a non-running
clock.
2015-01-31 00:45:33 +11:00
Jan Schmidt
8557eead82 audiobasesink: drop GAP buffers, or all buffers in trickmode no-audio mode
Make the base audio sink throw away buffers marked GAP, or all
incoming buffers when performing a trick play with
GST_SEGMENT_TRICKMODE_NO_AUDIO flag set, and make sure to start
the ringbuffer when that happens so the clock starts running.

Preserve the timing calculations when rendering, so state is all
updated the same, but just don't render samples.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-01-31 00:45:32 +11:00
Jan Schmidt
caff09300b audiobasesink: Make sure the ringbuffer really starts when we need it to
Some audio sink sub-classes (pulsesink) don't start their clock
when the ringbuffer starts, but always have to on EOS. When we
explicitly need to start the ringbuffer, make sure sub-classes will
do it by (ab)using the existing eos_rendering flag.
2015-01-28 16:30:42 +11:00
Luis de Bethencourt
783204824d orc: update orc files 2015-01-27 13:39:14 +00:00