From a644414fd2c3a3f7f41e716b6875a78981e4cfe1 Mon Sep 17 00:00:00 2001 From: jacko Date: Fri, 23 Jun 2017 16:12:18 +0200 Subject: adding mpd live handling + automatic mpd fetching Change-Id: I2c05bdf6a4d940ad22bb8632268f4b63a08a80a8 Signed-off-by: jacko --- Managers/MultimediaManager.h | 129 ++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 63 deletions(-) (limited to 'Managers/MultimediaManager.h') diff --git a/Managers/MultimediaManager.h b/Managers/MultimediaManager.h index b4187486..ade2b767 100644 --- a/Managers/MultimediaManager.h +++ b/Managers/MultimediaManager.h @@ -35,50 +35,52 @@ public: MultimediaManager(ViperGui *viperGui, int segmentBufferSize, std::string downloadPath, bool noDecoding = false); virtual ~MultimediaManager(); - bool init (const std::string& url); - bool initICN (const std::string& url); - void start (bool icnEnabled, double icnAlpha, uint32_t nextOffset); - void stop (); - dash::mpd::IMPD* getMPD (); - - bool setVideoQuality (dash::mpd::IPeriod* period, dash::mpd::IAdaptationSet *adaptationSet, dash::mpd::IRepresentation *representation); - bool setAudioQuality (dash::mpd::IPeriod* period, dash::mpd::IAdaptationSet *adaptationSet, dash::mpd::IRepresentation *representation); - - bool setVideoAdaptationLogic (libdash::framework::adaptation::LogicType type, struct libdash::framework::adaptation::AdaptationParameters *params); - bool setAudioAdaptationLogic (libdash::framework::adaptation::LogicType type, struct libdash::framework::adaptation::AdaptationParameters *params); - - void attachManagerObserver (IMultimediaManagerObserver *observer); - - void setFrameRate (double frameRate); + bool init (const std::string& url); + bool initICN (const std::string& url); + void start (bool icnEnabled, double icnAlpha, uint32_t nextOffset); + void stop (); + dash::mpd::IMPD* getMPD (); + bool setVideoQuality (); + bool setAudioQuality (); + bool setVideoAdaptationLogic (libdash::framework::adaptation::LogicType type, struct libdash::framework::adaptation::AdaptationParameters *params); + bool setAudioAdaptationLogic (libdash::framework::adaptation::LogicType type, struct libdash::framework::adaptation::AdaptationParameters *params); + void attachManagerObserver (IMultimediaManagerObserver *observer); + void setFrameRate (double frameRate); + void setSegmentDuration (float segDuration); + float getSegmentDuration (); /* IStreamObserver */ - void onSegmentDownloaded (); - void onSegmentBufferStateChanged (StreamType type, uint32_t fillstateInPercent, int maxC); - void onVideoBufferStateChanged (uint32_t fillstateInPercent); - void onAudioBufferStateChanged (uint32_t fillstateInPercent); - bool isUserDependent (); - bool isStarted (); - bool isStopping (); - bool isICN (); - void setEOS (bool value); - void shouldAbort (bool isVideo); - void setTargetDownloadingTime (bool isVid, double time); - bool isPlaying (); - void onPausePressed (); - void notifyStatistics (int segNum, uint32_t bitrate, int fps, uint32_t quality); - void notifyQualityDownloading (uint32_t quality); - uint32_t getUBufferLevel (); - int getBufferLevel (); - void setLooping (bool looping); - void setOffset(int offset); - void setBeta(float beta); - void setDrop(float drop); - bool canPush (); - CRITICAL_SECTION monitorBufferMutex; + void onSegmentDownloaded (); + void onSegmentBufferStateChanged (StreamType type, uint32_t fillstateInPercent, int maxC); + void onVideoBufferStateChanged (uint32_t fillstateInPercent); + void onAudioBufferStateChanged (uint32_t fillstateInPercent); + bool isUserDependent (); + bool isStarted (); + bool isStopping (); + bool isICN (); + void setEOS (bool value); + void shouldAbort (bool isVideo); + void setTargetDownloadingTime (bool isVid, double time); + bool isPlaying (); + void onPausePressed (); + void notifyStatistics (int segNum, uint32_t bitrate, int fps, uint32_t quality); + void notifyQualityDownloading (uint32_t quality); + uint32_t getUBufferLevel (); + int getBufferLevel (); + void setLooping (bool looping); + libdash::framework::mpd::MPDWrapper* getMPDWrapper (); + void setMPDWrapper (libdash::framework::mpd::MPDWrapper* mpdWrapper); + void setOffset (int offset); + void setBeta (float beta); + void setDrop (float drop); + bool canPush (); + void fetchMPD (); + - int offset; - std::chrono::time_point lastPointInTime; - std::chrono::time_point bufferingLimit; + CRITICAL_SECTION monitorBufferMutex; + int offset; + std::chrono::time_point lastPointInTime; + std::chrono::time_point bufferingLimit; private: float beta; @@ -87,14 +89,9 @@ private: int segmentBufferSize; ViperGui *viperGui; dash::IDASHManager *manager; - dash::mpd::IMPD *mpd; - dash::mpd::IPeriod *period; - dash::mpd::IAdaptationSet *videoAdaptationSet; - dash::mpd::IRepresentation *videoRepresentation; + libdash::framework::mpd::MPDWrapper *mpdWrapper; libdash::framework::adaptation::IAdaptationLogic *videoLogic; MultimediaStream *videoStream; - dash::mpd::IAdaptationSet *audioAdaptationSet; - dash::mpd::IRepresentation *audioRepresentation; libdash::framework::adaptation::IAdaptationLogic *audioLogic; MultimediaStream *audioStream; std::vector managerObservers; @@ -102,6 +99,7 @@ private: bool stopping; bool icn; double icnAlpha; + libdash::framework::input::IICNConnection *icnConn; uint64_t framesDisplayed; uint64_t segmentsDownloaded; CRITICAL_SECTION monitorMutex; @@ -117,22 +115,27 @@ private: mutable CRITICAL_SECTION monitor_playing_audio_mutex; mutable CONDITION_VARIABLE playingAudioStatusChanged; const char *logicName; - bool noDecoding; - void notifyBufferChange (); - bool startVideoRenderingThread (); - void stopVideoRenderingThread (); - static void* pushVideo (void *data); - static void* pushVideoNoOut (void *data); - bool startAudioRenderingThread (); - void stopAudioRenderingThread (); - void initVideoRendering (uint32_t offset); - void initAudioPlayback (uint32_t offset); - void stopVideo (); - void stopAudio (); - void notifyVideoBufferObservers (uint32_t fillstateInPercent); - void notifyVideoSegmentBufferObservers (uint32_t fillstateInPercent); - void notifyAudioBufferObservers (uint32_t fillstateInPercent); - void notifyAudioSegmentBufferObservers (uint32_t fillstateInPercent); + bool noDecoding; + std::string url; + float segmentDuration; + + void notifyBufferChange (); + bool startVideoRenderingThread (); + void stopVideoRenderingThread (); + static void* pushVideo (void *data); + static void* pushVideoNoOut (void *data); + bool startAudioRenderingThread (); + void stopAudioRenderingThread (); + void initVideoRendering (uint32_t offset); + void initAudioPlayback (uint32_t offset); + void stopVideo (); + void stopAudio (); + void notifyVideoBufferObservers (uint32_t fillstateInPercent); + void notifyVideoSegmentBufferObservers (uint32_t fillstateInPercent); + void notifyAudioBufferObservers (uint32_t fillstateInPercent); + void notifyAudioSegmentBufferObservers (uint32_t fillstateInPercent); + void updateMPD (); + void updateMPDICN (); }; } } -- cgit 1.2.3-korg