You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. Technologies Co., Ltd. 2020-2020. All rights reserved.
* Description: audio hal cast in header file.
* Author: yinyingcai
* Create: 2020-05-11
* Notes: NA
* History: 2020-05-11 yinyingcai for CodingStyle
*/
#ifndef HCI_H
#define HCI_H
#include <stdio.h>
#include <system/audio.h>
#include <hardware/audio.h>
#include <tinyalsa/asoundlib.h>
#include "audio_hw.h"
#include "audio_hal_common.h"
#define HCI_CACHE_BUFFER_MS 100
#define HCI_CACHE_BUFFER_SIZE (HCI_CACHE_BUFFER_MS * 48 * 4)
#define INVALID_HANDLE 0xffffffff
#define CAST_MIN_INDEX_TV (-100)
#define CAST_MAX_MUTE_CNT 5
typedef enum {
SINK_NONE = 0,
SINK_USB = 1,
SINK_A2DP,
} sink_device;
struct hci_data {
uint64_t frames_read;
uint32_t hCast;
struct stream_in *in;
uint32_t cacheBufSize;
uint8_t cacheBuf[HCI_CACHE_BUFFER_SIZE];
uint32_t pre_sink_delay;
uint32_t mute_cnt;
FILE *fd;
};
int hci_create(struct hci_data **pphci);
void hci_destroy(struct hci_data *hci);
int hci_open(struct hci_data *hci);
int hci_close(struct hci_data *hci);
ssize_t hci_read(struct hci_data *hci, const uint8_t *buffer, size_t bytes);
void hci_init_device_attr(struct hci_device_attr *device_attr);
void hci_set_patch_sink_device(struct hci_device_attr *device_attr, int32_t device);
void hci_set_audiopatch_src_volume(struct audio_device *adev, int32_t index);
#endif