Commit graph

52 commits

Author SHA1 Message Date
Philippe Renon
0dc1b6049e audiosink: expose more audioringbuffer vmethods to child sinks
The newly exposed vmethods are pause, resume, stop and clear_all.
The existing reset vmethod is deprecated.

The audio sink will fallback to calling reset if pause or stop
are not provided and will fallback to calling start if
resume is not provided. There is no default clear_all
implementation.
Existing audio sinks continue to work as before.

This change is useful for sinks that need to distinguish
between a pause and a stop (currently both are handled
by a reset) and is needed for https://bugzilla.gnome.org/show_bug.cgi?id=788362

https://bugzilla.gnome.org/show_bug.cgi?id=788361
2019-09-27 05:34:57 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
mrk501
361835979e audioringbuffer: Fix wrong memcpy address when reordering channels
When using multichannel audio data and being needed to reorder channels,
audio data is not copied correctly because destination address of
memcpy is wrong.

For example, the following command
$ gst-launch-1.0 pulsesrc ! audio/x-raw,channels=6,format=S16LE ! filesink location=test.raw
will reproduce this issue if there is 6-ch audio input device.

This commit fixes that.

The detailed process of this issue is as follows:
1. gst-launch-1.0 calls gst_pulsesrc_prepare (gst-plugins-good/ext/pulse/pulsesrc.c)

   1466 gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
   1467 {
   (skip...)
   1480   {
   1481     GstAudioRingBufferSpec s = *spec;
   1482     const pa_channel_map *m;
   1483
   1484     m = pa_stream_get_channel_map (pulsesrc->stream);
   1485     gst_pulse_channel_map_to_gst (m, &s);
   1486     gst_audio_ring_buffer_set_channel_positions (GST_AUDIO_BASE_SRC
   1487         (pulsesrc)->ringbuffer, s.info.position);
   1488   }

   In my environment, after line 1485 is processed, position of spec and s are
     spec->info.position[0] = 0
     spec->info.position[1] = 1
     spec->info.position[2] = 2
     spec->info.position[3] = 6
     spec->info.position[4] = 7
     spec->info.position[5] = 8

     s.info.position[0] = 0
     s.info.position[1] = 6
     s.info.position[2] = 2
     s.info.position[3] = 1
     s.info.position[4] = 7
     s.info.position[5] = 8

   The values of spec->info.positions equal
   GST_AUDIO_BASE_SRC(pulsesrc)->ringbuffer->spec->info.positions.

2. gst_audio_ring_buffer_set_channel_positions calls
   gst_audio_get_channel_reorder_map.

3. Arguments of gst_audio_get_channel_reorder_map are
    from = s.info.position
    to = GST_AUDIO_BASE_SRC(pulsesrc)->ringbuffer->spec->info.positions

   At the end of this function, reorder_map is set to
     reorder_map[0] = 0
     reorder_map[1] = 3
     reorder_map[2] = 2
     reorder_map[3] = 1
     reorder_map[4] = 4
     reorder_map[5] = 5

4. Go back to gst_audio_ring_buffer_set_channel_positions and
   2065       buf->need_reorder = TRUE;
   is processed.

5. Finally, in gst_audio_ring_buffer_read,

   1821     if (need_reorder) {
   (skip...)
   1829           memcpy (data + i * bpf + reorder_map[j] * bps, ptr + j * bps, bps);

   is processed and makes this issue.
2019-01-29 14:49:19 +00:00
Tim-Philipp Müller
ca15315565 gst-libs: include config.h in all source files
This will be needed later when we get our export define from config.h
2018-08-13 09:23:34 +01:00
Mark Nauwelaerts
9a360a47bf audio: fix some GIR annotations
Mostly related to out and array parameters
2018-04-23 19:33:19 +02:00
Nirbheek Chauhan
baadc3b302 audioringbuffer: Don't spam INFO for every buffer
This makes GST_DEBUG=4 outputs too spammy, and such frequent messages
are meant to go into DEBUG or TRACE anyway.
2018-04-07 11:09:58 +05:30
Nicolas Dufresne
1ceb40cd1e audioringbuffer: Accept MPEG 1 layer 3 version 2.5
https://bugzilla.gnome.org/show_bug.cgi?id=781929
2017-05-16 15:37:16 -04:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Jan Schmidt
5903e2dfbb audioringbuffer: Also add FLAC to debug strings.
Oops, also add FLAC to the debug strings array.

https://bugzilla.gnome.org/show_bug.cgi?id=777655
2017-02-04 14:46:42 +11:00
Jan Schmidt
04c14de1d1 audioringbuffer: Prevent overflow of debug names array
Add new audio types to the list of strings used for debug
so we don't index past the end of that array.

https://bugzilla.gnome.org/show_bug.cgi?id=777655
2017-02-04 14:42:33 +11:00
Vincent Penquerc'h
6134dab3bb audio: add FLAC to GstAudioRingBufferFormatType
https://bugzilla.gnome.org/show_bug.cgi?id=777655
2017-01-23 13:47:39 -05:00
Olivier Crete
c46607095e audioringbuffer: Also support raw AAC
Support raw AAC streams without the ADTS header

https://bugzilla.gnome.org/show_bug.cgi?id=777655
2017-01-23 13:45:50 -05:00
Evan Nemerson
98064ed9bf audioringbuffer: add set_callback_full() for g-i
https://bugzilla.gnome.org/show_bug.cgi?id=678301
2016-12-22 15:34:58 +00:00
Vincent Penquerc'h
6ee5922f2f audioringbuffer: do not require 4 byte multiple for encoded MPEG
Bytes per frame doesn't make sense for encoded audio.

https://bugzilla.gnome.org/show_bug.cgi?id=776038
2016-12-13 10:16:07 +00: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
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
Arun Raghavan
592fc9cdba audioringbuffer: Log with the ringbuffer object where possible 2015-03-13 23:24:58 +05:30
Mark Nauwelaerts
13ee94ef10 audioringbuffer: start ringbuffer if needed upon commit
... to provide for a running clock.
2015-01-10 13:03:20 +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
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
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
Reynaldo H. Verdejo Pinochet
aa1883d5d7 audiobase*: Drop trailing withespaces 2013-12-27 01:36:09 -03: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
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
Sebastian Dröge
98f41f1c39 audioringbuffer: Also reset segbase 2013-04-15 10:13:14 +02:00
Paul HENRYS
587b2721c8 audioringbuffer: Reset segdone when releasing audioringbuffer
https://bugzilla.gnome.org/show_bug.cgi?id=697723
2013-04-15 10:09:49 +02:00
Marc Leeman
0fa50b44f0 audioringbuffer: avoid division by 0 when outputting debug info
https://bugzilla.gnome.org/show_bug.cgi?id=695832
2013-03-15 09:06:07 +00:00
Akihiro Tsukada
a32877125f audio: add support for AAC pass-through
https://bugzilla.gnome.org/show_bug.cgi?id=694443
2013-02-27 00:38:05 +00:00
Stefan Sauer
b274ff7c21 audioringbuffer: log a few more details (e.g. obj-name) 2013-02-25 19:55:00 +01:00
Sebastian Dröge
3f82e919dd libs: Use foo/foo.h as single-include header consistently everywhere
https://bugzilla.gnome.org/show_bug.cgi?id=688785
2012-12-12 17:13:10 +00:00
Tim-Philipp Müller
8827437b61 audio: remove bogus Since marker from docs
It was causing perl warnings in gtk-doc code.
2012-11-21 23:19:14 +00:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Wim Taymans
5f44303925 audioringbuffer: reset spec on _release
Reset the caps and the audioinfo when releasing the ringbuffer.
Fixed a bug with reusing pulsesink.
2012-10-30 10:33:04 +00:00
Olivier Crête
b35bc51ed6 audio: Fix annotations 2012-09-13 17:11:56 -04:00
Wim Taymans
44dab50b7a ringbuffer: add method to check the flushing state 2012-09-10 12:19:22 +02:00
Pontus Oldberg
a2f8ec4f5a ringbuffer: add support for timestamps
Make it possible for subclasses to provide the timestamp (as an absolute time
against the pipeline clock) of the last read data.
Fix up alsa to provide the timestamp received from alsa. Because the alsa
timestamps are in monotonic time, we can only do this when the monotonic clock
has been selected as the pipeline clock.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=635256
2012-09-10 11:34:14 +02:00
Thibault Saunier
dc5bb008a3 audio: port to the new GLib thread API 2012-09-09 20:41:06 -03:00
Tim-Philipp Müller
2079a8c12b Remove glib-compat-private.h stuff we don't need any more
It's all been ported to the latest GLib API now.
2012-09-09 18:36:49 +01:00
Edward Hervey
2817bdadc9 libs: Remove "Since" markers and minor doc fixups 2012-07-13 12:11:06 +02:00
Sebastian Dröge
bd40936409 audioringbuffer: Use new function to get a channel reordering map 2012-01-05 10:34:24 +01:00
Sebastian Dröge
225238a913 audioringbuffer: Add support for reordering of channels 2012-01-05 10:34:16 +01:00
Tim-Philipp Müller
3dfdd6be9d audioringbuffer: rename GST_BUFTYPE_* to GST_AUDIO_RING_BUFFER_FORMAT_TYPE_*
Bit unwieldy, but more appropriate. Could also be moved into
audio.h as GstAudioFormatType.
2011-12-25 21:38:21 +00:00
Sebastian Dröge
338622fe7e audioringbuffer: Use guint8 instead of guchar 2011-12-20 14:36:28 +01:00
Tim-Philipp Müller
fb6d09055a Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	ext/alsa/gstalsadeviceprobe.c
	ext/alsa/gstalsamixer.c
	ext/pango/gsttextoverlay.c
	ext/pango/gsttextoverlay.h
	gst-libs/gst/audio/gstaudiobasesink.c
	gst-libs/gst/audio/gstaudioringbuffer.c
	gst-libs/gst/audio/gstaudiosrc.c
	gst-libs/gst/video/Makefile.am
	gst-libs/gst/video/video.c
	gst/encoding/gststreamcombiner.c
	gst/encoding/gststreamsplitter.c
	gst/playback/gstplaybasebin.c
	gst/playback/gststreamsynchronizer.c
	gst/playback/gstsubtitleoverlay.c
	gst/playback/gsturidecodebin.c
	sys/xvimage/xvimagesink.c
	tests/examples/Makefile.am
	win32/common/libgstvideo.def

Video overlay composition disabled for now, needs
porting to buffer meta.
2011-12-08 01:19:03 +00:00
Wim Taymans
f096b8a8d8 ringbuffer: remove old _full version 2011-12-06 15:06:12 +01:00
Tim-Philipp Müller
177525f89f Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst-libs/gst/netbuffer/gstnetbuffer.c
	gst/ffmpegcolorspace/avcodec.h
	gst/ffmpegcolorspace/gstffmpegcodecmap.c
	gst/ffmpegcolorspace/imgconvert.c
	gst/ffmpegcolorspace/imgconvert_template.h
	gst/ffmpegcolorspace/mem.c
	gst/playback/README
	gst/playback/gstplaybasebin.c
	gst/playback/gstplaybasebin.h
	gst/playback/gstplaybin.c
	sys/v4l/v4lmjpegsrc_calls.c
	sys/v4l/videodev_mjpeg.h
	tests/check/elements/gnomevfssink.c
2011-12-02 11:10:17 +00:00
Wim Taymans
ee7072fe7e rename GstBaseAudio* ->GstAudioBase* 2011-11-11 11:52:47 +01:00
Wim Taymans
3d0ac3ded2 rename files to match contained objects 2011-11-11 11:33:15 +01:00
Renamed from gst-libs/gst/audio/gstringbuffer.c (Browse further)