From a96880c176f23e3de62178e58d1b424cf286418c Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Fri, 27 Aug 2021 11:53:31 +0200
Subject: [PATCH] LIB: The 'Super' typedef is set in the abstract
 context/stream for more factorisation and less error-prone code

---
 src/Lib/AbstractMediaContext.hh | 6 ++++++
 src/Lib/Audio.hh                | 5 -----
 src/Lib/Video.hh                | 2 --
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/Lib/AbstractMediaContext.hh b/src/Lib/AbstractMediaContext.hh
index 1267b175..a2611c1d 100644
--- a/src/Lib/AbstractMediaContext.hh
+++ b/src/Lib/AbstractMediaContext.hh
@@ -52,6 +52,9 @@ template <size_t AVMEDIA_TYPE> class AbstractMediaStream {
 public:
     static inline constexpr AVMediaType avMediaType = static_cast<AVMediaType>(AVMEDIA_TYPE);
 
+protected:
+    using Super = AbstractMediaStream<AVMEDIA_TYPE>;
+
 protected:
     AbstractMediaStream(AVCodec *streamCodec, AVFormatContext *formatArg, AVStream *streamArg,
                         int index)
@@ -117,6 +120,9 @@ public:
     using StreamPtr                                 = std::shared_ptr<Stream>;
     using StreamWeakPtr                             = std::weak_ptr<Stream>;
 
+protected:
+    using Super = AbstractMediaContext<Stream>;
+
 public:
     AbstractMediaContext(const QString &path)
         : filePath(path)
diff --git a/src/Lib/Audio.hh b/src/Lib/Audio.hh
index 15d73c52..1e34c494 100644
--- a/src/Lib/Audio.hh
+++ b/src/Lib/Audio.hh
@@ -27,15 +27,11 @@ class AudioContext;
 // the AudioContext class.
 class AudioStream final : public AbstractMediaStream<AVMEDIA_TYPE_AUDIO> {
     VIVY_UNMOVABLE_OBJECT(AudioStream)
-    using Super = AbstractMediaStream<AVMEDIA_TYPE_AUDIO>;
 
 public:
     AudioStream(AVCodec *, AVFormatContext *, AVStream *, int index);
     ~AudioStream() noexcept override;
 
-    // The non-owning view of the stream's data
-    using DataWeakPtr = std::weak_ptr<double[]>;
-
     // Decode the stream
     void decodeData();
     void cleanUpData() noexcept;
@@ -72,7 +68,6 @@ private:
 // from it.
 class AudioContext final : public AbstractMediaContext<AudioStream> {
     VIVY_UNMOVABLE_OBJECT(AudioContext)
-    using Super = AbstractMediaContext<AudioStream>;
 
 public:
     using StreamPtr     = std::shared_ptr<AudioStream>;
diff --git a/src/Lib/Video.hh b/src/Lib/Video.hh
index e0826f0c..42032b88 100644
--- a/src/Lib/Video.hh
+++ b/src/Lib/Video.hh
@@ -25,7 +25,6 @@ namespace Vivy
 // VideoContext instance.
 class VideoStream final : public AbstractMediaStream<AVMEDIA_TYPE_VIDEO> {
     VIVY_UNMOVABLE_OBJECT(VideoStream)
-    using Super = AbstractMediaStream<AVMEDIA_TYPE_VIDEO>;
 
 public:
     VideoStream(AVCodec *, AVFormatContext *, AVStream *, int index);
@@ -47,7 +46,6 @@ private:
 // Like an audio context, but for videos.
 class VideoContext final : public AbstractMediaContext<VideoStream> {
     VIVY_UNMOVABLE_OBJECT(VideoContext)
-    using Super = AbstractMediaContext<VideoStream>;
 
 public:
     VideoContext(const QString &path);
-- 
GitLab