Commit graph

483 commits

Author SHA1 Message Date
Devarsh Thakkar
9759810d82 ext: alsa: Set buffer time after period time
This because underlying driver may have constraint on
buffer size to be dependent on period size, so period
time needs to be set first.

For e.g. Xilinx ASoC driver requires
buffer size to be multiple of period size for it's DMA
operation.

alsa-utils also set period time first as seen in below commit :
9b621eeac4

Tested it on zcu106 board with HDMI based record and playback.
Also tested on Intel PC using Logitech C920 Webcam mic and ALC887-VD
Analog for playback.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1040>
2021-03-11 14:15:54 +00:00
Stéphane Cerveau
1682161355 alsa: remove useless ret test
Use GST_ELEMENT_REGISTER_DEFINE_CUSTOM instead
of GST_ELEMENT_REGISTER_DEFINE_WITH_CODE if a specific
init needs to be tested before registering the element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1060>
2021-03-10 20:06:20 +01:00
Stéphane Cerveau
4a2981f906 alsa: allow per feature registration
Split plugin into features including
elements and device providers 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-base/-/merge_requests/900>
2020-12-10 13:01:57 +00:00
Jordan Petridis
31d683d59e alsamidisrc: fix compiler warning with clang 10
```
../subprojects/gst-plugins-base/ext/alsa/gstalsamidisrc.c:201:54: error: converting the result of '<<' to a boolean always evaluates to false [-Werror,-Wtautological-constant-compare]
  snd_seq_ev_schedule_real (&ev, alsamidisrc->queue, SND_SEQ_TIME_MODE_ABS,
                                                     ^
/usr/include/alsa/seq_event.h:215:34: note: expanded from macro 'SND_SEQ_TIME_MODE_ABS'
```

The ALSA API expects 0 or 1 here and will then add the flags accordingly,
and that's also what other code using this API does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/777>
2020-08-04 15:19:08 +03:00
Olivier Crête
2de70ed7c5 alsadeviceprovider: Remove redundant start function
The ALSA provider doesn't provider live monitoring, so don't
pretend otherwise.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/735>
2020-07-20 21:12:54 +00:00
Olivier Crête
2f83ca5c7f alsadeviceprovider: Rank down to secondary so PulseAudio can hide it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/727>
2020-07-06 16:32:21 +00:00
Stéphane Cerveau
f8dc428a2a remove various useless linefeed in logs 2019-12-11 10:07:12 +01:00
Tim-Philipp Müller
289d8e53e2 Remove autotools build system 2019-10-13 14:15:43 +01:00
Axel Mårtensson
5d3c948572 alsasink: pause/resume
alsasink can now detect a resume, stop and pause. The sink is now
properly paused using snd_pcm_pause(), and without losing any data
2019-09-27 05:34:57 +00:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Thibault Saunier
ac5d0f7da6 alsa: Implement a DeviceProvider
Removing gstalsadeviceprobe.[ch] as it was a relique from the 0.10
century.

This doesn't implement device monitoring but only probing, monitoring
should be implemented in its own commit.
2019-06-04 14:07:37 +00:00
Georg Lippitsch
ed33011502 alsasrc: Don't use driver timestamp if it's zero
Some alsa interfaces don't provide timestamps and thus always set the timestamp to zero.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/453
2019-05-20 15:22:30 +03:00
Thibault Saunier
bd72ad601f Mark some properties as DOC_SHOW_DEFAULT 2019-05-13 11:34:08 -04:00
Thibault Saunier
27ba8d24ec doc: Port to hotdoc 2019-05-13 11:34:08 -04:00
Robert Rosengren
123c2f8b5d alsasrc: driver timestamps only to be considered if system clock
The system clock check when considering to use driver timestamp
should not include sub-classes of system clock (such as the net clocks).
2019-04-30 10:55:52 +02:00
Danny Smith
a4cde36476 alsasrc: added option for chosing timestamps
Added an option for chosing if driver or pipeline timestamps shall be
used.
2019-04-29 11:23:45 +02:00
Nicolas Dufresne
d64a4b7a69 Revert "alsa: Implement a DeviceProvider"
This reverts commit 69c3c31608.

All devices have the same name, they are duplicated with pulseaudio one
and the provided does not respond to HW being plugged/unplugged. I think
it's not ready for 1.16.
2019-01-18 11:39:02 -05:00
Thibault Saunier
69c3c31608 alsa: Implement a DeviceProvider
Removing gstalsadeviceprobe.[ch] as it was a relique from the 0.10
century.
2019-01-18 10:18:54 -03:00
Nirbheek Chauhan
eadedc68f8 meson: Add feature options for all plugins
GL dependency detection is still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:11 +05:30
Xavier Claessens
201e7c7803 Meson: Generate pc file for all plugins in base
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:05:56 +01:00
Mathieu Duponchelle
32ca1701b7 alsamidisrc: unref buffer_list before early return 2018-04-13 01:07:21 +02:00
Tim-Philipp Müller
ae9911617e Revert "alsasrc: lock calls to snd_pcm_delay() with mutex as in alsasink"
This reverts commit 4f88125b3d.

