[vlc-commits] demux: adaptive: handle AR/rates in codecdesc

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 23 15:58:00 2021 +0100| [9aec7be7e7b2796913c795beef53109e0ba380ca] | committer: Francois Cartegnie

demux: adaptive: handle AR/rates in codecdesc

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

 .../demux/adaptive/playlist/CodecDescription.cpp   | 23 +++++++++++++++++
 .../demux/adaptive/playlist/CodecDescription.hpp   |  4 +++
 .../adaptive/playlist/CommonAttributesElements.cpp | 30 ++++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/modules/demux/adaptive/playlist/CodecDescription.cpp b/modules/demux/adaptive/playlist/CodecDescription.cpp
index 43546cc962..2eebc7ad08 100644
--- a/modules/demux/adaptive/playlist/CodecDescription.cpp
+++ b/modules/demux/adaptive/playlist/CodecDescription.cpp
@@ -62,6 +62,29 @@ void CodecDescription::setLanguage(const std::string &l)
     fmt.psz_language = ::strdup(l.c_str());
 }
 
+void CodecDescription::setAspectRatio(const AspectRatio &r)
+{
+    if(fmt.i_cat != VIDEO_ES || !r.isValid())
+        return;
+    fmt.video.i_sar_num = r.num();
+    fmt.video.i_sar_den = r.den();
+}
+
+void CodecDescription::setFrameRate(const Rate &r)
+{
+    if(fmt.i_cat != VIDEO_ES || !r.isValid())
+        return;
+    fmt.video.i_frame_rate = r.num();
+    fmt.video.i_frame_rate_base = r.den();
+}
+
+void CodecDescription::setSampleRate(const Rate &r)
+{
+    if(fmt.i_cat != AUDIO_ES || !r.isValid())
+        return;
+    fmt.audio.i_rate = r.num();
+}
+
 CodecDescriptionList::CodecDescriptionList()
 {
 
diff --git a/modules/demux/adaptive/playlist/CodecDescription.hpp b/modules/demux/adaptive/playlist/CodecDescription.hpp
index b0f5b7a714..17d3b6652a 100644
--- a/modules/demux/adaptive/playlist/CodecDescription.hpp
+++ b/modules/demux/adaptive/playlist/CodecDescription.hpp
@@ -20,6 +20,7 @@
 #ifndef CODECDESCRIPTION_HPP
 #define CODECDESCRIPTION_HPP
 
+#include "../tools/Properties.hpp"
 #include <vlc_es.h>
 #include <string>
 #include <list>
@@ -39,6 +40,9 @@ namespace adaptive
                 const es_format_t *getFmt() const;
                 void setDescription(const std::string &);
                 void setLanguage(const std::string &);
+                void setAspectRatio(const AspectRatio &);
+                void setFrameRate(const Rate &);
+                void setSampleRate(const Rate &);
 
             protected:
                 es_format_t fmt;
diff --git a/modules/demux/adaptive/playlist/CommonAttributesElements.cpp b/modules/demux/adaptive/playlist/CommonAttributesElements.cpp
index 1448de8152..da629f30af 100644
--- a/modules/demux/adaptive/playlist/CommonAttributesElements.cpp
+++ b/modules/demux/adaptive/playlist/CommonAttributesElements.cpp
@@ -73,3 +73,33 @@ void    CommonAttributesElements::setHeight( int height )
     if ( height > 0 )
         this->height = height;
 }
+
+void CommonAttributesElements::setAspectRatio(const AspectRatio &r)
+{
+    aspectRatio = r;
+}
+
+const AspectRatio & CommonAttributesElements::getAspectRatio() const
+{
+    return aspectRatio;
+}
+
+const Rate & CommonAttributesElements::getFrameRate() const
+{
+    return frameRate;
+}
+
+void CommonAttributesElements::setFrameRate(const Rate &r)
+{
+    frameRate = r;
+}
+
+const Rate & CommonAttributesElements::getSampleRate() const
+{
+    return sampleRate;
+}
+
+void CommonAttributesElements::setSampleRate(const Rate &r)
+{
+    sampleRate = r;
+}



More information about the vlc-commits mailing list