• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <stdint.h>
20 #include <time.h>
21 
22 #include "include/hardware/bt_av.h"
23 
24 namespace bluetooth {
25 namespace audio {
26 namespace a2dp {
27 
28 // Audio config from audio server; PCM format for now
29 struct AudioConfig {
30   btav_a2dp_codec_sample_rate_t sample_rate = BTAV_A2DP_CODEC_SAMPLE_RATE_48000;
31   btav_a2dp_codec_bits_per_sample_t bits_per_sample =
32       BTAV_A2DP_CODEC_BITS_PER_SAMPLE_24;
33   btav_a2dp_codec_channel_mode_t channel_mode =
34       BTAV_A2DP_CODEC_CHANNEL_MODE_STEREO;
35 };
36 
37 // Invoked by audio server to set audio config (PCM for now)
38 bool SetAudioConfig(AudioConfig);
39 
40 // Invoked by audio server when it has audio data to stream.
41 bool StartRequest();
42 
43 // Invoked by audio server when audio streaming is done.
44 bool StopRequest();
45 
46 struct PresentationPosition {
47   uint64_t remote_delay_report_ns;
48   uint64_t total_bytes_read;
49   timespec data_position;
50 };
51 
52 // Invoked by audio server to check audio presentation position periodically.
53 PresentationPosition GetPresentationPosition();
54 
55 bool is_opus_supported();
56 
57 }  // namespace a2dp
58 }  // namespace audio
59 }  // namespace bluetooth
60