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 --- Input/DASHReceiver.h | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'Input/DASHReceiver.h') diff --git a/Input/DASHReceiver.h b/Input/DASHReceiver.h index a2893b4d..cf56166b 100644 --- a/Input/DASHReceiver.h +++ b/Input/DASHReceiver.h @@ -14,7 +14,7 @@ #include "libdash.h" #include "IMPD.h" - +#include "../MPD/MPDWrapper.h" #include "../Input/MediaObject.h" #include "IDASHReceiverObserver.h" #include "../MPD/AdaptationSetStream.h" @@ -28,6 +28,10 @@ namespace libdash { namespace framework { +namespace mpd +{ +class AdaptationSetStream; +} namespace adaptation { class IAdaptationLogic; @@ -44,7 +48,7 @@ class MediaObject; class DASHReceiver { public: - DASHReceiver(dash::mpd::IMPD *mpd, IDASHReceiverObserver *obs, buffer::Buffer *buffer, uint32_t bufferSize, bool icnEnabled, double icnAlpha, float beta, float drop); + DASHReceiver(viper::managers::StreamType type, libdash::framework::mpd::MPDWrapper *mpdWrapper, IDASHReceiverObserver *obs, buffer::Buffer *buffer, uint32_t bufferSize, bool icnEnabled, double icnAlpha, float beta, float drop); virtual ~DASHReceiver(); bool Start(); @@ -52,15 +56,18 @@ public: input::MediaObject* GetNextSegment(); input::MediaObject* GetSegment(uint32_t segmentNumber); input::MediaObject* GetInitSegment(); - input::MediaObject* FindInitSegment(dash::mpd::IRepresentation *representation); + 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(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); @@ -78,21 +85,24 @@ public: bool CanPush(); void SetBeta(float beta); void SetDrop(float drop); + void updateMPD(dash::mpd::IMPD* mpd); private: float beta; float drop; bool withFeedBack; bool isBufferBased; - std::map initSegments; +// std::map initSegments; + std::map initSegments; libdash::framework::buffer::Buffer *buffer; IDASHReceiverObserver *observer; - dash::mpd::IMPD *mpd; - dash::mpd::IPeriod *period; - dash::mpd::IAdaptationSet *adaptationSet; - dash::mpd::IRepresentation *representation; + libdash::framework::mpd::MPDWrapper *mpdWrapper; +// dash::mpd::IMPD *mpd; +// dash::mpd::IPeriod *period; +// dash::mpd::IAdaptationSet *adaptationSet; +// dash::mpd::IRepresentation *representation; mpd::AdaptationSetStream *adaptationSetStream; - mpd::IRepresentationStream *representationStream; +// mpd::IRepresentationStream *representationStream; uint32_t segmentNumber; uint32_t positionInMsecs; uint32_t segmentOffset; @@ -109,6 +119,7 @@ private: IICNConnection *conn; IICNConnection *initConn; THREAD_HANDLE bufferingThread; + THREAD_HANDLE mpdFetcherThread; bool isBuffering; bool icn; double icnAlpha; @@ -116,11 +127,16 @@ private: int bufferLevelAtUpdate; int readMax; uint8_t *readBuffer; + viper::managers::StreamType type; uint32_t CalculateSegmentOffset(); void NotifySegmentDownloaded(); - void DownloadInitSegment(dash::mpd::IRepresentation* rep); - bool InitSegmentExists(dash::mpd::IRepresentation* rep); +// 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); }; } } -- cgit 1.2.3-korg