Commit graph

48 commits

Author SHA1 Message Date
David Henningsson
5c545ba38b card: Update preferred_profile for ports when profile changes
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:25 +02:00
David Henningsson
b9818b016f card: Add variables for splitting up a profile
It can be useful for routing modules to know a profile's input
and output parts, in order to e g change output profile
while keeping the input profile unchanged.

For now filling in these fields is optional and a routing module
must be able to handle NULL in these fields.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-11-22 04:59:19 +02:00
David Henningsson
336a2cc6f0 card: Use pa_xmalloc0 when creating card profiles
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-10-16 22:05:55 +03:00
David Henningsson
586ea6fcba card: Use pa_xnew0 when creating a card
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-09-28 14:37:49 +02:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
Pete Beardmore
fe6e41d7d2 alsa: Use card description in default sink/source prefix when available
When given an explicit device.description in card_properties, prefer
this information over other default prefixes (e.g. 'Built-in Audio')
when constructing sink/source descriptions.

For example, if I manually configure the card description to be
"FooBar", I then expect that the sinks and created by the card also
have "FooBar" in their description instead of generic "Built-in
Audio".
2014-03-14 16:16:46 +02:00
Tanu Kaskinen
c00ba036dc card: Move pa_card_add_profile() implementation to a more logical place
The old place was in the middle of pa_card_new_data functions, which
made no sense.
2013-12-05 19:00:11 +02:00
Tanu Kaskinen
ce304d6208 Pass the profile object instead of the profile name to pa_card_set_profile()
When setting attribute foo, or in this case the card profile, in my
opinion the thing passed to the set_foo() function should be of the
type of foo, not a string identifier that can be used to search for
the actual foo in set_foo().

This is mostly a question of taste, but there's at least some small
benefit from passing the actual object: often the profile object is
already available when calling pa_card_set_profile(), so passing the
card name would cause unnecessary searching when pa_card_set_profile()
needs to look up the profile from the hashmap.
2013-11-29 07:25:13 +02:00
Colin Guthrie
84af39f289 card: Ensure we still pick a profile even if it's unavailable.
f434087e42 introduced the potential to not select a card profile if
all the profiles were marked as unavailable.

While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.
2013-11-22 11:30:33 +02:00
Luiz Augusto von Dentz
f434087e42 card: Only set active_profile with available profile
When a card is being created and no profile has been assigned
pa_card_new will attempt to select one from the list but it does that
without checking the available flag which can lead to select profiles
not available.
2013-11-05 21:33:04 +02:00
Arun Raghavan
6825df8cec hashmap: Add the ability to free keys
Since the hashmap stores a pointer to the key provided at pa_hashmap_put()
time, it make sense to allow the hashmap to be given ownership of the key and
have it free it at pa_hashmap_remove/free time.

To do this cleanly, we now provide the key and value free functions at hashmap
creation time with a pa_hashmap_new_full. With this, we do away with the free
function that was provided at remove/free time for freeing the value.
2013-09-17 18:01:22 +05:30
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Mikel Astiz
3d65e9c49e Revert "card: Support adding ports dynamically"
This reverts commit a9c3f2fb0f.

It has been recently agreed that ports should somehow have some physical
meaning, leading to the port merge in module-bluetooth-device.

With this assumption in mind, it is very unlikely that a card would
add or remove ports dynamically. Therefore, the core can be simplified
by removing the support for this.

The revert affects the code added to module-card-restore in commit
a1a0ad1af2, which can now be partially
removed.

Conflicts:
	src/pulsecore/card.c
	src/pulsecore/core.h
2013-03-27 08:43:02 +02:00
Mikel Astiz
a40d83a472 card: Set initial profile availability state
Commit afd33da56a introduces this new
flag but the default initial value is missing, considering that
pa_xmalloc is used to allocate the memory.
2013-02-19 19:31:54 +02:00
Mikel Astiz
afd33da56a card: Add card profile availability
Some cards are capable to announce if a specific profile is available or
not, effectively predicting whether a profile switch would fail or would
likely succeed. This can for example be useful for a UI that would gray
out any unavailable profile.

In addition, this information can be useful for internal modules
implementing automatic profile-switching policies, such as
module-switch-on-port-available or module-bluetooth-policy.

