• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***
2   This file is part of PulseAudio.
3 
4   Copyright 2019 Pali Rohár <pali.rohar@gmail.com>
5 
6   PulseAudio is free software; you can redistribute it and/or modify
7   it under the terms of the GNU Lesser General Public License as
8   published by the Free Software Foundation; either version 2.1 of the
9   License, or (at your option) any later version.
10 
11   PulseAudio is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   General Public License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public
17   License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
18 ***/
19 
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 
24 #include <pulsecore/core.h>
25 #include <pulsecore/core-util.h>
26 
27 #include "a2dp-codec-util.h"
28 
29 extern const pa_a2dp_codec pa_a2dp_codec_sbc;
30 
31 /* This is list of supported codecs. Their order is important.
32  * Codec with higher index has higher priority. */
33 const pa_a2dp_codec *pa_a2dp_codecs[] = {
34     &pa_a2dp_codec_sbc,
35 };
36 
pa_bluetooth_a2dp_codec_count(void)37 unsigned int pa_bluetooth_a2dp_codec_count(void) {
38     return PA_ELEMENTSOF(pa_a2dp_codecs);
39 }
40 
pa_bluetooth_a2dp_codec_iter(unsigned int i)41 const pa_a2dp_codec *pa_bluetooth_a2dp_codec_iter(unsigned int i) {
42     pa_assert(i < pa_bluetooth_a2dp_codec_count());
43     return pa_a2dp_codecs[i];
44 }
45 
pa_bluetooth_get_a2dp_codec(const char * name)46 const pa_a2dp_codec *pa_bluetooth_get_a2dp_codec(const char *name) {
47     unsigned int i;
48     unsigned int count = pa_bluetooth_a2dp_codec_count();
49 
50     for (i = 0; i < count; i++) {
51         if (pa_streq(pa_a2dp_codecs[i]->name, name))
52             return pa_a2dp_codecs[i];
53     }
54 
55     return NULL;
56 }
57