this->receiver->OnSegmentBufferStateChanged(fillstateInPercent, maxC);
}
-void DASHManager::updateMPD(IMPD* mpd)
-{
-// this->receiver->updateMPD(mpd);
-}
-
void DASHManager::fetchMPD()
{
this->multimediaStream->fetchMPD();
void setTargetDownloadingTime(double);
MediaObject* getSegment();
void onBufferStateChanged(BufferType type, uint32_t fillstateInPercent, int maxC);
- void updateMPD(dash::mpd::IMPD* mpd);
void fetchMPD();
private:
{
return this->adaptationLogic;
}
-dash::mpd::IRepresentation* DASHReceiver::GetRepresentation ()
-{
- return NULL;
-}
+
uint32_t DASHReceiver::CalculateSegmentOffset ()
{
return this->mpdWrapper->calculateSegmentOffset(type, bufferSize);
this->observer->onSegmentDownloaded();
}
-void DASHReceiver::NotifyBitrateChange(dash::mpd::IRepresentation *representation)
-{
-// if(this->representation != representation)
-// {
-// this->representation = representation;
-// this->SetRepresentation(this->period,this->adaptationSet,this->representation);
-// }
-}
void DASHReceiver::DownloadInitSegmentWithoutLock ()
{
int rep = std::stoi(this->mpdWrapper->getRepresentationIDWithoutLock(type).c_str());
this->drop = drop;
}
-void DASHReceiver::updateMPD(IMPD* mpd)
-{
-// EnterCriticalSection(&this->monitorMutex);
- //First we need to find the new segmentNumber -> what is the segment time now?
-// uint32_t time = this->representationStream->getTime(this->segmentNumber);
-// printf("old segmentNumber!: %d\n", this->segmentNumber);
-// printf("time: %u\n", time);
- //Second, replace the MPD with the new one
-// delete(this->mpd);
-// this->mpd = mpd;
-//
- //Third, Update all the structures associated to the mpd
-// this->period = this->mpd->GetPeriods().at(0);
-// this->adaptationSet = this->period->GetAdaptationSets().at(0);
-// this->representation = this->adaptationSet->GetRepresentation().at(0);
-// delete(this->adaptationSetStream);
-// this->adaptationSetStream = new AdaptationSetStream(mpd, period, adaptationSet);
-// this->representationStream = adaptationSetStream->getRepresentationStream(this->representation);
-// this->segmentOffset = CalculateSegmentOffset();
-// this->representationStream->setSegmentOffset(this->segmentOffset);
-//
- //Fourth, Set the new segmentNumber by finding the index of the segment associated to 'uint32_t time' in the new mpd
-// this->segmentNumber = this->representationStream->getSegmentNumber(time);
-// printf("new segmentNumber!: %d\n", this->segmentNumber);
-// LeaveCriticalSection(&this->monitorMutex);
-}
-
input::MediaObject* GetSegment(uint32_t segmentNumber);
input::MediaObject* GetInitSegment();
input::MediaObject* GetInitSegmentWithoutLock();
-// input::MediaObject* FindInitSegment(dash::mpd::IRepresentation *representation);
input::MediaObject* FindInitSegment(int representation);
uint32_t GetPosition();
void SetPosition(uint32_t segmentNumber);
void SetLooping(bool isLoopinp);
void SetPositionInMsecs(uint32_t milliSecs);
- dash::mpd::IRepresentation* GetRepresentation();
-// void SetRepresentation(dash::mpd::IPeriod *period,
-// dash::mpd::IAdaptationSet *adaptationSet,
-// dash::mpd::IRepresentation *representation);
+
void SetRepresentation();
void SetAdaptationLogic(adaptation::IAdaptationLogic *_adaptationLogic);
libdash::framework::adaptation::IAdaptationLogic* GetAdaptationLogic();
void NotifyQualityDownloading(uint32_t quality);
void Notifybps(uint64_t bps);
void NotifyDLTime(double time);
- void NotifyBitrateChange(dash::mpd::IRepresentation *representation);
void OnSegmentBufferStateChanged(uint32_t fillstateInPercent, int maxC);
bool IsICN();
void ShouldAbort();
bool CanPush();
void SetBeta(float beta);
void SetDrop(float drop);
- void updateMPD(dash::mpd::IMPD* mpd);
private:
float beta;
public:
virtual ~IDASHManagerObserver() {}
- virtual void addFrame(QImage *frame) = 0;
virtual void setEOS(bool value)= 0;
virtual void onSegmentBufferStateChanged(uint32_t fillstateInPercent, int maxC) = 0;
bool MultimediaManager::setVideoQuality()
{
-
if (this->videoStream)
this->videoStream->setRepresentation();
return true;
using namespace dash::mpd;
MultimediaStream::MultimediaStream(StreamType type, MPDWrapper *mpdWrapper, uint32_t bufferSize, bool icnEnabled, double icnAlpha, bool nodecoding, float beta, float drop) :
- type (type),
- segmentBufferSize (bufferSize),
- dashManager (NULL),
- mpdWrapper (mpdWrapper),
- icn (icnEnabled),
- icnAlpha (icnAlpha),
- noDecoding (nodecoding),
- beta (beta),
- drop (drop)
-{
-// InitializeCriticalSection (&this->monitorMutex);
+ type (type),
+ segmentBufferSize (bufferSize),
+ dashManager (NULL),
+ mpdWrapper (mpdWrapper),
+ icn (icnEnabled),
+ icnAlpha (icnAlpha),
+ noDecoding (nodecoding),
+ beta (beta),
+ drop (drop)
+{
this->init();
}
MultimediaStream::~MultimediaStream ()
{
-// DestroyCriticalSection (&this->monitorMutex);
this->stop();
delete this->dashManager;
}
this->dashManager->clear();
}
-void MultimediaStream::addFrame(QImage *frame)
-{
-}
-
-QImage* MultimediaStream::getFrame()
-{
- return NULL;
-}
-
void MultimediaStream::attachStreamObserver(IStreamObserver *observer)
{
this->observers.push_back(observer);
this->dashManager->onBufferStateChanged(libdash::framework::buffer::VIDEO, bufferfill, maxC);
}
-void MultimediaStream::updateMPD (IMPD* mpd)
-{
-// this->mpd = mpd;
-// this->dashManager->updateMPD(mpd);
-}
-
void MultimediaStream::fetchMPD()
{
for(size_t i=0; i < this->observers.size(); i++)
void setLooping(bool looping);
void setPositionInMsec(uint32_t milliSecs);
- void addFrame(QImage *frame);
- QImage* getFrame();
libdash::framework::input::MediaObject* getSegment();
-
void setEOS(bool value);
-
void notifyBufferChange(uint32_t bufferfill, int maxC);
-
-// 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 setAdaptationLogic(libdash::framework::adaptation::IAdaptationLogic *logic);
bool isICN();
void shouldAbort();
void setTargetDownloadingTime(double);
- void updateMPD(dash::mpd::IMPD* mpd);
void fetchMPD();
private:
- float beta;
- float drop;
- std::vector<IStreamObserver *> observers;
- libdash::framework::mpd::MPDWrapper *mpdWrapper;
- libdash::framework::adaptation::IAdaptationLogic *logic;
- libdash::framework::input::DASHManager *dashManager;
- uint32_t segmentBufferSize;
- StreamType type;
- bool icn;
- double icnAlpha;
- mutable CRITICAL_SECTION monitorMutex;
+ float beta;
+ float drop;
+ std::vector<IStreamObserver *> observers;
+ libdash::framework::mpd::MPDWrapper *mpdWrapper;
+ libdash::framework::adaptation::IAdaptationLogic *logic;
+ libdash::framework::input::DASHManager *dashManager;
+ uint32_t segmentBufferSize;
+ StreamType type;
+ bool icn;
+ double icnAlpha;
+ mutable CRITICAL_SECTION monitorMutex;
+ bool noDecoding;
- bool noDecoding;
void init ();
};
}
}
}
this->setSettings(-1, -1, -1, -1, -1);
- this->gui->setGuiFields(this->mpdWrapper->getMPD());
+ this->gui->setMPDDuration(this->mpdWrapper->getMPD());
return true;
}
pthread_mutex_destroy(&(this->monitorMutex));
}
-void ViperGui::setGuiFields(dash::mpd::IMPD* mpd)
-{
-//USELESS CALLS
-// this->setPeriodComboBox(mpd);
-// if (mpd->GetPeriods().size() > 0)
-// {
-// IPeriod *period = mpd->GetPeriods().at(0);
-// this->setVideoAdaptationSetComboBox(period);
-// if (!AdaptationSetHelper::getVideoAdaptationSets(period).empty())
-// {
-// IAdaptationSet *adaptationSet = AdaptationSetHelper::getVideoAdaptationSets(period).at(0);
-// this->setRepresentationComoboBox(adaptationSet);
-// }
-// if (!AdaptationSetHelper::getAudioAdaptationSets(period).empty())
-// {
-// IAdaptationSet *adaptationSet = AdaptationSetHelper::getAudioAdaptationSets(period).at(0);
-// this->setRepresentationComoboBox(adaptationSet);
-// }
-// }
+void ViperGui::setMPDDuration(dash::mpd::IMPD* mpd)
+{
if(!strcmp(mpd->GetType().c_str(),"static"))
{
parse8601(mpd->GetMediaPresentationDuration());
this->durationString.assign(timeStamp);
}
-void ViperGui::setRepresentationComoboBox(dash::mpd::IAdaptationSet *adaptationSet)
-{
- std::vector<IRepresentation *> represenations = adaptationSet->GetRepresentation();
- for(size_t i = 0; i < represenations.size(); i++)
- {
- IRepresentation *representation = represenations.at(i);
- }
-}
-void ViperGui::setAdaptationSetComboBox(dash::mpd::IPeriod *period)
-{
- std::vector<IAdaptationSet *> adaptationSets = period->GetAdaptationSets();
- for(size_t i = 0; i < adaptationSets.size(); i++)
- {
- IAdaptationSet *adaptationSet = adaptationSets.at(i);
- }
-}
-
-void ViperGui::setAudioAdaptationSetComboBox(dash::mpd::IPeriod *period)
-{
- std::vector<IAdaptationSet *> adaptationSets = AdaptationSetHelper::getAudioAdaptationSets(period);
- for(size_t i = 0; i < adaptationSets.size(); i++)
- {
- IAdaptationSet *adaptationSet = adaptationSets.at(i);
- }
-}
-
-void ViperGui::setVideoAdaptationSetComboBox(dash::mpd::IPeriod *period)
-{
- std::vector<IAdaptationSet *> adaptationSets = AdaptationSetHelper::getVideoAdaptationSets(period);
- for(size_t i = 0; i < adaptationSets.size(); i++)
- {
- IAdaptationSet *adaptationSet = adaptationSets.at(i);
- }
-}
-void ViperGui::setPeriodComboBox(dash::mpd::IMPD *mpd)
-{
- std::vector<IPeriod *> periods = mpd->GetPeriods();
- for(size_t i = 0; i < periods.size(); i++)
- {
- IPeriod *period = periods.at(i);
- }
-}
-
ViperBuffer* ViperGui::getStreamBuffer()
{
return this->streamBuffer;
void setListSegmentSize(int listSegmentSize);
ViperBuffer* getStreamBuffer();
QtAV::AVPlayer* getVideoPlayer();
- void setGuiFields(dash::mpd::IMPD* mpd);
+ void setMPDDuration(dash::mpd::IMPD* mpd);
void setLifeLabel(QObject *lifeLabel);
void setNowLabel(QObject *nowLabel);
void setPlayButton(QObject *playButton);
void resetGraphValues();
private:
- pthread_mutex_t monitorMutex;
- GraphDataSource *graphDataSource;
- managers::MultimediaStream *videoStream;
- int64_t offset;
- int64_t durationMilliseconds;
- qint64 position;
- std::string durationString;
- QtAV::AVPlayer *videoPlayer;
- ViperBuffer *streamBuffer;
- std::map<std::string, std::string> keyValues;
- std::map<std::string, int> keyIndices;
- std::map<std::string, std::vector<std::string>> video;
- std::map<std::string, std::vector<std::string>> audio;
- QObject *lifeLabel;
- QObject *nowLabel;
- QObject *progressBar;
- QObject *playButton;
- std::vector<IDASHPlayerGuiObserver *> observers;
- dash::mpd::IMPD *mpd;
- void setPeriodComboBox(dash::mpd::IMPD *mpd);
- void setAdaptationSetComboBox(dash::mpd::IPeriod *period);
- void setVideoAdaptationSetComboBox(dash::mpd::IPeriod *period);
- void setAudioAdaptationSetComboBox(dash::mpd::IPeriod *period);
- void setRepresentationComoboBox(dash::mpd::IAdaptationSet *adaptationSet);
+ pthread_mutex_t monitorMutex;
+ GraphDataSource *graphDataSource;
+ managers::MultimediaStream *videoStream;
+ int64_t offset;
+ int64_t durationMilliseconds;
+ qint64 position;
+ std::string durationString;
+ QtAV::AVPlayer *videoPlayer;
+ ViperBuffer *streamBuffer;
+ std::map<std::string, std::string> keyValues;
+ std::map<std::string, int> keyIndices;
+ std::map<std::string, std::vector<std::string>> video;
+ std::map<std::string, std::vector<std::string>> audio;
+ QObject *lifeLabel;
+ QObject *nowLabel;
+ QObject *progressBar;
+ QObject *playButton;
+ std::vector<IDASHPlayerGuiObserver *> observers;
+ dash::mpd::IMPD *mpd;
+ int listSegmentSize;
+ int segment;
+ int64_t bufferDuration;
+ int64_t segmentDuration;
+ int64_t lastSegmentDuration;
+ bool play;
+ bool stop;
+ bool pause;
+ bool repeat;
+ QObject *rootObject;
+
void parse8601(std::string durationISO8601);
- int listSegmentSize;
- int segment;
- int64_t bufferDuration;
- int64_t segmentDuration;
- int64_t lastSegmentDuration;
- bool play;
- bool stop;
- bool pause;
- bool repeat;
- QObject *rootObject;
};
}