Commit graph

1417 commits

Author SHA1 Message Date
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
Jan Schmidt ef42a163e4 audiodecoder: Fix typo in documentation
Fix a couple of harmless warnings in the gtk-doc parsing
2015-01-27 02:12:08 +11:00
Sebastian Dröge 564f001aa8 audio-format: Constify the audio format table 2015-01-21 09:39:30 +01:00
Sebastian Dröge e63ad51dab audiosrc: Fill in the correct silence
For unsigned raw formats this is not all zeroes, and for non-raw formats
we just continue to assume all zeroes for now.

https://bugzilla.gnome.org/show_bug.cgi?id=739446
2015-01-21 09:37:30 +01:00
Thomas Roos f0f854d501 audiosink: Fill in the correct silence
For unsigned raw formats this is not all zeroes, and for non-raw formats
we just continue to assume all zeroes for now.

https://bugzilla.gnome.org/show_bug.cgi?id=739446
2015-01-21 09:35:55 +01:00
Sebastian Dröge 5b7d9e1954 audio: Keep caps features when building the downstream filter
Based on 5fd4e3e0b6 for video
by Alessandro Decina.
2015-01-15 10:51:37 +01:00
Mark Nauwelaerts 13ee94ef10 audioringbuffer: start ringbuffer if needed upon commit
... to provide for a running clock.
2015-01-10 13:03:20 +01:00
Nirbheek Chauhan 54e4baa523 audiobasesrc: Explicitly document that buffer-time and latency-time may be ignored 2014-12-27 10:24:45 +01:00
Thiago Santos ef580889e0 audiobasesink: get the internal time before the clock reset
Otherwise calls to get the clock time might change its internal state
and the internal/external time for calibration get unbalanced leading to
a clock jump

https://bugzilla.gnome.org/show_bug.cgi?id=740834
2014-12-22 10:22:03 -03:00
Sebastian Dröge aae6400962 audioencoder: Call reset() before the start() vfunc to guarantee a clean state
The same was done already in the decoder, and we cleaned some state just above
manually that would also be taken care of by reset().

This makes sure that the element is in the same state before start() is called
the very first time and every future call after the element was used already.
2014-12-22 11:36:58 +01:00
Sebastian Dröge ceb9de6e55 audiobase{sink,src}: Don't hold the object lock while calling create_ringbuffer() vfunc
The implementation of that vfunc might want to use the object lock for
something too. It's generally not a good idea to keep the object lock while
calling any function implemented elsewhere.

Also the ringbuffer can only be NULL at this point, remove a useless if block.

And in the sink actually hold the object lock while setting the ringbuffer on
the instance. Code accessing this is expected to use the object lock, so do it
here ourselves too.
2014-12-22 10:47:36 +01:00
Edward Hervey e527cea8d3 audio: Fix private header include/dist
We want to dist it, but we don't want to install it.

Fixes make dist/distcheck
2014-12-18 10:58:16 +01:00
Thiago Santos 17a7fac1a1 video: audio: fix GI annotations for proxy caps function
Add the annotations to parameters that can be null and also for stating
the ownership of the returned caps
2014-12-17 19:15:24 -03:00
Thiago Santos 36a99922e4 audiodecoder: expose getcaps virtual function
Allows subclasses to do custom caps query replies.

Also exposes the standard caps query handler so subclasses can just
extend on top of it instead of reimplementing the caps query proxying.
2014-12-17 19:15:24 -03:00
Thiago Santos 160dce872b audiodecoder: implement caps and accept-caps queries
Allows decoders to proxy downstream restrictions on caps.

