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.
57 lines
1.8 KiB
57 lines
1.8 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2020. All rights reserved.
|
|
* Description: audio hal primary output header file.
|
|
* Author: Hisilicon
|
|
* Create: 2020-05-11
|
|
* Notes: NA
|
|
* History: 2020-05-11 yinyingcai for CodingStyle
|
|
*/
|
|
#ifndef HPO_H
|
|
#define HPO_H
|
|
|
|
#include <system/audio.h>
|
|
#include <hardware/audio.h>
|
|
#include <tinyalsa/asoundlib.h>
|
|
#include "audio_hw.h"
|
|
|
|
#define AO_CARD_ID 0
|
|
#define AO_DEVICE_ID0 0
|
|
#define AO_DEVICE_ID1 1
|
|
#define AO_DEVICE_ID2 2
|
|
#define AO_DEVICE_ID4 4
|
|
|
|
struct hpo_data {
|
|
int out_card;
|
|
int out_device;
|
|
int alsa_delay; /* the delay of first frame writing caused by alsa, include pcm_open && first pcm_write */
|
|
/* add for printing xrun begin */
|
|
bool underrun;
|
|
bool max_underrun_update;
|
|
uint64_t frames_written;
|
|
uint64_t frames_written_standby; /* this value is reset when standby */
|
|
uint64_t frames_discarded;
|
|
uint64_t max_underrun_frames;
|
|
uint64_t max_overrun_frames;
|
|
uint64_t open_time;
|
|
uint64_t first_frame_time;
|
|
uint64_t last_print_time;
|
|
/* add for printing xrun end */
|
|
struct pcm *pcm;
|
|
struct stream_out *out;
|
|
FILE *fd;
|
|
void *sys_track; /* data of system track */
|
|
};
|
|
|
|
int hpo_open(struct hpo_data *hpo);
|
|
int hpo_create(struct hpo_data **pphpo);
|
|
void hpo_destroy(struct hpo_data *hpo);
|
|
size_t hpo_get_buffer_size(const struct hpo_data *hpo);
|
|
int hpo_close(struct hpo_data *hpo);
|
|
uint32_t hpo_get_latency(const struct hpo_data *hpo);
|
|
int hpo_get_render_position(const struct hpo_data *hpo, uint32_t *dsp_frames);
|
|
ssize_t hpo_write(struct hpo_data *hpo, const uint8_t *buffer, size_t bytes);
|
|
int hpo_get_tstamp(const struct hpo_data *hpo, uint64_t *frames);
|
|
bool hpo_check_equal(int real_value, int expect_value);
|
|
|
|
#endif
|