Format and .clang-format

This commit is contained in:
faumaray committed 2026-01-19 19:52:30 +03:00
1 parent 6aed7b0027
commit b94b634a87
47 files changed
+42341 -39711

No files matched your search

+35 -32
View File
@@ -17,37 +17,40 @@ extern "C" {
#include <libswresample/swresample.h>
}
enum class DecodeStatus { Idle, Processing, Completed, Failed, Cancelled };
class AudioDecoder {
public:
struct AudioData {
std::vector<short> buffer;
int samples = 0;
int channels = 0;
int sampleRate = 0;
};
std::deque<std::vector<short>> m_chunkQueue;
std::mutex m_queueMtx;
std::condition_variable m_cv;
std::atomic<bool> m_isDecodingFinished{false};
AudioDecoder();
~AudioDecoder();
void StartDecode(const std::string &url, int targetSampleRate);
void Cancel() { m_cancelRequested = true; }
DecodeStatus GetStatus() const { return m_status; }
AudioData GetResult() { return std::move(m_result); }
bool GetNextChunk(std::vector<short> &outChunk, bool blocking = false);
bool IsFinished() const { return m_finished.load(); }
class AudioDecoder
{
public:
private:
void Cleanup();
void InternalDecode(std::string url, int targetSampleRate);
std::atomic<DecodeStatus> m_status{DecodeStatus::Idle};
std::atomic<bool> m_cancelRequested{false};
std::jthread m_thread;
std::mutex m_logMtx;
AudioData m_result;
std::atomic<bool> m_finished{false};
AVFormatContext *m_formatCtx = nullptr;
AVCodecContext *m_codecCtx = nullptr;
SwrContext *m_swrCtx = nullptr;
struct AudioData {
std::vector<short> buffer;
int samples = 0;
int channels = 0;
int sampleRate = 0;
};
std::deque<std::vector<short>> m_chunkQueue;
std::mutex m_queueMtx;
std::condition_variable m_cv;
std::atomic<bool> m_isDecodingFinished{false};
AudioDecoder();
~AudioDecoder();
void StartDecode(const std::string &url, int targetSampleRate);
void Cancel() { m_cancelRequested = true; }
DecodeStatus GetStatus() const { return m_status; }
AudioData GetResult() { return std::move(m_result); }
bool GetNextChunk(std::vector<short> &outChunk, bool blocking = false);
bool IsFinished() const { return m_finished.load(); }
private:
void Cleanup();
void InternalDecode(std::string url, int targetSampleRate);
std::atomic<DecodeStatus> m_status{DecodeStatus::Idle};
std::atomic<bool> m_cancelRequested{false};
std::jthread m_thread;
std::mutex m_logMtx;
AudioData m_result;
std::atomic<bool> m_finished{false};
AVFormatContext *m_formatCtx = nullptr;
AVCodecContext *m_codecCtx = nullptr;
SwrContext *m_swrCtx = nullptr;
};