#include "code/capture/capture_audio_capturer.h"
#include "code/base/logger.h"
#include <iostream>

using namespace av::capture;

int main() {
    // 初始化日志
    av::Logger::instance().setLevel(av::LogLevel::DEBUG);
    
    std::cout << "测试音频采集器修复..." << std::endl;
    
    // 创建音频采集器
    AudioCapturer capturer;
    
    // 设置参数
    AudioCaptureParams params(CapturerType::AUDIO_MIC);
    params.micIndex = 0;
    params.sampleRate = 44100;
    params.channels = 1;
    params.sampleFormat = AV_SAMPLE_FMT_S16;
    
    // 初始化采集器
    auto result = capturer.initialize(params);
    
    if (result == av::ErrorCode::SUCCESS) {
        std::cout << "✓ 音频采集器初始化成功！" << std::endl;
        
        // 测试设备枚举
        auto devices = capturer.getAvailableDevices();
        std::cout << "找到 " << devices.size() << " 个音频设备" << std::endl;
        
        capturer.close();
    } else {
        std::cout << "✗ 音频采集器初始化失败，错误码: " << static_cast<int>(result) << std::endl;
        return 1;
    }
    
    std::cout << "测试完成！" << std::endl;
    return 0;
}