[vlc-commits] demux: adaptive: constify getByID()

Francois Cartegnie git at videolan.org
Tue Mar 2 23:44:56 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Mar  2 14:37:32 2021 +0100| [ec9f0e8da2bc54c652ed76ac00689907c6b8c56b] | committer: Francois Cartegnie

demux: adaptive: constify getByID()

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

 modules/demux/adaptive/playlist/BaseAdaptationSet.cpp | 5 ++---
 modules/demux/adaptive/playlist/BaseAdaptationSet.h   | 2 +-
 modules/demux/adaptive/playlist/BasePeriod.cpp        | 5 ++---
 modules/demux/adaptive/playlist/BasePeriod.h          | 2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp b/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp
index 8f3cac8a2c..b44699d23d 100644
--- a/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp
+++ b/modules/demux/adaptive/playlist/BaseAdaptationSet.cpp
@@ -66,10 +66,9 @@ const std::vector<BaseRepresentation*>& BaseAdaptationSet::getRepresentations()
     return representations;
 }
 
-BaseRepresentation * BaseAdaptationSet::getRepresentationByID(const ID &id)
+BaseRepresentation * BaseAdaptationSet::getRepresentationByID(const ID &id) const
 {
-    std::vector<BaseRepresentation *>::const_iterator it;
-    for(it = representations.begin(); it != representations.end(); ++it)
+    for(auto it = representations.cbegin(); it != representations.cend(); ++it)
     {
         if((*it)->getID() == id)
             return *it;
diff --git a/modules/demux/adaptive/playlist/BaseAdaptationSet.h b/modules/demux/adaptive/playlist/BaseAdaptationSet.h
index 574352cf3e..885e294122 100644
--- a/modules/demux/adaptive/playlist/BaseAdaptationSet.h
+++ b/modules/demux/adaptive/playlist/BaseAdaptationSet.h
@@ -51,7 +51,7 @@ namespace adaptive
 
                 virtual StreamFormat            getStreamFormat() const; /*reimpl*/
                 const std::vector<BaseRepresentation *>&  getRepresentations() const;
-                BaseRepresentation *            getRepresentationByID(const ID &);
+                BaseRepresentation *            getRepresentationByID(const ID &) const;
                 void                            setSegmentAligned(bool);
                 bool                            isSegmentAligned() const;
                 void                            setBitswitchAble(bool);
diff --git a/modules/demux/adaptive/playlist/BasePeriod.cpp b/modules/demux/adaptive/playlist/BasePeriod.cpp
index 4989f0e484..695b57b05b 100644
--- a/modules/demux/adaptive/playlist/BasePeriod.cpp
+++ b/modules/demux/adaptive/playlist/BasePeriod.cpp
@@ -75,10 +75,9 @@ void BasePeriod::addAdaptationSet(BaseAdaptationSet *adaptationSet)
     }
 }
 
-BaseAdaptationSet *BasePeriod::getAdaptationSetByID(const adaptive::ID &id)
+BaseAdaptationSet *BasePeriod::getAdaptationSetByID(const adaptive::ID &id) const
 {
-    std::vector<BaseAdaptationSet*>::const_iterator it;
-    for(it = adaptationSets.begin(); it!= adaptationSets.end(); ++it)
+    for(auto it = adaptationSets.cbegin(); it!= adaptationSets.cend(); ++it)
     {
         if( (*it)->getID() == id )
             return *it;
diff --git a/modules/demux/adaptive/playlist/BasePeriod.h b/modules/demux/adaptive/playlist/BasePeriod.h
index 5e40a2364c..5415462226 100644
--- a/modules/demux/adaptive/playlist/BasePeriod.h
+++ b/modules/demux/adaptive/playlist/BasePeriod.h
@@ -41,7 +41,7 @@ namespace adaptive
                 virtual ~BasePeriod ();
 
                 const std::vector<BaseAdaptationSet *>& getAdaptationSets   () const;
-                BaseAdaptationSet *                 getAdaptationSetByID(const ID &);
+                BaseAdaptationSet *                 getAdaptationSetByID(const ID &) const;
                 void                                addAdaptationSet    (BaseAdaptationSet *AdaptationSet);
                 void                                debug               (vlc_object_t *,int = 0) const;
 



More information about the vlc-commits mailing list