Commit graph

443 commits

Author SHA1 Message Date
Guillaume Desmottes
6e7fa6659f alsa: properly convert position-less channels from ALSA
The only way for ALSA to expose a position-less multi channels is to
return an array full of SND_CHMAP_MONO. Converting this to a
GST_AUDIO_CHANNEL_POSITION_MONO array would be invalid as
GST_AUDIO_CHANNEL_POSITION_MONO is meant to be used only with one
channel.

Fix this by using GST_AUDIO_CHANNEL_POSITION_NONE which is meant to be
used for position-less channels.

https://bugzilla.gnome.org/show_bug.cgi?id=763799
2016-04-12 14:48:30 -04:00
Guillaume Desmottes
eef7312169 alsa: add some debugging output to alsa_detect_channels_mapping()
https://bugzilla.gnome.org/show_bug.cgi?id=763985
2016-04-12 14:48:30 -04:00
Guillaume Desmottes
d9268a50f1 alsa: factor out alsa_detect_channels_mapping()
This code was duplicated in alsasrc and alsasink.

https://bugzilla.gnome.org/show_bug.cgi?id=763985
2016-04-12 14:34:13 -04:00
Guillaume Desmottes
592b87a463 alsa: coding style fix
Was using tabs instead of spaces.

https://bugzilla.gnome.org/show_bug.cgi?id=763985
2016-04-12 14:34:13 -04: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
Arun Raghavan
af091928f3 alsa: Trivial doc update
alsasink now does more than just raw audio.
2016-01-25 18:31:17 +05:30
Nicolas Dufresne
e7a59d2e08 Revert "alsasrc: Disable HW timestamp"
This reverts commit 3642e9a391.
2015-12-14 13:59:02 -05:00
Nicolas Dufresne
3642e9a391 alsasrc: Disable HW timestamp
This is a workaround for broken pulse module.
2015-12-14 13:39:02 -05:00
Sebastian Dröge
4fe12c1b09 alsa: Use 8 bit pointer type for byte-based pointer arithmetic
Usually these loops only run once, so there's no problem here. But sometimes
they run twice, and by adding the number of bytes to a 16 bit pointer type we
would advance twice as much as we should.

Also use snd_pcm_frames_to_bytes() in alsasrc to calculate
the number of bytes to skip, same as we do in alsasink.

Thanks to Lucio A. Hernandez <lucio.a.hernandez@gmail.com> for reporting.
2015-10-14 00:33:49 +03:00
Antonio Ospite
2c7ed42292 midi: add an ALSA MIDI sequencer source
The alsamidisrc element allows to get input event from ALSA MIDI
sequencer devices, and possibly convert them to sound using some
downstream element like fluiddec.

Fixes #738687
2015-10-01 21:43:21 +02:00
Carlos Rafael Giani
8f339c0932 alsa: report recoverable device failures to base class
This gives custom slave methods in the base class a chance to
resynchronize themselves

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
Tim-Philipp Müller
ec5c93f169 docs: update element example pipelines
- gst-launch -> gst-launch-1.0
- use autoaudiosink and audiovideosink more often
- review pipeline examples and descriptions
2015-05-10 11:38:19 +01:00
Sebastian Dröge
69e338d7dd alsa: Constify channel position table 2015-01-21 09:42:35 +01:00
Sebastian Dröge
8e6fb92886 alsa: Fix indention 2015-01-21 09:42:35 +01:00
Thomas Roos
485ad66a11 alsa: Allow to use 8 bit samples with ALSA
8 bit samples have no (0) as endianness, not the native endianness.

https://bugzilla.gnome.org/show_bug.cgi?id=739446
2015-01-21 09:42:35 +01:00
Thomas Klausner
a4b94e6c69 alsa: Use EPIPE instead of ESTRPIPE if the latter does not exist
NetBSD does not have ESTRPIPE.