Also implements accept-caps query to prevent regressions caused by the
new fields on the return of a caps query that would cause the accept-caps
to fail as it uses subset caps comparisons
2014-12-17 19:15:23 -03:00
Thiago Santos 5e3405bd08 audioencoder: refactor getcaps proxy function to be reusable
Makes the audioencoder's getcaps function that proxies downstream
restriction available to other elements in the audio module to use it
2014-12-17 19:15:23 -03:00
Sebastian Dröge 0b7537f93b audiobasesrc/sink: Add _CAST macros 2014-12-15 20:57:30 +01:00
Sanjay NM d226d45d2f audio: Add error handling to gst_audio_decoder_drain()
https://bugzilla.gnome.org/show_bug.cgi?id=740686
2014-12-14 12:05:52 +01:00
Sebastian Dröge f5cf586e77 audioclock: Fix redundant definitions compiler warning
gstaudioclock.c:51:31: error: redundant redeclaration of 'gst_audio_clock_init' [-Werror=redundant-decls]
 G_DEFINE_TYPE (GstAudioClock, gst_audio_clock, GST_TYPE_SYSTEM_CLOCK);

gstaudioclock.c:51:31: error: redundant redeclaration of 'gst_audio_clock_class_init' [-Werror=redundant-decls]
 G_DEFINE_TYPE (GstAudioClock, gst_audio_clock, GST_TYPE_SYSTEM_CLOCK);
2014-12-13 16:14:49 +01:00
Sebastian Dröge cb70d3fdf0 audioclock: No need to get the parent class in class_init, G_DEFINE_TYPE does that for us 2014-12-13 16:04:40 +01:00
Sebastian Dröge 41f1ec1c81 audioclock: Use G_DEFINE_TYPE instead of a custom get_type() function 2014-12-13 16:02:01 +01:00
Thiago Santos fce946a1a3 audiodecoder: do not use fixed caps on source pad
decoders can change the caps on their source pads, so they don't
use fixed caps. Having fixed caps can cause renegotiation issues.
2014-12-11 17:35:03 -03:00
Mathieu Duponchelle b2413d46ed audiodecoder: Push pending events before sending EOS.
Segments are added to the pending events, and pushing a segment
is mandatory before sending EOS.

+ Adds a test.

https://bugzilla.gnome.org/show_bug.cgi?id=740853
2014-12-05 12:04:04 +01:00
Sebastian Dröge 90eb93c2ef Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.
2014-12-01 09:51:12 +01:00
Peter G. Baum c734fbc139 audio-channels: allow partially valid channel_mask
Since WAVEFORMATEXTENSIBLE allows to have more channels than
bits in the channel mask we should allow this, too, to avoid
loss of information.

https://bugzilla.gnome.org/show_bug.cgi?id=733405
2014-10-14 10:29:56 +02:00
Thiago Santos a0b25a570a audiodecoder: should post DECODE errors and not ENCODE
Fix error code for audio decoder
2014-10-13 22:26:29 -03:00
Arun Raghavan c47b005197 audio: Fix up a comment in GstAudioBaseSink
Rewrote the comment to not be PulseAudio-specific.
2014-09-29 19:46:32 +05:30
Arun Raghavan 324ebd19e3 audio: Trivial comment for unhandled MPEG-2 payloading case
The spec mentions a version of the MPEG-2 frame with a base frame and
extension frame. I don't have IEC 13818-3 to figure out what that is,
and don't see any references in search results, so it's a FIXME for now.

https://bugzilla.gnome.org/show_bug.cgi?id=736797
2014-09-27 10:40:27 +05:30
Arun Raghavan 2965b796bc audio: Fixes for MPEG-2 LSF IEC61937 payloading
The low sample frequency case for MPEG-2 is <=12kHz (the 32kHz number
applies to MPEG-1).

https://bugzilla.gnome.org/show_bug.cgi?id=736797
2014-09-27 10:40:27 +05:30
Anuj Jaiswal 798ff6e561 audio: correct condition for MPEG case.
Signed-off-by: Anuj Jaiswal <anuj.jaiswal@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=736797
2014-09-27 10:40:27 +05:30
Thiago Santos 8242676dc2 audiosink: compensate for segment restart with clock's time_offset
When playing chained data the audio ringbuffer is released and
then acquired again. This makes it reset the segbase/segdone
variables, but the next sample will be scheduled to play in
the next position (right after the sample from the previous media)
and, as the segdone is at 0, the audiosink will wait the duration
of this previous media before it can write and play the new data.

