Commit bac93c6f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Don't hardcode the isLive information.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 5cc04d06)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 51ddaa77
......@@ -106,7 +106,7 @@ static int Open(vlc_object_t *p_obj)
p_sys->p_node = p_node;
p_sys->p_conManager = p_conManager;
p_sys->position = 0;
p_sys->isLive = true;
p_sys->isLive = p_dashManager->getMpdManager()->getMPD()->isLive();
p_stream->p_sys = p_sys;
p_stream->pf_read = Read;
p_stream->pf_peek = Peek;
......
......@@ -158,3 +158,8 @@ Period* BasicCMManager::getNextPeriod (Period *period)
return NULL;
}
const MPD* BasicCMManager::getMPD() const
{
return this->mpd;
}
......@@ -57,6 +57,7 @@ namespace dash
Representation* getBestRepresentation (Period *period);
std::vector<ISegment *> getSegments (Representation *rep);
Representation* getRepresentation (Period *period, long bitrate);
const MPD* getMPD () const;
private:
MPD *mpd;
......
......@@ -16,6 +16,8 @@ namespace dash
{
namespace mpd
{
class MPD;
enum Profile
{
NotValid,
......@@ -32,6 +34,7 @@ namespace dash
virtual Representation* getBestRepresentation (Period *period) = 0;
virtual std::vector<ISegment *> getSegments (Representation *rep) = 0;
virtual Representation* getRepresentation (Period *period, long bitrate) = 0;
virtual const MPD* getMPD () const = 0;
virtual ~IMPDManager(){}
};
}
......
......@@ -65,14 +65,6 @@ const std::string& MPD::getMinBufferTime () const throw(Attrib
return it->second;
}
const std::string& MPD::getType () const throw(AttributeNotPresentException)
{
AttributesMap::const_iterator it = this->attributes.find( "type" );
if( it == this->attributes.end() )
throw AttributeNotPresentException();
return it->second;
}
const std::string& MPD::getDuration () const throw(AttributeNotPresentException)
{
AttributesMap::const_iterator it = this->attributes.find("mediaPresentationDuration");
......@@ -101,3 +93,14 @@ void MPD::setProgramInformation (ProgramInformation *progInf
{
this->programInfo = progInfo;
}
bool MPD::isLive() const
{
AttributesMap::const_iterator it = this->attributes.find("mediaPresentationDuration");
/*
Standard specifies a default of "On-Demand",
so anything that is not "Live" is "On-Demand"
*/
return ( it != this->attributes.end() && it->second == "Live" );
}
......@@ -47,7 +47,7 @@ namespace dash
MPD (const AttributesMap& attributes);
virtual ~MPD();
const std::string& getType () const throw(dash::exception::AttributeNotPresentException);
bool isLive() const;
const std::string& getDuration () const throw(dash::exception::AttributeNotPresentException);
const std::string& getMinBufferTime () const throw(dash::exception::AttributeNotPresentException);
const std::vector<BaseUrl *>& getBaseUrls () const;
......
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