Commit graph

426 commits

Author SHA1 Message Date
Stéphane Cerveau 771d954c04 audioparsers: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
2021-03-29 12:45:22 +02:00
Matthew Waters 612102fdbc gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/911>
2021-03-18 19:52:53 +11:00
Vivia Nikolaidou 5a2f9d510f aacparse: Fix caps change handling
In baseparse we set the fixed caps flag on all src pads, therefore the
source pad caps query in get_allowed_caps will return the current caps.
Current caps won't necessarily intersect with the new caps (e.g. sample
rate change). Replace get_allowed_caps with peer_query_caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/816>
2020-11-13 13:10:05 +00:00
Zebediah Figura 71bb53a648 mpegaudioparse: Use a constant bit rate to convert between time and bytes if possible.
This should result in no worse accuracy than the base parse element, and may
result in better accuracy. In particular, the number of bytes processed at any
given point, as accumulated by baseparse, can be only accurate to
(1 / # of frames) bytes per second, and if we try to seek immediately after
pausing the pipeline to a large offset, this small inaccuracy can propagate to
something noticeable.

The use case that prompted this patch is a 45-minute MPEG-1 layer 3 file, which
has a constant bit rate but no seek tables. Trying to seek the pipeline
immediately after pauisng it, without the ACCURATE flag, to a location 41
minutes in, yields a location that is, even with <https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/374>,
still audibly incorrect. This patch yields a much closer position, no longer
audibly incorrect, and likely within a frame of the most correct position.
2020-03-19 14:02:44 +00:00
Jennifer Berringer 3287f1cb3f flacparse: fix broken reordering of flac metadata
Each FLAC metadata block starts with a flag denoting whether it is the
last metadata block. The existing flacparse code moves any existing
VORBISCOMMENT block to immediately follow the STREAMINFO block without
changing any block's last-metadata-block flag. If no VORBISCOMMENT block
exists, it created one with the last-metadata-block flag set to true.
This results in gstflacdec sometimes giving bad headers to libflac when
trying to play perfectly valid FLAC files depending on the file's
metadata ordering. Depending on the contents of the other metadata
blocks, current versions of libflac may or may not return
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER when given this broken
metadata. This is most noticeable with files that have a large cover art
image attached where VORBISCOMMENT is the very last metadata block with
no PADDING afterwards.

This patch changes that behavior so that:

1. For FLAC files that already have a VORBISCOMMENT block, the metadata
   order is preserved.
2. For FLAC files that do not have a VORBISCOMMENT block, the generated
   dummy VORBISCOMMENT is placed immediately after STREAMINFO and
   inherits the last-metadata-block flag from STREAMINFO.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/484
2020-03-03 08:03:32 +00:00
aogun a6e28ca268 aacparse: fix wrong offset of adts channel 2019-11-18 01:06:41 +00:00
Tim-Philipp Müller c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Mart Raudsepp ab6e49e9cc audioparsers: add back segment clipping to parsers that have lost it
The pre_push_frame default clipping behaviour was introduced in 2010
with commit 30be03004e and modified with commit 4163969a24 in 2011,
when most parsers didn't implement a pre_push_frame yet. Not having it
meant that clipping was done by default. Those that did implement a
pre_push_frame (flacparse and mpegaudioparse) at the time, had the flag
adjusted as part of the 2011 refactor work.

All other parsers got a pre_push_frame vfunc implementation only in
2013, but seem to have forgot to keep the clipping behaviour, as
was done automatically when a pre_push_frame implementation doesn't
exist for the parser. aacparse lost it with commit 91d4abcea in
July 2013; the others in Dec 2013 as part of AUDIO_CODEC tag posting
in commits 6f89b430e, d2ab5199b, 29f2cae12, 753d3c23a and 292780574.
2019-06-24 14:40:58 +03:00
Thibault Saunier af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04:00
Thibault Saunier 0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Jochen Henneberg 7824e87c5b flacparse: On sink caps change restart parser
Draining the parser is not enough here, on caps change we need to
reset it so it is ready to accept new caps.
2018-12-14 09:22:33 +00:00
Tim-Philipp Müller 0d88e3553a wavpackparse: fix handling of correction streams
Accept wavpack correction streams (.wvc) on sink pad, so
that wavpackparse can also be used to packetise correction
streams.

Fix parsing of subblock ID tags - the higher bits are
flags and are not part of the ID. This resulted in
correction blocks not being recognised properly and
the output not having the right (correction) caps.
2018-09-12 01:05:05 +01:00
Roland Jon 7fe18db041 aacparse: fix codec_data buffer leak
https://bugzilla.gnome.org/show_bug.cgi?id=740101
2018-08-13 00:05:59 +01:00
Matej Knopp 61ba778347 dcaparse: do not accept header with invalid channel count
https://bugzilla.gnome.org/show_bug.cgi?id=737928
2018-05-06 11:08:20 +02:00
Xavier Claessens edd9c8f6b8 Meson: Generate pc file for all plugins in good
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:07:06 +01:00
Sebastian Dröge 336a97157c flacparse: Drain the parser when a CAPS event is received
After a CAPS event, in theory a new stream can start and it might start
with the FLAC headers again. We can't detect FLAC headers in the middle
of the stream, so we drain the parser to be able to detect either FLAC
headers after the CAPS event or the continuation of the previous stream.

This fixes for example

gst-launch-1.0 audiotestsrc num-buffers=200 ! flacenc ! c. \
    audiotestsrc num-buffers=200 freq=880 ! flacenc ! c. \
    concat name=c ! rtpgstpay ! udpsink host=127.0.0.1 port=5000

gst-launch-1.0 udpsrc multicast-group=127.0.0.1 port=5000 \
    caps=application/x-rtp,media=application,clock-rate=90000,encoding-name=X-GST ! \
    rtpgstdepay ! flacparse ! flacdec ! audioconvert ! pulsesin
2018-04-16 21:29:57 +03:00
Jan Alexander Steffens (heftig) e273e5f7a6 aacparse: When parsing raw input, accept frames of any size
Raw AAC streams might have very small frames, e.g. 6 byte frames
when encoding silence. These frames are then smaller than aacparse's
default min_frame_size of 10 bytes (ADTS_MAX_SIZE).

When passthrough is disabled or aacparse has to output ADTS, GstBaseParse
will concatenate these short frames to the following frame before
handling them to aacparse, which processes each input buffer as a single
frame, producing bad output.

To avoid this problem, set the min_frame_size to 1 when receiving a raw
stream.

https://bugzilla.gnome.org/show_bug.cgi?id=792644
2018-01-18 19:09:19 +00:00
Tim-Philipp Müller d4c04cb079 Revert "flacparse: fix header rewriting being ignored"
This caused broken metadata and also looks a bit dodgy.
Revert until we can figure out a solution that works for
all cases and doesn't break anything.

This reverts commit adeee44b07.

https://bugzilla.gnome.org/show_bug.cgi?id=727802
https://bugzilla.gnome.org/show_bug.cgi?id=785558
2017-12-07 11:17:32 +00:00
Sebastian Dröge b02350bd62 flacparse: Request at least the full header size when parsing headers
Otherwise baseparse will incrementally send us bigger buffers until the
full header size is reached, which is not only pointless but also means
that baseparse will reallocate and copy into a bigger buffer for every
input buffers. In pull mode that's done in 64kb increments, in push mode
usually in much smaller increments, causing a lot of overhead for
example when parsing high-quality coverart.
2017-11-29 17:28:25 +02:00
Edward Hervey 5bc5e07531 dcaparse: Really fix "usage before unmap"
Previous patch would try to unref a buffer that was pushed downstream.

Instead only unref when/if needed and keep usage of the cleanup: goto
block
2017-09-04 17:06:39 +02:00
Arun Raghavan 5cf368b36c dcaparse: Don't unmap buffer before accessing data from it
The previous patch added a check for a substream header after
gst_buffer_unmap(), which is incorrect.
2017-09-03 15:23:10 +05:30
Matej Knopp f7854411fa dcaparse: preserve DTS HD substream 2017-09-03 15:05:08 +05:30
Sky Juan bc290059a4 ac3parse: fix not-linked handling causing glitches when selecting stream
Fix chain function not handling not-linked from baseparse.

When an input data is separated into 2 buffers, the second buffer
would not be pushed into the adapter if baseparse returns not-linked
for first buffer.

This caused glitches when switching streams and selecting
a stream that was previously unselected.

https://bugzilla.gnome.org/show_bug.cgi?id=786268
2017-08-16 14:09:31 +01:00
vijay 810c0bb084 aacparse : Fix, Caps were not set while reusing aacparse
While reusing aacparse caps were not set.This fix enables aacparse to reuse in same pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=783027
2017-05-24 13:59:52 +02:00
Nicolas Dufresne b68d936ae0 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:41:19 -04:00
Edward Hervey 9a066e548d aacparse: streamline and improve AudioSpecificConfig parsing
AudioSpecifigConfig is used in a variety of AAC streams but was
being parsed differently. Instead, make everyone use the same parsing.

* Remove unused 'bits' field (it was always set to 0 if present)
* Add proper GAConfig parsing (to know the  number of samples per frame
  if present).

Fixes wrong rate/channels configuration in streams coming from qtdemux

https://bugzilla.gnome.org/show_bug.cgi?id=780966
2017-04-06 12:04:46 +02:00
Edward Hervey 345c566552 aacparse: Handle Parametric Stereo with HE-AAC(v2)
According to ISO/IEC:14496-2:2009 , in the case of HE-AACv2 (audioObjecType
29) parametric stereo is used (a single mono track is used and then
transformations are applied to it to provide a stereo output).

We therefore report two channels in the case where there is one reported
in the audioChannelConfiguration.

Fixes the various issues where a demuxer would report two channels, but
then the parser would say there's only one channel, and then the decoder
would output two channels.
2017-04-04 18:16:39 +02:00
Tim-Philipp Müller f26edcdf34 docs: update two references to the removed 'mad' plugin
https://bugzilla.gnome.org/show_bug.cgi?id=776140
2017-03-20 17:03:54 +00:00
Vincent Penquerc'h f35238794c flacparse: fix playback if sample number does not start at 0
This reverts commit 29b807685d, while
fixing the original breaking tests/check/pipelines/flacdec.
2017-03-17 14:11:44 +00:00
Vincent Penquerc'h 29b807685d Revert "flacparse: fix playback if sample number does not start at 0"
This breaks gst-validate on the build server (though not locally),
and a unit test, and I can't run unit tests right now for some
unrelated reason.

This reverts commit 0747b56f8e.
2017-03-17 11:30:04 +00:00
Vincent Penquerc'h 0747b56f8e flacparse: fix playback if sample number does not start at 0
https://bugzilla.gnome.org/show_bug.cgi?id=777738
2017-03-16 14:21:20 +00:00
Michael Smith f7b1eae3a2 sbcparse: Fix up values for allocation enumeration.
https://bugzilla.gnome.org/show_bug.cgi?id=779389
2017-03-02 11:29:25 -05:00
Sebastian Dröge 323dc466d0 mpegaudioparse: Fix compilation with gcc 7
gstmpegaudioparse.c: In function ‘gst_mpeg_audio_parse_reset’:
gstmpegaudioparse.c:209:3: error: ‘memset’ used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
   memset (mp3parse->xing_seek_table_inverse, 0, 256);
   ^~~~~~
gstmpegaudioparse.c: In function ‘gst_mpeg_audio_parse_handle_first_frame’:
gstmpegaudioparse.c:951:7: error: ‘memset’ used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size]
       memset (mp3parse->xing_seek_table_inverse, 0, 256);
       ^~~~~~
