summaryrefslogtreecommitdiff
path: root/hdmi_audio_hw.h (plain)
blob: adb9c241b8ea6fe1c4e52d2a1b7315b1107f97ec
1#ifndef _HDMI_AUDIO_HW_H_
2#define _HDMI_AUDIO_HW_H_
3
4
5// add compute hdmi in volume function, volume index between 0 and 15 ,this reference AudioPolicyManagerBase
6
7enum
8{ VOLMIN = 0, VOLKNEE1 = 1, VOLKNEE2 = 2, VOLMAX = 3, VOLCNT = 4 };
9
10struct VolumeCurvePoint {
11 int mIndex;
12 float mDBAttenuation;
13};
14
15static struct VolumeCurvePoint sSpeakerMediaVolumeCurve[VOLCNT] = {
16 {1, -56.0f}, {20, -34.0f}, {60, -11.0f}, {100, 0.0f}
17};
18
19// stream descriptor used for volume control
20struct StreamDescriptor {
21 int mIndexMin; // min volume index
22 int mIndexMax; // max volume index
23 int mIndexCur[15]; // current volume index
24 struct VolumeCurvePoint *mVolumeCurve;
25};
26enum {
27 TYPE_PCM = 0,
28 TYPE_AC3 = 2,
29 TYPE_DTS = 3,
30 TYPE_EAC3 = 4,
31 TYPE_DTS_HD = 5 ,
32 TYPE_MULTI_PCM = 6,
33 TYPE_TRUE_HD = 7,
34 TYPE_DTS_HD_MA = 8,//should not used after we unify DTS-HD&DTS-HD MA
35 TYPE_PCM_HIGH_SR = 9,
36};
37#define HDMI_ARC_MAX_FORMAT 20
38struct aml_audio_device {
39 struct audio_hw_device hw_device;
40 pthread_mutex_t lock; /* see note below on mutex acquisition order */
41 int mode;
42 audio_devices_t in_device;
43 audio_devices_t out_device;
44 int in_call;
45 struct aml_stream_in *active_input;
46 struct aml_stream_out *active_output;
47 bool mic_mute;
48 struct echo_reference_itfe *echo_reference;
49 bool hw_sync_mode;
50 audio_hwsync_t hwsync;
51 unsigned hdmi_arc_ad[HDMI_ARC_MAX_FORMAT];
52};
53
54struct aml_stream_out {
55 struct audio_stream_out stream;
56 pthread_mutex_t lock; /* see note below on mutex acquisition order */
57 struct pcm_config config;
58 struct pcm *pcm;
59 char *buffer;
60 int standby;
61 struct aml_audio_device *dev;
62 int write_threshold;
63 unsigned multich;
64 int codec_type;
65 int last_codec_type;
66 int format;
67 uint64_t frame_write_sum;
68 uint64_t frame_skip_sum;
69 audio_output_flags_t flags;
70 audio_devices_t out_device;
71 uint64_t spdif_enc_init_frame_write_sum;
72 uint64_t last_frames_postion;
73 uint64_t bytes_write_total;
74 unsigned char pause_status;
75 int skip_frame;
76};
77
78struct aml_stream_in {
79 struct audio_stream_in stream;
80 pthread_mutex_t lock; /* see note below on mutex acquisition order */
81 struct pcm_config config;
82 struct pcm *pcm;
83 int device;
84 int16_t *buffer;
85 size_t frames_in;
86 int standby;
87 int source;
88 bool need_echo_reference;
89 int requested_rate;
90 struct aml_audio_device *dev;
91};
92#endif
93