4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
24 #include "utils/BitstreamStats.h"
25 #include "filesystem/IFileTypes.h"
28 #include "guilib/Geometry.h"
32 DVDSTREAM_TYPE_NONE = -1,
33 DVDSTREAM_TYPE_FILE = 1,
34 DVDSTREAM_TYPE_DVD = 2,
35 DVDSTREAM_TYPE_HTTP = 3,
36 DVDSTREAM_TYPE_MEMORY = 4,
37 DVDSTREAM_TYPE_FFMPEG = 5,
38 DVDSTREAM_TYPE_TV = 6,
39 DVDSTREAM_TYPE_RTMP = 7,
40 DVDSTREAM_TYPE_HTSP = 8,
41 DVDSTREAM_TYPE_MPLS = 10,
42 DVDSTREAM_TYPE_BLURAY = 11,
43 DVDSTREAM_TYPE_PVRMANAGER = 12,
46 #define SEEK_POSSIBLE 0x10 // flag used to check if protocol allows seeks
48 #define DVDSTREAM_BLOCK_SIZE_FILE (2048 * 16)
49 #define DVDSTREAM_BLOCK_SIZE_DVD 2048
54 typedef boost::shared_ptr<PVR::CPVRChannel> CPVRChannelPtr;
63 virtual ~IChannel() {};
64 virtual bool NextChannel(bool preview = false) = 0;
65 virtual bool PrevChannel(bool preview = false) = 0;
66 virtual bool SelectChannelByNumber(unsigned int channel) = 0;
67 virtual bool SelectChannel(const PVR::CPVRChannel &channel) { return false; };
68 virtual bool GetSelectedChannel(PVR::CPVRChannelPtr&) { return false; };
69 virtual bool UpdateItem(CFileItem& item) = 0;
70 virtual bool CanRecord() = 0;
71 virtual bool IsRecording() = 0;
72 virtual bool Record(bool bOnOff) = 0;
73 virtual bool CanPause() = 0;
74 virtual bool CanSeek() = 0;
80 virtual ~IDisplayTime() {};
81 virtual int GetTotalTime() = 0;
82 virtual int GetTime() = 0;
88 virtual ~ISeekTime() {};
89 virtual bool SeekTime(int ms) = 0;
95 virtual ~IChapter() {};
96 virtual int GetChapter() = 0;
97 virtual int GetChapterCount() = 0;
98 virtual void GetChapterName(std::string& name) = 0;
99 virtual bool SeekChapter(int ch) = 0;
105 virtual ~IMenus() {};
106 virtual void ActivateButton() = 0;
107 virtual void SelectButton(int iButton) = 0;
108 virtual int GetCurrentButton() = 0;
109 virtual int GetTotalButtons() = 0;
110 virtual void OnUp() = 0;
111 virtual void OnDown() = 0;
112 virtual void OnLeft() = 0;
113 virtual void OnRight() = 0;
114 virtual void OnMenu() = 0;
115 virtual void OnBack() = 0;
116 virtual void OnNext() = 0;
117 virtual void OnPrevious() = 0;
118 virtual bool OnMouseMove(const CPoint &point) = 0;
119 virtual bool OnMouseClick(const CPoint &point) = 0;
120 virtual bool IsInMenu() = 0;
121 virtual double GetTimeStampCorrection() = 0;
131 CDVDInputStream(DVDStreamType m_streamType);
132 virtual ~CDVDInputStream();
133 virtual bool Open(const char* strFileName, const std::string& content);
134 virtual void Close() = 0;
135 virtual int Read(BYTE* buf, int buf_size) = 0;
136 virtual int64_t Seek(int64_t offset, int whence) = 0;
137 virtual bool Pause(double dTime) = 0;
138 virtual int64_t GetLength() = 0;
139 virtual std::string& GetContent() { return m_content; };
140 virtual std::string& GetFileName() { return m_strFileName; }
141 virtual ENextStream NextStream() { return NEXTSTREAM_NONE; }
142 virtual void Abort() {}
143 virtual int GetBlockSize() { return 0; }
144 virtual void ResetScanTimeout(unsigned int iTimeoutMs) { }
146 /*! \brief Indicate expected read rate in bytes per second.
147 * This could be used to throttle caching rate. Should
148 * be seen as only a hint
150 virtual void SetReadRate(unsigned rate) {}
152 /*! \brief Get the cache status
153 \return true when cache status was succesfully obtained
155 virtual bool GetCacheStatus(XFILE::SCacheStatus *status) { return false; }
157 bool IsStreamType(DVDStreamType type) const { return m_streamType == type; }
158 virtual bool IsEOF() = 0;
159 virtual int GetCurrentGroupId() { return 0; }
160 virtual BitstreamStats GetBitstreamStats() const { return m_stats; }
162 void SetFileItem(const CFileItem& item);
165 DVDStreamType m_streamType;
166 std::string m_strFileName;
167 BitstreamStats m_stats;
168 std::string m_content;