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

77 lines
2.2 KiB
C

/*
* Copyright (C) 2025 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 _AML_POLICY_H_
#define _AML_POLICY_H_
#ifdef __cplusplus
extern "C" {
#endif
struct aml_stream_out;
typedef enum {
AML_POLICY_TYPE_NONE, // don't output
AML_POLICY_TYPE_NORMAL, //output as normal
AML_POLICY_TYPE_HEADPHONE, //output to headphone
AML_POLICY_TYPE_USB_SPEAKER,
AML_POLICY_TYPE_BLUETOOTH_SPEAKER,
} aml_policy_type;
typedef enum {
AML_STREAM_STEREO_PORT,
AML_STREAM_MULTI_CHANNEL_PORT,
AML_STREAM_BYPASS_PORT,
AML_STREAM_TRANSCODE_PORT,
} aml_stream_port_type;
typedef enum {
AML_OUTPUT_DEVICE_DEFAULT, //tv means speaker, stb means hdmi
AML_OUTPUT_DEVICE_HEADPHONE,
AML_OUTPUT_DEVICE_USB_SPEAKER,
AML_OUTPUT_DEVICE_BLUETOOTH_SPEAKER,
AML_OUTPUT_DEVICE_MAX,
} aml_output_device_type;
typedef enum {
AML_OUTPUT_SOURCE_MIXER_OUTPUT, //from mixer output or ms12 output
AML_OUTPUT_SOURCE_DECODER_OUTPUT, //from decoder output
} aml_output_source_type;
typedef enum {
AML_POLICY_DECODER_CLOSED,
AML_POLICY_HEADPHONE_PLUG_IN,
AML_POLICY_HEADPHONE_PLUG_OUT,
AML_POLICY_USB_DEVICE_PLUG_IN,
AML_POLICY_USB_DEVICE_PLUG_OUT,
AML_POLICY_BT_DEVICE_PLUG_IN,
AML_POLICY_BT_DEVICE_PLUG_OUT,
} aml_policy_event_type;
aml_policy_type aml_get_stream_policy(struct aml_stream_out *out, aml_stream_port_type out_type);
aml_output_source_type aml_get_output_device_src_type(aml_output_device_type device);
int aml_restore_output_device_to_mixer_by_id(int id);
int aml_set_output_device_by_id(int id, aml_output_device_type device);
void aml_dump_policy_mappings(struct aml_audio_device* adev, int fd);
int aml_policy_update(aml_policy_event_type event);
#ifdef __cplusplus
}
#endif
#endif