What happens is this:
pointer at 0, write to 698-1564, diff 698, segtotal 20, segsize 1764, base 0

it will have to wait the length of 698 samples before being able to write.

In a regular sample playback it looks like:
pointer at 677, write to 696-1052, diff 19, segtotal 20, segsize 1764, base 0

In this case it will write to the next available position and it
doesn't need to wait or fill with silence.

This solution is borrowed from pulsesink that resets the clock to
start again from 0, which makes it reset the time_offset to the time
of the last played sample. This is used to correct the place of
writing in the ringbuffer to the new start (0 again)

https://bugzilla.gnome.org/show_bug.cgi?id=737055
2014-09-24 10:22:54 -03:00
Stefan Sauer 5f0aad6f42 audioencoder: reshuffle code in error handling
Move the assert to the error handling block at the end of the function so the
the logging is still triggered. Reword the logging slightly and add another
comment to hint what went wrong.

Fixes #737138
2014-09-23 11:56:33 +02:00
Sebastian Dröge 3592bd577c audiodecoder: Simplify code a bit 2014-09-18 12:40:26 +03:00
Ognyan Tonchev 2fff66b071 audioencoder: do not leak events when flushing them
https://bugzilla.gnome.org/show_bug.cgi?id=736796
2014-09-18 12:40:19 +03:00
Ognyan Tonchev c674a0aa64 audiodecoder: Don't leak events
https://bugzilla.gnome.org/show_bug.cgi?id=736788
2014-09-17 14:11:34 +03:00
Ognyan Tonchev add8f02703 audiocdsrc: do not leak uid after parsing TOC select event
https://bugzilla.gnome.org/show_bug.cgi?id=736739
2014-09-17 09:50:17 +03:00
Garg 47e303269d audiobasesink: Fix deadlock caused by holding object lock while calling clock functions
Issue:
During a PAUSED->PLAYING transition when we are rendering an audio buffer in AudioBaseSink
we make adjustments to the sink's provided clock i.e. fix clock calibration using the external
pipeline clock, within "gst_audio_base_sink_sync_latency function inside gstaudiobasesink.c".
For the calibration adjustment we need to get the sink clock time using "gst_audio_clock_get_time".
But before calling "gst_audio_clock_get_time" we acquire the Object Lock on the Sink. If sink is
a pulsesink, "gst_audio_clock_get_time" internally calls "gst_pulsesink_get_time" which needs to
acquire Pulse Audio Main Loop Lock before querying Pulse Audio for its stream time using
"pa_stream_get_time". Please see "gst_pulsesink_get_time in pulsesink.c".

So the situation here is we have acquired the Object lock on Sink and need PA Main Loop Lock.
Now Pulse Audio Main Thread itself might be in the process of posting a stream status
message after Paused to Playing transition which in turn acquires the PA Main loop lock and
needs the Object Lock on Pulse Sink. This causes a deadlock with the earlier render thread.

Fix:
Do not acquire the object Lock on Sink before querying the time on PulseSink clock. This is
similar to the way we have used get_time at other places in the code. Acquire it after the
get_time call. This way PA Main loop will be able to post its stream status message by
acquiring the Sink Object lock and will eventually release its Main Loop lock needed for
gst_pulsesink_get_time to continue.

https://bugzilla.gnome.org/show_bug.cgi?id=736071
2014-09-12 14:21:19 +03:00
Sebastian Dröge d357f28260 audiodecoder: Fix broken boolean expression
We can seek with end_type==NONE and end_type==SET && end_position=-1. The
check for end_type!=NONE made the second condition impossible.

CID 1226439
2014-08-28 17:00:26 +03:00
Sebastian Dröge 4a69d6ba3b audiodecoder: Don't ignore ::start/stop return values 2014-08-25 13:15:07 +03:00
Jan Schmidt 02d1ab0d1c audiodecoder: Don't drain and flush on SEGMENT events.
As was done for the base video decoder in commit 695675, don't
flush out the decoder on a new SEGMENT event. Segment events
may be a new segment, but are also often segment updates for
the current segment where the old data should be kept. For new
segments, a STREAM_START event will already trigger a drain, but
make sure to flush any remaining partial data then as well.

