//
// Created by chenjinyi on 2024/10/29.
//

#ifndef _ASP_AUDIO_RENDER_H
#define _ASP_AUDIO_RENDER_H
#include "AspPlayer.h"

namespace wuying {
namespace asp {

typedef std::function<void()> ReleaseBuffer;
typedef std::function<void(void*, uint32_t&)> AudioReader;

struct AspAudioFrame {
    int sample;
    int channels;
    int size;
    uint8_t *data;

    ReleaseBuffer releaseBuffer;
};

struct AspAudioPlayback {
    AspAudioReadType readType;
    AspAudioMode mode;
    uint32_t channels;
    uint32_t frequency;
    AspAudioFormat format;

    AudioReader audioReader;
};

class ASP_CLIENT_SDK_API AspAudio {
public:
    virtual void onAudioFrameRender(AspAudioFrame &frame) = 0;
    virtual void onAudioVolumeUpdate(uint32_t volume) = 0;
    virtual void onAudioMuteUpdate(bool isMute) = 0;

    virtual void onAudioPlaybackUpdate(AspAudioPlayback &playback) = 0;
    virtual void onAudioPlaybackStart() = 0;
    virtual void onAudioPlaybackStop() = 0;
};

}
}


#endif //_ASP_AUDIO_RENDER_H