2017-02-27 21:01:23 +02:00
Edgard Lima 8635258046 Update Edgard Lima's email
https://bugzilla.gnome.org/show_bug.cgi?id=779230
2017-02-27 00:34:19 +00:00
Sebastian Dröge 87a2c140ca aacparse: Make sure we have enough data in the codec_data to be able to parse it
Also error out cleanly if mapping the buffer failed.

https://bugzilla.gnome.org/show_bug.cgi?id=775450
2016-12-01 13:38:52 +02:00
Vinod Kesti f1726c7088 aacparse: assertion while converting ADTS stream to RAW
aacparse resizes input buffer while converting ADTS stream to RAW,
During buffer resize buffer write permission is not checked.
This throws gst_buffer_is_writable assertion and leads to AV sync issue some times.
It is corrected by making buffer writeable using gst_buffer_make_writable

https://bugzilla.gnome.org/show_bug.cgi?id=774129
2016-11-15 14:57:22 +02:00
Vincent Penquerc'h adeee44b07 flacparse: fix header rewriting being ignored
https://bugzilla.gnome.org/show_bug.cgi?id=727802
2016-11-10 12:51:08 +00:00
Vincent Penquerc'h c974df1c06 aacparse: parse a bit more of the humongous LOAS data
https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Vincent Penquerc'h e66ee5491c aacparse: make it clear when a potential LOAS frame is not one
https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Vincent Penquerc'h b0f20bacfd aacparse: add a few comments to anchor parsing to the spec
https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Vincent Penquerc'h 559546dd3a aacparse: improve channel/rate handling
Keep track of the last parsed channels/rate fields so they can be
used even if the element was not yet configured.

