aboutsummaryrefslogtreecommitdiffstats
path: root/Input/MediaObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'Input/MediaObject.h')
-rw-r--r--Input/MediaObject.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/Input/MediaObject.h b/Input/MediaObject.h
new file mode 100644
index 00000000..9d5c7826
--- /dev/null
+++ b/Input/MediaObject.h
@@ -0,0 +1,78 @@
+/*
+ * MediaObject.h
+ *****************************************************************************
+ * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
+ *
+ * Email: libdash-dev@vicky.bitmovin.net
+ *
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ *****************************************************************************/
+
+#ifndef LIBDASH_FRAMEWORK_INPUT_MEDIAOBJECT_H_
+#define LIBDASH_FRAMEWORK_INPUT_MEDIAOBJECT_H_
+
+#include "../Adaptation/IAdaptationLogic.h"
+#include "IMPD.h"
+#include "IDownloadObserver.h"
+#include "IDASHMetrics.h"
+#include "../Portable/MultiThreading.h"
+#include "ICNConnectionConsumerApi.h"
+
+namespace libdash
+{
+namespace framework
+{
+namespace adaptation
+{
+class IAdaptationLogic;
+}
+namespace input
+{
+class DASHReceiver;
+class MediaObject : public dash::network::IDownloadObserver, public dash::metrics::IDASHMetrics
+{
+public:
+ MediaObject(dash::mpd::ISegment *segment, dash::mpd::IRepresentation *rep, bool withFeedBack = false);
+ virtual ~MediaObject();
+
+ bool StartDownload();
+ bool StartDownload(IICNConnection* conn);
+ void AbortDownload();
+ void WaitFinished();
+ int Read(uint8_t *data, size_t len);
+ int Peek(uint8_t *data, size_t len);
+ int Peek(uint8_t *data, size_t len, size_t offset);
+ dash::mpd::IRepresentation* GetRepresentation();
+ dash::mpd::ISegment* GetSegment();
+ const char* GetPath();
+ void SetFeedBack(bool flag);
+ virtual void OnDownloadStateChanged(dash::network::DownloadState state);
+ virtual void OnDownloadRateChanged(uint64_t bytesDownloaded); //Here the bytesDownloaded is in fact the bitrate bps
+ virtual void OnDownloadTimeChanged(double dnltime);
+
+ void AddInitSegment(MediaObject* initSeg);
+ int ReadInitSegment(uint8_t* data, size_t len);
+ const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList() const;
+ const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList() const;
+ void SetAdaptationLogic(framework::adaptation::IAdaptationLogic *_adaptationLogic);
+ void SetDASHReceiver(input::DASHReceiver *_dashReceiver);
+
+private:
+ dash::mpd::ISegment *segment;
+ MediaObject *initSeg;
+ dash::mpd::IRepresentation *rep;
+ dash::network::DownloadState state;
+ uint64_t bps;
+ bool withFeedBack;
+ double dnltime;
+ input::DASHReceiver *dashReceiver;
+ adaptation::IAdaptationLogic *adaptationLogic;
+ mutable CRITICAL_SECTION stateLock;
+ mutable CONDITION_VARIABLE stateChanged;
+};
+}
+}
+}
+
+#endif /* LIBDASH_FRAMEWORK_INPUT_MEDIAOBJECT_H_ */