This seems to have undesirable side-effects and needs more
investigation first.

https://bugzilla.gnome.org/show_bug.cgi?id=746015
2018-03-07 18:50:25 +00:00
Branislav Katreniak
4f88125b3d alsasrc: lock calls to snd_pcm_delay() with mutex as in alsasink
Alsasrc introduced delay_lock in commit 519f85a43e73efb8f3fb2c7be45226e
because alsa-lib is not thread safe for the same handle.
Alsasrc uses the same threading pattern, it should be locked too.

https://bugzilla.gnome.org/show_bug.cgi?id=746015
2018-01-22 20:24:00 +00:00
Tim-Philipp Müller
0ef44cefc9 alsamidisrc: unlock create function on shutdown
Fixes occasional hang in generic/states unit test or

GST_CHECKS=test_state_changes_up_and_down_seq make forever
2017-12-08 10:35:43 +00:00
Edward Hervey
c3875a236b alsamidisrc: Don't assume a clock has been set
Can happen in testing scenarios for example
2017-11-30 10:47:12 +01:00
Antonio Ospite
feacb875a4 alsamidisrc: Improve buffer timestamping
Make buffer timestamps more accurate and, more importantly, actually
representative of the MIDI events timing.

Previously, buffers were only sent with timetamps aligned at a 10ms
boundary which was just wrong, now the buffer timestamp represents the
real time of the MIDI event.

Conveniently, the ALSA sequencer API supports scheduling events in the
future so the sequencer infrastructure can be used to have the tick
delivered at the right time, avoiding any custom scheduling mechanism.

The ticks scheduling starts on the first transition to PLAYING, and the
delay is also calculated when the pipeline goes into PLAYING.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
3a64ed723a alsamidisrc: Expand snd_seq_create_simple_port() and use a queue for timestamps
Events are timestamped with a real-time value representing the time
passed since the queue timer was started.

The timestamp is not used just yet.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
132ead36c1 alsamidisrc: Merge prepare_buffer() and push_buffer()
The separation is not very useful since push_buffer() is the only user
of prepare_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
b5060f16d9 alsamidisrc: Don't set buffer offset and duration
They are not relly needed for a live source.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
3c5aa0a786 alsamidisrc: Fix a memory leak when setting the "ports" property
When setting the "ports" property the value is duplicated but it's not
freed when the elements stops.

Reported by Valgrind (example run with "alsamidisrc ports=128:0"):

  6 bytes in 1 blocks are definitely lost in loss record 30 of 1,911
     at 0x4C2BBEF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
     by 0x5411528: g_malloc (gmem.c:94)
     by 0x542A9FE: g_strdup (gstrfuncs.c:363)
     by 0x775211E: gst_alsa_midi_src_set_property (gstalsamidisrc.c:284)
     by 0x5184A4D: object_set_property (gobject.c:1439)
     by 0x5184A4D: g_object_setv (gobject.c:2245)
     by 0x51859DD: g_object_set_property (gobject.c:2529)
     by 0x4F0474C: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4F065C8: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4F07557: ??? (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4EFE3EE: gst_parse_launch_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)
     by 0x4EFE673: gst_parse_launchv_full (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1203.0)

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
f671026f11 alsamidisrc: Prevent Valgrind from reporting cached config as memory leaks
See http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=MEMORY-LEAK;hb=HEAD

This allows to have cleaner Valgrind reports about alsamidisrc and make
it easier to spot actual problems.

https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Antonio Ospite
8638d81eb3 alsamidisrc: Improve a comment and remove one trailing space
https://bugzilla.gnome.org/show_bug.cgi?id=787683
2017-11-29 21:13:38 -05:00
Ponnam Srinivas
0e8a510eda alsasink: Fix Memory leak in payload not succuss case
https://bugzilla.gnome.org/show_bug.cgi?id=788114
2017-09-26 11:18:09 +03:00
Thibault Saunier
dd1e4f5ebb alsasrc: Handle newly added GstStateChange values
https://bugzilla.gnome.org/show_bug.cgi?id=783798
2017-06-20 09:19:53 -04:00
vijay
f460d7d184 alsa: Add mapping for PCM F32/F64 formats
Fix enables float pcm formats for both the alsasrc and alsasink

https://bugzilla.gnome.org/show_bug.cgi?id=782695
2017-05-17 10:33:52 -04:00
Nicolas Dufresne
e0d793f793 alsasink: 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
Nicolas Dufresne
8e6c6266d7 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 13:42:07 -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
Nirbheek Chauhan
5c4f4ac1bd Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

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

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

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

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

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:09:51 +01:00
Jan Schmidt
614ddaa739 alsasink: Remove unused hwparam/swparam pointers
The ALSA params structures aren't kept. The pointers
aren't used anywhere, so remove them from the struct.
2016-07-15 22:51:35 +10:00
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