Commit graph

39 commits

Author SHA1 Message Date
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
Niels De Graef
a9ff9fe94e pulse: Use G_DECLARE_FINAL_TYPE 2020-03-16 09:20:07 +01:00
Olivier Crête
e00b8f0a4a pulsesink: Add property to find out the device currently in use
https://bugzilla.gnome.org/show_bug.cgi?id=590768
2013-08-22 15:03:29 -04:00
Akihiro Tsukada
fda72021d2 pulsesink: Add support for AAC pass-through
https://bugzilla.gnome.org/show_bug.cgi?id=694445
2013-08-21 21:48:56 +02:00
Olivier Crête
db84b928a3 pulse: Share static caps definition between src and sink
The src was also missing 24-bit sample formats
2013-08-21 15:23:12 -04:00
Olivier Crête
dd5d93f0f6 pulse: Remove unused GstPulseProbe 2013-08-19 12:56:27 -04:00
Wim Taymans
5750a67765 sink: alaw/mulaw caps don't have a layout property 2013-07-12 12:32:42 +02:00
Arun Raghavan
14e784f9fc pulsesink: Add a getcaps function
This allows us to have more fine-tuned caps in READY or above. However,
this is _really_ inefficient since we create a new stream and query sink
for every getcaps in READY, which on a simple gst-launch line happens
about 35 times. The next step is to cache getcaps results.

https://bugzilla.gnome.org/show_bug.cgi?id=686459
2013-06-10 13:05:24 +05:30
Arun Raghavan
e5fad95306 pulsesink: Get rid of acceptcaps side-effects
The sink info callback should not have side-effects on the GstPulseSink
object since we are sometimes using with a dummy stream in acceptcaps.

https://bugzilla.gnome.org/show_bug.cgi?id=686459
2013-06-06 16:15:48 +05:30
Sebastian Dröge
0726b71ceb ext/sys: Fix some compilation errors caused by circular includes 2012-12-12 17:35:04 +00:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Wim Taymans
ed59c841a4 pulse: fix formats, we can not handle S8 but only U8 2012-03-13 13:25:09 +01:00
Wim Taymans
1584806634 port to new gthread API 2012-01-19 11:33:53 +01:00
Sebastian Dröge
dc049d1f1f pulse: Port to the new multichannel caps 2012-01-05 10:30:30 +01:00
Tim-Philipp Müller
ff74718616 pulse: remove pulseaudiosink helper bin
This is causing us lots of headaches in 0.10 and needs to be done
differently and properly in 0.11. playbin or decodebin should
reconfigure themselves based on reconfigure events, for example.
2011-12-25 22:21:36 +00:00
Tim-Philipp Müller
eeaa9e0bbc pulseaudio: require pulseaudio >= 1.0 2011-11-26 13:54:22 +00:00
Wim Taymans
86e33bc46b audio: update for base class rename 2011-11-11 11:53:45 +01:00
Wim Taymans
87fbd1e784 Merge branch 'master' into 0.11
Conflicts:
	common
	ext/pulse/pulsesink.c
	ext/soup/gstsouphttpclientsink.c
	gst/audioparsers/gstaacparse.c
	gst/audioparsers/gstac3parse.c
	gst/rtp/gstrtph264depay.c
	gst/rtpmanager/gstrtpjitterbuffer.c
	gst/rtpmanager/rtpjitterbuffer.c
	gst/rtsp/gstrtspsrc.c
	sys/ximage/gstximagesrc.c
2011-09-28 12:44:59 +02:00
Arun Raghavan
8ca420f547 pulse: New pulseaudiosink element to handle format changes
This introduces a new bin which wraps around pulsesink and depending on
the formats supported by the sink, plugs in/out a decodebin2 as
required. This allows users to switch sinks on the stream and adapts
accordingly (for example, you could watch a movie in passthrough mode on
your receiver which supports AC3 decode, then plug out and switch to a
non-digital profile to continue uninterrupted on analog output).

The bin is required because doing the same with playbin2/playsink will
require API changes that cannot be made in 0.10. With 0.11/1.0, we
should be able to ask for upstream caps renegotiation to deal with all
this.

https://bugzilla.gnome.org/show_bug.cgi?id=657179
2011-09-19 07:43:04 +05:30
Arun Raghavan
ac7cad431c pulsesink: Add support for compressed formats
This adds support for various compressed formats (AC3, E-AC3, DTS and
MP3) payloaded in IEC 61937 format (used for transmission over S/PDIF,
HDMI and Bluetooth).