In particular, this information is essential when a port is associated
to multiple card profiles and therefore the port availability flag does
not provide enough information. The port "bluetooth-output" falls into
this category, for example, since it doesn't distinguish HSP/HFP from
A2DP.
2013-02-18 17:36:17 +02:00
Tanu Kaskinen
061878b5a4 idxset: Use pa_free_cb_t instead of pa_free2_cb_t
There were no users for the userdata pointer.
2013-02-16 01:15:27 +02:00
Tanu Kaskinen
43e7868008 device-port: Remove pa_device_port_hashmap_free() 2013-02-16 01:13:57 +02:00
Tanu Kaskinen
8872c238ba hashmap: Use pa_free_cb_t instead of pa_free2_cb_t
The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
2013-02-16 01:12:21 +02:00
Tanu Kaskinen
dd6c8ae38f card: Remove some unnecessary checks. 2013-01-22 08:54:57 +02:00
poljar (Damir Jelić)
9d6eb21c7e device-port: Add a card pointer to the ports.
This way we can directly access the card that owns the port instead of
iterating over all cards.
2013-01-20 09:27:05 +02:00
Tanu Kaskinen
43454bc48c card: Store a pa_card pointer in pa_card_profile. 2012-10-25 16:47:53 +03:00
Mikel Astiz
a9c3f2fb0f card: Support adding ports dynamically
Card profiles -specially the ones registered with pa_card_add_profile()-
might need to create new ports during the lifetime of the card.
2012-10-25 13:00:04 +03:00
Mikel Astiz
3c9b42d2bc card: Support adding profiles dynamically
Some cards might need to add profiles during their lifetime, that is,
after the card has been created.
2012-10-25 12:58:29 +03:00
Tanu Kaskinen
12af302ac7 card: Ensure that there's always at least one profile.
In practice there is always at least one profile, and I
don't think there will ever be cards without profiles.
Therefore, I added assertions to pa_card_new() stating that
the card new data must always contain at least one profile.
Now a lot of code can be simplified, because it's guaranteed
that the profiles hashmap and the active_profile field are
always non-NULL.
2012-06-29 14:24:43 +03:00
Tanu Kaskinen
21c6c70438 card: Don't crash if someone gives NULL name to pa_card_set_profile().
In my opinion, pa_card_set_profile() should assert that name
is not NULL, and it would be the job of the client interface
to filter out NULLs from the client input, but this is done
this way also when setting sink and source ports, so for
consistency I'll do this this way for now.
2012-06-29 14:24:43 +03:00
Harsh Prateek Bora
13c7a55599 pulsecore: Use PA_IDXSET_FOREACH wherever applicable.
Signed-off-by: Harsh Prateek Bora <harsh.bora@linaro.org>
2012-05-31 14:12:36 +02:00
David Henningsson
0dced7f275 Cards now has ports directly, and device port has list of profiles
This forms the base for being able to expose all ports of all
profiles (even inactive ones) to clients.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-11-26 16:46:42 +02:00
Colin Guthrie
3153b60a62 core: Add a new hook PA_CORE_HOOK_CARD_PROFILE_CHANGED
This will allow modules to know when a card profile has changed
and take appropriate action. This might prove useful when developing
UCM so that the appropriate verb can be set.
2011-02-25 11:28:01 +00:00
Lennart Poettering
4f44fe86fb card: make sure to always hand failure code back in some calls 2009-06-17 03:15:56 +02:00
Lennart Poettering
325c01bdbc card: some modernizations 2009-06-17 03:15:36 +02:00
Lennart Poettering
f13bbd576f prop: introduce new PA_PROP_DEVICE_INTENDED_ROLES property 2009-06-08 16:58:45 +02:00
Lennart Poettering
00797b8b6e core: add a suspend cause flags field 2009-06-05 19:05:07 +02:00
Lennart Poettering
3813034cef add missing initialization 2009-03-25 23:49:26 +01:00
Lennart Poettering
08154554b0 only store card profile if flagged for that 2009-03-23 19:31:36 +01:00
Colin Guthrie
86dee05aec Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
Lennart Poettering
671b927955 add logic for initializing a useful icon name 2009-03-01 21:38:27 +01:00
Lennart Poettering
87e134277d don't claim that profile changes are always successful 2009-02-12 22:09:17 +01:00
Lennart Poettering
36362f624f add new function pa_card_suspend() 2009-01-22 00:17:11 +01:00
Lennart Poettering
0f7954a9f5 don't include full path in driver name. 2009-01-22 00:15:19 +01:00
Lennart Poettering
9661cd0444 make pa_card_new_data::active_profile a string 2009-01-21 02:46:36 +01:00
Lennart Poettering
cba4c6b9eb when changing profiles do the actual assignment in the generic implementation 2009-01-21 01:59:15 +01:00
Lennart Poettering
1d0bd6e5b7 remove bogus pa_core_check_idle() call 2009-01-21 01:55:26 +01:00
Lennart Poettering
7368a6e6be add priority logic to find best default profile 2009-01-20 20:35:18 +01:00
Lennart Poettering
7aa7a7b6ac fix destruction when no profiles are defined 2009-01-20 03:24:40 +01:00
Lennart Poettering
c06e43d7ff actually create pa_card object in module-alsa-card 2009-01-17 02:03:35 +01:00
Lennart Poettering
33c22b0102 rename card config to card profile 2009-01-15 23:44:46 +01:00
Lennart Poettering
344c934edb maintain a list of sink inputs/source outputs as part of the pa_client object 2009-01-15 18:38:20 +01:00
Lennart Poettering
b6deb0cc4c add new pa_card object as a way to logically combine multiple sinks and sources 2009-01-15 18:29:16 +01:00