[vlc-commits] demux: adaptive: add missing common attributes

Francois Cartegnie git at videolan.org
Thu Mar 4 13:47:32 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 23 15:57:38 2021 +0100| [56251ef310918e43a0b2c2ac04c370e867fcabd6] | committer: Francois Cartegnie

demux: adaptive: add missing common attributes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=56251ef310918e43a0b2c2ac04c370e867fcabd6
---

 .../adaptive/playlist/CommonAttributesElements.h      | 10 ++++++++++
 modules/demux/adaptive/tools/Properties.hpp           | 19 +++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/modules/demux/adaptive/playlist/CommonAttributesElements.h b/modules/demux/adaptive/playlist/CommonAttributesElements.h
index 3ba41d06c4..94656a0148 100644
--- a/modules/demux/adaptive/playlist/CommonAttributesElements.h
+++ b/modules/demux/adaptive/playlist/CommonAttributesElements.h
@@ -24,6 +24,7 @@
 #ifndef COMMONATTRIBUTESELEMENTS_H
 #define COMMONATTRIBUTESELEMENTS_H
 
+#include "../tools/Properties.hpp"
 #include <string>
 
 namespace adaptive
@@ -41,11 +42,20 @@ namespace adaptive
                 void                            setWidth( int width );
                 int                             getHeight() const;
                 void                            setHeight( int height );
+                const AspectRatio &             getAspectRatio() const;
+                void                            setAspectRatio(const AspectRatio &);
+                const Rate &                    getFrameRate() const;
+                void                            setFrameRate(const Rate &);
+                const Rate &                    getSampleRate() const;
+                void                            setSampleRate(const Rate &);
 
             protected:
                 std::string                         mimeType;
                 int                                 width;
                 int                                 height;
+                AspectRatio                         aspectRatio;
+                Rate                                frameRate;
+                Rate                                sampleRate;
         };
     }
 }
diff --git a/modules/demux/adaptive/tools/Properties.hpp b/modules/demux/adaptive/tools/Properties.hpp
index 3247f8a8ec..ee9b9ba607 100644
--- a/modules/demux/adaptive/tools/Properties.hpp
+++ b/modules/demux/adaptive/tools/Properties.hpp
@@ -57,4 +57,23 @@ template <typename T> class Undef
         T val;
 };
 
+template <typename T> class Ratio
+{
+    public:
+        Ratio() { m_den = m_num = 0; }
+        Ratio(T n, T d) { m_den = d, m_num = n; }
+        bool isValid() const { return m_num && m_den; }
+        T num() const { return m_num; }
+        T den() const { return m_den; }
+        T width() const { return m_num; }
+        T height() const { return m_den; }
+
+    protected:
+        T m_num;
+        T m_den;
+};
+
+using AspectRatio = Ratio<unsigned int>;
+using Rate = Ratio<unsigned int>;
+
 #endif // PROPERTIES_HPP



More information about the vlc-commits mailing list