The acceptcaps() function allows bins to probe for what formats the sink
being connected to support. This only works after the element is set to
at least READY.

If the underlying sink changes and the format we are streaming is not
available, we emit a message that will allow upstream elements/bins to
block and renegotiate a new format.
2011-07-29 01:25:15 +05:30
René Stadler
ae87731de5 pulsesink: prevent race condition causing ref leak
Since commit 8bfd80, gst_pulseringbuffer_stop doesn't wait for the
deferred call to be run before returning. This causes a race when
READY->NULL is executed shortly after, which stops the mainloop. This
leaks the element reference which is passed as userdata for the callback
(introduced in commit 7cf996, bug #614765).

The correct fix is to wait in READY->NULL for all outstanding calls to
be fired (since libpulse doesn't provide a DestroyNotify for the
userdata). We get rid of the reference passing from 7cf996 altogether,
since finalization from the callback would anyways lead to a deadlock.

Re-fixes bug #614765.
2011-07-05 16:36:17 +02:00
René Stadler
3589cee762 pulsesink: remove unused member variable and misleading log message
Wim changed it in commit 8bfd80 so that pa_defer_ran is not read
anywhere.

The log message used to annotate a mainloop_wait call which is gone.
2011-07-05 16:36:17 +02:00
Stefan Kost
ae8d210fdb pulsesink: move the shared mainloop from class to static var
Just have one static var for the shared mainloop instead of one class variable
and copies in the instance.
2010-09-14 10:10:27 +03:00
Stefan Kost
f62dc6976b pulsesink: rework context sharing
We also need to share the main-loop threads as this owns the context. Thus have
a class wide main-loop thread. From this we create a context per client-name.
Instead of always looking up the context, we keep this with the instance. The
reverse mapping is only needed in pulse singal handlers. This saves a lot of
locking. Also one signal handler becomes simpler as ther eis only one mainloop
to notify.

Now valgind happy - no leaks, no bad reads/writes.

This reverts major parts of commit 69a397c32f.

Fixes #628996
2010-09-13 16:59:22 +03:00
Stefan Kost
f604e20499 pulse: allow setting stream properties
Add a "properties" property to the elements to allow setting extra stream
properties.

Fixes #537544
2010-09-07 14:20:21 +03:00
Philippe Normand
7116fff3c5 pulsesink: Add "client" property to set the PA client name
Allows the application to modify the client name used to connect when
connecting to the PulseAudio daemon. Note however that updating the
property after the element reached the READY state will have no
effect until the next NULL->READY transition.

Fixes bug #627174.
2010-09-04 14:52:07 +02:00
Lennart Poettering
d64200f46b pulse: make a few things smaller by making them bitfields 2009-10-17 08:48:21 +02:00
Sebastian Dröge
7fb6ad6d4c pulsesink: Implement mute property 2009-09-11 16:38:03 +02:00
Wim Taymans
75a48e238a pulsesink: whitespace fixes 2009-09-09 16:24:49 +02:00
Olivier Crête
b2e9f0a7c9 pulsesink: Emit stream-status enter message
Emit stream-status messages for the pulse thread.
Don't use our own GCond for signaling but simply use the pulse mainloop
mechanisms for synchronisation.
See #587695
2009-07-14 18:44:21 +02:00
Stefan Kost
b3d66d5e8d pulse: make it work on 0.9.12
First we ignore request to fill the ringbuffer which are less then a segment.
The small request where causing stutter.
Then we disable flushing the stream when running against pa 0.9.12 as this
triggers an assertiong in the sound server and terminates it. It does not happen
with 0.9.10 and 0.9.14.
2009-04-10 21:42:13 +03:00
Wim Taymans
6bc6cafcc6 pulsesink: rewrite pulsesink
Derive from BaseAudioSink and implement our custom ringbuffer that maps to the
internal pulseaudio ringbuffer.
2009-04-09 17:26:20 +02:00
Jan Schmidt
b39d090a49 pulsesink: Track the corked/uncorked state ourselves
Use an instance variable to track whether the stream is corked or not,
instead of using PA API that was only introduced in 0.9.11
2009-03-20 13:27:59 +00:00
Mark Nauwelaerts
7756d37531 pulsesink: Issue property change notification in streaming thread,
rather than PA thread.

pa_threaded_mainloop_lock() (a.o.) and by extension get_property should
not be done from a PA thread, but the latter may occur as a result of a
property change notification.  Fixes #571204 (though current situation
not ideal, e.g. post message rather than signal).
2009-02-13 18:04:41 +01:00
Jan Schmidt
0037635bf2 Rewrite the pulse plugin, conditionally enabling new behaviour with
newer pulseaudio.

