bluetooth: Check support for encoding and decoding separately

As suggested in [1]:

This way it is possible for a codec to have both the encoding and
decoding part optional, instead of getting both or nothing (where PA
theoretically supports both).

In addition this cleans up code that was previously checking the
existence of a function pointer, or nothing at all (switch_codec).

[1]: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440#note_768146

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/479>
This commit is contained in:
Marijn Suijten 2021-01-19 23:20:07 +01:00
parent 8816b6b05b
commit 519052e77e
6 changed files with 37 additions and 38 deletions

View file

@ -33,9 +33,12 @@
#include "a2dp-codec-gst.h"
#include "rtp.h"
static bool can_be_supported(void) {
static bool can_be_supported(bool for_encoding) {
GstElementFactory *element_factory;
if (!for_encoding)
return false;
element_factory = gst_element_factory_find("ldacenc");
if (element_factory == NULL) {
pa_log_info("LDAC encoder not found");