From f4e04ba88228eb158d8b457d79f241f187b82dc6 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Fri, 27 Aug 2021 14:32:54 +0200
Subject: [PATCH] LIB: Finished implementing V1 of the VideoContext and its
 stream

---
 src/Lib/Video.cc | 24 ++++++++++++++++++++++++
 src/Lib/Video.hh |  8 ++++----
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/Lib/Video.cc b/src/Lib/Video.cc
index 467d562c..e6b9a070 100644
--- a/src/Lib/Video.cc
+++ b/src/Lib/Video.cc
@@ -31,3 +31,27 @@ VideoContext::getElementName() const noexcept
 {
     return "Video" + Super::getElementName();
 }
+
+int
+VideoStream::getWidth() const noexcept
+{
+    return codecContext->width;
+}
+
+int
+VideoStream::getHeight() const noexcept
+{
+    return codecContext->height;
+}
+
+qint64
+VideoStream::getDuration() const noexcept
+{
+    return dataFormat->duration;
+}
+
+double
+VideoStream::getFramesPerSecond() const noexcept
+{
+    return av_q2d(stream->r_frame_rate);
+}
diff --git a/src/Lib/Video.hh b/src/Lib/Video.hh
index 3f52495f..2d3c6054 100644
--- a/src/Lib/Video.hh
+++ b/src/Lib/Video.hh
@@ -17,10 +17,10 @@ public:
     VideoStream(AVCodec *, AVFormatContext *, AVStream *, int index);
     ~VideoStream() noexcept override = default;
 
-    size_t getWidth() const noexcept;
-    size_t getHeight() const noexcept;
-    size_t getDuration() const noexcept;
-    size_t getFramesPerSecond() const noexcept;
+    int getWidth() const noexcept;
+    int getHeight() const noexcept;
+    qint64 getDuration() const noexcept;
+    double getFramesPerSecond() const noexcept;
 
     QJsonObject getProperties() const noexcept override;
 
-- 
GitLab