diff --git a/src/Lib/Audio.hh b/src/Lib/Audio.hh index ee0efab5dcd5714d34d100f531a48eb673397b6b..3259d1ffdec318d6bfeba89149de700d40dbea03 100644 --- a/src/Lib/Audio.hh +++ b/src/Lib/Audio.hh @@ -1,5 +1,4 @@ -#ifndef VIVY_AUDIO_H -#define VIVY_AUDIO_H +#pragma once #ifndef __cplusplus #error "This is a C++ header" @@ -11,6 +10,7 @@ extern "C" { #include <libavformat/avformat.h> #include <libswresample/swresample.h> #include <libavcodec/avfft.h> +#include <memory.h> } #include "Utils.hh" @@ -18,7 +18,6 @@ extern "C" { #include <QMap> #include <QVector> #include <QString> -#include <memory.h> namespace Vivy { @@ -111,14 +110,11 @@ public: static constexpr uint resamplerSampleRate = 44100; }; - using StreamPtr = std::shared_ptr<Stream>; + using StreamPtr = std::shared_ptr<Stream>; + using StreamWeakPtr = std::weak_ptr<Stream>; public: AudioContext(const QString &path); - ~AudioContext() noexcept = default; - - // The stream non-owning view pointer - using StreamWeakPtr = std::weak_ptr<Stream>; StreamWeakPtr getStream(int) const noexcept; StreamWeakPtr getDefaultStream() const noexcept; @@ -134,7 +130,7 @@ private: using AVFormatContextPtr = std::unique_ptr<AVFormatContext, decltype(avFormatContextDeleter)>; AVFormatContextPtr format{ avformat_alloc_context(), avFormatContextDeleter }; - QString filePath; // Usefull information + const QString filePath; // Usefull information QMap<uint, StreamPtr> audioStreams{}; // THe audio streams of the file int defaultStreamIndex{ -1 }; @@ -144,5 +140,3 @@ private: StreamPtr spareNullSreamPtr{ nullptr }; }; } - -#endif // VIVY_AUDIO_H