summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2015-03-03 16:53:59 +0100
committermanuel <manuel@mausz.at>2015-03-03 16:53:59 +0100
commitffca21f2743a7b367fa212799c6e2fea6190dd5d (patch)
tree0608ea3a29cf644ec9ab204e2b4bb9bfaae1c381 /xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
downloadkodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.gz
kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.tar.bz2
kodi-pvr-build-ffca21f2743a7b367fa212799c6e2fea6190dd5d.zip
initial commit for kodi master
Diffstat (limited to 'xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h')
-rw-r--r--xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h359
1 files changed, 359 insertions, 0 deletions
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
new file mode 100644
index 0000000..fca164d
--- /dev/null
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.h
@@ -0,0 +1,359 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2013 Team XBMC
5 * http://xbmc.org
6 *
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)
10 * any later version.
11 *
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.
16 *
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/>.
20 *
21 */
22
23#include <string>
24#include "system.h"
25#include "DVDDemuxPacket.h"
26
27class CDVDInputStream;
28
29#ifndef __GNUC__
30#pragma warning(push)
31#pragma warning(disable:4244)
32#endif
33
34#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
35 #include "config.h"
36#endif
37
38extern "C" {
39#include "libavcodec/avcodec.h"
40}
41
42#ifndef __GNUC__
43#pragma warning(pop)
44#endif
45
46enum AVDiscard;
47
48enum StreamType
49{
50 STREAM_NONE = 0,// if unknown
51 STREAM_AUDIO, // audio stream
52 STREAM_VIDEO, // video stream
53 STREAM_DATA, // data stream
54 STREAM_SUBTITLE,// subtitle stream
55 STREAM_TELETEXT // Teletext data stream
56};
57
58enum StreamSource {
59 STREAM_SOURCE_NONE = 0x000,
60 STREAM_SOURCE_DEMUX = 0x100,
61 STREAM_SOURCE_NAV = 0x200,
62 STREAM_SOURCE_DEMUX_SUB = 0x300,
63 STREAM_SOURCE_TEXT = 0x400,
64 STREAM_SOURCE_VIDEOMUX = 0x500
65};
66
67#define STREAM_SOURCE_MASK(a) ((a) & 0xf00)
68
69/*
70 * CDemuxStream
71 * Base class for all demuxer streams
72 */
73class CDemuxStream
74{
75public:
76 CDemuxStream()
77 {
78 iId = 0;
79 iPhysicalId = 0;
80 codec = (AVCodecID)0; // AV_CODEC_ID_NONE
81 codec_fourcc = 0;
82 profile = FF_PROFILE_UNKNOWN;
83 level = FF_LEVEL_UNKNOWN;
84 type = STREAM_NONE;
85 source = STREAM_SOURCE_NONE;
86 iDuration = 0;
87 pPrivate = NULL;
88 ExtraData = NULL;
89 ExtraSize = 0;
90 memset(language, 0, sizeof(language));
91 disabled = false;
92 changes = 0;
93 flags = FLAG_NONE;
94 orig_type = 0;
95 }
96
97 virtual ~CDemuxStream()
98 {
99 delete [] ExtraData;
100 }
101
102 virtual void GetStreamInfo(std::string& strInfo)
103 {
104 strInfo = "";
105 }
106
107 virtual void GetStreamName(std::string& strInfo);
108
109 virtual void SetDiscard(AVDiscard discard);
110 virtual AVDiscard GetDiscard();
111
112 int iId; // most of the time starting from 0
113 int iPhysicalId; // id
114 AVCodecID codec;
115 unsigned int codec_fourcc; // if available
116 int profile; // encoder profile of the stream reported by the decoder. used to qualify hw decoders.
117 int level; // encoder level of the stream reported by the decoder. used to qualify hw decoders.
118 StreamType type;
119 int source;
120
121 int iDuration; // in mseconds
122 void* pPrivate; // private pointer for the demuxer
123 uint8_t* ExtraData; // extra data for codec to use
124 unsigned int ExtraSize; // size of extra data
125
126 char language[4]; // ISO 639 3-letter language code (empty string if undefined)
127 bool disabled; // set when stream is disabled. (when no decoder exists)
128
129 int changes; // increment on change which player may need to know about
130
131 int orig_type; // type of original source
132
133 enum EFlags
134 { FLAG_NONE = 0x0000
135 , FLAG_DEFAULT = 0x0001
136 , FLAG_DUB = 0x0002
137 , FLAG_ORIGINAL = 0x0004
138 , FLAG_COMMENT = 0x0008
139 , FLAG_LYRICS = 0x0010
140 , FLAG_KARAOKE = 0x0020
141 , FLAG_FORCED = 0x0040
142 , FLAG_HEARING_IMPAIRED = 0x0080
143 , FLAG_VISUAL_IMPAIRED = 0x0100
144 } flags;
145};
146
147class CDemuxStreamVideo : public CDemuxStream
148{
149public:
150 CDemuxStreamVideo() : CDemuxStream()
151 {
152 iFpsScale = 0;
153 iFpsRate = 0;
154 irFpsScale = 0;
155 irFpsRate = 0;
156 iHeight = 0;
157 iWidth = 0;
158 fAspect = 0.0;
159 bVFR = false;
160 bPTSInvalid = false;
161 bForcedAspect = false;
162 type = STREAM_VIDEO;
163 iOrientation = 0;
164 iBitsPerPixel = 0;
165 }
166
167 virtual ~CDemuxStreamVideo() {}
168 int iFpsScale; // scale of 1000 and a rate of 29970 will result in 29.97 fps
169 int iFpsRate;
170 int irFpsScale;
171 int irFpsRate;
172 int iHeight; // height of the stream reported by the demuxer
173 int iWidth; // width of the stream reported by the demuxer
174 float fAspect; // display aspect of stream
175 bool bVFR; // variable framerate
176 bool bPTSInvalid; // pts cannot be trusted (avi's).
177 bool bForcedAspect; // aspect is forced from container
178 int iOrientation; // orientation of the video in degress counter clockwise
179 int iBitsPerPixel;
180 std::string stereo_mode; // expected stereo mode
181};
182
183class CDemuxStreamAudio : public CDemuxStream
184{
185public:
186 CDemuxStreamAudio() : CDemuxStream()
187 {
188 iChannels = 0;
189 iSampleRate = 0;
190 iBlockAlign = 0;
191 iBitRate = 0;
192 iBitsPerSample = 0;
193 type = STREAM_AUDIO;
194 }
195
196 virtual ~CDemuxStreamAudio() {}
197
198 void GetStreamType(std::string& strInfo);
199
200 int iChannels;
201 int iSampleRate;
202 int iBlockAlign;
203 int iBitRate;
204 int iBitsPerSample;
205};
206
207class CDemuxStreamSubtitle : public CDemuxStream
208{
209public:
210 CDemuxStreamSubtitle() : CDemuxStream()
211 {
212 type = STREAM_SUBTITLE;
213 }
214};
215
216class CDemuxStreamTeletext : public CDemuxStream
217{
218public:
219 CDemuxStreamTeletext() : CDemuxStream()
220 {
221 type = STREAM_TELETEXT;
222 }
223 virtual void GetStreamInfo(std::string& strInfo);
224};
225
226class CDVDDemux
227{
228public:
229
230 CDVDDemux() {}
231 virtual ~CDVDDemux() {}
232
233
234 /*
235 * Reset the entire demuxer (same result as closing and opening it)
236 */
237 virtual void Reset() = 0;
238
239 /*
240 * Aborts any internal reading that might be stalling main thread
241 * NOTICE - this can be called from another thread
242 */
243 virtual void Abort() = 0;
244
245 /*
246 * Flush the demuxer, if any data is kept in buffers, this should be freed now
247 */
248 virtual void Flush() = 0;
249
250 /*
251 * Read a packet, returns NULL on error
252 *
253 */
254 virtual DemuxPacket* Read() = 0;
255
256 /*
257 * Seek, time in msec calculated from stream start
258 */
259 virtual bool SeekTime(int time, bool backwords = false, double* startpts = NULL) = 0;
260
261 /*
262 * Seek to a specified chapter.
263 * startpts can be updated to the point where display should start
264 */
265 virtual bool SeekChapter(int chapter, double* startpts = NULL) { return false; }
266
267 /*
268 * Get the number of chapters available
269 */
270 virtual int GetChapterCount() { return 0; }
271
272 /*
273 * Get current chapter
274 */
275 virtual int GetChapter() { return 0; }
276
277 /*
278 * Get the name of a chapter
279 * \param strChapterName[out] Name of chapter
280 * \param chapterIdx -1 for current chapter, else a chapter index
281 */
282 virtual void GetChapterName(std::string& strChapterName, int chapterIdx=-1) {}
283
284 /*
285 * Get the position of a chapter
286 * \param chapterIdx -1 for current chapter, else a chapter index
287 */
288 virtual int64_t GetChapterPos(int chapterIdx=-1) { return 0; }
289
290 /*
291 * Set the playspeed, if demuxer can handle different
292 * speeds of playback
293 */
294 virtual void SetSpeed(int iSpeed) = 0;
295
296 /*
297 * returns the total time in msec
298 */
299 virtual int GetStreamLength() = 0;
300
301 /*
302 * returns the stream or NULL on error, starting from 0
303 */
304 virtual CDemuxStream* GetStream(int iStreamId) = 0;
305
306 /*
307 * return nr of streams, 0 if none
308 */
309 virtual int GetNrOfStreams() = 0;
310
311 /*
312 * returns opened filename
313 */
314 virtual std::string GetFileName() = 0;
315 /*
316 * return nr of audio streams, 0 if none
317 */
318 int GetNrOfAudioStreams();
319
320 /*
321 * return nr of video streams, 0 if none
322 */
323 int GetNrOfVideoStreams();
324
325 /*
326 * return nr of subtitle streams, 0 if none
327 */
328 int GetNrOfSubtitleStreams();
329
330 /*
331 * return nr of teletext streams, 0 if none
332 */
333 int GetNrOfTeletextStreams();
334
335 /*
336 * return the audio stream, or NULL if it does not exist
337 */
338 CDemuxStreamAudio* GetStreamFromAudioId(int iAudioIndex);
339
340 /*
341 * return the video stream, or NULL if it does not exist
342 */
343 CDemuxStreamVideo* GetStreamFromVideoId(int iVideoIndex);
344
345 /*
346 * return the subtitle stream, or NULL if it does not exist
347 */
348 CDemuxStreamSubtitle* GetStreamFromSubtitleId(int iSubtitleIndex);
349
350 /*
351 * return the teletext stream, or NULL if it does not exist
352 */
353 CDemuxStreamTeletext* GetStreamFromTeletextId(int iTeletextIndex);
354
355 /*
356 * return a user-presentable codec name of the given stream
357 */
358 virtual void GetStreamCodecName(int iStreamId, std::string &strName) {};
359};