summaryrefslogtreecommitdiff
path: root/hlsPlayer.h
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-01-11 15:14:03 +0100
committerchriszero <zerov83@gmail.com>2015-01-11 15:14:03 +0100
commit508ba3458094f0c30b278cc05abc626b6f3940e0 (patch)
tree12592e3fb841f80ad1c61d07b3f9242ad94d2cbe /hlsPlayer.h
parenta9dd0c6a322f139e03a0ba4570e2a78508ddd6c3 (diff)
downloadvdr-plugin-plex-508ba3458094f0c30b278cc05abc626b6f3940e0.tar.gz
vdr-plugin-plex-508ba3458094f0c30b278cc05abc626b6f3940e0.tar.bz2
Removed Mplayer support.
Added HLS Streaming Player for directly play in VDR
Diffstat (limited to 'hlsPlayer.h')
-rw-r--r--hlsPlayer.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/hlsPlayer.h b/hlsPlayer.h
new file mode 100644
index 0000000..3df9c46
--- /dev/null
+++ b/hlsPlayer.h
@@ -0,0 +1,90 @@
+#ifndef HLSPLAYER_H
+#define HLSPLAYER_H
+
+#include <string>
+#include <iostream>
+#include <sstream>
+
+#include <vdr/thread.h>
+#include <vdr/player.h>
+#include <vdr/ringbuffer.h>
+#include <vdr/tools.h>
+
+#include <Poco/Net/HTTPClientSession.h>
+#include <Poco/URI.h>
+
+#include "m3u8Parser.h"
+
+class cHlsSegmentLoader : public cThread
+{
+private:
+ int m_ringBufferSize;
+ int m_segmentsToBuffer;
+ unsigned int m_lastLoadedSegment;
+ bool m_bufferFilled;
+
+ uchar* m_pBuffer;
+
+ Poco::Net::HTTPClientSession* m_pClientSession;
+ Poco::URI m_startUri;
+ std::string m_sessionUriPart;
+ std::string m_segmentUriPart;
+ std::string m_sessionCookie;
+
+ cM3u8Parser m_startParser;
+ cM3u8Parser m_indexParser;
+
+ bool ConnectToServer(void);
+ void CloseConnection(void);
+ void LoadStartList(void);
+ void LoadIndexList(void);
+ std::string GetSegmentUri(int segmentIndex) const;
+ int GetSegmentSize(int segmentIndex);
+ bool LoadSegment(std::string uri);
+ int EstimateSegmentSize();
+
+protected:
+ void Action(void);
+ bool DoLoad(void);
+ bool StopLoader(void);
+
+public:
+ cHlsSegmentLoader(std::string startm3u8);
+ ~cHlsSegmentLoader();
+
+ cRingBufferLinear* m_pRingbuffer;
+ bool BufferFilled();
+};
+
+class cHlsPlayer : public cPlayer, cThread
+{
+private:
+ cHlsSegmentLoader* m_pSegmentLoader;
+
+ int m_videoLenght;
+ int m_actualSegment;
+ int m_actualTime;
+
+ enum ePlayModes { pmPlay, pmPause };
+ ePlayModes playMode;
+
+ virtual void Activate(bool On);
+
+
+protected:
+ void Action(void);
+ bool DoPlay(void);
+
+
+public:
+ cHlsPlayer(std::string startm3u8);
+ ~cHlsPlayer();
+
+ virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false);
+ virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
+ void Pause(void);
+ void Play(void);
+
+};
+
+#endif // HLSPLAYER_H