https://bugzilla.gnome.org/show_bug.cgi?id=734666
2014-08-12 23:54:41 +10:00
Sebastian Rasmussen a285f7126b audioencoder: Mark caps argument as not being transferred
https://bugzilla.gnome.org/show_bug.cgi?id=734540
2014-08-10 10:45:14 +01:00
Sebastian Dröge 368d75fe75 audiodecoder: Handle CAPS events immediately instead of delaying them
https://bugzilla.gnome.org/show_bug.cgi?id=733147
2014-07-21 09:36:00 +02:00
Sebastian Dröge 1e64667fe0 libs: There is no G_TYPE_CHECK_INTERFACE_TYPE and G_TYPE_CHECK_INTERFACE_CAST
Remove the macros that used them, nobody could've used them anyway.
2014-06-26 16:18:46 +02:00
Sebastian Dröge 909dd7831b audiodecoder: Don't be too picky about the output frame counter
With most decoder libraries, and especially when accessing codecs via
OpenMAX or similar APIs, we don't have the ability to properly related
the output buffers to a number of input samples. And could e.g. get
a fractional number of input buffers decoded at a time.

Previously this would in the end lead to an error message and stopped
playback. Change it to a warning message instead and try to handle it
gracefully. In theory the subclass can now get timestamp tracking
wrong if it completely misuses the API, but if on average it behaves
correct (and gst-omx and others do) it will continue to work properly.

Also add a test for the new behaviour.

We don't change it in the encoder yet as that requires more internal logic
changes AFAIU and I'm not aware of a case where this was a problem so far.
2014-06-20 11:02:55 +02:00
Thibault Saunier 12df7fa49d audiodecoder: Keep still meaningfull pending events on FLUSH_STOP
Only EOS and segment should be deleted in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=709868
2014-06-03 13:03:21 +02:00
Thibault Saunier 967d1fb982 audioencoder: Keep still meaningfull pending events on FLUSH_STOP
Only EOS and segment should be deleted in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=709868
2014-06-03 13:03:16 +02:00
Philip Withnall ba87655628 audio: Add a missing precondition to gst_audio_format_from_string()
https://bugzilla.gnome.org/show_bug.cgi?id=730874
2014-05-28 11:34:01 +02:00
Thiago Santos 09b8f902ea audiodecoder: return EOS when segment is over
if a buffer is clipped by being completely out of segment, check if this
buffer is after the end of the segment and return EOS upstream

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 19:26:45 -03:00
Sebastian Dröge 68f5350c66 Release 1.3.1 2014-05-03 17:50:10 +02:00
Haakon Sporsheim 7c97a1c6cf audiodecoder: Make caps writable before fixating
https://bugzilla.gnome.org/show_bug.cgi?id=729114
2014-04-29 09:58:21 +02:00
Tim-Philipp Müller bcb8068e27 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:28:57 +01:00
Edward Hervey 74eb5fa995 audiodecoder: Plug caps leaks
We were returning in various places without unreffing the caps, and
we were also leaking (overwriting) the caps we got from _get_current_caps()

Spotted by Haakon Sporsheim in #gstreamer
2014-04-25 11:30:37 +02:00
Vincent Penquerc'h dda777803c audiocdsrc: guard aginst overflow
An audio CD may contain about a tenth of the samples 32 bit can
represent, so it doesn't seem likely this will be hit in practice.

Coverity 1139805
2014-04-10 12:35:03 +01:00
Vincent Penquerc'h 7618699ffd audiobasesink: avoid possible sample count overflow
At 48 kHz, 2<<31 samples is reached before 13 hours so it
sounds plausible this would be hit.

Coverity 1139800, 1139801
2014-04-10 11:06:00 +01:00
Josep Torra 6ce7ade7c6 audioringbuffer: parse channels field from compressed audio caps
Also parse channels as an optional field in the caps for compressed
audio formats.
2014-04-08 12:54:04 +02:00
Vincent Penquerc'h 169166d0a2 audiobasesink: clip start samples to match clipped start time
Clock slaving can clip start time to zero, giving us a shorted
duration than we originally got. To keep in sync, we must then
discard the samples falling before that zero timestamp.

