if(this->adaptationLogic->isBufferBased())
this->receiver->OnSegmentBufferStateChanged(fillstateInPercent, maxC);
}
-
void DASHManager::fetchMPD()
{
this->multimediaStream->fetchMPD();
bool start();
void stop();
uint32_t getPosition();
- void setPosition(uint32_t segmentNumber); // to implement
+ void setPosition(uint32_t segmentNumber);
void setLooping(bool looping);
void setPositionInMsec(uint32_t millisec);
void clear();
-// void setRepresentation(dash::mpd::IPeriod *period, dash::mpd::IAdaptationSet *adaptationSet, dash::mpd::IRepresentation *representation);
void setRepresentation();
void enqueueRepresentation(dash::mpd::IPeriod *period, dash::mpd::IAdaptationSet *adaptationSet, dash::mpd::IRepresentation *representation);
void fetchMPD();
private:
- float beta;
- float drop;
- buffer::Buffer<MediaObject> *buffer;
- DASHReceiver *receiver;
- uint32_t readSegmentCount;
- IDASHManagerObserver *multimediaStream;
- bool isRunning;
- bool icn;
- double icnAlpha;
- bool noDecoding;
- libdash::framework::adaptation::IAdaptationLogic *adaptationLogic;
+ float beta;
+ float drop;
+ buffer::Buffer<MediaObject> *buffer;
+ DASHReceiver *receiver;
+ uint32_t readSegmentCount;
+ IDASHManagerObserver *multimediaStream;
+ bool isRunning;
+ bool icn;
+ double icnAlpha;
+ bool noDecoding;
+ libdash::framework::adaptation::IAdaptationLogic *adaptationLogic;
};
}
}
DASHReceiver::DASHReceiver (viper::managers::StreamType type, MPDWrapper *mpdWrapper, IDASHReceiverObserver *obs, Buffer<MediaObject> *buffer, uint32_t bufferSize, bool icnEnabled, double icnAlpha, float beta, float drop) :
type (type),
mpdWrapper (mpdWrapper),
-// period (NULL),
-// adaptationSet (NULL),
-// representation (NULL),
adaptationSetStream (NULL),
-// representationStream (NULL),
segmentNumber (0),
observer (obs),
buffer (buffer),
{
readMax = 32768;
readBuffer = (uint8_t*)malloc(sizeof(uint8_t)*readMax);
-// this->period = this->mpd->GetPeriods().at(0);
-// this->adaptationSet = this->period->GetAdaptationSets().at(0);
-// this->representation = this->adaptationSet->GetRepresentation().at(0);
-
this->adaptationSetStream = new AdaptationSetStream(type, mpdWrapper);
-// this->representationStream = adaptationSetStream->getRepresentationStream(this->representation);
this->segmentOffset = CalculateSegmentOffset();
-// this->representationStream->setSegmentOffset(this->segmentOffset);
this->mpdWrapper->setSegmentOffset(type, this->segmentOffset);
this->conn = NULL;
this->initConn = NULL;
this->drop = drop;
}
+
void SetPosition(uint32_t segmentNumber);
void SetLooping(bool isLoopinp);
void SetPositionInMsecs(uint32_t milliSecs);
-
+ dash::mpd::IRepresentation* GetRepresentation();
void SetRepresentation();
void SetAdaptationLogic(adaptation::IAdaptationLogic *_adaptationLogic);
libdash::framework::adaptation::IAdaptationLogic* GetAdaptationLogic();
float drop;
bool withFeedBack;
bool isBufferBased;
-// std::map<dash::mpd::IRepresentation*, MediaObject*> initSegments;
- std::map<int, MediaObject*> initSegments;
+ std::map<int, MediaObject*> initSegments;
libdash::framework::buffer::Buffer<MediaObject> *buffer;
IDASHReceiverObserver *observer;
- libdash::framework::mpd::MPDWrapper *mpdWrapper;
-// dash::mpd::IMPD *mpd;
-// dash::mpd::IPeriod *period;
-// dash::mpd::IAdaptationSet *adaptationSet;
-// dash::mpd::IRepresentation *representation;
+ libdash::framework::mpd::MPDWrapper *mpdWrapper;
mpd::AdaptationSetStream *adaptationSetStream;
-// mpd::IRepresentationStream *representationStream;
uint32_t segmentNumber;
uint32_t positionInMsecs;
uint32_t segmentOffset;
int bufferLevelAtUpdate;
int readMax;
uint8_t *readBuffer;
- viper::managers::StreamType type;
+ viper::managers::StreamType type;
+
uint32_t CalculateSegmentOffset();
void NotifySegmentDownloaded();
-// void DownloadInitSegment(dash::mpd::IRepresentation* rep);
void DownloadInitSegment();
void DownloadInitSegmentWithoutLock();
-// bool InitSegmentExists(dash::mpd::IRepresentation* rep);
bool InitSegmentExists(int rep);
static void* DoBuffering(void *receiver);
static void* DoMPDFetching(void * data);
this->segmentOffset = offset;
}
-uint32_t AbstractRepresentationStream::getTime(size_t segmentNumber)
+uint64_t AbstractRepresentationStream::getTime(size_t segmentNumber)
{
return 0;
}
-size_t AbstractRepresentationStream::getSegmentNumber(uint32_t time)
+size_t AbstractRepresentationStream::getSegmentNumber(uint64_t time)
{
return 0;
}
virtual dash::mpd::ISegment* getBitstreamSwitchingSegment() = 0;
virtual RepresentationStreamType getStreamType() = 0;
- virtual uint32_t getSize();
- virtual uint32_t getFirstSegmentNumber();
- virtual uint32_t getCurrentSegmentNumber();
- virtual uint32_t getLastSegmentNumber();
- virtual uint32_t getAverageSegmentDuration();
+ virtual uint32_t getSize();
+ virtual uint32_t getFirstSegmentNumber();
+ virtual uint32_t getCurrentSegmentNumber();
+ virtual uint32_t getLastSegmentNumber();
+ virtual uint32_t getAverageSegmentDuration();
- virtual uint32_t getTimescale();
- virtual void setSegmentOffset(uint32_t offset);
- virtual uint32_t getTime(size_t segmentNumber);
- virtual size_t getSegmentNumber(uint32_t time);
+ virtual uint32_t getTimescale();
+ virtual void setSegmentOffset(uint32_t offset);
+ virtual uint64_t getTime(size_t segmentNumber);
+ virtual size_t getSegmentNumber(uint64_t time);
protected:
virtual void setBaseUrls(const std::vector<dash::mpd::IBaseUrl *> baseurls);
- std::vector<dash::mpd::IBaseUrl *> baseUrls;
- libdash::framework::mpd::IMPDWrapper *mpdWrapper;
- dash::mpd::IPeriod *period;
- dash::mpd::IAdaptationSet *adaptationSet;
- dash::mpd::IRepresentation *representation;
- uint32_t segmentOffset;
- viper::managers::StreamType type;
+ std::vector<dash::mpd::IBaseUrl *> baseUrls;
+ libdash::framework::mpd::IMPDWrapper *mpdWrapper;
+ dash::mpd::IPeriod *period;
+ dash::mpd::IAdaptationSet *adaptationSet;
+ dash::mpd::IRepresentation *representation;
+ uint32_t segmentOffset;
+ viper::managers::StreamType type;
};
}
}
class IMPDWrapper
{
public:
- virtual std::string getAvailabilityStarttime() = 0;
- virtual std::string getTimeShiftBufferDepth() = 0;
- virtual std::string getTypeWithoutLock() = 0;
- virtual uint32_t getFetchTime() = 0;
- virtual std::string getMinimumUpdatePeriodWithoutLock() = 0;
- virtual std::vector<dash::mpd::IBaseUrl *> resolveBaseUrl(viper::managers::StreamType type, size_t mpdBaseUrl, size_t periodBaseUrl, size_t adaptationSetBaseUrl) = 0;
- virtual std::vector<dash::mpd::IBaseUrl *> resolveBaseUrl(viper::managers::StreamType type, size_t mpdBaseUrl, size_t periodBaseUrl, size_t adaptationSetBaseUrl, dash::mpd::IMPD* mpd) = 0;
- virtual void releaseLock() = 0;
- virtual std::string getMediaPresentationDuration() = 0;
+ virtual std::string getAvailabilityStarttime() = 0;
+ virtual std::string getTimeShiftBufferDepth() = 0;
+ virtual std::string getTypeWithoutLock() = 0;
+ virtual uint32_t getFetchTime() = 0;
+ virtual std::string getMinimumUpdatePeriodWithoutLock() = 0;
+ virtual std::vector<dash::mpd::IBaseUrl *> resolveBaseUrl(viper::managers::StreamType type, size_t mpdBaseUrl, size_t periodBaseUrl, size_t adaptationSetBaseUrl) = 0;
+ virtual std::vector<dash::mpd::IBaseUrl *> resolveBaseUrl(viper::managers::StreamType type, size_t mpdBaseUrl, size_t periodBaseUrl, size_t adaptationSetBaseUrl, dash::mpd::IMPD* mpd) = 0;
+ virtual void releaseLock() = 0;
+ virtual std::string getMediaPresentationDuration() = 0;
};
}
}
virtual uint32_t getLastSegmentNumber() = 0;
virtual uint32_t getAverageSegmentDuration() = 0;
virtual void setSegmentOffset(uint32_t offset) = 0;
- virtual uint32_t getTime(size_t segmentNumber) = 0;
- virtual size_t getSegmentNumber(uint32_t time) = 0;
+ virtual uint64_t getTime(size_t segmentNumber) = 0;
+ virtual size_t getSegmentNumber(uint64_t time) = 0;
};
}
this->videoRepresentation = representations.at(0);
this->initializeAdaptationSetStreamWithoutLock(viper::managers::StreamType::VIDEO, mpd);
- this->videoSegmentNumber = this->videoRepresentations->find(this->videoRepresentation)->second->getSegmentNumber(time);
+ this->videoSegmentNumber = 0;
}
else
{
{
if(id == std::stoi(representations.at(i)->GetId()))
{
- this->videoRepresentation = representations.at(i);
+ this->audioRepresentation = representations.at(i);
this->destroyAdaptationSetStream(viper::managers::StreamType::AUDIO);
this->initializeAdaptationSetStreamWithoutLock(viper::managers::StreamType::AUDIO, mpd);
this->audioSegmentNumber = this->audioRepresentations->find(this->audioRepresentation)->second->getSegmentNumber(time);
}
this->audioRepresentation = representations.at(0);
this->initializeAdaptationSetStreamWithoutLock(viper::managers::StreamType::AUDIO,mpd);
- this->audioSegmentNumber = this->audioRepresentations->find(this->audioRepresentation)->second->getSegmentNumber(time);
+ this->audioSegmentNumber = 0;
}
else
{
return;
size_t numOfTimelines = 0;
- uint32_t segStartTime = 0;
- uint32_t segDuration = 0;
+ uint64_t segStartTime = 0;
+ uint64_t segDuration = 0;
size_t repeatCount = 0;
- uint32_t totalDuration = 0;
+ uint64_t totalDuration = 0;
numOfTimelines = this->segmentTemplate->GetSegmentTimeline()->GetTimelines().size();
segStartTime = this->segmentTemplate->GetSegmentTimeline()->GetTimelines().at(i)->GetStartTime();
segDuration = this->segmentTemplate->GetSegmentTimeline()->GetTimelines().at(i)->GetDuration();
totalDuration = totalDuration + segDuration;
-
if (repeatCount > 0)
{
for (size_t j = 0; j <= repeatCount; j++)
this->averageDuration = totalDuration / numOfTimelines;
}
-uint32_t SegmentTemplateStream::getTime(size_t segmentNumber)
+uint64_t SegmentTemplateStream::getTime(size_t segmentNumber)
{
if(segmentNumber < this->segmentStartTimes.size())
return this->segmentStartTimes.at(segmentNumber);
return 0;
}
-size_t SegmentTemplateStream::getSegmentNumber(uint32_t time)
+size_t SegmentTemplateStream::getSegmentNumber(uint64_t time)
{
size_t i;
for(i = 0; i < this->segmentStartTimes.size(); i ++)
virtual uint32_t getSize();
virtual uint32_t getAverageSegmentDuration();
virtual uint32_t getTimescale();
- virtual uint32_t getTime(size_t segmentNumber);
- virtual size_t getSegmentNumber(uint32_t time);
+ virtual uint64_t getTime(size_t segmentNumber);
+ virtual size_t getSegmentNumber(uint64_t time);
private:
dash::mpd::ISegmentTemplate* findSegmentTemplate();
void calculateSegmentStartTimes();
dash::mpd::ISegmentTemplate *segmentTemplate;
- std::vector<uint32_t> segmentStartTimes;
+ std::vector<uint64_t> segmentStartTimes;
uint32_t averageDuration;
bool inSync;
uint32_t currentSegment;
bool MultimediaManager::setVideoQuality()
{
+
if (this->videoStream)
this->videoStream->setRepresentation();
return true;
void setPosition(uint32_t segmentNumber);
void setLooping(bool looping);
void setPositionInMsec(uint32_t milliSecs);
-
libdash::framework::input::MediaObject* getSegment();
void setEOS(bool value);
void notifyBufferChange(uint32_t bufferfill, int maxC);
StreamType type;
bool icn;
double icnAlpha;
- mutable CRITICAL_SECTION monitorMutex;
bool noDecoding;
- void init ();
+ void init();
};
}
}
if (!this->settingsChanged(period, videoAdaptationSet, videoRepresentation, audioAdaptationSet, audioRepresentation))
return;
-// IPeriod *currentPeriod = this->multimediaManager->getMPD()->GetPeriods().at(period);
-// std::vector<IAdaptationSet *> videoAdaptationSets = AdaptationSetHelper::getVideoAdaptationSets(currentPeriod);
-// std::vector<IAdaptationSet *> audioAdaptationSets = AdaptationSetHelper::getAudioAdaptationSets(currentPeriod);
-// if (videoAdaptationSet >= 0 && videoRepresentation >= 0)
-// {
-// this->multimediaManager->setVideoQuality(currentPeriod,
-// videoAdaptationSets.at(videoAdaptationSet),
-// videoAdaptationSets.at(videoAdaptationSet)->GetRepresentation().at(videoRepresentation));
-// }
-// else
-// {
-// this->multimediaManager->setVideoQuality(currentPeriod, NULL, NULL);
-// }
this->mpdWrapper->settingsChanged(period, videoAdaptationSet, videoRepresentation, audioAdaptationSet, audioRepresentation);
this->multimediaManager->setVideoQuality();
}
* This integer will be formated according to a possibly contained format tag in the \em \$Time\$ identifier.
* @return a pointer to a dash::mpd::ISegment object
*/
- virtual ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const = 0;
+ virtual ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const = 0;
/**
* Returns a pointer to a dash::mpd::ISegment object that represents a Index Segment and can be downloaded.
* This integer will be formated according to a possibly contained format tag in the \em \$Time\$ identifier.
* @return a pointer to a dash::mpd::ISegment object
*/
- virtual ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const = 0;
+ virtual ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const = 0;
};
}
}
-#endif /* ISEGMENTTEMPLATE_H_ */
\ No newline at end of file
+#endif /* ISEGMENTTEMPLATE_H_ */
* \em StartTime corresponds to the \c \@t attribute.
* @return an unsigned integer
*/
- virtual uint32_t GetStartTime () const = 0;
+ virtual uint64_t GetStartTime () const = 0;
/**
* Returns the integer that specifies the Segment duration, in units of the value of the \c \@timescale. \n\n
* \em Duration corresponds to the \c \@d attribute.
* @return an unsigned integer
*/
- virtual uint32_t GetDuration () const = 0;
+ virtual uint64_t GetDuration () const = 0;
/**
* Returns an integer that specifies the repeat count of the number of following contiguous Segments with the same duration expressed by the value of \c \@d.
* \em RepeatCount corresponds to the \c \@r attribute.
* @return an unsigned integer
*/
- virtual uint32_t GetRepeatCount () const = 0;
+ virtual uint64_t GetRepeatCount () const = 0;
};
}
}
-#endif /* ITIMELINE_H_ */
\ No newline at end of file
+#endif /* ITIMELINE_H_ */
{
return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, number);
}
-ISegment* SegmentTemplate::GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const
+ISegment* SegmentTemplate::GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const
{
return ToSegment(this->media, baseurls, representationID, bandwidth, dash::metrics::MediaSegment, 0, time);
}
-ISegment* SegmentTemplate::GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const
+ISegment* SegmentTemplate::GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const
{
return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, 0, time);
}
-std::string SegmentTemplate::ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const
+std::string SegmentTemplate::ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint64_t time) const
{
std::vector<std::string> chunks;
std::string replacedUri = "";
return replacedUri;
}
}
-void SegmentTemplate::FormatChunk (std::string& uri, uint32_t number) const
+void SegmentTemplate::FormatChunk (std::string& uri, uint64_t number) const
{
char formattedNumber [50];
size_t pos = 0;
- std::string formatTag = "%01d";
+ std::string formatTag = "%01lu";
if ( (pos = uri.find("%0")) != std::string::npos)
formatTag = uri.substr(pos).append("d");
-
sprintf(formattedNumber, formatTag.c_str(), number);
uri = formattedNumber;
}
-ISegment* SegmentTemplate::ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, HTTPTransactionType type, uint32_t number, uint32_t time) const
+ISegment* SegmentTemplate::ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, HTTPTransactionType type, uint32_t number, uint64_t time) const
{
Segment *seg = new Segment();
delete(seg);
return NULL;
-}
\ No newline at end of file
+}
ISegment* ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const;
ISegment* GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const;
ISegment* GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const;
- ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const;
- ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const;
+ ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const;
+ ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint64_t time) const;
void SetMedia (const std::string& media);
void SetIndex (const std::string& index);
void SetBitstreamSwitching (const std::string& bitstreamSwichting);
private:
- std::string ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const;
- void FormatChunk (std::string& uri, uint32_t number) const;
+ std::string ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint64_t time) const;
+ void FormatChunk (std::string& uri, uint64_t number) const;
ISegment* ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth,
- dash::metrics::HTTPTransactionType type, uint32_t number = 0, uint32_t time = 0) const;
+ dash::metrics::HTTPTransactionType type, uint32_t number = 0, uint64_t time = 0) const;
std::string media;
std::string index;
{
}
-uint32_t Timeline::GetStartTime () const
+uint64_t Timeline::GetStartTime () const
{
return this->startTime;
}
-void Timeline::SetStartTime (uint32_t startTime)
+void Timeline::SetStartTime (uint64_t startTime)
{
this->startTime = startTime;
}
-uint32_t Timeline::GetDuration () const
+uint64_t Timeline::GetDuration () const
{
return this->duration;
}
-void Timeline::SetDuration (uint32_t duration)
+void Timeline::SetDuration (uint64_t duration)
{
this->duration = duration;
}
-uint32_t Timeline::GetRepeatCount () const
+uint64_t Timeline::GetRepeatCount () const
{
return this->repeatCount;
}
-void Timeline::SetRepeatCount (uint32_t repeatCount)
+void Timeline::SetRepeatCount (uint64_t repeatCount)
{
this->repeatCount = repeatCount;
-}
\ No newline at end of file
+}
Timeline ();
virtual ~Timeline ();
- uint32_t GetStartTime () const;
- uint32_t GetDuration () const;
- uint32_t GetRepeatCount () const;
+ uint64_t GetStartTime () const;
+ uint64_t GetDuration () const;
+ uint64_t GetRepeatCount () const;
- void SetStartTime (uint32_t startTime);
- void SetDuration (uint32_t duration);
- void SetRepeatCount (uint32_t repeatCount);
+ void SetStartTime (uint64_t startTime);
+ void SetDuration (uint64_t duration);
+ void SetRepeatCount (uint64_t repeatCount);
private:
- uint32_t startTime;
- uint32_t duration;
- uint32_t repeatCount;
+ uint64_t startTime;
+ uint64_t duration;
+ uint64_t repeatCount;
};
}
}
if (this->HasAttribute("t"))
{
+ uint64_t yolo = strtoul(this->GetAttributeValue("t").c_str(), NULL, 10);
timeline->SetStartTime(strtoul(this->GetAttributeValue("t").c_str(), NULL, 10));
}
if (this->HasAttribute("d"))