[vlc-commits] demux: adaptive: use enum class
Francois Cartegnie
git at videolan.org
Tue Jan 5 20:25:36 UTC 2021
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 15:05:53 2020 +0100| [b0a0cd26760a3a32de6a49d2f1840db00fbf5d44] | committer: Francois Cartegnie
demux: adaptive: use enum class
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0a0cd26760a3a32de6a49d2f1840db00fbf5d44
---
modules/demux/adaptive/PlaylistManager.cpp | 14 ++++----
modules/demux/adaptive/SegmentTracker.cpp | 12 +++----
modules/demux/adaptive/SegmentTracker.hpp | 14 ++++----
modules/demux/adaptive/Streams.cpp | 8 ++---
modules/demux/adaptive/adaptive.cpp | 16 ++++-----
.../demux/adaptive/encryption/CommonEncryption.cpp | 8 ++---
.../demux/adaptive/encryption/CommonEncryption.hpp | 6 ++--
.../demux/adaptive/logic/AbstractAdaptationLogic.h | 2 +-
.../adaptive/logic/NearOptimalAdaptationLogic.cpp | 6 ++--
.../adaptive/logic/PredictiveAdaptationLogic.cpp | 8 ++---
.../adaptive/logic/RateBasedAdaptationLogic.cpp | 2 +-
modules/demux/adaptive/playlist/BasePlaylist.cpp | 2 +-
modules/demux/adaptive/playlist/Inheritables.cpp | 20 +++++------
modules/demux/adaptive/playlist/Inheritables.hpp | 42 +++++++++++-----------
modules/demux/adaptive/playlist/Segment.cpp | 2 +-
modules/demux/adaptive/playlist/SegmentBase.cpp | 2 +-
.../demux/adaptive/playlist/SegmentBaseType.cpp | 4 +--
.../demux/adaptive/playlist/SegmentInformation.cpp | 32 ++++++++---------
modules/demux/adaptive/playlist/SegmentList.cpp | 4 +--
.../demux/adaptive/playlist/SegmentTemplate.cpp | 8 ++---
.../demux/adaptive/playlist/SegmentTimeline.cpp | 2 +-
modules/demux/dash/mpd/IsoffMainParser.cpp | 4 +--
modules/demux/dash/mpd/MPD.cpp | 2 +-
modules/demux/dash/mpd/Profile.cpp | 24 ++++++-------
modules/demux/dash/mpd/Profile.hpp | 2 +-
modules/demux/hls/playlist/Parser.cpp | 4 +--
26 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 9f53c0dcc8..e1da43104e 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -775,19 +775,19 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
AbstractAdaptationLogic *logic = NULL;
switch(type)
{
- case AbstractAdaptationLogic::FixedRate:
+ case AbstractAdaptationLogic::LogicType::FixedRate:
{
size_t bps = var_InheritInteger(p_demux, "adaptive-bw") * 8192;
logic = new (std::nothrow) FixedRateAdaptationLogic(obj, bps);
break;
}
- case AbstractAdaptationLogic::AlwaysLowest:
+ case AbstractAdaptationLogic::LogicType::AlwaysLowest:
logic = new (std::nothrow) AlwaysLowestAdaptationLogic(obj);
break;
- case AbstractAdaptationLogic::AlwaysBest:
+ case AbstractAdaptationLogic::LogicType::AlwaysBest:
logic = new (std::nothrow) AlwaysBestAdaptationLogic(obj);
break;
- case AbstractAdaptationLogic::RateBased:
+ case AbstractAdaptationLogic::LogicType::RateBased:
{
RateBasedAdaptationLogic *ratelogic =
new (std::nothrow) RateBasedAdaptationLogic(obj);
@@ -796,13 +796,13 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
logic = ratelogic;
break;
}
- case AbstractAdaptationLogic::Default:
+ case AbstractAdaptationLogic::LogicType::Default:
#ifdef ADAPTIVE_DEBUGGING_LOGIC
logic = new (std::nothrow) RoundRobinLogic(obj);
msg_Warn(p_demux, "using RoundRobinLogic every %u", RoundRobinLogic::QUANTUM);
break;
#endif
- case AbstractAdaptationLogic::NearOptimal:
+ case AbstractAdaptationLogic::LogicType::NearOptimal:
{
NearOptimalAdaptationLogic *noplogic =
new (std::nothrow) NearOptimalAdaptationLogic(obj);
@@ -811,7 +811,7 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
logic = noplogic;
break;
}
- case AbstractAdaptationLogic::Predictive:
+ case AbstractAdaptationLogic::LogicType::Predictive:
{
AbstractAdaptationLogic *predictivelogic =
new (std::nothrow) PredictiveAdaptationLogic(obj);
diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index 71395e0901..eb14a9a52b 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -40,33 +40,33 @@ using namespace adaptive::playlist;
SegmentTrackerEvent::SegmentTrackerEvent(SegmentChunk *s)
{
- type = DISCONTINUITY;
+ type = Type::Discontinuity;
u.discontinuity.sc = s;
}
SegmentTrackerEvent::SegmentTrackerEvent(BaseRepresentation *prev, BaseRepresentation *next)
{
- type = SWITCHING;
+ type = Type::RepresentationSwitch;
u.switching.prev = prev;
u.switching.next = next;
}
SegmentTrackerEvent::SegmentTrackerEvent(const StreamFormat *fmt)
{
- type = FORMATCHANGE;
+ type = Type::FormatChange;
u.format.f = fmt;
}
SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, bool enabled)
{
- type = BUFFERING_STATE;
+ type = Type::BufferingStateUpdate;
u.buffering.enabled = enabled;
u.buffering.id = &id;
}
SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, vlc_tick_t min, vlc_tick_t current, vlc_tick_t target)
{
- type = BUFFERING_LEVEL_CHANGE;
+ type = Type::BufferingLevelChange;
u.buffering_level.minimum = min;
u.buffering_level.current = current;
u.buffering_level.target = target;
@@ -75,7 +75,7 @@ SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, vlc_tick_t min, vlc_tick_
SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, vlc_tick_t duration)
{
- type = SEGMENT_CHANGE;
+ type = Type::SegmentChange;
u.segment.duration = duration;
u.segment.id = &id;
}
diff --git a/modules/demux/adaptive/SegmentTracker.hpp b/modules/demux/adaptive/SegmentTracker.hpp
index cdaeff9510..cd303ec072 100644
--- a/modules/demux/adaptive/SegmentTracker.hpp
+++ b/modules/demux/adaptive/SegmentTracker.hpp
@@ -62,14 +62,14 @@ namespace adaptive
SegmentTrackerEvent(const ID &, bool);
SegmentTrackerEvent(const ID &, vlc_tick_t, vlc_tick_t, vlc_tick_t);
SegmentTrackerEvent(const ID &, vlc_tick_t);
- enum
+ enum class Type
{
- DISCONTINUITY,
- SWITCHING,
- FORMATCHANGE,
- BUFFERING_STATE,
- BUFFERING_LEVEL_CHANGE,
- SEGMENT_CHANGE,
+ Discontinuity,
+ RepresentationSwitch,
+ FormatChange,
+ SegmentChange,
+ BufferingStateUpdate,
+ BufferingLevelChange,
} type;
union
{
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 204bd7c480..3360747558 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -643,11 +643,11 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
{
switch(event.type)
{
- case SegmentTrackerEvent::DISCONTINUITY:
+ case SegmentTrackerEvent::Type::Discontinuity:
discontinuity = true;
break;
- case SegmentTrackerEvent::FORMATCHANGE:
+ case SegmentTrackerEvent::Type::FormatChange:
/* Check if our current demux is still valid */
if(*event.u.format.f != format || format == StreamFormat(StreamFormat::UNKNOWN))
{
@@ -661,7 +661,7 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::SWITCHING:
+ case SegmentTrackerEvent::Type::RepresentationSwitch:
if(demuxer && !inrestart)
{
if(!demuxer->bitstreamSwitchCompatible() ||
@@ -677,7 +677,7 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
event.u.switching.next ? event.u.switching.next->getStreamFormat().str().c_str() : ""));
break;
- case SegmentTrackerEvent::SEGMENT_CHANGE:
+ case SegmentTrackerEvent::Type::SegmentChange:
if(demuxer && demuxer->needsRestartOnEachSegment() && !inrestart)
{
needrestart = true;
diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index 2f4016e112..0ec57f5ae4 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -86,13 +86,13 @@ static void Close (vlc_object_t *);
#define ADAPT_LOWLATENCY_LONGTEXT N_("Overrides low latency parameters")
static const AbstractAdaptationLogic::LogicType pi_logics[] = {
- AbstractAdaptationLogic::Default,
- AbstractAdaptationLogic::Predictive,
- AbstractAdaptationLogic::NearOptimal,
- AbstractAdaptationLogic::RateBased,
- AbstractAdaptationLogic::FixedRate,
- AbstractAdaptationLogic::AlwaysLowest,
- AbstractAdaptationLogic::AlwaysBest};
+ AbstractAdaptationLogic::LogicType::Default,
+ AbstractAdaptationLogic::LogicType::Predictive,
+ AbstractAdaptationLogic::LogicType::NearOptimal,
+ AbstractAdaptationLogic::LogicType::RateBased,
+ AbstractAdaptationLogic::LogicType::FixedRate,
+ AbstractAdaptationLogic::LogicType::AlwaysLowest,
+ AbstractAdaptationLogic::LogicType::AlwaysBest};
static const char *const ppsz_logics_values[] = {
"",
@@ -180,7 +180,7 @@ static int Open(vlc_object_t *p_obj)
PlaylistManager *p_manager = NULL;
char *psz_logic = var_InheritString(p_obj, "adaptive-logic");
- AbstractAdaptationLogic::LogicType logic = AbstractAdaptationLogic::Default;
+ AbstractAdaptationLogic::LogicType logic = AbstractAdaptationLogic::LogicType::Default;
if( psz_logic )
{
bool b_found = false;
diff --git a/modules/demux/adaptive/encryption/CommonEncryption.cpp b/modules/demux/adaptive/encryption/CommonEncryption.cpp
index df642df92b..ea8930b29a 100644
--- a/modules/demux/adaptive/encryption/CommonEncryption.cpp
+++ b/modules/demux/adaptive/encryption/CommonEncryption.cpp
@@ -38,13 +38,13 @@ using namespace adaptive::encryption;
CommonEncryption::CommonEncryption()
{
- method = CommonEncryption::Method::NONE;
+ method = CommonEncryption::Method::None;
}
void CommonEncryption::mergeWith(const CommonEncryption &other)
{
- if(method == CommonEncryption::Method::NONE &&
- other.method != CommonEncryption::Method::NONE)
+ if(method == CommonEncryption::Method::None &&
+ other.method != CommonEncryption::Method::None)
method = other.method;
if(uri.empty() && !other.uri.empty())
uri = other.uri;
@@ -138,7 +138,7 @@ size_t CommonEncryptionSession::decrypt(void *inputdata, size_t inputbytes, bool
}
else
#endif
- if(encryption.method != CommonEncryption::Method::NONE)
+ if(encryption.method != CommonEncryption::Method::None)
{
inputbytes = 0;
}
diff --git a/modules/demux/adaptive/encryption/CommonEncryption.hpp b/modules/demux/adaptive/encryption/CommonEncryption.hpp
index 1645c57e94..f3767c7dd3 100644
--- a/modules/demux/adaptive/encryption/CommonEncryption.hpp
+++ b/modules/demux/adaptive/encryption/CommonEncryption.hpp
@@ -34,11 +34,11 @@ namespace adaptive
public:
CommonEncryption();
void mergeWith(const CommonEncryption &);
- enum Method
+ enum class Method
{
- NONE,
+ None,
AES_128,
- AES_SAMPLE,
+ AES_Sample,
} method;
std::string uri;
std::vector<unsigned char> iv;
diff --git a/modules/demux/adaptive/logic/AbstractAdaptationLogic.h b/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
index 8db5ded177..7542114ce9 100644
--- a/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
+++ b/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
@@ -52,7 +52,7 @@ namespace adaptive
virtual void trackerEvent (const SegmentTrackerEvent &) {}
void setMaxDeviceResolution (int, int);
- enum LogicType
+ enum class LogicType
{
Default = 0,
AlwaysBest,
diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index d31758b49c..9e898ec7a3 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -198,7 +198,7 @@ void NearOptimalAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
{
switch(event.type)
{
- case SegmentTrackerEvent::SWITCHING:
+ case SegmentTrackerEvent::Type::RepresentationSwitch:
{
vlc_mutex_lock(&lock);
if(event.u.switching.prev)
@@ -210,7 +210,7 @@ void NearOptimalAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::BUFFERING_STATE:
+ case SegmentTrackerEvent::Type::BufferingStateUpdate:
{
const ID &id = *event.u.buffering.id;
vlc_mutex_lock(&lock);
@@ -234,7 +234,7 @@ void NearOptimalAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::BUFFERING_LEVEL_CHANGE:
+ case SegmentTrackerEvent::Type::BufferingLevelChange:
{
const ID &id = *event.u.buffering.id;
vlc_mutex_lock(&lock);
diff --git a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
index 81f171f372..2e05cfb2d1 100644
--- a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
@@ -179,7 +179,7 @@ void PredictiveAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
{
switch(event.type)
{
- case SegmentTrackerEvent::SWITCHING:
+ case SegmentTrackerEvent::Type::RepresentationSwitch:
{
vlc_mutex_lock(&lock);
if(event.u.switching.prev)
@@ -192,7 +192,7 @@ void PredictiveAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::BUFFERING_STATE:
+ case SegmentTrackerEvent::Type::BufferingStateUpdate:
{
const ID &id = *event.u.buffering.id;
vlc_mutex_lock(&lock);
@@ -216,7 +216,7 @@ void PredictiveAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::BUFFERING_LEVEL_CHANGE:
+ case SegmentTrackerEvent::Type::BufferingLevelChange:
{
const ID &id = *event.u.buffering.id;
vlc_mutex_lock(&lock);
@@ -227,7 +227,7 @@ void PredictiveAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
break;
- case SegmentTrackerEvent::SEGMENT_CHANGE:
+ case SegmentTrackerEvent::Type::SegmentChange:
{
const ID &id = *event.u.segment.id;
vlc_mutex_lock(&lock);
diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
index 2885110f83..4101fdeb78 100644
--- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
@@ -107,7 +107,7 @@ void RateBasedAdaptationLogic::updateDownloadRate(const ID &, size_t size, vlc_t
void RateBasedAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
{
- if(event.type == SegmentTrackerEvent::SWITCHING)
+ if(event.type == SegmentTrackerEvent::Type::RepresentationSwitch)
{
vlc_mutex_lock(&lock);
if(event.u.switching.prev)
diff --git a/modules/demux/adaptive/playlist/BasePlaylist.cpp b/modules/demux/adaptive/playlist/BasePlaylist.cpp
index 9fffe77e8d..fa9a1e4cfe 100644
--- a/modules/demux/adaptive/playlist/BasePlaylist.cpp
+++ b/modules/demux/adaptive/playlist/BasePlaylist.cpp
@@ -34,7 +34,7 @@
using namespace adaptive::playlist;
BasePlaylist::BasePlaylist (vlc_object_t *p_object_) :
- ICanonicalUrl(), AttrsNode(Type::PLAYLIST),
+ ICanonicalUrl(), AttrsNode(Type::Playlist),
p_object(p_object_)
{
playbackStart.Set(0);
diff --git a/modules/demux/adaptive/playlist/Inheritables.cpp b/modules/demux/adaptive/playlist/Inheritables.cpp
index c19bba99ba..2b8fae58c9 100644
--- a/modules/demux/adaptive/playlist/Inheritables.cpp
+++ b/modules/demux/adaptive/playlist/Inheritables.cpp
@@ -54,7 +54,7 @@ AttrsNode::AttrsNode(Type t, AttrsNode *parent_)
: AbstractAttr( t )
{
setParentNode(parent_);
- is_canonical_root = (t == SEGMENTINFORMATION);
+ is_canonical_root = (t == Type::SegmentInformation);
}
AttrsNode::~AttrsNode()
@@ -139,7 +139,7 @@ AbstractAttr * AttrsNode::inheritAttribute(AbstractAttr::Type type) const
stime_t AttrsNode::inheritDuration() const
{
- const AbstractAttr *p = inheritAttribute(Type::DURATION);
+ const AbstractAttr *p = inheritAttribute(Type::Duration);
if(p && p->isValid())
return (const stime_t &) *(static_cast<const DurationAttr *>(p));
return 0;
@@ -147,7 +147,7 @@ stime_t AttrsNode::inheritDuration() const
uint64_t AttrsNode::inheritStartNumber() const
{
- const AbstractAttr *p = inheritAttribute(Type::STARTNUMBER);
+ const AbstractAttr *p = inheritAttribute(Type::StartNumber);
if(p && p->isValid())
return (const uint64_t &) *(static_cast<const StartnumberAttr *>(p));
return std::numeric_limits<uint64_t>::max();
@@ -155,7 +155,7 @@ uint64_t AttrsNode::inheritStartNumber() const
Timescale AttrsNode::inheritTimescale() const
{
- const AbstractAttr *p = inheritAttribute(Type::TIMESCALE);
+ const AbstractAttr *p = inheritAttribute(Type::Timescale);
if(p && p->isValid())
return (Timescale) *(static_cast<const TimescaleAttr *>(p));
else
@@ -164,7 +164,7 @@ Timescale AttrsNode::inheritTimescale() const
vlc_tick_t AttrsNode::inheritAvailabilityTimeOffset() const
{
- const AbstractAttr *p = inheritAttribute(Type::AVAILABILITYTTIMEOFFSET);
+ const AbstractAttr *p = inheritAttribute(Type::AvailabilityTimeOffset);
if(p && p->isValid())
return (const vlc_tick_t &) *(static_cast<const AvailabilityTimeOffsetAttr *>(p));
return 0;
@@ -172,7 +172,7 @@ vlc_tick_t AttrsNode::inheritAvailabilityTimeOffset() const
bool AttrsNode::inheritAvailabilityTimeComplete() const
{
- const AbstractAttr *p = inheritAttribute(Type::AVAILABILITYTTIMECOMPLETE);
+ const AbstractAttr *p = inheritAttribute(Type::AvailabilityTimeComplete);
if(p && p->isValid())
return (const bool &) *(static_cast<const AvailabilityTimeCompleteAttr *>(p));
return true;
@@ -180,7 +180,7 @@ bool AttrsNode::inheritAvailabilityTimeComplete() const
SegmentBase * AttrsNode::inheritSegmentBase() const
{
- AbstractAttr *p = inheritAttribute(Type::SEGMENTBASE);
+ AbstractAttr *p = inheritAttribute(Type::SegmentBase);
if(p && p->isValid())
return static_cast<SegmentBase *>(p);
return NULL;
@@ -188,7 +188,7 @@ SegmentBase * AttrsNode::inheritSegmentBase() const
SegmentList * AttrsNode::inheritSegmentList() const
{
- AbstractAttr *p = inheritAttribute(Type::SEGMENTLIST);
+ AbstractAttr *p = inheritAttribute(Type::SegmentList);
if(p && p->isValid())
return static_cast<SegmentList *> (p);
return NULL;
@@ -196,7 +196,7 @@ SegmentList * AttrsNode::inheritSegmentList() const
SegmentTemplate * AttrsNode::inheritSegmentTemplate() const
{
- AbstractAttr *p = inheritAttribute(Type::SEGMENTTEMPLATE);
+ AbstractAttr *p = inheritAttribute(Type::SegmentTemplate);
if(p && p->isValid())
return static_cast<SegmentTemplate *> (p);
return NULL;
@@ -204,7 +204,7 @@ SegmentTemplate * AttrsNode::inheritSegmentTemplate() const
SegmentTimeline * AttrsNode::inheritSegmentTimeline() const
{
- AbstractAttr *p = inheritAttribute(Type::TIMELINE);
+ AbstractAttr *p = inheritAttribute(Type::Timeline);
if(p && p->isValid())
return static_cast<SegmentTimeline *> (p);
return NULL;
diff --git a/modules/demux/adaptive/playlist/Inheritables.hpp b/modules/demux/adaptive/playlist/Inheritables.hpp
index dc00e5e0b5..d76908379a 100644
--- a/modules/demux/adaptive/playlist/Inheritables.hpp
+++ b/modules/demux/adaptive/playlist/Inheritables.hpp
@@ -38,20 +38,20 @@ namespace adaptive
class AbstractAttr
{
public:
- enum Type
+ enum class Type
{
- NONE,
- PLAYLIST,
- SEGMENTINFORMATION,
- SEGMENTLIST,
- SEGMENTBASE,
- SEGMENTTEMPLATE,
- TIMESCALE,
- TIMELINE,
- DURATION,
- STARTNUMBER,
- AVAILABILITYTTIMEOFFSET,
- AVAILABILITYTTIMECOMPLETE,
+ None,
+ Playlist,
+ SegmentInformation,
+ SegmentList,
+ SegmentBase,
+ SegmentTemplate,
+ Timescale,
+ Timeline,
+ Duration,
+ StartNumber,
+ AvailabilityTimeOffset,
+ AvailabilityTimeComplete,
};
AbstractAttr(enum Type);
virtual ~AbstractAttr();
@@ -69,7 +69,7 @@ namespace adaptive
class AttrsNode : public AbstractAttr
{
public:
- AttrsNode( enum Type, AttrsNode * = NULL );
+ AttrsNode( Type, AttrsNode * = NULL );
~AttrsNode();
void addAttribute( AbstractAttr * );
void replaceAttribute( AbstractAttr * );
@@ -108,25 +108,25 @@ namespace adaptive
T value;
};
- typedef AttrWrapper<AbstractAttr::Type::AVAILABILITYTTIMEOFFSET, vlc_tick_t> AvailabilityTimeOffsetAttr;
- typedef AttrWrapper<AbstractAttr::Type::AVAILABILITYTTIMECOMPLETE, bool> AvailabilityTimeCompleteAttr;
- typedef AttrWrapper<AbstractAttr::Type::STARTNUMBER, uint64_t> StartnumberAttr;
+ using AvailabilityTimeOffsetAttr = AttrWrapper<AbstractAttr::Type::AvailabilityTimeOffset, vlc_tick_t>;
+ using AvailabilityTimeCompleteAttr = AttrWrapper<AbstractAttr::Type::AvailabilityTimeComplete, bool>;
+ using StartnumberAttr = AttrWrapper<AbstractAttr::Type::StartNumber, uint64_t>;
class TimescaleAttr:
- public AttrWrapper<AbstractAttr::Type::TIMESCALE, Timescale>
+ public AttrWrapper<AbstractAttr::Type::Timescale, Timescale>
{
public:
TimescaleAttr(Timescale v) :
- AttrWrapper<AbstractAttr::Type::TIMESCALE, Timescale>( v ) {}
+ AttrWrapper<AbstractAttr::Type::Timescale, Timescale>( v ) {}
virtual bool isValid() const { return value.isValid(); }
};
class DurationAttr:
- public AttrWrapper<AbstractAttr::Type::DURATION, stime_t>
+ public AttrWrapper<AbstractAttr::Type::Duration, stime_t>
{
public:
DurationAttr(stime_t v) :
- AttrWrapper<AbstractAttr::Type::DURATION, stime_t>( v ) {}
+ AttrWrapper<AbstractAttr::Type::Duration, stime_t>( v ) {}
virtual bool isValid() const { return value > 0; }
};
}
diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index 11f76b5ee1..ef023a875b 100644
--- a/modules/demux/adaptive/playlist/Segment.cpp
+++ b/modules/demux/adaptive/playlist/Segment.cpp
@@ -62,7 +62,7 @@ bool ISegment::prepareChunk(SharedResources *res, SegmentChunk *chunk, BaseRepre
CommonEncryption enc = encryption;
enc.mergeWith(rep->intheritEncryption());
- if(enc.method != CommonEncryption::Method::NONE)
+ if(enc.method != CommonEncryption::Method::None)
{
CommonEncryptionSession *encryptionSession = new CommonEncryptionSession();
if(!encryptionSession->start(res, enc))
diff --git a/modules/demux/adaptive/playlist/SegmentBase.cpp b/modules/demux/adaptive/playlist/SegmentBase.cpp
index b28dc72834..415340407b 100644
--- a/modules/demux/adaptive/playlist/SegmentBase.cpp
+++ b/modules/demux/adaptive/playlist/SegmentBase.cpp
@@ -34,7 +34,7 @@ using namespace adaptive::playlist;
SegmentBase::SegmentBase(SegmentInformation *parent) :
Segment(parent),
- AbstractSegmentBaseType(parent, AttrsNode::Type::SEGMENTBASE)
+ AbstractSegmentBaseType(parent, AttrsNode::Type::SegmentBase)
{
this->parent = parent;
}
diff --git a/modules/demux/adaptive/playlist/SegmentBaseType.cpp b/modules/demux/adaptive/playlist/SegmentBaseType.cpp
index 1cc85fb474..2054ce9a1a 100644
--- a/modules/demux/adaptive/playlist/SegmentBaseType.cpp
+++ b/modules/demux/adaptive/playlist/SegmentBaseType.cpp
@@ -106,8 +106,8 @@ AbstractMultipleSegmentBaseType::~AbstractMultipleSegmentBaseType()
void AbstractMultipleSegmentBaseType::updateWith(AbstractMultipleSegmentBaseType *updated,
bool)
{
- SegmentTimeline *local = static_cast<SegmentTimeline *>(getAttribute(Type::TIMELINE));
- SegmentTimeline *other = static_cast<SegmentTimeline *>(updated->getAttribute(Type::TIMELINE));
+ SegmentTimeline *local = static_cast<SegmentTimeline *>(getAttribute(Type::Timeline));
+ SegmentTimeline *other = static_cast<SegmentTimeline *>(updated->getAttribute(Type::Timeline));
if(local && other)
local->updateWith(*other);
}
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 43d3a4c008..c111fc5138 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -40,7 +40,7 @@ using namespace adaptive::playlist;
SegmentInformation::SegmentInformation(SegmentInformation *parent_) :
ICanonicalUrl( parent_ ),
- AttrsNode( AbstractAttr::SEGMENTINFORMATION, parent_ )
+ AttrsNode( AbstractAttr::Type::SegmentInformation, parent_ )
{
parent = parent_;
init();
@@ -48,7 +48,7 @@ SegmentInformation::SegmentInformation(SegmentInformation *parent_) :
SegmentInformation::SegmentInformation(BasePlaylist * parent_) :
ICanonicalUrl(parent_),
- AttrsNode( AbstractAttr::SEGMENTINFORMATION, NULL )
+ AttrsNode( AbstractAttr::Type::SegmentInformation, NULL )
{
parent = NULL;
init();
@@ -131,14 +131,14 @@ SegmentInformation * SegmentInformation::getChildByID(const adaptive::ID &id)
void SegmentInformation::updateWith(SegmentInformation *updated)
{
/* Support Segment List for now */
- AbstractAttr *p = getAttribute(Type::SEGMENTLIST);
- if(p && p->isValid() && updated->getAttribute(Type::SEGMENTLIST))
+ AbstractAttr *p = getAttribute(Type::SegmentList);
+ if(p && p->isValid() && updated->getAttribute(Type::SegmentList))
{
inheritSegmentList()->updateWith(updated->inheritSegmentList());
}
- p = getAttribute(Type::SEGMENTTEMPLATE);
- if(p && p->isValid() && updated->getAttribute(Type::SEGMENTTEMPLATE))
+ p = getAttribute(Type::SegmentTemplate);
+ if(p && p->isValid() && updated->getAttribute(Type::SegmentTemplate))
{
inheritSegmentTemplate()->updateWith(updated->inheritSegmentTemplate());
}
@@ -156,11 +156,11 @@ void SegmentInformation::updateWith(SegmentInformation *updated)
void SegmentInformation::pruneByPlaybackTime(vlc_tick_t time)
{
- SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SEGMENTLIST));
+ SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SegmentList));
if(segmentList)
segmentList->pruneByPlaybackTime(time);
- SegmentTemplate *templ = static_cast<SegmentTemplate *>(getAttribute(Type::SEGMENTTEMPLATE));
+ SegmentTemplate *templ = static_cast<SegmentTemplate *>(getAttribute(Type::SegmentTemplate));
if(templ)
templ->pruneByPlaybackTime(time);
@@ -173,18 +173,18 @@ void SegmentInformation::pruneBySegmentNumber(uint64_t num)
{
assert(dynamic_cast<BaseRepresentation *>(this));
- SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SEGMENTLIST));
+ SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SegmentList));
if(segmentList)
segmentList->pruneBySegmentNumber(num);
- SegmentTemplate *templ = static_cast<SegmentTemplate *>(getAttribute(Type::SEGMENTTEMPLATE));
+ SegmentTemplate *templ = static_cast<SegmentTemplate *>(getAttribute(Type::SegmentTemplate));
if(templ)
templ->pruneBySequenceNumber(num);
}
const CommonEncryption & SegmentInformation::intheritEncryption() const
{
- if(parent && commonEncryption.method == CommonEncryption::Method::NONE)
+ if(parent && commonEncryption.method == CommonEncryption::Method::None)
return parent->intheritEncryption();
return commonEncryption;
}
@@ -213,11 +213,11 @@ vlc_tick_t SegmentInformation::getPeriodDuration() const
AbstractSegmentBaseType * SegmentInformation::getProfile() const
{
AbstractAttr *p;
- if((p = getAttribute(Type::SEGMENTTEMPLATE)))
+ if((p = getAttribute(Type::SegmentTemplate)))
return static_cast<SegmentTemplate *> (p);
- else if((p = getAttribute(Type::SEGMENTLIST)))
+ else if((p = getAttribute(Type::SegmentList)))
return static_cast<SegmentList *> (p);
- else if((p = getAttribute(Type::SEGMENTBASE)))
+ else if((p = getAttribute(Type::SegmentBase)))
return static_cast<SegmentBase *> (p);
return NULL;
@@ -225,7 +225,7 @@ AbstractSegmentBaseType * SegmentInformation::getProfile() const
void SegmentInformation::updateSegmentList(SegmentList *list, bool restamp)
{
- SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SEGMENTLIST));
+ SegmentList *segmentList = static_cast<SegmentList *>(getAttribute(Type::SegmentList));
if(segmentList && restamp)
{
segmentList->updateWith(list, restamp);
@@ -239,7 +239,7 @@ void SegmentInformation::updateSegmentList(SegmentList *list, bool restamp)
void SegmentInformation::setSegmentTemplate(SegmentTemplate *templ)
{
- SegmentTemplate *local = static_cast<SegmentTemplate *>(getAttribute(Type::SEGMENTTEMPLATE));
+ SegmentTemplate *local = static_cast<SegmentTemplate *>(getAttribute(Type::SegmentTemplate));
if(local)
{
local->updateWith(templ);
diff --git a/modules/demux/adaptive/playlist/SegmentList.cpp b/modules/demux/adaptive/playlist/SegmentList.cpp
index fbf47e002e..255dc19cdc 100644
--- a/modules/demux/adaptive/playlist/SegmentList.cpp
+++ b/modules/demux/adaptive/playlist/SegmentList.cpp
@@ -35,7 +35,7 @@
using namespace adaptive::playlist;
SegmentList::SegmentList( SegmentInformation *parent_ ):
- AbstractMultipleSegmentBaseType( parent_, AttrsNode::Type::SEGMENTLIST )
+ AbstractMultipleSegmentBaseType( parent_, AttrsNode::Type::SegmentList )
{
totalLength = 0;
}
@@ -301,7 +301,7 @@ void SegmentList::debug(vlc_object_t *obj, int indent) const
std::vector<Segment *>::const_iterator it;
for(it = segments.begin(); it != segments.end(); ++it)
(*it)->debug(obj, indent);
- const AbstractAttr *p = getAttribute(Type::TIMELINE);
+ const AbstractAttr *p = getAttribute(Type::Timeline);
if(p)
static_cast<const SegmentTimeline *> (p)->debug(obj, indent + 1);
}
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index 237698982b..daf8bbc2a2 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -52,7 +52,7 @@ void SegmentTemplateSegment::setSourceUrl(const std::string &url)
}
SegmentTemplate::SegmentTemplate( SegmentInformation *parent ) :
- AbstractMultipleSegmentBaseType( parent, AbstractAttr::Type::SEGMENTTEMPLATE )
+ AbstractMultipleSegmentBaseType( parent, AbstractAttr::Type::SegmentTemplate )
{
initialisationSegment.Set( NULL );
parentSegmentInformation = parent;
@@ -71,14 +71,14 @@ void SegmentTemplate::setSourceUrl( const std::string &url )
void SegmentTemplate::pruneByPlaybackTime(vlc_tick_t time)
{
- AbstractAttr *p = getAttribute(Type::TIMELINE);
+ AbstractAttr *p = getAttribute(Type::Timeline);
if(p)
return static_cast<SegmentTimeline *> (p)->pruneByPlaybackTime(time);
}
size_t SegmentTemplate::pruneBySequenceNumber(uint64_t number)
{
- AbstractAttr *p = getAttribute(Type::TIMELINE);
+ AbstractAttr *p = getAttribute(Type::Timeline);
if(p)
return static_cast<SegmentTimeline *> (p)->pruneBySequenceNumber(number);
return 0;
@@ -113,7 +113,7 @@ void SegmentTemplate::debug(vlc_object_t *obj, int indent) const
{
AbstractSegmentBaseType::debug(obj, indent);
(*segments.begin())->debug(obj, indent);
- const AbstractAttr *p = getAttribute(Type::TIMELINE);
+ const AbstractAttr *p = getAttribute(Type::Timeline);
if(p)
static_cast<const SegmentTimeline *> (p)->debug(obj, indent + 1);
}
diff --git a/modules/demux/adaptive/playlist/SegmentTimeline.cpp b/modules/demux/adaptive/playlist/SegmentTimeline.cpp
index 69aed9bf37..bb73f1a648 100644
--- a/modules/demux/adaptive/playlist/SegmentTimeline.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTimeline.cpp
@@ -34,7 +34,7 @@
using namespace adaptive::playlist;
SegmentTimeline::SegmentTimeline(AbstractMultipleSegmentBaseType *parent_)
- : AttrsNode(Type::TIMELINE, parent_)
+ : AttrsNode(Type::Timeline, parent_)
{
totalLength = 0;
parent = parent_;
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 4fc22457c6..68d43ca3f3 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -571,7 +571,7 @@ void IsoffMainParser::parseProgramInformation(Node * node, MPD *mpd)
Profile IsoffMainParser::getProfile() const
{
- Profile res(Profile::Unknown);
+ Profile res(Profile::Name::Unknown);
if(this->root == NULL)
return res;
@@ -587,7 +587,7 @@ Profile IsoffMainParser::getProfile() const
nextpos = urn.find_first_of(",", pos);
res = Profile(urn.substr(pos, nextpos - pos));
}
- while (nextpos != std::string::npos && res == Profile::Unknown);
+ while (nextpos != std::string::npos && res == Profile::Name::Unknown);
return res;
}
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index ae95452008..51e7a8dc8a 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -54,7 +54,7 @@ bool MPD::isLive() const
{
if(type.empty())
{
- Profile live(Profile::ISOLive);
+ Profile live(Profile::Name::ISOLive);
return profile == live;
}
else
diff --git a/modules/demux/dash/mpd/Profile.cpp b/modules/demux/dash/mpd/Profile.cpp
index a7520c238a..62ce1aee5c 100644
--- a/modules/demux/dash/mpd/Profile.cpp
+++ b/modules/demux/dash/mpd/Profile.cpp
@@ -32,15 +32,15 @@ struct
}
const urnmap[] =
{
- { Profile::Full, "urn:mpeg:dash:profile:full:2011" },
- { Profile::ISOOnDemand, "urn:mpeg:dash:profile:isoff-on-demand:2011" },
- { Profile::ISOOnDemand, "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" },
- { Profile::ISOOnDemand, "urn:mpeg:dash:profile:isoff-ondemand:2011" },
- { Profile::ISOMain, "urn:mpeg:dash:profile:isoff-main:2011" },
- { Profile::ISOLive, "urn:mpeg:dash:profile:isoff-live:2011" },
- { Profile::MPEG2TSMain, "urn:mpeg:dash:profile:mp2t-main:2011" },
- { Profile::MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" },
- { Profile::Unknown, "" },
+ { Profile::Name::Full, "urn:mpeg:dash:profile:full:2011" },
+ { Profile::Name::ISOOnDemand, "urn:mpeg:dash:profile:isoff-on-demand:2011" },
+ { Profile::Name::ISOOnDemand, "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" },
+ { Profile::Name::ISOOnDemand, "urn:mpeg:dash:profile:isoff-ondemand:2011" },
+ { Profile::Name::ISOMain, "urn:mpeg:dash:profile:isoff-main:2011" },
+ { Profile::Name::ISOLive, "urn:mpeg:dash:profile:isoff-live:2011" },
+ { Profile::Name::MPEG2TSMain, "urn:mpeg:dash:profile:mp2t-main:2011" },
+ { Profile::Name::MPEG2TSSimple,"urn:mpeg:dash:profile:mp2t-simple:2011" },
+ { Profile::Name::Unknown, "" },
};
Profile::Profile(Name name)
@@ -55,12 +55,12 @@ Profile::Profile(const std::string &urn)
Profile::Name Profile::getNameByURN(const std::string &urn) const
{
- for( int i=0; urnmap[i].name != Unknown; i++ )
+ for( int i=0; urnmap[i].name != Name::Unknown; i++ )
{
if ( urn == urnmap[i].urn )
return urnmap[i].name;
}
- return Unknown;
+ return Name::Unknown;
}
Profile::operator Profile::Name ()
@@ -70,7 +70,7 @@ Profile::operator Profile::Name ()
Profile::operator std::string ()
{
- for( int i=0; urnmap[i].name != Unknown; i++ )
+ for( int i=0; urnmap[i].name != Name::Unknown; i++ )
{
if ( urnmap[i].name == type )
return std::string( urnmap[i].urn );
diff --git a/modules/demux/dash/mpd/Profile.hpp b/modules/demux/dash/mpd/Profile.hpp
index b0ced80095..10f65ba267 100644
--- a/modules/demux/dash/mpd/Profile.hpp
+++ b/modules/demux/dash/mpd/Profile.hpp
@@ -29,7 +29,7 @@ namespace dash
class Profile
{
public:
- enum Name
+ enum class Name
{
Unknown,
Full,
diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 5dc889d78f..dd1267046a 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -199,7 +199,7 @@ static bool parseEncryption(const AttributesTag *keytag, const Url &playlistUrl,
else
{
/* unsupported or invalid */
- encryption.method = CommonEncryption::Method::NONE;
+ encryption.method = CommonEncryption::Method::None;
encryption.uri.clear();
encryption.iv.clear();
return false;
@@ -296,7 +296,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
discontinuity = false;
}
- if(encryption.method != CommonEncryption::Method::NONE)
+ if(encryption.method != CommonEncryption::Method::None)
segment->setEncryption(encryption);
}
break;
More information about the vlc-commits
mailing list