https://bugzilla.gnome.org/show_bug.cgi?id=740952
2014-12-01 09:51:12 +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
b6d49d2a12 alsasrc: debug message fixes
In the same vein as 74e9640a.
2014-11-25 22:01:08 +00:00
Branislav Katreniak
5e8e6276cd alsa: Change the log messages in xrun_recovery() from DEBUG to WARNING
xrun_recovery() runs when there is an error

https://bugzilla.gnome.org/show_bug.cgi?id=740615
2014-11-24 15:30:32 +00:00
Vincent Penquerc'h
b444d8ba97 alsasink: make gst-ident happy 2014-06-03 15:17:20 +01:00
Vincent Penquerc'h
3b2d583373 alsasink: fix occasional crash intersecting invalid values
When a pipeline using alsasink and push mode upstream fails
to preroll, the following state will be the case:
- A loop upstream will be PAUSED, pushing a first buffer
- alsasink will be READY, pending PAUSED, because async

On error, the pipeline will switch to NULL. alsasink is in
READY, so goes to NULL immediately. It zeroes its cached
caps. Meanwhile, the upstream loop can cause a caps query,
conccurent with the state change. This will use those cached
caps. If the zeroing happens between the NULL test and the
dereferencing, GStreamer will critical down in the GstValue
code.

Since it appears that such a gap between states (PAUSED
and pushing upstream, and NULL downstream) is expected, we
need to protect the read/write access to the cached caps.

This fixes the critical.

See https://bugzilla.gnome.org/show_bug.cgi?id=731121
2014-06-03 15:17:20 +01:00
Vincent Penquerc'h
74e9640a22 alsasink: pass correct error to g_strerror
The error we get is a negated errno.

While there, fix a couple typos in messages.
2014-05-19 13:57:41 +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
Sebastian Dröge
d3e0381d3d alsa: Make clang happy with our g_strdup_vprintf() wrapper 2014-02-08 17:01:38 +01:00
Takashi Iwai
76d807893c alsa: Add channel map API support
The initial support for the new ALSA chmap API.
Just translate the current chmap to GstAudioChannelPosition during the
setup.  No function to specify the channel map manually yet, so still
impossible to assign any non-standard positions or to configure in a
different order even if the hardware allows.

https://bugzilla.gnome.org/show_bug.cgi?id=709755
2013-10-09 19:05:53 +02:00
Sebastian Dröge
4180581ce9 alsasrc: Dump some more debug output about the device configuration 2013-05-29 16:41:14 +02:00
Sebastian Dröge
639e2d4346 alsasink: Update internal buffer/period times with the values that were configured on the device 2013-05-29 16:41:06 +02:00
Alexander Schrab
a049b102da alsasrc: Make using driver timestamps possible
https://bugzilla.gnome.org/show_bug.cgi?id=699744
2013-05-20 11:25:17 +02:00
Sebastian Dröge
0bc25f0325 alsa: Dump min/max period time and buffer time in alsasrc too 2013-05-20 11:23:06 +02:00
Sebastian Dröge
948a4a3632 gst: Add better support for static plugins 2013-04-15 15:52:58 +02:00
yanghuolin
67a7b5a993 alsasink: don't use 100% CPU
The root cause is that alsa-lib is not thread safe for the same handle.
There are two threads in the gstreamer accessing alsa-lib not serilized.
The race condition happens when one thread holds the old framebuffer app_ptr
position in the kernel, another thread advances the framebuffer app_ptr.
when the former thread is scheduled to run again, it overwrites the app_ptr
to old value by copying from kernel.Thus,the app_ptr in the upper
alsa-lib(pcm_rate) become one period size more advanced than the lower
alsa-lib(pcm_hw & kernel).

gstreamer uses noblock and poll method to communicate with the alsa-lib.
The app_ptr unsync situation as described above makes the poll return immediately because
it concludes there is enough space for the ring-buffer via the low-level alsa-lib.
The write function returns immediately because it concludes there is not enough
space for the ring-buffer from the upper-level alsa-lib. Then the loop of poll
and write runs again and again until another period size is available for
ring-buffer.This leads to the cpu 100 problem.

