21 #define PTSINDEX_ENTRIES 500
36 void Put(uint32_t Pts,
int Index);
67 uint32_t Delta = 0xFFFFFFFF;
69 for (
int i =
w; i !=
r; ) {
108 :
cThread(
"non blocking file reader")
194 #define PLAYERBUFSIZE MEGABYTE(1)
196 #define RESUMEBACKUP 10 // number of seconds to back up when resuming an interrupted replay session
197 #define MAXSTUCKATEOF 3 // max. number of seconds to wait in case the device doesn't play the last frame
226 bool NextFile(uint16_t FileNumber = 0, off_t FileOffset = -1);
231 virtual void Action(
void);
233 cDvbPlayer(
const char *FileName,
bool PauseLive);
242 void Goto(
int Position,
bool Still =
false);
244 virtual bool GetIndex(
int &Current,
int &Total,
bool SnapToIFrame =
false);
248 #define MAX_VIDEO_SLOWMOTION 63 // max. arg to pass to VIDEO_SLOWMOTION // TODO is this value correct?
249 #define NORMAL_SPEED 4 // the index of the '1' entry in the following array
250 #define MAX_SPEEDS 3 // the offset of the maximum speed from normal speed in either direction
251 #define SPEED_MULT 12 // the speed multiplier
274 isyslog(
"replay %s", FileName);
283 esyslog(
"ERROR: can't allocate index");
357 if (
index->
Get(Index, &FileNumber, &FileOffset) &&
NextFile(FileNumber, FileOffset))
415 if (
index->
Get(Index, &FileNumber, &FileOffset) &&
417 isyslog(
"PlayJump: start replay at first mark %d (%s)",
423 bool LastMarkPause =
false;
427 bool WaitingForData =
false;
428 time_t StuckAtEof = 0;
429 uint32_t LastStc = 0;
430 int LastReadIFrame = -1;
431 int SwitchToPlayFrame = 0;
468 if (NewIndex <= 0 && readIndex > 0)
478 if (!
NextFile(FileNumber, FileOffset))
492 if (m && (m->
Index() & 0x01) != 0) {
499 isyslog(
"PauseLastMark: pause at position %d (%s)",
501 LastMarkPause =
true;
513 isyslog(
"PlayJump: %d frames to %d (%s)",
545 WaitingForData =
false;
555 WaitingForData =
true;
643 LastMarkPause =
false;
651 if (
eof || SwitchToPlayFrame) {
652 bool SwitchToPlay =
false;
656 else if (!StuckAtEof)
657 StuckAtEof = time(NULL);
666 if (Index >= LastReadIFrame)
669 else if (Index <= 0 || SwitchToPlayFrame && Index >= SwitchToPlayFrame)
672 if (!SwitchToPlayFrame)
677 SwitchToPlayFrame = 0;
762 default:
esyslog(
"ERROR: unknown playMode %d (%s)",
playMode, __FUNCTION__);
814 default:
esyslog(
"ERROR: unknown playMode %d (%s)",
playMode, __FUNCTION__);
821 if (
index && Frames) {
824 int OldCurrent = Current;
829 return Current >= 0 ? Current : OldCurrent;
836 if (
index && Seconds) {
862 if (Index >= 0 &&
NextFile(FileNumber, FileOffset) && Still) {
884 Current = (abs(Current - i1) <= abs(Current - i2)) ? i1 : i2;
889 Current = Total = -1;