Fixes: #567794

* Hook pulsesink's volume property up with the stream volume -- not the
  sink volume in PA.

* Read the device description directly from the sink instead of going
  via the mixer.

* Properly implement _reset() methods for both sink and source to avoid
  deadlocks when shutting down a pipeline.

* Replace all simple pa_threaded_mainloop_wait() by proper loops to
  guarantee that we wait for the right event in case multiple events are
  fired.  While this is not strictly necessary in many cases it
  certainly is more correct and makes me sleep better at night.

* Replace CHECK_DEAD_GOTO macros with proper functions

* Extend the number of supported channels to 32 since that is the actual
  limit in PA.

* Get rid of _dispose() methods since we don't need them.

* Increase the volume property upper limit of the sink to 1000.

* Reset function pointers after we disconnect a stream/context. Better
  fix for bug 556986.

* Reset the state of the element properly if open/prepare fails

* Cork the PA stream when the pipeline is paused. This allows the PA
* daemon to
  close audio device on pause and thus save a bit of power.

* Set PA stream properties based on GST tags such as GST_TAG_TITLE,
  GST_TAG_ARTIST, and so on.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
2009-01-28 20:34:40 +00:00
Jan Schmidt
3e380b488d ext/pulse/pulsesink.*: Use a mutex to protect the current stream pointer, and ignore callbacks for stream objects tha...
Original commit message from CVS:
* ext/pulse/pulsesink.c:
* ext/pulse/pulsesink.h:
Use a mutex to protect the current stream pointer, and ignore
callbacks for stream objects that have been destroyed already.
Fixes problems with unprepare/prepare cycles caused by the input
caps changing, without reintroducing bug #556986.
2009-01-07 20:38:50 +00:00
Sebastian Dröge
37dee77f26 ext/pulse/pulsesink.*: Add "device-name" property to pulsesink too and currently commented out and not working suppor...
Original commit message from CVS:
* ext/pulse/pulsesink.c: (gst_pulsesink_class_init),
(gst_pulsesink_init), (gst_pulsesink_finalize),
(gst_pulsesink_set_volume), (gst_pulsesink_get_volume),
(gst_pulsesink_set_property), (gst_pulsesink_get_property),
(gst_pulsesink_prepare), (gst_pulsesink_change_state):
* ext/pulse/pulsesink.h:
Add "device-name" property to pulsesink too and currently commented
out and not working support for a "volume" property.
2008-08-13 13:57:01 +00:00
Laszlo Pandy
397da5daf0 ext/pulse/: Implement GstPropertyProbe interface on pulsesink for detecting sink devices and on pulsesrc for detectin...
Original commit message from CVS:
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
* ext/pulse/pulsesink.c: (gst_pulsesink_interface_supported),
(gst_pulsesink_implements_interface_init),
(gst_pulsesink_init_interfaces), (gst_pulsesink_init),
(gst_pulsesink_finalize), (gst_pulsesink_set_property),
(gst_pulsesink_get_type):
* ext/pulse/pulsesink.h:
* ext/pulse/pulsesrc.c: (gst_pulsesrc_interface_supported),
(gst_pulsesrc_init_interfaces), (gst_pulsesrc_init),
(gst_pulsesrc_finalize), (gst_pulsesrc_set_property):
* ext/pulse/pulsesrc.h:
Implement GstPropertyProbe interface on pulsesink for detecting
sink devices and on pulsesrc for detecting source devices.
Fixes bugs #547227 and #547217.
2008-08-13 12:01:01 +00:00
Sebastian Dröge
f3b03cd773 Add pulseaudio GStreamer element from gst-pulse. Development will continue here instead of pulseaudio SVN. Fixes bug ...
Original commit message from CVS:
* configure.ac:
* ext/pulse/Makefile.am:
* ext/pulse/plugin.c: (plugin_init):
* ext/pulse/pulsemixer.c: (gst_pulsemixer_interface_supported),
(gst_pulsemixer_implements_interface_init),
(gst_pulsemixer_init_interfaces), (gst_pulsemixer_base_init),
(gst_pulsemixer_class_init), (gst_pulsemixer_init),
(gst_pulsemixer_finalize), (gst_pulsemixer_set_property),
(gst_pulsemixer_get_property), (gst_pulsemixer_change_state):
* ext/pulse/pulsemixer.h:
* ext/pulse/pulsemixerctrl.c:
(gst_pulsemixer_ctrl_context_state_cb),
(gst_pulsemixer_ctrl_sink_info_cb),
(gst_pulsemixer_ctrl_source_info_cb),
(gst_pulsemixer_ctrl_subscribe_cb),
(gst_pulsemixer_ctrl_success_cb), (gst_pulsemixer_ctrl_open),
(gst_pulsemixer_ctrl_close), (gst_pulsemixer_ctrl_new),
(gst_pulsemixer_ctrl_free), (gst_pulsemixer_ctrl_list_tracks),
(gst_pulsemixer_ctrl_timeout_event), (restart_time_event),
(gst_pulsemixer_ctrl_set_volume), (gst_pulsemixer_ctrl_get_volume),
(gst_pulsemixer_ctrl_set_record), (gst_pulsemixer_ctrl_set_mute):
* ext/pulse/pulsemixerctrl.h:
* ext/pulse/pulsemixertrack.c: (gst_pulsemixer_track_class_init),
(gst_pulsemixer_track_init), (gst_pulsemixer_track_new):
* ext/pulse/pulsemixertrack.h:
* ext/pulse/pulseprobe.c: (gst_pulseprobe_context_state_cb),
(gst_pulseprobe_sink_info_cb), (gst_pulseprobe_source_info_cb),
(gst_pulseprobe_invalidate), (gst_pulseprobe_open),
(gst_pulseprobe_enumerate), (gst_pulseprobe_close),
(gst_pulseprobe_new), (gst_pulseprobe_free),
(gst_pulseprobe_get_properties), (gst_pulseprobe_needs_probe),
(gst_pulseprobe_probe_property), (gst_pulseprobe_get_values),
(gst_pulseprobe_set_server):
* ext/pulse/pulseprobe.h:
* ext/pulse/pulsesink.c: (gst_pulsesink_base_init),
(gst_pulsesink_class_init), (gst_pulsesink_init),
(gst_pulsesink_destroy_stream), (gst_pulsesink_destroy_context),
(gst_pulsesink_finalize), (gst_pulsesink_dispose),
(gst_pulsesink_set_property), (gst_pulsesink_get_property),
(gst_pulsesink_context_state_cb), (gst_pulsesink_stream_state_cb),
(gst_pulsesink_stream_request_cb),
(gst_pulsesink_stream_latency_update_cb), (gst_pulsesink_open),
(gst_pulsesink_close), (gst_pulsesink_prepare),
(gst_pulsesink_unprepare), (gst_pulsesink_write),
(gst_pulsesink_delay), (gst_pulsesink_success_cb),
(gst_pulsesink_reset), (gst_pulsesink_change_title),
(gst_pulsesink_event), (gst_pulsesink_get_type):
* ext/pulse/pulsesink.h:
* ext/pulse/pulsesrc.c: (gst_pulsesrc_interface_supported),
(gst_pulsesrc_implements_interface_init),
(gst_pulsesrc_init_interfaces), (gst_pulsesrc_base_init),
(gst_pulsesrc_class_init), (gst_pulsesrc_init),
(gst_pulsesrc_destroy_stream), (gst_pulsesrc_destroy_context),
(gst_pulsesrc_finalize), (gst_pulsesrc_dispose),
(gst_pulsesrc_set_property), (gst_pulsesrc_get_property),
(gst_pulsesrc_context_state_cb), (gst_pulsesrc_stream_state_cb),
(gst_pulsesrc_stream_request_cb), (gst_pulsesrc_open),
(gst_pulsesrc_close), (gst_pulsesrc_prepare),
(gst_pulsesrc_unprepare), (gst_pulsesrc_read),
(gst_pulsesrc_delay), (gst_pulsesrc_change_state),
(gst_pulsesrc_get_type):
* ext/pulse/pulsesrc.h:
* ext/pulse/pulseutil.c: (gst_pulse_fill_sample_spec),
(gst_pulse_client_name), (gst_pulse_gst_to_channel_map):
* ext/pulse/pulseutil.h:
Add pulseaudio GStreamer element from gst-pulse. Development will
continue here instead of pulseaudio SVN. Fixes bug #400679.
Only changes over gst-pulse SVN are added copyright to the top of
files and coding style changes.
2008-06-10 06:45:33 +00:00