This possibly fixes random distortion caused by constant PA
underflows which are never resynced.
2014-04-04 17:04:06 +01:00
Rafał Mużyło 5496d09eb4 audio: map channels=1,channel-mask=0 to MONO instead of NONE
Fixes problem in audioconvert, which would end up using
a mixmatrix when converting between different mono format
because it thinks MONO positioning is different from
unpositioned channels, which is not the case in this
special case. The mixmatrix would end up being 0.0 so
audioconvert would convert to silence samples.

https://bugzilla.gnome.org/show_bug.cgi?id=724509
2014-02-18 10:41:47 +00:00
Sebastian Dröge bc92cd8f67 audiosrc: Fix typo in docs
We read *from* the audio device, not to it.
2014-02-09 11:28:48 +01:00
Stefan Sauer 76ec6d3760 docs: doc fixes for audio library
Add sections docs for audiometa. Fix sections docs for audiochannels. Remove old
mixerutil section.
2014-02-03 09:36:43 +01:00
Thiago Santos e00dc5b879 audioencoder: push pending events and tags before EOS
if there are tags or events pending and an EOS is received, push those
events and tags before the EOS.
2014-01-29 12:33:59 -03:00
Wim Taymans 6a88d6f8cd audiobasesink: make _get_time more threadsafe
We call the _get_time function from the provided clock and we don't lock
the sink object for performance reasons. Make sure we only read and
check variables once so that they don't change while we are executing
the code.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720661
2014-01-21 11:25:18 +01:00
Thiago Santos 695ddbd56f audiodecoder: copy rate and channels from input before fixating output caps
For default caps generation when handling gap events that are sent
before any buffer, try to use caps that are closer to what upstream
provided to avoid fixating rate or channels to 1 as default.

So there are the steps:
1) Try to set rate, channels and channel-mask from upstream if provided
2) Fixate the rate and channels to the default rate and channels from
   audio lib
3) Fixate the caps just to be sure everything is fixed
4) If no channel-mask was provided and channels > 2, use a default
   channel-mask (taken from audioconvert code)

https://bugzilla.gnome.org/show_bug.cgi?id=722144
2014-01-15 15:20:39 -03:00
Thiago Santos 95a56dbda7 audiodecoder: avoid parsing caps event if it is not used
Saves some cpu
2014-01-14 09:34:44 -03:00
Thiago Santos 8cf8332b91 audiodecoder: make sure caps is set before forwarding gap event
Before trying to generate a default fixated caps when handling a gap
event, make sure that the same strategy that is used when handling
a buffer has been attempted. Otherwise audiodecoder will ignore
upstream caps settings such as rate and channels and will likely
end with a caps with channels=1 and rate=1.

https://bugzilla.gnome.org/show_bug.cgi?id=722144
2014-01-14 09:34:44 -03:00
Jan Schmidt f0b655e1ad audiobasesrc: Avoid unnecessary configuration
Port a change from audiobasesink from def07410, to ignore setcaps
when the caps don't actually change, and avoid a reconfiguration
and reset of the ringbuffer in that case.
2014-01-03 02:20:39 +11:00
Sebastian Dröge 58592a2af3 audio/video-info: Properly initialize the info structures in set_format()
And don't assume in other code that set_format() preserves any fields at
all. These assumptions were already made here for fields that were changed
by set_format().
2013-12-30 10:53:24 +01:00
Sebastian Dröge 65732d9c97 audio/video-info: Initialize the complete struct to 0 in the beginning
Instead of only initializing some parts in some code paths. Also
makes it easier to use the reserved bits of the structs later.