https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Vincent Penquerc'h 740749ac55 aacparse: fix varlength number reading as per spec
https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Vincent Penquerc'h 991e46ce42 aacparse: strip uneeded static arrays slack
https://bugzilla.gnome.org/show_bug.cgi?id=769278
2016-09-06 15:09:21 +01:00
Nirbheek Chauhan b09f478e80 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:21:12 +01:00
Tim-Philipp Müller 0f41d0e75d Revert "flacparse: Add maximum bitrate tag"
This reverts commit c703ab69f5.

https://bugzilla.gnome.org/show_bug.cgi?id=769392
2016-08-18 12:02:01 +01:00
Carlos Rafael Giani c703ab69f5 flacparse: Add maximum bitrate tag
https://bugzilla.gnome.org/show_bug.cgi?id=769392
2016-08-02 14:34:54 +03:00
Sebastian Dröge fd261e1099 aacparse: Reject raw AAC if no codec_data is found in the caps
If necessary, a demuxer will have to invent something here but this is only a
problem with non-conformant files anyway.
2016-07-04 16:58:38 +02:00
Vineeth TM 1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Sebastian Dröge 66e9e4c202 Revert "flacparse: push tags in pre_push_frame"
This reverts commit 4065fcb80a.

flacparse should not push tags by itself, the base class is going to do that
while properly merging in upstream tags. It just didn't because of a bug in
the base class, which was hidden by this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=763553
2016-03-13 10:33:13 +02:00
Luis de Bethencourt 4065fcb80a flacparse: push tags in pre_push_frame
Push a tag event before pre-roll if we have tags.

https://bugzilla.gnome.org/show_bug.cgi?id=762660
2016-03-01 19:23:02 +00:00