13 #include "ringbuffer.h"
39 class MythSqlDatabase;
49 class NSAutoreleasePool;
96 #define FlagIsSet(arg) (playerFlags & arg)
102 :
MThread(
"Decoder"), m_mp(mp), m_start_paused(start_paused) { }
106 virtual void run(
void);
137 virtual int OpenFile(
uint retries = 4);
138 bool InitVideo(
void);
143 void SetFramesPlayed(uint64_t played);
144 void SetVideoFilters(
const QString &
override);
149 void SetTranscoding(
bool value);
150 void SetWatchingRecording(
bool mode);
151 void SetWatched(
bool forceWatched =
false);
152 void SetKeyframeDistance(
int keyframedistance);
153 void SetVideoParams(
int w,
int h,
double fps,
155 void SetFileLength(
int total,
int frames);
156 void SetDuration(
int duration);
157 void SetVideoResize(
const QRect &videoRect);
158 void EnableFrameRateMonitor(
bool enable =
false);
159 void ForceDeinterlacer(
const QString &
override = QString());
166 void GetPlaybackData(
InfoMap &infoMap);
167 bool IsAudioNeeded(
void)
168 {
return !(FlagIsSet(
kVideoIsNull)) && player_ctx->IsAudioNeeded(); }
170 int GetSecondsBehind(
void)
const;
171 int GetFreeVideoFrames(
void)
const;
183 uint64_t GetCurrentFrameCount(
void)
const;
185 virtual int64_t GetSecondsPlayed(
bool honorCutList);
186 virtual int64_t GetTotalSeconds(
void)
const;
187 virtual uint64_t GetBookmark(
void);
188 QString GetError(
void)
const;
189 bool IsErrorRecoverable(
void)
const
191 bool IsDecoderErrored(
void)
const
193 QString GetEncodingType(
void)
const;
194 void GetCodecDescription(
InfoMap &infoMap);
195 QString GetXDS(
const QString &key)
const;
200 bool GetRawAudioState(
void)
const;
203 bool IsErrored(
void)
const;
204 bool IsPlaying(
uint wait_ms = 0,
bool wait_for =
true)
const;
206 bool IsReallyNearEnd(
void)
const;
207 bool IsNearEnd(
void);
211 bool IsMuted(
void) {
return audio.IsMuted(); }
214 bool HasTVChainNext(
void)
const;
215 bool CanSupportDoubleRate(
void);
216 bool GetScreenShot(
int width = 0,
int height = 0, QString filename =
"");
217 bool IsWatchingInprogress(
void)
const;
220 virtual char *GetScreenGrabAtFrame(uint64_t frameNum,
bool absolute,
221 int &
buflen,
int &vw,
int &vh,
float &ar);
222 virtual char *GetScreenGrab(
int secondsin,
int &
buflen,
223 int &vw,
int &vh,
float &ar);
237 void InitForTranscode(
bool copyaudio,
bool copyvideo);
238 bool TranscodeGetNextFrame(frm_dir_map_t::iterator &dm_iter,
239 int &did_ff,
bool &is_key,
bool honorCutList);
240 bool WriteStoredData(
242 long UpdateStoredFrameNum(
long curFrameNum);
247 VideoFrame *GetRawVideoFrame(
long long frameNumber = -1);
255 void DiscardVideoFrames(
bool next_frame_keyframe);
256 void DrawSlice(
VideoFrame *frame,
int x,
int y,
int w,
int h);
259 void *GetDecoderContext(
unsigned char*
buf, uint8_t*&
id);
260 virtual bool HasReachedEof(
void)
const;
263 void SaveScreenshot(
void);
266 void ReinitVideo(
void);
269 virtual bool PrepareAudioSample(int64_t &timecode);
279 void TracksChanged(
uint trackType);
280 void EnableSubtitles(
bool enable);
281 void EnableForcedSubtitles(
bool enable);
283 return allowForcedSubtitles && !captionsEnabledbyDefault;
289 void SetAllowForcedSubtitles(
bool allow);
293 bool SetAudioByComponentTag(
int tag);
294 bool SetVideoByComponentTag(
int tag);
295 bool SetStream(
const QString &);
297 long GetStreamMaxPos();
298 long SetStreamPos(
long);
299 void StreamPlay(
bool play =
true);
303 void FileChangedCallback();
306 virtual int GetNumChapters(
void);
307 virtual int GetCurrentChapter(
void);
308 virtual void GetChapterTimes(QList<long long> ×);
322 virtual bool GoToMenu(QString str) {
return false; }
326 bool PosMapFromEnc(uint64_t start,
336 void ToggleStudioLevels(
void);
337 void ToggleNightMode(
void);
340 bool CanVisualise(
void);
341 bool IsVisualising(
void);
342 QString GetVisualiserName(
void);
343 QStringList GetVisualiserList(
void);
344 bool EnableVisualisation(
bool enable,
const QString &
name = QString(
""));
346 void SaveTotalDuration(
void);
347 void ResetTotalDuration(
void);
356 void SaveTotalFrames(
void);
360 void OpenDummy(
void);
363 virtual void SetBookmark(
bool clear =
false);
366 void NextScanType(
void)
374 void EmbedInWidget(QRect rect);
375 void StopEmbedding(
void);
376 void ExposeEvent(
void);
377 bool IsEmbedding(
void);
378 void WindowResized(
const QSize &new_size);
383 bool SetMuted(
bool mute) {
return audio.SetMuted(mute); }
390 virtual void SeekForScreenGrab(uint64_t &number, uint64_t frameNum,
394 virtual long long CalcMaxFFTime(
long long ff,
bool setjump =
true)
const;
395 long long CalcRWTime(
long long rw)
const;
396 virtual void calcSliderPos(
osdInfo &info,
bool paddedFields =
false);
397 uint64_t TranslatePositionFrameToMs(uint64_t position,
398 bool use_cutlist)
const;
399 uint64_t TranslatePositionMsToFrame(uint64_t position,
400 bool use_cutlist)
const {
401 return deleteMap.TranslatePositionMsToFrame(position,
409 return deleteMap.TranslatePositionAbsToRel(position);
412 return deleteMap.TranslatePositionRelToAbs(position);
415 return TranslatePositionFrameToMs(position, use_cutlist) / 1000.0;
417 uint64_t FindFrame(
float offset,
bool use_cutlist)
const;
421 { commBreakMap.SetAutoCommercialSkip(autoskip, framesPlayed); }
422 void SkipCommercials(
int direction)
423 { commBreakMap.SkipCommercials(direction); }
426 {
return commBreakMap.GetAutoCommercialSkip(); }
433 virtual bool StartPlaying(
void);
434 virtual void ResetPlaying(
bool resetframes =
true);
436 virtual void StopPlaying(
void);
439 bool PauseDecoder(
void);
440 void UnpauseDecoder(
void);
442 bool Play(
float speed = 1.0,
bool normal =
true,
bool unpauseaudio =
true);
445 virtual bool FastForward(
float seconds);
446 virtual bool Rewind(
float seconds);
447 virtual bool JumpToFrame(uint64_t frame);
450 void JumpChapter(
int chapter);
453 virtual bool PrebufferEnoughFrames(
int min_buffers = 0);
454 void SetBuffering(
bool new_buffering);
455 void RefreshPauseFrame(
void);
457 virtual void DisplayPauseFrame(
void);
458 virtual void DisplayNormalFrame(
bool check_prebuffer =
true);
459 virtual void PreProcessNormalFrame(
void);
460 virtual void VideoStart(
void);
461 virtual bool VideoLoop(
void);
462 virtual void VideoEnd(
void);
463 virtual void DecoderStart(
bool start_paused);
464 virtual void DecoderLoop(
bool pause);
465 virtual void DecoderEnd(
void);
466 virtual void DecoderPauseCheck(
void);
467 virtual void AudioEnd(
void);
468 virtual void EventStart(
void);
469 virtual void EventLoop(
void);
470 virtual void InitialSeek(
void);
473 bool ITVHandleAction(
const QString &
action);
474 void ITVRestart(
uint chanid,
uint cardid,
bool isLiveTV);
477 bool EnableEdit(
void);
478 bool HandleProgramEditorActions(QStringList &actions);
480 void DisableEdit(
int howToSave);
481 bool IsInDelete(uint64_t frame);
482 uint64_t GetNearestMark(uint64_t frame,
bool right);
483 bool IsTemporaryMark(uint64_t frame);
484 bool HasTemporaryMark(
void);
492 void ReinitOSD(
void);
499 void ResetCaptions(
void);
500 bool ToggleCaptions(
void);
503 void SetCaptionsEnabled(
bool,
bool osd_msg=
true);
504 bool GetCaptionsEnabled(
void);
505 virtual void DisableCaptions(
uint mode,
bool osd_msg=
true);
506 virtual void EnableCaptions(
uint mode,
bool osd_msg=
true);
511 virtual int SetTrack(
uint type,
int trackNo);
513 int ChangeTrack(
uint type,
int dir);
514 void ChangeCaptionTrack(
int dir);
515 bool HasCaptionTrack(
int mode);
516 int NextCaptionTrack(
int mode);
517 void DoDisableForcedSubtitles(
void);
518 void DoEnableForcedSubtitles(
void);
521 void EnableTeletext(
int page = 0x100);
522 void DisableTeletext(
void);
523 void ResetTeletext(
void);
524 bool HandleTeletextAction(
const QString &
action);
527 void SetTeletextPage(
uint page);
530 int64_t AdjustAudioTimecodeOffset(int64_t v,
int newsync = -9999);
531 int64_t GetAudioTimecodeOffset(
void)
const
539 void InitFilters(
void);
541 float fps,
int video_height);
542 virtual void AutoDeint(
VideoFrame* frame,
bool allow_lock =
true);
546 void SetPlaying(
bool is_playing);
547 void SetErrored(
const QString &reason)
const;
550 int GetStatusbarPos(
void)
const;
553 void PauseVideo(
void);
554 void UnpauseVideo(
void);
555 void PauseBuffer(
void);
556 void UnpauseBuffer(
void);
559 virtual void CreateDecoder(
char *testbuf,
int testreadsize);
564 unsigned char *strm,
unsigned char *outbuf);
566 virtual bool DecoderGetFrameFFREW(
void);
567 virtual bool DecoderGetFrameREW(
void);
568 bool DecoderGetFrame(
DecodeType,
bool unsafe =
false);
571 bool UpdateFFRewSkip(
void);
572 virtual void ChangeSpeed(
void);
574 bool DoFastForward(uint64_t
frames,
double inaccuracy);
575 bool DoRewind(uint64_t
frames,
double inaccuracy);
576 bool DoFastForwardSecs(
float secs,
double inaccuracy,
bool use_cutlist);
577 bool DoRewindSecs(
float secs,
double inaccuracy,
bool use_cutlist);
578 void DoJumpToFrame(uint64_t frame,
double inaccuracy);
581 void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted);
582 void ClearAfterSeek(
bool clearvideobuffers =
true);
585 virtual bool DoJumpChapter(
int chapter);
586 virtual int64_t GetChapter(
int chapter);
589 void HandleArbSeek(
bool right);
592 void WrapTimecode(int64_t &timecode,
TCTypes tc_type);
593 void InitAVSync(
void);
595 void ResetAVSync(
void);
596 int64_t AVSyncGetAudiotime(
void);
598 void FallbackDeint(
void);
599 void CheckExtraAudioDecode(
void);
602 void SwitchToProgram(
void);
603 void JumpToProgram(
void);
604 void JumpToStream(
const QString&);
803 int64_t tc_wrap[TCTYPESMAX];
804 int64_t tc_lastval[TCTYPESMAX];
814 void syncWithAudioStretch();