https://bugzilla.gnome.org/show_bug.cgi?id=720810
2013-12-30 10:15:20 +01:00
Reynaldo H. Verdejo Pinochet 5f07c1ed4e audiobasesrc: Bunch of cosmetic/grammar fixes 2013-12-27 01:36:09 -03:00
Reynaldo H. Verdejo Pinochet 0a6d6e1fff audiobasesrc: Retarget FIXME to 2.0
Properly fixing this one would break API.
2013-12-27 01:36:09 -03:00
Reynaldo H. Verdejo Pinochet aa1883d5d7 audiobase*: Drop trailing withespaces 2013-12-27 01:36:09 -03:00
Reynaldo H. Verdejo Pinochet d1b3454299 audiobasesrc: Break some too long lines 2013-12-27 01:36:09 -03:00
Reynaldo H. Verdejo Pinochet 6b17d86692 audiobasesrc: Add FIXME for times in NSECONDS
Timebase is in nanoseconds pretty much everywhere else
2013-12-27 01:36:09 -03:00
Jan Schmidt c24a1254c9 audiodecoder: Choose a default initial caps before sending GAP
If there are no caps from the audio decoder when handling a GAP
event - as when one is received right at the start on a DVD without
initial audio - then choose any default caps for downstream and
then send the GAP, so the audio sink has a configured format in
which to start the ringbuffer.

Also, make the audio sink reject a GAP without caps with a clearer
error message.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=603921
2013-12-27 04:04:45 +11:00
Reynaldo H. Verdejo Pinochet 21190b9749 gstaudiobasesink: Always reset last_align
Should be done for all the reset_sync() cases. Not
only for the READY to PAUSED one.
2013-12-20 18:06:25 -03:00
Reynaldo H. Verdejo Pinochet 032779ff13 gstaudiobasesink: Reset last_align to 0, not -1
This is the expected behavior in READY -> PAUSED
2013-12-20 18:02:42 -03:00
Reynaldo H. Verdejo Pinochet c1de7cdefb gstaudiobasesink: Always reset avg_skew on _reset
Only case in which it wasn't (READY to PAUSED) should
have had this value reseted too.
2013-12-20 17:58:43 -03:00
Reynaldo H. Verdejo Pinochet adf800087c gstaudiobasesink: Retarget FIXME to 2.0
Properly fixing this one would break API
2013-12-20 17:48:22 -03:00
Reynaldo H. Verdejo Pinochet d35db35258 gstaudiobasesink: Factor out reset sync routine 2013-12-20 17:47:38 -03:00
Reynaldo H. Verdejo Pinochet b324d67586 gstaudiobasesink: Drop dead _sink_async_play() code 2013-12-20 13:58:34 -03:00
Reynaldo H. Verdejo Pinochet 2f04733a4b gstaudiobasesink: Break some too long lines 2013-12-20 13:58:33 -03:00
Reynaldo H. Verdejo Pinochet 187b106202 gstaudiobasesink: Cosmetics, grammar/spelling
- Drop repeated 'yet' from debug msg
- Drop repeated 'to' from param desc
- Some spelling
2013-12-20 13:58:33 -03:00
Edward Hervey b97c711def audio/video: Initialize all {audio|video}info fields
Fixes "Unitialized Scalar Variable" issues reported by Coverity.

Has the added advantage of detecting whether somebody *does* use those
fields (ending up with a invalid address).

https://bugzilla.gnome.org/show_bug.cgi?id=720810
2013-12-20 14:47:22 +01:00
Reynaldo H. Verdejo Pinochet 86b0a0d6d0 gstaudiobasesink: Refactor alignment computation for clarity 2013-12-19 18:05:44 -03:00
Todd Agulnick 38d8fa12a5 Some compiler warning fixes to satisfy XCode compiler
https://bugzilla.gnome.org/show_bug.cgi?id=720513
2013-12-16 16:51:29 +01:00
Wim Taymans df3718ea2b audiobasesink: handle the RESYNC flag
Also resync when a buffer with the RESYNC flag is seen.
2013-12-05 16:27:35 +01:00
Julien Isorce e68317f070 audiodec/enc: clear reconfigure flag if negotiate succeeds
So that it avoids to send an allocation query twice.
One from an early call to gst_audio_encoder_negotiate from a
subclass, then one from gst_audio_encoder_allocate_output_buffer.
Which means that previously gst_audio_encoder_negotiate was not
clearing the GST_PAD_FLAG_NEED_RECONFIGURE even on success.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=719684
2013-12-05 15:19:16 +00:00
Sebastian Dröge 400d4baf92 audiodecoder: Use FALSE instead of 0 2013-12-05 11:37:09 +01:00
Mark Nauwelaerts 6e639b73ff audiodecoder: no fallback to segment start for reverse playback
See https://bugzilla.gnome.org/show_bug.cgi?id=709965
2013-12-04 19:24:25 +01:00
Mark Nauwelaerts 387e5f0c14 audiodecoder: use segment start as fallback ts if no other available
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=709965
2013-12-02 20:36:21 +01:00
Sebastian Dröge f8477e6b88 audiodecoder: error out if no frames are decoded before eos
Raise an error in case no frames are decoded before EOS and we
have input, meaning that data was received but it was somehow invalid.

