-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPalDefs.h
1491 lines (1339 loc) · 64 KB
/
PalDefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2022, 2024, Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
/** \file pal_defs.h
* \brief struture, enum constant defintions of the
* PAL(Platform Audio Layer).
*
* This file contains macros, constants, or global variables
* exposed to the client of PAL(Platform Audio Layer).
*/
#ifndef PAL_DEFS_H
#define PAL_DEFS_H
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef __cplusplus
#include <map>
#include <string>
extern "C" {
#endif
#define MIXER_PATH_MAX_LENGTH 100
#define PAL_MAX_CHANNELS_SUPPORTED 64
#define MAX_KEYWORD_SUPPORTED 8
/** Audio stream handle */
typedef uint64_t pal_stream_handle_t;
/** Sound Trigger handle */
typedef uint64_t pal_st_handle_t;
/** PAL Audio format enumeration */
typedef enum {
PAL_AUDIO_FMT_DEFAULT_PCM = 0x1, /**< PCM*/
PAL_AUDIO_FMT_PCM_S16_LE = PAL_AUDIO_FMT_DEFAULT_PCM, /**< 16 bit little endian PCM*/
PAL_AUDIO_FMT_DEFAULT_COMPRESSED = 0x2, /**< Default Compressed*/
PAL_AUDIO_FMT_MP3 = PAL_AUDIO_FMT_DEFAULT_COMPRESSED,
PAL_AUDIO_FMT_AAC = 0x3,
PAL_AUDIO_FMT_AAC_ADTS = 0x4,
PAL_AUDIO_FMT_AAC_ADIF = 0x5,
PAL_AUDIO_FMT_AAC_LATM = 0x6,
PAL_AUDIO_FMT_WMA_STD = 0x7,
PAL_AUDIO_FMT_ALAC = 0x8,
PAL_AUDIO_FMT_APE = 0x9,
PAL_AUDIO_FMT_WMA_PRO = 0xA,
PAL_AUDIO_FMT_FLAC = 0xB,
PAL_AUDIO_FMT_FLAC_OGG = 0xC,
PAL_AUDIO_FMT_VORBIS = 0xD,
PAL_AUDIO_FMT_AMR_NB = 0xE,
PAL_AUDIO_FMT_AMR_WB = 0xF,
PAL_AUDIO_FMT_AMR_WB_PLUS = 0x10,
PAL_AUDIO_FMT_EVRC = 0x11,
PAL_AUDIO_FMT_G711 = 0x12,
PAL_AUDIO_FMT_QCELP = 0x13,
PAL_AUDIO_FMT_PCM_S8 = 0x14, /**< 8 Bit PCM*/
PAL_AUDIO_FMT_PCM_S24_3LE = 0x15, /**<24 bit packed little endian PCM*/
PAL_AUDIO_FMT_PCM_S24_LE = 0x16, /**<24bit in 32bit word (LSB aligned) little endian PCM*/
PAL_AUDIO_FMT_PCM_S32_LE = 0x17, /**< 32bit little endian PCM*/
PAL_AUDIO_FMT_NON_PCM = 0xE0000000, /* Internal Constant used for Non PCM format identification */
PAL_AUDIO_FMT_COMPRESSED_RANGE_BEGIN = 0xF0000000, /* Reserved for beginning of compressed codecs */
PAL_AUDIO_FMT_COMPRESSED_EXTENDED_RANGE_BEGIN = 0xF0000F00, /* Reserved for beginning of 3rd party codecs */
PAL_AUDIO_FMT_COMPRESSED_EXTENDED_RANGE_END = 0xF0000FFF, /* Reserved for beginning of 3rd party codecs */
PAL_AUDIO_FMT_COMPRESSED_RANGE_END = PAL_AUDIO_FMT_COMPRESSED_EXTENDED_RANGE_END /* Reserved for beginning of 3rd party codecs */
} pal_audio_fmt_t;
#define PCM_24_BIT_PACKED (0x6u)
#define PCM_32_BIT (0x3u)
#define PCM_16_BIT (0x1u)
#define SAMPLE_RATE_192000 192000
#ifdef __cplusplus
static const std::map<std::string, pal_audio_fmt_t> PalAudioFormatMap
{
{ "PCM", PAL_AUDIO_FMT_PCM_S16_LE},
{ "PCM_S8", PAL_AUDIO_FMT_PCM_S8},
{ "PCM_S16_LE", PAL_AUDIO_FMT_PCM_S16_LE},
{ "PCM_S24_3LE", PAL_AUDIO_FMT_PCM_S24_3LE},
{ "PCM_S24_LE", PAL_AUDIO_FMT_PCM_S24_LE},
{ "PCM_S32_LE", PAL_AUDIO_FMT_PCM_S32_LE},
{ "MP3", PAL_AUDIO_FMT_MP3},
{ "AAC", PAL_AUDIO_FMT_AAC},
{ "AAC_ADTS", PAL_AUDIO_FMT_AAC_ADTS},
{ "AAC_ADIF", PAL_AUDIO_FMT_AAC_ADIF},
{ "AAC_LATM", PAL_AUDIO_FMT_AAC_LATM},
{ "WMA_STD", PAL_AUDIO_FMT_WMA_STD},
{ "ALAC", PAL_AUDIO_FMT_ALAC},
{ "APE", PAL_AUDIO_FMT_APE},
{ "WMA_PRO", PAL_AUDIO_FMT_WMA_PRO},
{ "FLAC", PAL_AUDIO_FMT_FLAC},
{ "FLAC_OGG", PAL_AUDIO_FMT_FLAC_OGG},
{ "VORBIS", PAL_AUDIO_FMT_VORBIS},
{ "AMR_NB", PAL_AUDIO_FMT_AMR_NB},
{ "AMR_WB", PAL_AUDIO_FMT_AMR_WB},
{ "AMR_WB_PLUS", PAL_AUDIO_FMT_AMR_WB_PLUS},
{ "EVRC", PAL_AUDIO_FMT_EVRC},
{ "G711", PAL_AUDIO_FMT_G711},
{ "QCELP", PAL_AUDIO_FMT_QCELP}
};
#endif
struct aac_enc_cfg {
uint16_t aac_enc_mode; /**< AAC encoder mode */
uint16_t aac_fmt_flag; /**< AAC format flag */
};
struct pal_snd_enc_aac {
uint32_t aac_bit_rate;
struct aac_enc_cfg enc_cfg;
};
struct pal_snd_dec_aac {
uint16_t audio_obj_type;
uint16_t pce_bits_size;
};
struct pal_snd_dec_wma {
uint32_t fmt_tag;
uint32_t super_block_align;
uint32_t bits_per_sample;
uint32_t channelmask;
uint32_t encodeopt;
uint32_t encodeopt1;
uint32_t encodeopt2;
uint32_t avg_bit_rate;
};
struct pal_snd_dec_alac {
uint32_t frame_length;
uint8_t compatible_version;
uint8_t bit_depth;
uint8_t pb;
uint8_t mb;
uint8_t kb;
uint8_t num_channels;
uint16_t max_run;
uint32_t max_frame_bytes;
uint32_t avg_bit_rate;
uint32_t sample_rate;
uint32_t channel_layout_tag;
};
struct pal_snd_dec_ape {
uint16_t compatible_version;
uint16_t compression_level;
uint32_t format_flags;
uint32_t blocks_per_frame;
uint32_t final_frame_blocks;
uint32_t total_frames;
uint16_t bits_per_sample;
uint16_t num_channels;
uint32_t sample_rate;
uint32_t seek_table_present;
};
struct pal_snd_dec_flac {
uint16_t sample_size;
uint16_t min_blk_size;
uint16_t max_blk_size;
uint16_t min_frame_size;
uint16_t max_frame_size;
};
struct pal_snd_dec_vorbis {
uint32_t bit_stream_fmt;
};
typedef struct pal_key_value_pair_s {
uint32_t key; /**< key */
uint32_t value; /**< value */
} pal_key_value_pair_t;
typedef struct pal_key_vector_s {
size_t num_tkvs; /**< number of key value pairs */
pal_key_value_pair_t kvp[]; /**< vector of key value pairs */
} pal_key_vector_t;
typedef enum {
PARAM_NONTKV,
PARAM_TKV,
} pal_param_type_t;
typedef struct pal_effect_custom_payload_s {
uint32_t paramId;
uint32_t data[];
} pal_effect_custom_payload_t;
typedef struct effect_pal_payload_s {
pal_param_type_t isTKV; /* payload type: 0->non-tkv 1->tkv*/
uint32_t tag;
uint32_t payloadSize;
uint32_t payload[]; /* TKV uses pal_key_vector_t, while nonTKV uses pal_effect_custom_payload_t */
} effect_pal_payload_t;
/* Type of Modes for Speaker Protection */
typedef enum {
PAL_SP_MODE_DYNAMIC_CAL = 1,
PAL_SP_MODE_FACTORY_TEST,
PAL_SP_MODE_V_VALIDATION,
} pal_spkr_prot_mode;
/* Payload For ID: PAL_PARAM_ID_SP_MODE
* Description : Values for Speaker protection modes
*/
typedef struct pal_spkr_prot_payload {
uint32_t spkrHeatupTime; /* Wait time in mili seconds to heat up the
* speaker before collecting statistics */
uint32_t operationModeRunTime; /* Time period in milli seconds when
* statistics are collected */
pal_spkr_prot_mode operationMode;/* Type of mode for which request is raised */
} pal_spkr_prot_payload;
typedef enum {
GEF_PARAM_READ = 0,
GEF_PARAM_WRITE,
} gef_param_rw_t;
/** Audio parameter data*/
typedef union {
struct pal_snd_dec_aac aac_dec;
struct pal_snd_dec_wma wma_dec;
struct pal_snd_dec_alac alac_dec;
struct pal_snd_dec_ape ape_dec;
struct pal_snd_dec_flac flac_dec;
struct pal_snd_dec_vorbis vorbis_dec;
} pal_snd_dec_t;
/** Audio encoder parameter data*/
typedef union {
struct pal_snd_enc_aac aac_enc;
} pal_snd_enc_t;
/** Audio parameter data*/
typedef struct pal_param_payload_s {
uint32_t payload_size;
uint8_t payload[];
} pal_param_payload;
typedef struct gef_payload_s {
pal_key_vector_t *graph;
bool persist;
effect_pal_payload_t data;
} gef_payload_t;
/** Audio channel map enumeration*/
typedef enum {
PAL_CHMAP_CHANNEL_FL = 1, /**< Front right channel. */
PAL_CHMAP_CHANNEL_FR = 2, /**< Front center channel. */
PAL_CHMAP_CHANNEL_C = 3, /**< Left surround channel. */
PAL_CHMAP_CHANNEL_LS = 4, /** Right surround channel. */
PAL_CHMAP_CHANNEL_RS = 5, /** Low frequency effect channel. */
PAL_CHMAP_CHANNEL_LFE = 6, /** Center surround channel; */
PAL_CHMAP_CHANNEL_RC = 7, /**< rear center channel. */
PAL_CHMAP_CHANNEL_CB = PAL_CHMAP_CHANNEL_RC, /**< center back channel. */
PAL_CHMAP_CHANNEL_LB = 8, /**< rear left channel. */
PAL_CHMAP_CHANNEL_RB = 9, /**< rear right channel. */
PAL_CHMAP_CHANNEL_TS = 10, /**< Top surround channel. */
PAL_CHMAP_CHANNEL_CVH = 11, /**< Center vertical height channel.*/
PAL_CHMAP_CHANNEL_TFC = PAL_CHMAP_CHANNEL_CVH, /**< Top front center channel. */
PAL_CHMAP_CHANNEL_MS = 12, /**< Mono surround channel. */
PAL_CHMAP_CHANNEL_FLC = 13, /**< Front left of center channel. */
PAL_CHMAP_CHANNEL_FRC = 14, /**< Front right of center channel. */
PAL_CHMAP_CHANNEL_RLC = 15, /**< Rear left of center channel. */
PAL_CHMAP_CHANNEL_RRC = 16, /**< Rear right of center channel. */
PAL_CHMAP_CHANNEL_LFE2 = 17, /**< Secondary low frequency effect channel. */
PAL_CHMAP_CHANNEL_SL = 18, /**< Side left channel. */
PAL_CHMAP_CHANNEL_SR = 19, /**< Side right channel. */
PAL_CHMAP_CHANNEL_TFL = 20, /**< Top front left channel. */
PAL_CHMAP_CHANNEL_LVH = PAL_CHMAP_CHANNEL_TFL, /**< Right vertical height channel */
PAL_CHMAP_CHANNEL_TFR = 21, /**< Top front right channel. */
PAL_CHMAP_CHANNEL_RVH = PAL_CHMAP_CHANNEL_TFR, /**< Right vertical height channel. */
PAL_CHMAP_CHANNEL_TC = 22, /**< Top center channel. */
PAL_CHMAP_CHANNEL_TBL = 23, /**< Top back left channel. */
PAL_CHMAP_CHANNEL_TBR = 24, /**< Top back right channel. */
PAL_CHMAP_CHANNEL_TSL = 25, /**< Top side left channel. */
PAL_CHMAP_CHANNEL_TSR = 26, /**< Top side right channel. */
PAL_CHMAP_CHANNEL_TBC = 27, /**< Top back center channel. */
PAL_CHMAP_CHANNEL_BFC = 28, /**< Bottom front center channel. */
PAL_CHMAP_CHANNEL_BFL = 29, /**< Bottom front left channel. */
PAL_CHMAP_CHANNEL_BFR = 30, /**< Bottom front right channel. */
PAL_CHMAP_CHANNEL_LW = 31, /**< Left wide channel. */
PAL_CHMAP_CHANNEL_RW = 32, /**< Right wide channel. */
PAL_CHMAP_CHANNEL_LSD = 33, /**< Left side direct channel. */
PAL_CHMAP_CHANNEL_RSD = 34, /**< Left side direct channel. */
} pal_channel_map;
/** Audio channel info data structure */
struct pal_channel_info {
uint16_t channels; /**< number of channels*/
uint8_t ch_map[PAL_MAX_CHANNELS_SUPPORTED]; /**< ch_map value per channel. */
};
/** Audio stream direction enumeration */
typedef enum {
PAL_AUDIO_OUTPUT = 0x1, /**< playback usecases*/
PAL_AUDIO_INPUT = 0x2, /**< capture/voice activation usecases*/
PAL_AUDIO_INPUT_OUTPUT = 0x3, /**< transcode usecases*/
} pal_stream_direction_t;
/** Audio Voip TX Effect enumeration */
typedef enum {
PAL_AUDIO_EFFECT_NONE = 0x0, /**< No audio effect ie., EC_OFF_NS_OFF*/
PAL_AUDIO_EFFECT_EC = 0x1, /**< Echo Cancellation ie., EC_ON_NS_OFF*/
PAL_AUDIO_EFFECT_NS = 0x2, /**< Noise Suppression ie., NS_ON_EC_OFF*/
PAL_AUDIO_EFFECT_ECNS = 0x3, /**< EC + NS*/
} pal_audio_effect_t;
/** Audio stream types */
typedef enum {
PAL_STREAM_LOW_LATENCY = 1, /**< :low latency, higher power*/
PAL_STREAM_DEEP_BUFFER = 2, /**< :low power, higher latency*/
PAL_STREAM_COMPRESSED = 3, /**< :compresssed audio*/
PAL_STREAM_VOIP = 4, /**< :pcm voip audio*/
PAL_STREAM_VOIP_RX = 5, /**< :pcm voip audio downlink*/
PAL_STREAM_VOIP_TX = 6, /**< :pcm voip audio uplink*/
PAL_STREAM_VOICE_CALL_MUSIC = 7, /**< :incall music */
PAL_STREAM_GENERIC = 8, /**< :generic playback audio*/
PAL_STREAM_RAW = 9, /**< pcm no post processing*/
PAL_STREAM_VOICE_RECOGNITION = 10, /**< voice recognition*/
PAL_STREAM_VOICE_CALL_RECORD = 11, /**< incall record */
PAL_STREAM_VOICE_CALL_TX = 12, /**< incall record, uplink */
PAL_STREAM_VOICE_CALL_RX_TX = 13, /**< incall record, uplink & Downlink */
PAL_STREAM_VOICE_CALL = 14, /**< voice call */
PAL_STREAM_LOOPBACK = 15, /**< loopback */
PAL_STREAM_TRANSCODE = 16, /**< audio transcode */
PAL_STREAM_VOICE_UI = 17, /**< voice ui */
PAL_STREAM_PCM_OFFLOAD = 18, /**< pcm offload audio */
PAL_STREAM_ULTRA_LOW_LATENCY = 19, /**< pcm ULL audio */
PAL_STREAM_PROXY = 20, /**< pcm proxy audio */
PAL_STREAM_NON_TUNNEL = 21, /**< NT Mode session */
PAL_STREAM_HAPTICS = 22, /**< Haptics Stream */
PAL_STREAM_ACD = 23, /**< ACD Stream */
PAL_STREAM_CONTEXT_PROXY = 24, /**< Context Proxy Stream */
PAL_STREAM_SENSOR_PCM_DATA = 25, /**< Sensor Pcm Data Stream */
PAL_STREAM_ULTRASOUND = 26, /**< Ultrasound Proximity detection */
PAL_STREAM_MAX, /**< max stream types - add new ones above */
} pal_stream_type_t;
/** Audio devices available for enabling streams */
typedef enum {
//OUTPUT DEVICES
PAL_DEVICE_OUT_MIN = 0,
PAL_DEVICE_NONE = 1, /**< for transcode usecases*/
PAL_DEVICE_OUT_HANDSET = 2,
PAL_DEVICE_OUT_SPEAKER = 3,
PAL_DEVICE_OUT_WIRED_HEADSET = 4,
PAL_DEVICE_OUT_WIRED_HEADPHONE = 5, /**< Wired headphones without mic*/
PAL_DEVICE_OUT_LINE = 6,
PAL_DEVICE_OUT_BLUETOOTH_SCO = 7,
PAL_DEVICE_OUT_BLUETOOTH_A2DP = 8,
PAL_DEVICE_OUT_AUX_DIGITAL = 9,
PAL_DEVICE_OUT_HDMI = 10,
PAL_DEVICE_OUT_USB_DEVICE = 11,
PAL_DEVICE_OUT_USB_HEADSET = 12,
PAL_DEVICE_OUT_SPDIF = 13,
PAL_DEVICE_OUT_FM = 14,
PAL_DEVICE_OUT_AUX_LINE = 15,
PAL_DEVICE_OUT_PROXY = 16,
PAL_DEVICE_OUT_AUX_DIGITAL_1 = 17,
PAL_DEVICE_OUT_HEARING_AID = 18,
PAL_DEVICE_OUT_HAPTICS_DEVICE = 19,
PAL_DEVICE_OUT_ULTRASOUND = 20,
// Add new OUT devices here, increment MAX and MIN below when you do so
PAL_DEVICE_OUT_MAX = 21,
//INPUT DEVICES
PAL_DEVICE_IN_MIN = PAL_DEVICE_OUT_MAX,
PAL_DEVICE_IN_HANDSET_MIC = PAL_DEVICE_IN_MIN +1,
PAL_DEVICE_IN_SPEAKER_MIC = PAL_DEVICE_IN_MIN + 2,
PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET = PAL_DEVICE_IN_MIN + 3,
PAL_DEVICE_IN_WIRED_HEADSET = PAL_DEVICE_IN_MIN + 4,
PAL_DEVICE_IN_AUX_DIGITAL = PAL_DEVICE_IN_MIN + 5,
PAL_DEVICE_IN_HDMI = PAL_DEVICE_IN_MIN + 6,
PAL_DEVICE_IN_USB_ACCESSORY = PAL_DEVICE_IN_MIN + 7,
PAL_DEVICE_IN_USB_DEVICE = PAL_DEVICE_IN_MIN + 8,
PAL_DEVICE_IN_USB_HEADSET = PAL_DEVICE_IN_MIN + 9,
PAL_DEVICE_IN_FM_TUNER = PAL_DEVICE_IN_MIN + 10,
PAL_DEVICE_IN_LINE = PAL_DEVICE_IN_MIN + 11,
PAL_DEVICE_IN_SPDIF = PAL_DEVICE_IN_MIN + 12,
PAL_DEVICE_IN_PROXY = PAL_DEVICE_IN_MIN + 13,
PAL_DEVICE_IN_HANDSET_VA_MIC = PAL_DEVICE_IN_MIN + 14,
PAL_DEVICE_IN_BLUETOOTH_A2DP = PAL_DEVICE_IN_MIN + 15,
PAL_DEVICE_IN_HEADSET_VA_MIC = PAL_DEVICE_IN_MIN + 16,
PAL_DEVICE_IN_VI_FEEDBACK = PAL_DEVICE_IN_MIN + 17,
PAL_DEVICE_IN_TELEPHONY_RX = PAL_DEVICE_IN_MIN + 18,
PAL_DEVICE_IN_ULTRASOUND_MIC = PAL_DEVICE_IN_MIN +19,
PAL_DEVICE_IN_EXT_EC_REF = PAL_DEVICE_IN_MIN + 20,
PAL_DEVICE_IN_ECHO_REF = PAL_DEVICE_IN_MIN + 21,
// Add new IN devices here, increment MAX and MIN below when you do so
PAL_DEVICE_IN_MAX = PAL_DEVICE_IN_MIN + 22,
} pal_device_id_t;
typedef enum {
VOICEMMODE1 = 0x11C05000,
VOICEMMODE2 = 0x11DC5000,
VOICELBMMODE1 = 0x12006000,
VOICELBMMODE2 = 0x121C6000,
} pal_VSID_t;
typedef enum {
PAL_STREAM_LOOPBACK_PCM,
PAL_STREAM_LOOPBACK_HFP_RX,
PAL_STREAM_LOOPBACK_HFP_TX,
PAL_STREAM_LOOPBACK_COMPRESS,
PAL_STREAM_LOOPBACK_FM,
PAL_STREAM_LOOPBACK_KARAOKE,
} pal_stream_loopback_type_t;
typedef enum {
PAL_STREAM_PROXY_TX_VISUALIZER,
PAL_STREAM_PROXY_TX_WFD,
PAL_STREAM_PROXY_TX_TELEPHONY_RX,
} pal_stream_proxy_tx_type_t;
#ifdef __cplusplus
static const std::map<std::string, pal_device_id_t> deviceIdLUT {
{std::string{ "PAL_DEVICE_OUT_MIN" }, PAL_DEVICE_OUT_MIN},
{std::string{ "PAL_DEVICE_NONE" }, PAL_DEVICE_NONE},
{std::string{ "PAL_DEVICE_OUT_HANDSET" }, PAL_DEVICE_OUT_HANDSET},
{std::string{ "PAL_DEVICE_OUT_SPEAKER" }, PAL_DEVICE_OUT_SPEAKER},
{std::string{ "PAL_DEVICE_OUT_WIRED_HEADSET" }, PAL_DEVICE_OUT_WIRED_HEADSET},
{std::string{ "PAL_DEVICE_OUT_WIRED_HEADPHONE" }, PAL_DEVICE_OUT_WIRED_HEADPHONE},
{std::string{ "PAL_DEVICE_OUT_LINE" }, PAL_DEVICE_OUT_LINE},
{std::string{ "PAL_DEVICE_OUT_BLUETOOTH_SCO" }, PAL_DEVICE_OUT_BLUETOOTH_SCO},
{std::string{ "PAL_DEVICE_OUT_BLUETOOTH_A2DP" }, PAL_DEVICE_OUT_BLUETOOTH_A2DP},
{std::string{ "PAL_DEVICE_OUT_AUX_DIGITAL" }, PAL_DEVICE_OUT_AUX_DIGITAL},
{std::string{ "PAL_DEVICE_OUT_HDMI" }, PAL_DEVICE_OUT_HDMI},
{std::string{ "PAL_DEVICE_OUT_USB_DEVICE" }, PAL_DEVICE_OUT_USB_DEVICE},
{std::string{ "PAL_DEVICE_OUT_USB_HEADSET" }, PAL_DEVICE_OUT_USB_HEADSET},
{std::string{ "PAL_DEVICE_OUT_SPDIF" }, PAL_DEVICE_OUT_SPDIF},
{std::string{ "PAL_DEVICE_OUT_FM" }, PAL_DEVICE_OUT_FM},
{std::string{ "PAL_DEVICE_OUT_AUX_LINE" }, PAL_DEVICE_OUT_AUX_LINE},
{std::string{ "PAL_DEVICE_OUT_PROXY" }, PAL_DEVICE_OUT_PROXY},
{std::string{ "PAL_DEVICE_OUT_AUX_DIGITAL_1" }, PAL_DEVICE_OUT_AUX_DIGITAL_1},
{std::string{ "PAL_DEVICE_OUT_HEARING_AID" }, PAL_DEVICE_OUT_HEARING_AID},
{std::string{ "PAL_DEVICE_OUT_HAPTICS_DEVICE" }, PAL_DEVICE_OUT_HAPTICS_DEVICE},
{std::string{ "PAL_DEVICE_OUT_ULTRASOUND" }, PAL_DEVICE_OUT_ULTRASOUND},
{std::string{ "PAL_DEVICE_OUT_MAX" }, PAL_DEVICE_OUT_MAX},
{std::string{ "PAL_DEVICE_IN_HANDSET_MIC" }, PAL_DEVICE_IN_HANDSET_MIC},
{std::string{ "PAL_DEVICE_IN_SPEAKER_MIC" }, PAL_DEVICE_IN_SPEAKER_MIC},
{std::string{ "PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET" }, PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET},
{std::string{ "PAL_DEVICE_IN_WIRED_HEADSET" }, PAL_DEVICE_IN_WIRED_HEADSET},
{std::string{ "PAL_DEVICE_IN_AUX_DIGITAL" }, PAL_DEVICE_IN_AUX_DIGITAL},
{std::string{ "PAL_DEVICE_IN_HDMI" }, PAL_DEVICE_IN_HDMI},
{std::string{ "PAL_DEVICE_IN_USB_ACCESSORY" }, PAL_DEVICE_IN_USB_ACCESSORY},
{std::string{ "PAL_DEVICE_IN_USB_DEVICE" }, PAL_DEVICE_IN_USB_DEVICE},
{std::string{ "PAL_DEVICE_IN_USB_HEADSET" }, PAL_DEVICE_IN_USB_HEADSET},
{std::string{ "PAL_DEVICE_IN_FM_TUNER" }, PAL_DEVICE_IN_FM_TUNER},
{std::string{ "PAL_DEVICE_IN_LINE" }, PAL_DEVICE_IN_LINE},
{std::string{ "PAL_DEVICE_IN_SPDIF" }, PAL_DEVICE_IN_SPDIF},
{std::string{ "PAL_DEVICE_IN_PROXY" }, PAL_DEVICE_IN_PROXY},
{std::string{ "PAL_DEVICE_IN_HANDSET_VA_MIC" }, PAL_DEVICE_IN_HANDSET_VA_MIC},
{std::string{ "PAL_DEVICE_IN_BLUETOOTH_A2DP" }, PAL_DEVICE_IN_BLUETOOTH_A2DP},
{std::string{ "PAL_DEVICE_IN_HEADSET_VA_MIC" }, PAL_DEVICE_IN_HEADSET_VA_MIC},
{std::string{ "PAL_DEVICE_IN_VI_FEEDBACK" }, PAL_DEVICE_IN_VI_FEEDBACK},
{std::string{ "PAL_DEVICE_IN_TELEPHONY_RX" }, PAL_DEVICE_IN_TELEPHONY_RX},
{std::string{ "PAL_DEVICE_IN_ULTRASOUND_MIC" }, PAL_DEVICE_IN_ULTRASOUND_MIC},
{std::string{ "PAL_DEVICE_IN_EXT_EC_REF" }, PAL_DEVICE_IN_EXT_EC_REF},
#ifdef EC_REF_CAPTURE_ENABLED
{std::string{ "PAL_DEVICE_IN_ECHO_REF" }, PAL_DEVICE_IN_ECHO_REF},
#endif
};
//reverse mapping
static const std::map<uint32_t, std::string> deviceNameLUT {
{PAL_DEVICE_OUT_MIN, std::string{"PAL_DEVICE_OUT_MIN"}},
{PAL_DEVICE_NONE, std::string{"PAL_DEVICE_NONE"}},
{PAL_DEVICE_OUT_HANDSET, std::string{"PAL_DEVICE_OUT_HANDSET"}},
{PAL_DEVICE_OUT_SPEAKER, std::string{"PAL_DEVICE_OUT_SPEAKER"}},
{PAL_DEVICE_OUT_WIRED_HEADSET, std::string{"PAL_DEVICE_OUT_WIRED_HEADSET"}},
{PAL_DEVICE_OUT_WIRED_HEADPHONE, std::string{"PAL_DEVICE_OUT_WIRED_HEADPHONE"}},
{PAL_DEVICE_OUT_LINE, std::string{"PAL_DEVICE_OUT_LINE"}},
{PAL_DEVICE_OUT_BLUETOOTH_SCO, std::string{"PAL_DEVICE_OUT_BLUETOOTH_SCO"}},
{PAL_DEVICE_OUT_BLUETOOTH_A2DP, std::string{"PAL_DEVICE_OUT_BLUETOOTH_A2DP"}},
{PAL_DEVICE_OUT_AUX_DIGITAL, std::string{"PAL_DEVICE_OUT_AUX_DIGITAL"}},
{PAL_DEVICE_OUT_HDMI, std::string{"PAL_DEVICE_OUT_HDMI"}},
{PAL_DEVICE_OUT_USB_DEVICE, std::string{"PAL_DEVICE_OUT_USB_DEVICE"}},
{PAL_DEVICE_OUT_USB_HEADSET, std::string{"PAL_DEVICE_OUT_USB_HEADSET"}},
{PAL_DEVICE_OUT_SPDIF, std::string{"PAL_DEVICE_OUT_SPDIF"}},
{PAL_DEVICE_OUT_FM, std::string{"PAL_DEVICE_OUT_FM"}},
{PAL_DEVICE_OUT_AUX_LINE, std::string{"PAL_DEVICE_OUT_AUX_LINE"}},
{PAL_DEVICE_OUT_PROXY, std::string{"PAL_DEVICE_OUT_PROXY"}},
{PAL_DEVICE_OUT_AUX_DIGITAL_1, std::string{"PAL_DEVICE_OUT_AUX_DIGITAL_1"}},
{PAL_DEVICE_OUT_HEARING_AID, std::string{"PAL_DEVICE_OUT_HEARING_AID"}},
{PAL_DEVICE_OUT_HAPTICS_DEVICE, std::string{"PAL_DEVICE_OUT_HAPTICS_DEVICE"}},
{PAL_DEVICE_OUT_ULTRASOUND, std::string{"PAL_DEVICE_OUT_ULTRASOUND"}},
{PAL_DEVICE_OUT_MAX, std::string{"PAL_DEVICE_OUT_MAX"}},
{PAL_DEVICE_IN_HANDSET_MIC, std::string{"PAL_DEVICE_IN_HANDSET_MIC"}},
{PAL_DEVICE_IN_SPEAKER_MIC, std::string{"PAL_DEVICE_IN_SPEAKER_MIC"}},
{PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET, std::string{"PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET"}},
{PAL_DEVICE_IN_WIRED_HEADSET, std::string{"PAL_DEVICE_IN_WIRED_HEADSET"}},
{PAL_DEVICE_IN_AUX_DIGITAL, std::string{"PAL_DEVICE_IN_AUX_DIGITAL"}},
{PAL_DEVICE_IN_HDMI, std::string{"PAL_DEVICE_IN_HDMI"}},
{PAL_DEVICE_IN_USB_ACCESSORY, std::string{"PAL_DEVICE_IN_USB_ACCESSORY"}},
{PAL_DEVICE_IN_USB_DEVICE, std::string{"PAL_DEVICE_IN_USB_DEVICE"}},
{PAL_DEVICE_IN_USB_HEADSET, std::string{"PAL_DEVICE_IN_USB_HEADSET"}},
{PAL_DEVICE_IN_FM_TUNER, std::string{"PAL_DEVICE_IN_FM_TUNER"}},
{PAL_DEVICE_IN_LINE, std::string{"PAL_DEVICE_IN_LINE"}},
{PAL_DEVICE_IN_SPDIF, std::string{"PAL_DEVICE_IN_SPDIF"}},
{PAL_DEVICE_IN_PROXY, std::string{"PAL_DEVICE_IN_PROXY"}},
{PAL_DEVICE_IN_HANDSET_VA_MIC, std::string{"PAL_DEVICE_IN_HANDSET_VA_MIC"}},
{PAL_DEVICE_IN_BLUETOOTH_A2DP, std::string{"PAL_DEVICE_IN_BLUETOOTH_A2DP"}},
{PAL_DEVICE_IN_HEADSET_VA_MIC, std::string{"PAL_DEVICE_IN_HEADSET_VA_MIC"}},
{PAL_DEVICE_IN_VI_FEEDBACK, std::string{"PAL_DEVICE_IN_VI_FEEDBACK"}},
{PAL_DEVICE_IN_TELEPHONY_RX, std::string{"PAL_DEVICE_IN_TELEPHONY_RX"}},
{PAL_DEVICE_IN_ULTRASOUND_MIC, std::string{"PAL_DEVICE_IN_ULTRASOUND_MIC"}},
{PAL_DEVICE_IN_EXT_EC_REF, std::string{"PAL_DEVICE_IN_EXT_EC_REF"}},
#ifdef EC_REF_CAPTURE_ENABLED
{PAL_DEVICE_IN_ECHO_REF, std::string{"PAL_DEVICE_IN_ECHO_REF"}},
#endif
};
const std::map<std::string, uint32_t> usecaseIdLUT {
{std::string{ "PAL_STREAM_LOW_LATENCY" }, PAL_STREAM_LOW_LATENCY},
{std::string{ "PAL_STREAM_DEEP_BUFFER" }, PAL_STREAM_DEEP_BUFFER},
{std::string{ "PAL_STREAM_COMPRESSED" }, PAL_STREAM_COMPRESSED},
{std::string{ "PAL_STREAM_VOIP" }, PAL_STREAM_VOIP},
{std::string{ "PAL_STREAM_VOIP_RX" }, PAL_STREAM_VOIP_RX},
{std::string{ "PAL_STREAM_VOIP_TX" }, PAL_STREAM_VOIP_TX},
{std::string{ "PAL_STREAM_VOICE_CALL_MUSIC" }, PAL_STREAM_VOICE_CALL_MUSIC},
{std::string{ "PAL_STREAM_GENERIC" }, PAL_STREAM_GENERIC},
{std::string{ "PAL_STREAM_RAW" }, PAL_STREAM_RAW},
{std::string{ "PAL_STREAM_VOICE_RECOGNITION" }, PAL_STREAM_VOICE_RECOGNITION},
{std::string{ "PAL_STREAM_VOICE_CALL_RECORD" }, PAL_STREAM_VOICE_CALL_RECORD},
{std::string{ "PAL_STREAM_VOICE_CALL_TX" }, PAL_STREAM_VOICE_CALL_TX},
{std::string{ "PAL_STREAM_VOICE_CALL_RX_TX" }, PAL_STREAM_VOICE_CALL_RX_TX},
{std::string{ "PAL_STREAM_VOICE_CALL" }, PAL_STREAM_VOICE_CALL},
{std::string{ "PAL_STREAM_LOOPBACK" }, PAL_STREAM_LOOPBACK},
{std::string{ "PAL_STREAM_TRANSCODE" }, PAL_STREAM_TRANSCODE},
{std::string{ "PAL_STREAM_VOICE_UI" }, PAL_STREAM_VOICE_UI},
{std::string{ "PAL_STREAM_PCM_OFFLOAD" }, PAL_STREAM_PCM_OFFLOAD},
{std::string{ "PAL_STREAM_ULTRA_LOW_LATENCY" }, PAL_STREAM_ULTRA_LOW_LATENCY},
{std::string{ "PAL_STREAM_PROXY" }, PAL_STREAM_PROXY},
{std::string{ "PAL_STREAM_NON_TUNNEL" }, PAL_STREAM_NON_TUNNEL},
{std::string{ "PAL_STREAM_HAPTICS" }, PAL_STREAM_HAPTICS},
{std::string{ "PAL_STREAM_ACD" }, PAL_STREAM_ACD},
{std::string{ "PAL_STREAM_ULTRASOUND" }, PAL_STREAM_ULTRASOUND},
{std::string{ "PAL_STREAM_SENSOR_PCM_DATA" }, PAL_STREAM_SENSOR_PCM_DATA},
};
/* Update the reverse mapping as well when new stream is added */
const std::map<uint32_t, std::string> streamNameLUT {
{PAL_STREAM_LOW_LATENCY, std::string{ "PAL_STREAM_LOW_LATENCY" } },
{PAL_STREAM_DEEP_BUFFER, std::string{ "PAL_STREAM_DEEP_BUFFER" } },
{PAL_STREAM_COMPRESSED, std::string{ "PAL_STREAM_COMPRESSED" } },
{PAL_STREAM_VOIP, std::string{ "PAL_STREAM_VOIP" } },
{PAL_STREAM_VOIP_RX, std::string{ "PAL_STREAM_VOIP_RX" } },
{PAL_STREAM_VOIP_TX, std::string{ "PAL_STREAM_VOIP_TX" } },
{PAL_STREAM_VOICE_CALL_MUSIC, std::string{ "PAL_STREAM_VOICE_CALL_MUSIC" } },
{PAL_STREAM_GENERIC, std::string{ "PAL_STREAM_GENERIC" } },
{PAL_STREAM_RAW, std::string{ "PAL_STREAM_RAW" } },
{PAL_STREAM_VOICE_RECOGNITION, std::string{ "PAL_STREAM_VOICE_RECOGNITION" } },
{PAL_STREAM_VOICE_CALL_RECORD, std::string{ "PAL_STREAM_VOICE_CALL_RECORD" } },
{PAL_STREAM_VOICE_CALL_TX, std::string{ "PAL_STREAM_VOICE_CALL_TX" } },
{PAL_STREAM_VOICE_CALL_RX_TX, std::string{ "PAL_STREAM_VOICE_CALL_RX_TX" } },
{PAL_STREAM_VOICE_CALL, std::string{ "PAL_STREAM_VOICE_CALL" } },
{PAL_STREAM_LOOPBACK, std::string{ "PAL_STREAM_LOOPBACK" } },
{PAL_STREAM_TRANSCODE, std::string{ "PAL_STREAM_TRANSCODE" } },
{PAL_STREAM_VOICE_UI, std::string{ "PAL_STREAM_VOICE_UI" } },
{PAL_STREAM_PCM_OFFLOAD, std::string{ "PAL_STREAM_PCM_OFFLOAD" } },
{PAL_STREAM_ULTRA_LOW_LATENCY, std::string{ "PAL_STREAM_ULTRA_LOW_LATENCY" } },
{PAL_STREAM_PROXY, std::string{ "PAL_STREAM_PROXY" } },
{PAL_STREAM_NON_TUNNEL, std::string{ "PAL_STREAM_NON_TUNNEL" } },
{PAL_STREAM_HAPTICS, std::string{ "PAL_STREAM_HAPTICS" } },
{PAL_STREAM_ACD, std::string{ "PAL_STREAM_ACD" } },
{PAL_STREAM_ULTRASOUND, std::string{ "PAL_STREAM_ULTRASOUND" } },
{PAL_STREAM_SENSOR_PCM_DATA, std::string{ "PAL_STREAM_SENSOR_PCM_DATA" } },
};
const std::map<uint32_t, std::string> vsidLUT {
{VOICEMMODE1, std::string{ "VOICEMMODE1" } },
{VOICEMMODE2, std::string{ "VOICEMMODE2" } },
{VOICELBMMODE1, std::string{ "VOICELBMMODE1" } },
{VOICELBMMODE2, std::string{ "VOICELBMMODE2" } },
};
const std::map<uint32_t, std::string> loopbackLUT {
{PAL_STREAM_LOOPBACK_PCM, std::string{ "PAL_STREAM_LOOPBACK_PCM" } },
{PAL_STREAM_LOOPBACK_HFP_RX, std::string{ "PAL_STREAM_LOOPBACK_HFP_RX" } },
{PAL_STREAM_LOOPBACK_HFP_TX, std::string{ "PAL_STREAM_LOOPBACK_HFP_TX" } },
{PAL_STREAM_LOOPBACK_COMPRESS, std::string{ "PAL_STREAM_LOOPBACK_COMPRESS" } },
{PAL_STREAM_LOOPBACK_FM, std::string{ "PAL_STREAM_LOOPBACK_FM" } },
{PAL_STREAM_LOOPBACK_KARAOKE, std::string{ "PAL_STREAM_LOOPBACK_KARAOKE" }},
};
#endif
/* type of asynchronous write callback events. Mutually exclusive */
typedef enum {
PAL_STREAM_CBK_EVENT_WRITE_READY, /* non blocking write completed */
PAL_STREAM_CBK_EVENT_DRAIN_READY, /* drain completed */
PAL_STREAM_CBK_EVENT_PARTIAL_DRAIN_READY, /* partial drain completed */
PAL_STREAM_CBK_EVENT_READ_DONE, /* stream hit some error, let AF take action */
PAL_STREAM_CBK_EVENT_ERROR, /* stream hit some error, let AF take action */
} pal_stream_callback_event_t;
/* type of global callback events. */
typedef enum {
PAL_SND_CARD_STATE,
} pal_global_callback_event_t;
struct pal_stream_info {
int64_t version; /** version of structure*/
int64_t size; /** size of structure*/
int64_t duration_us; /** duration in microseconds, -1 if unknown */
bool has_video; /** optional, true if stream is tied to a video stream */
bool is_streaming; /** true if streaming, false if local playback */
int32_t loopback_type; /** used only if stream_type is LOOPBACK. One of the */
/** enums defined in enum pal_stream_loopback_type */
int32_t tx_proxy_type; /** enums defined in enum pal_stream_proxy_tx_types */
//pal_audio_attributes_t usage; /** Not sure if we make use of this */
};
typedef enum {
INCALL_RECORD_VOICE_UPLINK = 1,
INCALL_RECORD_VOICE_DOWNLINK,
INCALL_RECORD_VOICE_UPLINK_DOWNLINK,
} pal_incall_record_direction;
struct pal_voice_record_info {
int64_t version; /** version of structure*/
int64_t size; /** size of structure*/
pal_incall_record_direction record_direction; /** use direction enum to indicate content to be record */
};
struct pal_voice_call_info {
uint32_t VSID;
uint32_t tty_mode;
};
typedef enum {
PAL_TTY_OFF = 0,
PAL_TTY_HCO = 1,
PAL_TTY_VCO = 2,
PAL_TTY_FULL = 3,
} pal_tty_t;
typedef union {
struct pal_stream_info opt_stream_info; /* optional */
struct pal_voice_record_info voice_rec_info; /* mandatory */
struct pal_voice_call_info voice_call_info; /* manatory for voice call*/
} pal_stream_info_t;
/** Media configuraiton */
struct pal_media_config {
uint32_t sample_rate; /**< sample rate */
uint32_t bit_width; /**< bit width */
pal_audio_fmt_t aud_fmt_id; /**< audio format id*/
struct pal_channel_info ch_info; /**< channel info */
};
/** Android Media configuraiton */
/* dynamic media config for plugin devices, +1 so that the last entry is always 0 */
#define MAX_SUPPORTED_CHANNEL_MASKS (2 * 8)
#define MAX_SUPPORTED_FORMATS 15
#define MAX_SUPPORTED_SAMPLE_RATES 7
typedef struct dynamic_media_config {
uint32_t sample_rate[MAX_SUPPORTED_SAMPLE_RATES+1]; /**< sample rate */
uint32_t format[MAX_SUPPORTED_FORMATS+1]; /**< format */
uint32_t mask[MAX_SUPPORTED_CHANNEL_MASKS + 1]; /**< channel mask */
bool jack_status; /**< input/output jack status*/
} dynamic_media_config_t;
/** Available stream flags of an audio session*/
typedef enum {
PAL_STREAM_FLAG_TIMESTAMP = 0x1, /**< Enable time stamps associated to audio buffers */
PAL_STREAM_FLAG_NON_BLOCKING = 0x2, /**< Stream IO operations are non blocking */
PAL_STREAM_FLAG_MMAP = 0x4, /**< Stream Mode should be in MMAP*/
PAL_STREAM_FLAG_MMAP_NO_IRQ = 0x8, /**< Stream Mode should be No IRQ */
PAL_STREAM_FLAG_EXTERN_MEM = 0x10, /**< Shared memory buffers allocated by client*/
PAL_STREAM_FLAG_SRCM_INBAND = 0x20, /**< MediaFormat change event inband with data buffers*/
PAL_STREAM_FLAG_EOF = 0x40, /**< MediaFormat change event inband with data buffers*/
} pal_stream_flags_t;
#define PAL_STREAM_FLAG_NON_BLOCKING_MASK 0x2
#define PAL_STREAM_FLAG_MMAP_MASK 0x4
#define PAL_STREAM_FLAG_MMAP_NO_IRQ_MASK 0x8
/**< PAL stream attributes to be specified, used in pal_stream_open cmd */
struct pal_stream_attributes {
pal_stream_type_t type; /**< stream type */
pal_stream_info_t info; /**< stream info */
pal_stream_flags_t flags; /**< stream flags */
pal_stream_direction_t direction; /**< direction of the streams */
struct pal_media_config in_media_config; /**< media config of the input audio samples */
struct pal_media_config out_media_config; /**< media config of the output audio samples */
bool isComboHeadsetActive;
};
/**< Key value pair to identify the topology of a usecase from default */
struct modifier_kv {
uint32_t key;
uint32_t value;
};
/** Metadata flags */
enum {
PAL_META_DATA_FLAGS_NONE = 0,
};
/** metadata flags, can be OR'able */
typedef uint32_t pal_meta_data_flags_t;
typedef struct pal_extern_alloc_buff_info{
int alloc_handle;/**< unique memory handle identifying extern mem allocation */
uint32_t alloc_size; /**< size of external allocation */
uint32_t offset; /**< offset of buffer within extern allocation */
} pal_extern_alloc_buff_info_t;
/** PAL buffer structure used for reading/writing buffers from/to the stream */
struct pal_buffer {
uint8_t *buffer; /**< buffer pointer */
size_t size; /**< number of bytes */
size_t offset; /**< offset in buffer from where valid byte starts */
struct timespec *ts; /**< timestmap */
uint32_t flags; /**< flags */
size_t metadata_size; /**< size of metadata buffer in bytes */
uint8_t *metadata; /**< metadata buffer. Can contain multiple metadata*/
pal_extern_alloc_buff_info_t alloc_info; /**< holds info for extern buff */
};
/** pal_mmap_buffer flags */
enum {
PAL_MMMAP_BUFF_FLAGS_NONE = 0,
/**
* Only set this flag if applications can access the audio buffer memory
* shared with the backend (usually DSP) _without_ security issue.
*
* Setting this flag also implies that Binder will allow passing the shared memory FD
* to applications.
*
* That usually implies that the kernel will prevent any access to the
* memory surrounding the audio buffer as it could lead to a security breach.
*
* For example, a "/dev/snd/" file descriptor generally is not shareable,
* but an "anon_inode:dmabuffer" file descriptor is shareable.
* See also Linux kernel's dma_buf.
*
*/
PAL_MMMAP_BUFF_FLAGS_APP_SHAREABLE = 1,
};
/** pal_mmap_buffer flags, can be OR'able */
typedef uint32_t pal_mmap_buffer_flags_t;
/** PAL buffer structure used for reading/writing buffers from/to the stream */
struct pal_mmap_buffer {
void* buffer; /**< base address of mmap memory buffer,
for use by local proces only */
int32_t fd; /**< fd for mmap memory buffer */
uint32_t buffer_size_frames; /**< total buffer size in frames */
uint32_t burst_size_frames; /**< transfer size granularity in frames */
pal_mmap_buffer_flags_t flags; /**< Attributes describing the buffer. */
};
/**
* Mmap buffer read/write position returned by GetMmapPosition.
* note\ Used by streams opened in mmap mode.
*/
struct pal_mmap_position {
int64_t time_nanoseconds; /**< timestamp in ns, CLOCK_MONOTONIC */
int32_t position_frames; /**< increasing 32 bit frame count reset when stop()
is called */
};
/** channel mask and volume pair */
struct pal_channel_vol_kv {
uint32_t channel_mask; /**< channel mask */
float vol; /**< gain of the channel mask */
};
/** Volume data strucutre defintion used as argument for volume command */
struct pal_volume_data {
uint32_t no_of_volpair; /**< no of volume pairs*/
struct pal_channel_vol_kv volume_pair[]; /**< channel mask and volume pair */
};
struct pal_time_us {
uint32_t value_lsw; /** Lower 32 bits of 64 bit time value in microseconds */
uint32_t value_msw; /** Upper 32 bits of 64 bit time value in microseconds */
};
/** Timestamp strucutre defintion used as argument for
* gettimestamp api */
struct pal_session_time {
struct pal_time_us session_time; /** Value of the current session time in microseconds */
struct pal_time_us absolute_time; /** Value of the absolute time in microseconds */
struct pal_time_us timestamp; /** Value of the last processed time stamp in microseconds */
};
/** EVENT configurations data strucutre defintion used as
* argument for mute command */
//typedef union {
//} pal_event_cfg_t;
/** event id of the event generated*/
typedef uint32_t pal_event_id;
typedef enum {
/** request notification when all accumlated data has be
* drained.*/
PAL_DRAIN,
/** request notification when drain completes shortly before all
* accumlated data of the current track has been played out */
PAL_DRAIN_PARTIAL,
} pal_drain_type_t;
typedef enum {
PAL_PARAM_ID_LOAD_SOUND_MODEL = 0,
PAL_PARAM_ID_RECOGNITION_CONFIG = 1,
PAL_PARAM_ID_ECNS_ON_OFF = 2,
PAL_PARAM_ID_DIRECTION_OF_ARRIVAL = 3,
PAL_PARAM_ID_UIEFFECT = 4,
PAL_PARAM_ID_STOP_BUFFERING = 5,
PAL_PARAM_ID_CODEC_CONFIGURATION = 6,
/* Non-Stream Specific Parameters*/
PAL_PARAM_ID_DEVICE_CONNECTION = 7,
PAL_PARAM_ID_SCREEN_STATE = 8,
PAL_PARAM_ID_CHARGING_STATE = 9,
PAL_PARAM_ID_DEVICE_ROTATION = 10,
PAL_PARAM_ID_BT_SCO = 11,
PAL_PARAM_ID_BT_SCO_WB = 12,
PAL_PARAM_ID_BT_SCO_SWB = 13,
PAL_PARAM_ID_BT_A2DP_RECONFIG = 14,
PAL_PARAM_ID_BT_A2DP_RECONFIG_SUPPORTED = 15,
PAL_PARAM_ID_BT_A2DP_SUSPENDED = 16,
PAL_PARAM_ID_BT_A2DP_TWS_CONFIG = 17,
PAL_PARAM_ID_BT_A2DP_ENCODER_LATENCY = 18,
PAL_PARAM_ID_DEVICE_CAPABILITY = 19,
PAL_PARAM_ID_GET_SOUND_TRIGGER_PROPERTIES = 20,
PAL_PARAM_ID_TTY_MODE = 21,
PAL_PARAM_ID_VOLUME_BOOST = 22,
PAL_PARAM_ID_SLOW_TALK = 23,
PAL_PARAM_ID_SPEAKER_RAS = 24,
PAL_PARAM_ID_SP_MODE = 25,
PAL_PARAM_ID_GAIN_LVL_MAP = 26,
PAL_PARAM_ID_GAIN_LVL_CAL = 27,
PAL_PARAM_ID_GAPLESS_MDATA = 28,
PAL_PARAM_ID_HD_VOICE = 29,
PAL_PARAM_ID_WAKEUP_ENGINE_CONFIG = 30,
PAL_PARAM_ID_WAKEUP_BUFFERING_CONFIG = 31,
PAL_PARAM_ID_WAKEUP_ENGINE_RESET = 32,
PAL_PARAM_ID_WAKEUP_MODULE_VERSION = 33,
PAL_PARAM_ID_WAKEUP_CUSTOM_CONFIG = 34,
PAL_PARAM_ID_UNLOAD_SOUND_MODEL = 35,
PAL_PARAM_ID_MODULE_CONFIG = 36, /*Clients directly configure DSP modules*/
PAL_PARAM_ID_BT_A2DP_LC3_CONFIG = 37,
PAL_PARAM_ID_PROXY_CHANNEL_CONFIG = 38,
PAL_PARAM_ID_CONTEXT_LIST = 39,
PAL_PARAM_ID_HAPTICS_INTENSITY = 40,
PAL_PARAM_ID_HAPTICS_VOLUME = 41,
PAL_PARAM_ID_BT_A2DP_DECODER_LATENCY = 42,
PAL_PARAM_ID_CUSTOM_CONFIGURATION = 43,
PAL_PARAM_ID_KW_TRANSFER_LATENCY = 44,
PAL_PARAM_ID_BT_A2DP_FORCE_SWITCH = 45,
PAL_PARAM_ID_BT_SCO_LC3 = 46,
PAL_PARAM_ID_DEVICE_MUTE = 47,
PAL_PARAM_ID_UPD_REGISTER_FOR_EVENTS = 48,
PAL_PARAM_ID_SP_GET_CAL = 49,
PAL_PARAM_ID_BT_A2DP_CAPTURE_SUSPENDED = 50,
PAL_PARAM_ID_SNDCARD_STATE = 51,
PAL_PARAM_ID_HIFI_PCM_FILTER = 52,
PAL_PARAM_ID_CHARGER_STATE = 53,
PAL_PARAM_ID_BT_SCO_NREC = 54,
PAL_PARAM_ID_VOLUME_USING_SET_PARAM = 55,
PAL_PARAM_ID_UHQA_FLAG = 56,
PAL_PARAM_ID_STREAM_ATTRIBUTES = 57,
PAL_PARAM_ID_SET_UPD_DUTY_CYCLE = 58,
PAL_PARAM_ID_MSPP_LINEAR_GAIN = 59,
PAL_PARAM_ID_SET_SOURCE_METADATA = 60,
PAL_PARAM_ID_SET_SINK_METADATA = 61,
PAL_PARAM_ID_ULTRASOUND_RAMPDOWN = 62,
PAL_PARAM_ID_VOLUME_CTRL_RAMP = 63,
PAL_PARAM_ID_SVA_WAKEUP_MODULE_VERSION = 64,
PAL_PARAM_ID_GAIN_USING_SET_PARAM = 65,
PAL_PARAM_ID_HAPTICS_CNFG = 66,
PAL_PARAM_ID_WAKEUP_ENGINE_PER_MODEL_RESET = 67,
PAL_PARAM_ID_RECONFIG_ENCODER = 68,
PAL_PARAM_ID_VUI_SET_META_DATA = 69,
PAL_PARAM_ID_VUI_GET_META_DATA = 70,
PAL_PARAM_ID_VUI_CAPTURE_META_DATA = 71,
PAL_PARAM_ID_TIMESTRETCH_PARAMS = 72,
PAL_PARAM_ID_LATENCY_MODE = 73,
PAL_PARAM_ID_PROXY_RECORD_SESSION = 74,
PAL_PARAM_ID_MIC_OCCLUSION_INFO = 75,
PAL_PARAM_ID_ULTRASOUND_SET_GAIN = 76,
} pal_param_id_type_t;
/** HDMI/DP */
// START: MST ==================================================
#define MAX_CONTROLLERS 1
#define MAX_STREAMS_PER_CONTROLLER 2
// END: MST ==================================================
/** Audio parameter data*/
typedef struct pal_param_proxy_channel_config {
uint32_t num_proxy_channels;
} pal_param_proxy_channel_config_t;
struct pal_param_context_list {
uint32_t num_contexts;
uint32_t context_id[]; /* list of num_contexts context_id */
};
struct pal_param_disp_port_config_params {
int controller;
int stream;
};
struct pal_usb_device_address {
int card_id;
int device_num;
};
typedef union {
struct pal_param_disp_port_config_params dp_config;
struct pal_usb_device_address usb_addr;
} pal_device_config_t;
struct pal_amp_db_and_gain_table {
float amp;
float db;
uint32_t level;
};
struct pal_vol_ctrl_ramp_param {
uint32_t ramp_period_ms;
};
/* Payload For ID: PAL_PARAM_ID_DEVICE_CONNECTION
* Description : Device Connection
*/
typedef struct pal_param_device_connection {
pal_device_id_t id;
bool connection_state;
pal_device_config_t device_config;
} pal_param_device_connection_t;
/* Payload For ID: PAL_PARAM_ID_GAIN_LVL_MAP
* Description : get gain level mapping
*/
typedef struct pal_param_gain_lvl_map {
struct pal_amp_db_and_gain_table *mapping_tbl;
int table_size;
int filled_size;
} pal_param_gain_lvl_map_t;
/* Payload For ID: PAL_PARAM_ID_GAIN_LVL_CAL
* Description : set gain level calibration
*/
typedef struct pal_param_gain_lvl_cal {
int level;
} pal_param_gain_lvl_cal_t;
/* Payload For ID: PAL_PARAM_ID_DEVICE_CAPABILITY
* Description : get Device Capability
*/
typedef struct pal_param_device_capability {
pal_device_id_t id;
struct pal_usb_device_address addr;
bool is_playback;