2 Copyright 2004-2008 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef PLAYERVIDEOREC_H
22 #define PLAYERVIDEOREC_H
32 #include <condition_variable>
40 #include "teletextdecodervbiebu.h"
52 class PlayerVideoRec : public Callback
55 PlayerVideoRec(MessageQueue* messageQueue, void* messageReceiver, OSDReceiver* osdReceiver);
56 virtual ~PlayerVideoRec();
58 int init(bool p_isPesRecording,double framespersec);
60 void setStartFrame(ULONG frameNum);
61 void setLengthBytes(ULLONG length);
62 void setLengthFrames(ULONG length);
63 void setAudioChannel(int newChannel, int type, int streamtype);
64 void setSubtitleChannel(int newChannel);
65 bool toggleSubtitles();
66 void turnSubtitlesOn(bool ison);
67 bool isSubtitlesOn() { return subtitlesShowing; }
68 void tellSubtitlesOSDVisible(bool visible);
76 void jumpToPercent(double percent);
77 void skipForward(int seconds);
78 void skipBackward(int seconds);
79 void jumpToMark(int mark);
80 void jumpToFrameP(int newFrame);
82 UCHAR getState() { return state; }
83 ULONG getCurrentFrameNum();
84 ULONG getLengthFrames();
85 UCHAR getIScanRate() { return ifactor; }
86 bool* getDemuxerMpegAudioChannels();
87 bool* getDemuxerAc3AudioChannels();
88 bool* getDemuxerSubtitleChannels();
89 int *getTeletxtSubtitlePages();
90 int getCurrentAudioChannel();
91 int getCurrentSubtitleChannel();
92 bool isPesRecording() { return is_pesrecording; }
93 Channel *getDemuxerChannel();
95 TeletextDecoderVBIEBU * getTeletextDecoder() { return teletext; }
97 void call(void*); // for callback interface
99 const static UCHAR S_PLAY = 1;
100 const static UCHAR S_PAUSE_P = 2;
101 const static UCHAR S_PAUSE_I = 3;
102 const static UCHAR S_FFWD = 4;
103 const static UCHAR S_FBWD = 5;
104 const static UCHAR S_STOP = 6;
105 const static UCHAR S_JUMP = 7;
106 const static UCHAR S_JUMP_PI = 8; // Jump to Pause_I mode
110 // FIXME so far this just duplicates the old system + the wss
112 const static UCHAR CONNECTION_LOST = 1;
113 const static UCHAR STOP_PLAYBACK = 2;
114 const static UCHAR STREAM_END = 3;
115 const static UCHAR ASPECT43 = 4;
116 const static UCHAR ASPECT169 = 5;
124 void switchState(UCHAR newState, ULONG jumpFrame=0);
127 void threadFeedPlay();
128 bool threadFeedScan();
129 bool threadPTSFeedScan();
131 void doConnectionLost();
132 void restartAtFrame(ULONG newFrame);
133 void restartAtFramePI(ULONG newFrame);
138 OSDReceiver* osdReceiver;
139 MessageQueue* messageQueue;
140 void* messageReceiver;
145 DVBSubtitles* subtitles;
148 TeletextDecoderVBIEBU *teletext;
153 bool subtitlesShowing{};
154 bool is_pesrecording{true};
158 std::mutex stateMutex;
160 std::thread playerThread;
161 std::mutex playerThreadMutex;
162 std::condition_variable playerThreadCond;
167 ULLONG lengthBytes{};
168 ULONG lengthFrames{};
169 ULONG currentFrameNumber{};
170 UINT blockSize{100000};
171 UINT startupBlockSize{250000};
173 UCHAR ifactor{4}; // 4, 8, 16, 32
183 Play, Pause, FFwd, FBwd, (Stop), [Jump]