Commit 83a72ce8 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: split common inheritable classes

parent a649c63e
......@@ -294,6 +294,8 @@ libdash_plugin_la_SOURCES += \
demux/adaptative/playlist/CommonAttributesElements.cpp \
demux/adaptative/playlist/CommonAttributesElements.h \
demux/adaptative/playlist/ICanonicalUrl.hpp \
demux/adaptative/playlist/Inheritables.hpp \
demux/adaptative/playlist/Inheritables.cpp \
demux/adaptative/playlist/Segment.cpp \
demux/adaptative/playlist/Segment.h \
demux/adaptative/playlist/SegmentBase.cpp \
......@@ -310,6 +312,7 @@ libdash_plugin_la_SOURCES += \
demux/adaptative/playlist/SegmentTemplate.h \
demux/adaptative/playlist/Url.cpp \
demux/adaptative/playlist/Url.hpp \
demux/adaptative/playlist/Templates.hpp \
demux/adaptative/logic/AbstractAdaptationLogic.cpp \
demux/adaptative/logic/AbstractAdaptationLogic.h \
demux/adaptative/logic/AlwaysBestAdaptationLogic.cpp \
......
......@@ -20,6 +20,7 @@
#include "SegmentTracker.hpp"
#include "playlist/AbstractPlaylist.hpp"
#include "playlist/BaseRepresentation.h"
#include "playlist/Segment.h"
#include "logic/AbstractAdaptationLogic.h"
using namespace adaptative;
......
/*****************************************************************************
* Inheritables.cpp
*****************************************************************************
* Copyright (C) 1998-2015 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "Inheritables.hpp"
#include "SegmentTimeline.h"
using namespace adaptative::playlist;
Timelineable::Timelineable()
{
segmentTimeline.Set(NULL);
}
Timelineable::~Timelineable()
{
delete segmentTimeline.Get();
}
TimescaleAble::TimescaleAble(TimescaleAble *parent)
{
timescale.Set(0);
parentTimescale = parent;
}
TimescaleAble::~TimescaleAble()
{
}
uint64_t TimescaleAble::inheritTimescale() const
{
if(timescale.Get())
return timescale.Get();
else if(parentTimescale)
return parentTimescale->inheritTimescale();
else
return 1;
}
/*****************************************************************************
* Inheritables.hpp Nodes inheritables properties
*****************************************************************************
* Copyright (C) 1998-2015 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef INHERITABLES_H
#define INHERITABLES_H
#include "../tools/Properties.hpp"
#include <string>
namespace adaptative
{
namespace playlist
{
class SegmentTimeline;
class Timelineable
{
public:
Timelineable();
~Timelineable();
Property<SegmentTimeline *> segmentTimeline;
};
class TimescaleAble
{
public:
TimescaleAble( TimescaleAble * = NULL );
~TimescaleAble();
uint64_t inheritTimescale() const;
Property<uint64_t> timescale;
protected:
TimescaleAble *parentTimescale;
};
template<class T> class UniqueNess
{
public:
UniqueNess(){}
~UniqueNess() {}
void setId(const std::string &id_) {id = id_;}
const std::string & getId() const {return id;}
bool sameAs(const T &other) const
{
return (!id.empty() && id == other.id);
}
private:
std::string id;
};
}
}
#endif // INHERITABLES_H
......@@ -28,41 +28,8 @@
#include "SegmentInfoCommon.h"
#include "Segment.h"
#include "SegmentTimeline.h"
using namespace adaptative::playlist;
Timelineable::Timelineable()
{
segmentTimeline.Set(NULL);
}
Timelineable::~Timelineable()
{
delete segmentTimeline.Get();
}
TimescaleAble::TimescaleAble(TimescaleAble *parent)
{
timescale.Set(0);
parentTimescale = parent;
}
TimescaleAble::~TimescaleAble()
{
}
uint64_t TimescaleAble::inheritTimescale() const
{
if(timescale.Get())
return timescale.Get();
else if(parentTimescale)
return parentTimescale->inheritTimescale();
else
return 1;
}
SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) :
ICanonicalUrl( parent ), Initializable(), Indexable(),
duration( 0 ),
......
......@@ -27,79 +27,17 @@
#include <string>
#include <list>
#include <ctime>
#include "ICanonicalUrl.hpp"
#include "Inheritables.hpp"
#include "Templates.hpp"
#include "Segment.h"
#include "ICanonicalUrl.hpp"
#include "../tools/Properties.hpp"
namespace adaptative
{
namespace playlist
{
class SegmentTimeline;
template<class T> class Initializable
{
public:
Initializable()
{
initialisationSegment.Set(NULL);
}
~Initializable()
{
delete initialisationSegment.Get();
}
Property<T *> initialisationSegment;
};
template<class T> class Indexable
{
public:
Indexable()
{
indexSegment.Set(NULL);
}
~Indexable()
{
delete indexSegment.Get();
}
Property<T *> indexSegment;
};
class Timelineable
{
public:
Timelineable();
~Timelineable();
Property<SegmentTimeline *> segmentTimeline;
};
class TimescaleAble
{
public:
TimescaleAble( TimescaleAble * = NULL );
~TimescaleAble();
uint64_t inheritTimescale() const;
Property<uint64_t> timescale;
private:
TimescaleAble *parentTimescale;
};
template<class T> class UniqueNess
{
public:
UniqueNess(){}
~UniqueNess() {}
void setId(const std::string &id_) {id = id_;}
const std::string & getId() const {return id;}
bool sameAs(const T &other) const
{
return (!id.empty() && id == other.id);
}
private:
std::string id;
};
class Segment;
class SegmentInfoCommon : public ICanonicalUrl,
public Initializable<Segment>,
......
/*****************************************************************************
* Templates.hpp
*****************************************************************************
* Copyright (C) 2014-2015 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef TEMPLATES_HPP
#define TEMPLATES_HPP
namespace adaptative
{
namespace playlist
{
template<class T> class Initializable
{
public:
Initializable()
{
initialisationSegment.Set(NULL);
}
~Initializable()
{
delete initialisationSegment.Get();
}
Property<T *> initialisationSegment;
};
template<class T> class Indexable
{
public:
Indexable()
{
indexSegment.Set(NULL);
}
~Indexable()
{
delete indexSegment.Get();
}
Property<T *> indexSegment;
};
}
}
#endif // TEMPLATES_HPP
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment