Files
BPI-CM9-Linux/aml-comp/multimedia/aml_audio_hal/audio_hal/audio_decoder.h
T

59 lines
2.0 KiB
C
Raw Normal View History

2026-11-11 08:50:43 +08:00
/*
* Copyright (C) 2021 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 _AUDIO_DECODER_H_
#define _AUDIO_DECODER_H_
#include <hardware/audio.h>
#include "aml_dec_api.h"
#include "audio_buffer.h"
struct audio_stream_out;
/* Called before aml_decoder_process in each consume iteration. */
#define AUDIO_DECODER_PRE 0x1000
/**
* Per-frame callback for audio_decoder_process().
*
* @param decoder_ret AUDIO_DECODER_PRE before decode;
* otherwise the return of aml_decoder_process().
* @return 0 to continue the consume loop; < 0 to break.
*/
typedef int (*audio_decoder_frame_cb)(struct audio_stream_out *stream,
aml_dec_t *aml_dec,
struct audio_buffer *ainput,
int decoder_ret);
int audio_decoder_init(struct audio_stream_out *stream);
int audio_decoder_reset(struct audio_stream_out *stream);
int audio_decoder_release(struct audio_stream_out *stream);
int audio_decoder_process(struct audio_stream_out *stream,
struct audio_buffer *abuffer,
audio_decoder_frame_cb cb);
int dca_get_out_ch_internal(void);
int dca_set_out_ch_internal(int ch_num);
/**
* @brief Get dca decoder output channel mask(internal use).
* @return [success]: 0 decoder not init.
* [success]: Output channel mask, see #AmlDtsSpeakerMask.
* [fail]: -1 get output channel fail.
*/
uint32_t dca_get_out_chmask_internal(void);
#endif