Based on the videodecoder change, merged here for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-26 12:29:30 +01:00
Sebastian Dröge b0788ce054 audiodecoder: Allow using -1 for infinite tolerated errors
Allows using -1 to make audiodecoder never post an error message
after decoding errors.

Based on the videodecoder change, merged here for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-26 12:20:33 +01:00
Mark Nauwelaerts b13a722746 audioencoder: also set output buffer DTS 2013-11-16 15:25:38 +01:00
Sebastian Dröge 3fb235c53c audio: Update ORC dist files 2013-11-03 15:58:35 +01:00
Sebastian Dröge 081f009e25 audio-format: Use ORC for filling memory with silence samples 2013-11-03 15:58:35 +01:00
Takashi Iwai 6d659e3c6f audioringbuffer: Don't clear need_reorder flag too early
gst_audio_ring_buffer_set_channel_positions() checks whether the given
positions are identical with the current setup and returns
immediately if so.  But it also clears need_reorder flag before this
comparison, thus this flag might be wrongly cleared if the function is
called twice with the same channel positions.

Move the flag clearance after the check.

https://bugzilla.gnome.org/show_bug.cgi?id=709754
2013-10-09 19:00:33 +02:00
Johannes Dewender 019ef0747d audiocdsrc: Don't consider trailing data tracks for MusicBrainz disc id calculation
MusicBrainz removes trailing data tracks from releases on the server
and also for the calculation of the MusicBrainz Disc ID.

https://bugzilla.gnome.org/show_bug.cgi?id=708991
2013-10-01 22:24:22 +02:00
David Svensson Fors 09d628f8f1 audioringbuffer: check if acquired in set_timestamp
Also use GST_OBJECT_LOCK when accessing object data in set_timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=702230
2013-10-01 22:12:07 +02:00
Matej Knopp dbaf1bf0a3 audio: change buffer timestamp when clipping even if data hasn't been trimmed
https://bugzilla.gnome.org/show_bug.cgi?id=708952
2013-09-28 11:39:43 +02:00
Wim Taymans c9ff3e4f98 audiobasesink: do big correction for large drift
If we are using skew slaving and we drift more than twice the allowed amount, do
a big correction to get back on track more quickly.
2013-09-25 16:03:07 +02:00
Sebastian Dröge 420e229829 audioencoder/decoder: Mark pads as requiring reconfiguration again if negotiation fails
Otherwise we might end up in non-optimal configuration, especially
when a flush happened during reconfiguration.
2013-09-12 09:42:36 +02:00
Wim Taymans d3641943b3 docs: fix some doc blocks 2013-09-09 15:52:05 +02:00
Mathieu Duponchelle d1cb9c994b video/audio: #define metadata strings.
For instance "orientation" becomes GST_VIDEO_ORIENTATION_METADATA.
2013-09-09 15:37:02 +02:00
Sebastian Dröge 96ab6db422 audioencoder: Simplify pushing of pending events during negotiation
And also don't send the same caps twice.
2013-08-23 19:17:16 +02:00
Sebastian Dröge daf017ced8 audiodecoder: Fix last commit and simplify code a lot 2013-08-23 19:10:48 +02:00