Commit df82d1c3 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: simplify MPD set/getters

parent 442030d6
......@@ -154,7 +154,7 @@ mtime_t DASHManager::getDuration() const
if (mpd->isLive())
return 0;
else
return CLOCK_FREQ * mpd->getDuration();
return CLOCK_FREQ * mpd->duration.Get();
}
bool DASHManager::setPosition(mtime_t time)
......
......@@ -242,7 +242,7 @@ static int Control (demux_t *p_demux, int i_query, va_list args)
case DEMUX_GET_META:
{
if(!p_sys->p_mpd->getProgramInformation())
if(!p_sys->p_mpd->programInfo.Get())
break;
vlc_meta_t *p_meta = (vlc_meta_t *) va_arg (args, vlc_meta_t*);
......@@ -250,17 +250,17 @@ static int Control (demux_t *p_demux, int i_query, va_list args)
if (meta == NULL)
return VLC_EGENERIC;
if(!p_sys->p_mpd->getProgramInformation()->getTitle().empty())
vlc_meta_SetTitle(meta, p_sys->p_mpd->getProgramInformation()->getTitle().c_str());
if(!p_sys->p_mpd->programInfo.Get()->getTitle().empty())
vlc_meta_SetTitle(meta, p_sys->p_mpd->programInfo.Get()->getTitle().c_str());
if(!p_sys->p_mpd->getProgramInformation()->getSource().empty())
vlc_meta_SetPublisher(meta, p_sys->p_mpd->getProgramInformation()->getSource().c_str());
if(!p_sys->p_mpd->programInfo.Get()->getSource().empty())
vlc_meta_SetPublisher(meta, p_sys->p_mpd->programInfo.Get()->getSource().c_str());
if(!p_sys->p_mpd->getProgramInformation()->getCopyright().empty())
vlc_meta_SetCopyright(meta, p_sys->p_mpd->getProgramInformation()->getCopyright().c_str());
if(!p_sys->p_mpd->programInfo.Get()->getCopyright().empty())
vlc_meta_SetCopyright(meta, p_sys->p_mpd->programInfo.Get()->getCopyright().c_str());
if(!p_sys->p_mpd->getProgramInformation()->getMoreInformationUrl().empty())
vlc_meta_SetURL(meta, p_sys->p_mpd->getProgramInformation()->getMoreInformationUrl().c_str());
if(!p_sys->p_mpd->programInfo.Get()->getMoreInformationUrl().empty())
vlc_meta_SetURL(meta, p_sys->p_mpd->programInfo.Get()->getMoreInformationUrl().c_str());
vlc_meta_Merge(p_meta, meta);
vlc_meta_Delete(meta);
......
......@@ -67,11 +67,11 @@ void IsoffMainParser::setMPDAttributes ()
it = attr.find("mediaPresentationDuration");
if(it != attr.end())
this->mpd->setDuration(IsoTime(it->second));
this->mpd->duration.Set(IsoTime(it->second));
it = attr.find("minBufferTime");
if(it != attr.end())
this->mpd->setMinBufferTime(IsoTime(it->second));
this->mpd->minBufferTime.Set(IsoTime(it->second));
it = attr.find("type");
if(it != attr.end())
......@@ -79,11 +79,11 @@ void IsoffMainParser::setMPDAttributes ()
it = attr.find("availabilityStartTime");
if(it != attr.end())
mpd->setAvailabilityStartTime(UTCTime(it->second));
mpd->availabilityStartTime.Set(UTCTime(it->second));
it = attr.find("timeShiftBufferDepth");
if(it != attr.end())
mpd->setTimeShiftBufferDepth(IsoTime(it->second));
mpd->timeShiftBufferDepth.Set(IsoTime(it->second));
}
void IsoffMainParser::parsePeriods(Node *root)
......@@ -397,7 +397,7 @@ void IsoffMainParser::parseProgramInformation(Node * node, MPD *mpd)
if(node->hasAttribute("moreInformationURL"))
info->setMoreInformationUrl(node->getAttributeValue("moreInformationURL"));
mpd->setProgramInformation(info);
mpd->programInfo.Set(info);
}
}
......@@ -407,8 +407,8 @@ void IsoffMainParser::print ()
{
msg_Dbg(p_stream, "MPD profile=%s mediaPresentationDuration=%ld minBufferTime=%ld",
static_cast<std::string>(mpd->getProfile()).c_str(),
mpd->getDuration(),
mpd->getMinBufferTime());
mpd->duration.Get(),
mpd->minBufferTime.Get());
msg_Dbg(p_stream, "BaseUrl=%s", mpd->getUrlSegment().toString().c_str());
std::vector<Period *>::const_iterator i;
......
......@@ -36,16 +36,16 @@ using namespace dash::mpd;
MPD::MPD (stream_t *stream_, Profile profile_) :
ICanonicalUrl(),
stream(stream_),
profile( profile_ ),
availabilityStartTime( 0 ),
availabilityEndTime( 0 ),
duration( 0 ),
minUpdatePeriod( -1 ),
minBufferTime( 0 ),
timeShiftBufferDepth( 0 ),
programInfo( NULL )
profile( profile_ )
{
playbackStart.Set(0);
availabilityStartTime.Set( 0 );
availabilityEndTime.Set( 0 );
duration.Set( 0 );
minUpdatePeriod.Set( 0 );
minBufferTime.Set( 0 );
timeShiftBufferDepth.Set( 0 );
programInfo.Set( NULL );
}
MPD::~MPD ()
......@@ -56,7 +56,7 @@ MPD::~MPD ()
for(size_t i = 0; i < this->baseUrls.size(); i++)
delete(this->baseUrls.at(i));
delete(this->programInfo);
delete(programInfo.Get());
}
const std::vector<Period*>& MPD::getPeriods () const
......@@ -64,55 +64,6 @@ const std::vector<Period*>& MPD::getPeriods () const
return this->periods;
}
time_t MPD::getDuration() const
{
return this->duration;
}
void MPD::setDuration(time_t duration)
{
if ( duration >= 0 )
this->duration = duration;
}
time_t MPD::getMinUpdatePeriod() const
{
return this->minUpdatePeriod;
}
void MPD::setMinUpdatePeriod(time_t period)
{
if ( period >= 0 )
this->minUpdatePeriod = period;
}
time_t MPD::getMinBufferTime() const
{
return this->minBufferTime;
}
void MPD::setMinBufferTime(time_t time)
{
if ( time >= 0 )
this->minBufferTime = time;
}
time_t MPD::getTimeShiftBufferDepth() const
{
return this->timeShiftBufferDepth;
}
void MPD::setTimeShiftBufferDepth(time_t depth)
{
if ( depth >= 0 )
this->timeShiftBufferDepth = depth;
}
const ProgramInformation* MPD::getProgramInformation () const
{
return this->programInfo;
}
void MPD::addBaseUrl (BaseUrl *url)
{
this->baseUrls.push_back(url);
......@@ -121,10 +72,6 @@ void MPD::addPeriod (Period *period)
{
this->periods.push_back(period);
}
void MPD::setProgramInformation (ProgramInformation *progInfo)
{
this->programInfo = progInfo;
}
bool MPD::isLive() const
{
......@@ -142,28 +89,6 @@ void MPD::setType(const std::string &type_)
type = type_;
}
time_t MPD::getAvailabilityStartTime() const
{
return this->availabilityStartTime;
}
void MPD::setAvailabilityStartTime(time_t time)
{
if ( time >=0 )
this->availabilityStartTime = time;
}
time_t MPD::getAvailabilityEndTime() const
{
return this->availabilityEndTime;
}
void MPD::setAvailabilityEndTime(time_t time)
{
if ( time >= 0 )
this->availabilityEndTime = time;
}
Profile MPD::getProfile() const
{
return profile;
......
......@@ -48,24 +48,10 @@ namespace dash
Profile getProfile() const;
bool isLive() const;
time_t getAvailabilityStartTime() const;
void setAvailabilityStartTime( time_t time );
time_t getAvailabilityEndTime() const;
void setAvailabilityEndTime( time_t time );
void setType(const std::string &);
time_t getDuration() const;
void setDuration( time_t duration );
time_t getMinUpdatePeriod() const;
void setMinUpdatePeriod( time_t period );
time_t getMinBufferTime() const;
void setMinBufferTime( time_t time );
time_t getTimeShiftBufferDepth() const;
void setTimeShiftBufferDepth( time_t depth );
const ProgramInformation* getProgramInformation() const;
void addPeriod (Period *period);
void addBaseUrl (BaseUrl *url);
void setProgramInformation (ProgramInformation *progInfo);
virtual Url getUrlSegment() const; /* impl */
vlc_object_t * getVLCObject() const;
......@@ -74,20 +60,20 @@ namespace dash
virtual Period* getFirstPeriod() const;
virtual Period* getNextPeriod(Period *period);
Property<time_t> duration;
Property<time_t> playbackStart;
Property<time_t> availabilityEndTime;
Property<time_t> availabilityStartTime;
Property<time_t> minUpdatePeriod;
Property<time_t> minBufferTime;
Property<time_t> timeShiftBufferDepth;
Property<ProgramInformation *> programInfo;
private:
stream_t *stream;
Profile profile;
time_t availabilityStartTime;
time_t availabilityEndTime;
time_t duration;
time_t minUpdatePeriod;
time_t minBufferTime;
time_t timeShiftBufferDepth;
std::vector<Period *> periods;
std::vector<BaseUrl *> baseUrls;
ProgramInformation *programInfo;
std::string type;
};
}
......
......@@ -113,7 +113,7 @@ size_t Url::Component::getSegmentNumber(size_t index, const Representation *rep)
else if(templ->duration.Get())
{
mtime_t playbackstart = rep->getMPD()->playbackStart.Get();
mtime_t streamstart = rep->getMPD()->getAvailabilityStartTime();
mtime_t streamstart = rep->getMPD()->availabilityStartTime.Get();
streamstart += rep->getPeriodStart();
mtime_t duration = templ->duration.Get();
uint64_t timescale = templ->timescale.Get() ?
......
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