forked from opdenkamp/xbmc
/
DVDInputStream.h
165 lines (146 loc) · 4.72 KB
/
DVDInputStream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include <string>
#include "utils/BitstreamStats.h"
#include "filesystem/IFile.h"
#include "FileItem.h"
enum DVDStreamType
{
DVDSTREAM_TYPE_NONE = -1,
DVDSTREAM_TYPE_FILE = 1,
DVDSTREAM_TYPE_DVD = 2,
DVDSTREAM_TYPE_HTTP = 3,
DVDSTREAM_TYPE_MEMORY = 4,
DVDSTREAM_TYPE_FFMPEG = 5,
DVDSTREAM_TYPE_TV = 6,
DVDSTREAM_TYPE_RTMP = 7,
DVDSTREAM_TYPE_HTSP = 8,
DVDSTREAM_TYPE_MPLS = 10,
DVDSTREAM_TYPE_BLURAY = 11,
DVDSTREAM_TYPE_PVRMANAGER = 12,
};
#define SEEK_POSSIBLE 0x10 // flag used to check if protocol allows seeks
#define DVDSTREAM_BLOCK_SIZE_FILE (2048 * 16)
#define DVDSTREAM_BLOCK_SIZE_DVD 2048
class CPoint;
class CDVDInputStream
{
public:
class IChannel
{
public:
virtual ~IChannel() {};
virtual bool NextChannel(bool preview = false) = 0;
virtual bool PrevChannel(bool preview = false) = 0;
virtual bool SelectChannelByNumber(unsigned int channel) = 0;
virtual bool SelectChannel(const PVR::CPVRChannel &channel) { return false; };
virtual bool GetSelectedChannel(PVR::CPVRChannel *) { return false; };
virtual int GetTotalTime() = 0;
virtual int GetStartTime() = 0;
virtual bool UpdateItem(CFileItem& item) = 0;
virtual bool CanRecord() = 0;
virtual bool IsRecording() = 0;
virtual bool Record(bool bOnOff) = 0;
};
class IDisplayTime
{
public:
virtual ~IDisplayTime() {};
virtual int GetTotalTime() = 0;
virtual int GetTime() = 0;
};
class ISeekTime
{
public:
virtual ~ISeekTime() {};
virtual bool SeekTime(int ms) = 0;
};
class IChapter
{
public:
virtual ~IChapter() {};
virtual int GetChapter() = 0;
virtual int GetChapterCount() = 0;
virtual void GetChapterName(std::string& name) = 0;
virtual bool SeekChapter(int ch) = 0;
};
class IMenus
{
public:
virtual ~IMenus() {};
virtual void ActivateButton() = 0;
virtual void SelectButton(int iButton) = 0;
virtual int GetCurrentButton() = 0;
virtual int GetTotalButtons() = 0;
virtual void OnUp() = 0;
virtual void OnDown() = 0;
virtual void OnLeft() = 0;
virtual void OnRight() = 0;
virtual void OnMenu() = 0;
virtual void OnBack() = 0;
virtual void OnNext() = 0;
virtual void OnPrevious() = 0;
virtual bool OnMouseMove(const CPoint &point) = 0;
virtual bool OnMouseClick(const CPoint &point) = 0;
virtual bool IsInMenu() = 0;
virtual double GetTimeStampCorrection() = 0;
};
enum ENextStream
{
NEXTSTREAM_NONE,
NEXTSTREAM_OPEN,
NEXTSTREAM_RETRY,
};
CDVDInputStream(DVDStreamType m_streamType);
virtual ~CDVDInputStream();
virtual bool Open(const char* strFileName, const std::string& content);
virtual void Close() = 0;
virtual int Read(BYTE* buf, int buf_size) = 0;
virtual __int64 Seek(__int64 offset, int whence) = 0;
virtual bool Pause(double dTime) = 0;
virtual __int64 GetLength() = 0;
virtual std::string& GetContent() { return m_content; };
virtual std::string& GetFileName() { return m_strFileName; }
virtual ENextStream NextStream() { return NEXTSTREAM_NONE; }
virtual void Abort() {}
virtual int GetBlockSize() { return 0; }
/*! \brief Indicate expected read rate in bytes per second.
* This could be used to throttle caching rate. Should
* be seen as only a hint
*/
virtual void SetReadRate(unsigned rate) {}
/*! \brief Get the cache status
\return true when cache status was succesfully obtained
*/
virtual bool GetCacheStatus(XFILE::SCacheStatus *status) { return false; }
bool IsStreamType(DVDStreamType type) const { return m_streamType == type; }
virtual bool IsEOF() = 0;
virtual int GetCurrentGroupId() { return 0; }
virtual BitstreamStats GetBitstreamStats() const { return m_stats; }
void SetFileItem(const CFileItem& item);
protected:
DVDStreamType m_streamType;
std::string m_strFileName;
BitstreamStats m_stats;
std::string m_content;
CFileItem m_item;
};