From 7ee4bd7abc51ca9c6ab47500f4449b5d13e568f3 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Fri, 27 Aug 2021 10:05:03 +0200
Subject: [PATCH] [WIP] LIB: Make the 'fileName' a const member

---
 src/Lib/Audio.hh | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/Lib/Audio.hh b/src/Lib/Audio.hh
index ee0efab5..3259d1ff 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
-- 
GitLab