delay_lock  is used to avoid the race condition.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=690937
2013-01-24 15:08:31 +01:00
Tim-Philipp Müller
df6031f7c6 alsasrc: return negative value on read error
Otherwise baseaudiosrc won't go into the error code path.

https://bugzilla.gnome.org/show_bug.cgi?id=690197
2012-12-17 20:50:33 +00:00
Tim-Philipp Müller
3d5a78e67a alsa: post error message when audio device disappears
Don't loop forever if an USB audio device gets disconnected
while in use. Post an error message instead. This is not
enough yet though, we still need to make the base class
and/or the ring buffer bail out.

https://bugzilla.gnome.org/show_bug.cgi?id=690197
2012-12-16 01:00:43 +00:00
Sebastian Dröge
d9b25afe71 ext: Fix some compilation errors caused by circular header includes 2012-12-12 17:22:31 +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
Sebastian Dröge
3c1041d5eb Revert "gst: Add better support for static plugins"
This reverts commit d2d79e3bc2,
which was accidentially pushed.
2012-10-24 13:26:26 +02:00
Sebastian Dröge
d2d79e3bc2 gst: Add better support for static plugins 2012-10-24 12:10:44 +02:00
Tim-Philipp Müller
ccbb233da8 alsasink: fix caps leak in acceptcaps function
https://bugzilla.gnome.org/show_bug.cgi?id=681192
2012-10-20 11:38:55 +01:00
Tim-Philipp Müller
1a69ec3fd3 alsa: if no formats in native endianness could be detected, try non-native endianness as well
This can happen, e.g. when using an USB sound card on
a big-endian device

https://bugzilla.gnome.org/show_bug.cgi?id=680904
2012-10-18 11:04:06 +01:00
Tim-Philipp Müller
1e329bb4f4 alsa: fix supported format detection
The format probing code was assuming there'd be one caps
structure for each separate width/depth combination like
we did in 0.10 all over the place: for one, we'd query
unsigned/signed formats together for the same width/height,
and we'd add the entire current structure to the probed
caps when we find a format is supported. Now that we have
all raw formats in a single structure, this is all not going
to work so well any more. We added the entire structure with
all possible formats to the caps if we support just one format.

Fix probing so that we only return the list of actually
supported raw audio formats (with native endianness) from
get_caps().
2012-10-18 11:03:07 +01:00
Arun Raghavan
9f9718715a audio: Explicitly specify endianness for IEC 61937 payloading
This is required since some systems (DirectSound and OS X) manage the
final byte order themselves.

https://bugzilla.gnome.org/show_bug.cgi?id=678021
2012-09-19 09:15:16 +05:30
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
Tim-Philipp Müller
794af4fc51 alsa: port to new GLib thread API 2012-09-10 01:06:51 +01: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
Tim-Philipp Müller
fc37cf5779 Silence some 'variable may be used uninitialized' compiler warnings
when compiling with -DG_DISABLE_ASSERT
2012-08-08 10:19:20 +01:00
Andoni Morales Alastruey
2434f2932b alsasink: check for spdif support only in the current device 2012-05-18 12:01:06 +02:00
Mark Nauwelaerts
1c70c5b85e alsasink: really use local ringbuffer spec helper var and init it a bit more
... to avoid assertion failures

Conflicts:

	ext/alsa/gstalsasink.c
2012-05-09 10:28:16 +02:00
Andoni Morales Alastruey
c6409806c1 alsasink: use the iec958 payloader to support non-payloaded input streams 2012-05-07 13:31:01 +02:00
Sebastian Dröge
69b18ab09d gst-libs: Remove interfaces libs and mixer/tuner interfaces
The navigation interface is now in the video library.
2012-04-13 13:14:13 +02:00
Tim-Philipp Müller
3c6a3ad629 Use new gst_element_class_set_static_metadata() 2012-04-10 00:45:16 +01:00