Files
2026-08-24 10:03:24 +08:00

73 lines
2.6 KiB
C

/*
* Copyright (C) 2017 Amlogic Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ALSA_MANAGER_H_
#define _ALSA_MANAGER_H_
#include <hardware/audio.h>
typedef enum info_type {
OUTPUT_INFO_STATUS, // running or xrun etc..
OUTPUT_INFO_DELAYFRAME, // the delay frames
} alsa_info_type_t;
typedef union output_info {
int delay_ms;
} alsa_output_info_t;
typedef struct aml_alsa_config {
int format;
unsigned int channel_mask;
int sample_rate;
//for capture only
int period_size;
int period_count;
} aml_alsa_config_t;
typedef struct aml_device_config {
uint32_t device_port;
} aml_device_config_t;
void aml_alsa_info_dump(void* handle, int fd);
int aml_alsa_input_open(void **handle, aml_alsa_config_t * stream_config, aml_device_config_t *device_config);
int aml_alsa_input_read(void *handle, void *buffer, int bytes);
int aml_alsa_input_flush(void *handle);
int aml_alsa_input_get_delay(void *handle);
uint64_t aml_alsa_input_get_timestamp(void *handle);
int aml_alsa_input_stop(void *handle);
int aml_alsa_input_close(void *handle);
int aml_alsa_output_open(void **handle, aml_alsa_config_t * stream_config, aml_device_config_t *device_config);
int aml_alsa_output_close(void *handle);
int aml_alsa_output_write(void *handle, const void *buffer, int bytes);
int aml_alsa_output_getinfo(void *handle, alsa_info_type_t type, alsa_output_info_t * info);
int aml_alsa_output_pause(void *handle);
int aml_alsa_output_resume(void *handle);
int aml_alsa_output_stop(void *handle);
bool aml_alsa_output_get_alsa_status(void *handle, bool *alsa_status);
int aml_alsa_output_clear_alsa_status_changed_flag(void *handle);
uint64_t aml_alsa_output_get_delay_frame(void *handle, bool ignore_default);
int aml_alsa_output_flush(void *handle);
int aml_alsa_output_get_timestamp(void *handle, unsigned int *avail, struct timespec *tstamp);
bool aml_alsa_output_get_start_threshold(void *handle, uint32_t *start_threshold);
enum pcm_format convert_audio_format_2_alsa_format(audio_format_t format);
void *get_internal_pcm(void *handle);
void aml_alsa_set_llp(bool mode);
#endif // _ALSA_MANAGER_H_