|
MythTV
0.26-pre
|
00001 // -*- Mode: c++ -*- 00002 00003 #ifndef TVPLAY_H 00004 #define TVPLAY_H 00005 00006 // C 00007 #include <stdint.h> 00008 00009 // C++ 00010 #include <vector> 00011 using namespace std; 00012 00013 // Qt 00014 #include <QReadWriteLock> 00015 #include <QWaitCondition> 00016 #include <QStringList> 00017 #include <QDateTime> 00018 #include <QKeyEvent> 00019 #include <QObject> 00020 #include <QRegExp> 00021 #include <QString> 00022 #include <QEvent> 00023 #include <QMutex> 00024 #include <QHash> 00025 #include <QTime> 00026 #include <QMap> 00027 #include <QSet> 00028 00029 // MythTV 00030 #include "mythdeque.h" 00031 #include "tv.h" 00032 #include "mythmiscutil.h" 00033 #include "programinfo.h" 00034 #include "channelutil.h" 00035 #include "videoouttypes.h" 00036 #include "volumebase.h" 00037 #include "inputinfo.h" 00038 #include "channelgroup.h" 00039 #include "osd.h" 00040 00041 class QDateTime; 00042 class OSD; 00043 class RemoteEncoder; 00044 class MythPlayer; 00045 class DetectLetterbox; 00046 class RingBuffer; 00047 class ProgramInfo; 00048 class MythDialog; 00049 class PlayerContext; 00050 class TvPlayWindow; 00051 class TV; 00052 class TVBrowseHelper; 00053 class DDLoader; 00054 struct osdInfo; 00055 00056 typedef QMap<QString,InfoMap> DDValueMap; 00057 typedef QMap<QString,DDValueMap> DDKeyMap; 00058 typedef void (*EMBEDRETURNVOID) (void *, bool); 00059 typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool, bool, int); 00060 typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool, bool); 00061 typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *, void *); 00062 00063 // Locking order 00064 // 00065 // playerLock -> askAllowLock -> osdLock 00066 // -> progListLock -> osdLock 00067 // -> chanEditMapLock -> osdLock 00068 // -> lastProgramLock 00069 // -> is_tunable_cache_lock 00070 // -> recorderPlaybackInfoLock 00071 // -> timerIdLock 00072 // -> mainLoopCondLock 00073 // -> channelGroupLock 00074 // 00075 // When holding one of these locks, you may lock any lock of the locks to 00076 // the right of the current lock, but may not lock any lock to the left of 00077 // this lock (which will cause a deadlock). Nor should you lock any other 00078 // lock in the TV class without first adding it to the locking order list 00079 // above. 00080 // 00081 // Note: Taking a middle lock such as askAllowLock, without taking a 00082 // playerLock first does not violate these rules, but once you are 00083 // holding it, you cannot later lock playerLock. 00084 // 00085 // It goes without saying that any locks outside of this class should only 00086 // be taken one at a time, and should be taken last and released first of 00087 // all the locks required for any algorithm. (Unless you use tryLock and 00088 // release all locks if it can't gather them all at once, see the 00089 // "multi_lock()" function as an example; but this is not efficient nor 00090 // desirable and should be avoided when possible.) 00091 // 00092 00093 enum scheduleEditTypes { 00094 kScheduleProgramGuide = 0, 00095 kScheduleProgramFinder, 00096 kScheduledRecording, 00097 kViewSchedule, 00098 kPlaybackBox 00099 }; 00100 00104 typedef enum 00105 { 00106 kNoRecorders = 0, 00107 kNoCurrRec = 1, 00108 kNoTuners = 2, 00109 } NoRecorderMsg; 00110 00111 enum { 00112 kStartTVNoFlags = 0x00, 00113 kStartTVInGuide = 0x01, 00114 kStartTVInPlayList = 0x02, 00115 kStartTVByNetworkCommand = 0x04, 00116 kStartTVIgnoreBookmark = 0x08, 00117 }; 00118 00119 class AskProgramInfo 00120 { 00121 public: 00122 AskProgramInfo() : 00123 has_rec(false), has_later(false), 00124 is_in_same_input_group(false), is_conflicting(false), 00125 info(NULL) {} 00126 AskProgramInfo(const QDateTime &e, bool r, bool l, ProgramInfo *i) : 00127 expiry(e), has_rec(r), has_later(l), 00128 is_in_same_input_group(false), is_conflicting(false), 00129 info(i) {} 00130 00131 QDateTime expiry; 00132 bool has_rec; 00133 bool has_later; 00134 bool is_in_same_input_group; 00135 bool is_conflicting; 00136 ProgramInfo *info; 00137 }; 00138 00139 class MTV_PUBLIC TV : public QObject 00140 { 00141 friend class PlaybackBox; 00142 friend class GuideGrid; 00143 friend class ProgFinder; 00144 friend class ViewScheduled; 00145 friend class ScheduleEditor; 00146 friend class TvPlayWindow; 00147 friend class TVBrowseHelper; 00148 friend class DDLoader; 00149 00150 Q_OBJECT 00151 public: 00152 // Check whether we already have a TV object 00153 static bool IsTVRunning(void); 00154 // Start media playback 00155 static bool StartTV(ProgramInfo *tvrec = NULL, 00156 uint flags = kStartTVNoFlags); 00157 00158 // Public event handling 00159 bool event(QEvent *e); 00160 bool eventFilter(QObject *o, QEvent *e); 00161 00162 // Public PlaybackBox methods 00164 bool IsSameProgram(int player_idx, const ProgramInfo *p) const; 00165 00166 // Public recorder methods 00167 void FinishRecording(int player_idx); 00168 00169 // static functions 00170 static void InitKeys(void); 00171 static void ReloadKeys(void); 00172 static void SetFuncPtr(const char *, void *); 00173 static int ConfiguredTunerCards(void); 00174 00176 class SleepTimerInfo 00177 { 00178 public: 00179 SleepTimerInfo(QString str, unsigned long secs) 00180 : dispString(str), seconds(secs) { ; } 00181 QString dispString; 00182 unsigned long seconds; 00183 }; 00184 00185 public slots: 00186 void HandleOSDClosed(int osdType); 00187 void timerEvent(QTimerEvent*); 00188 00189 protected: 00190 // Protected event handling 00191 void customEvent(QEvent *e); 00192 00193 static QStringList lastProgramStringList; 00194 static EMBEDRETURNVOID RunPlaybackBoxPtr; 00195 static EMBEDRETURNVOID RunViewScheduledPtr; 00196 static EMBEDRETURNVOIDEPG RunProgramGuidePtr; 00197 static EMBEDRETURNVOIDFINDER RunProgramFinderPtr; 00198 static EMBEDRETURNVOIDSCHEDIT RunScheduleEditorPtr; 00199 00200 private: 00201 TV(); 00202 ~TV(); 00203 static TV* GetTV(void); 00204 static void ReleaseTV(TV* tv); 00205 static QMutex *gTVLock; 00206 static TV *gTV; 00207 00208 // Private initialisation 00209 bool Init(bool createWindow = true); 00210 void InitFromDB(void); 00211 00212 // Top level playback methods 00213 bool LiveTV(bool showDialogs = true); 00214 bool StartLiveTVInGuide(void) { return db_start_in_guide; } 00215 int Playback(const ProgramInfo &rcinfo); 00216 void PlaybackLoop(void); 00217 00218 // Private event handling 00219 bool ProcessKeypress(PlayerContext*, QKeyEvent *e); 00220 void ProcessNetworkControlCommand(PlayerContext *, const QString &command); 00221 00222 bool HandleTrackAction(PlayerContext*, const QString &action); 00223 bool ActiveHandleAction(PlayerContext*, 00224 const QStringList &actions, 00225 bool isDVD, bool isDVDStillFrame); 00226 bool BrowseHandleAction(PlayerContext*, const QStringList &actions); 00227 void OSDDialogEvent(int result, QString text, QString action); 00228 bool PxPHandleAction(PlayerContext*,const QStringList &actions); 00229 bool ToggleHandleAction(PlayerContext*, 00230 const QStringList &actions, bool isDVD); 00231 bool FFRewHandleAction(PlayerContext*, const QStringList &actions); 00232 bool ActivePostQHandleAction(PlayerContext*, const QStringList &actions); 00233 bool HandleJumpToProgramAction(PlayerContext *ctx, 00234 const QStringList &actions); 00235 bool SeekHandleAction(PlayerContext *actx, const QStringList &actions, 00236 const bool isDVD); 00237 bool TimeStretchHandleAction(PlayerContext*, 00238 const QStringList &actions); 00239 bool DiscMenuHandleAction(PlayerContext*, const QStringList &actions); 00240 bool Handle3D(PlayerContext *ctx, const QString &action); 00241 00242 // Timers and timer events 00243 int StartTimer(int interval, int line); 00244 void KillTimer(int id); 00245 00246 void SetSpeedChangeTimer(uint when, int line); 00247 void HandleEndOfPlaybackTimerEvent(void); 00248 void HandleIsNearEndWhenEmbeddingTimerEvent(void); 00249 void HandleEndOfRecordingExitPromptTimerEvent(void); 00250 void HandleVideoExitDialogTimerEvent(void); 00251 void HandlePseudoLiveTVTimerEvent(void); 00252 void HandleSpeedChangeTimerEvent(void); 00253 void ToggleSleepTimer(const PlayerContext*); 00254 void ToggleSleepTimer(const PlayerContext*, const QString &time); 00255 bool HandlePxPTimerEvent(void); 00256 bool HandleLCDTimerEvent(void); 00257 void HandleLCDVolumeTimerEvent(void); 00258 00259 // Commands used by frontend UI screens (PlaybackBox, GuideGrid etc) 00260 void EditSchedule(const PlayerContext*, 00261 int editType = kScheduleProgramGuide); 00262 bool StartEmbedding(const QRect&); 00263 void StopEmbedding(void); 00264 bool IsTunable(const PlayerContext*, uint chanid, bool use_cache = false); 00265 QSet<uint> IsTunableOn(const PlayerContext*, uint chanid, 00266 bool use_cache, bool early_exit); 00267 void ClearTunableCache(void); 00268 void ChangeChannel(const PlayerContext*, const DBChanList &options); 00269 void DrawUnusedRects(void); 00270 void DoEditSchedule(int editType = kScheduleProgramGuide); 00271 QString GetRecordingGroup(int player_idx) const; 00272 void ChangeVolume(PlayerContext*, bool up, int newvolume = -1); 00273 void ToggleMute(PlayerContext*, const bool muteIndividualChannels = false); 00274 void UpdateChannelList(int groupID); 00275 00276 // Lock handling 00277 OSD *GetOSDL(const char *, int); 00278 OSD *GetOSDL(const PlayerContext*,const char *, int); 00279 void ReturnOSDLock(const PlayerContext*,OSD*&); 00280 PlayerContext *GetPlayerWriteLock( 00281 int which, const char *file, int location); 00282 PlayerContext *GetPlayerReadLock( 00283 int which, const char *file, int location); 00284 const PlayerContext *GetPlayerReadLock( 00285 int which, const char *file, int location) const; 00286 PlayerContext *GetPlayerHaveLock( 00287 PlayerContext*, 00288 int which, const char *file, int location); 00289 const PlayerContext *GetPlayerHaveLock( 00290 const PlayerContext*, 00291 int which, const char *file, int location) const; 00292 void ReturnPlayerLock(PlayerContext*&); 00293 void ReturnPlayerLock(const PlayerContext*&) const; 00294 00295 // Other toggles 00296 void ToggleAutoExpire(PlayerContext*); 00297 void ToggleRecord(PlayerContext*); 00298 00299 // General TV state 00300 static bool StateIsRecording(TVState state); 00301 static bool StateIsPlaying(TVState state); 00302 static bool StateIsLiveTV(TVState state); 00303 00304 TVState GetState(int player_idx) const; 00305 TVState GetState(const PlayerContext*) const; 00306 void HandleStateChange(PlayerContext *mctx, PlayerContext *ctx); 00307 void GetStatus(void); 00308 void ForceNextStateNone(PlayerContext*); 00309 void ScheduleStateChange(PlayerContext*); 00310 void SetErrored(PlayerContext*); 00311 void setInPlayList(bool setting) { inPlaylist = setting; } 00312 void setUnderNetworkControl(bool setting) { underNetworkControl = setting; } 00313 void PrepToSwitchToRecordedProgram(PlayerContext*, 00314 const ProgramInfo &); 00315 enum BookmarkAction { 00316 kBookmarkAlways, 00317 kBookmarkNever, 00318 kBookmarkAuto // set iff db_playback_exit_prompt==2 00319 }; 00320 void PrepareToExitPlayer(PlayerContext*, int line, 00321 BookmarkAction bookmark = kBookmarkAuto); 00322 void SetExitPlayer(bool set_it, bool wants_to); 00323 00324 bool RequestNextRecorder(PlayerContext *, bool); 00325 void DeleteRecorder(); 00326 00327 bool StartRecorder(PlayerContext *ctx, int maxWait=-1); 00328 void StopStuff(PlayerContext *mctx, PlayerContext *ctx, 00329 bool stopRingbuffers, bool stopPlayers, bool stopRecorders); 00330 void TeardownPlayer(PlayerContext *mctx, PlayerContext *ctx); 00331 00332 00333 bool StartPlayer(PlayerContext *mctx, PlayerContext *ctx, 00334 TVState desiredState); 00335 00336 vector<long long> TeardownAllPlayers(PlayerContext*); 00337 void RestartAllPlayers(PlayerContext *lctx, 00338 const vector<long long> &pos, 00339 MuteState mctx_mute); 00340 void RestartMainPlayer(PlayerContext *mctx); 00341 00343 bool IsSwitchingCards(void) const { return switchToRec; } 00345 bool getAllowRerecord(void) const { return allowRerecord; } 00348 bool getEndOfRecording(void) const { return endOfRecording; } 00351 bool getJumpToProgram(void) const { return jumpToProgram; } 00352 bool IsDeleteAllowed(const PlayerContext*) const; 00353 00354 // Channels 00355 void ToggleChannelFavorite(PlayerContext *ctx); 00356 void ToggleChannelFavorite(PlayerContext*, QString); 00357 void ChangeChannel(PlayerContext*, int direction); 00358 void ChangeChannel(PlayerContext*, uint chanid, const QString &channum); 00359 00360 void ShowPreviousChannel(PlayerContext*); 00361 void PopPreviousChannel(PlayerContext*, bool immediate_change); 00362 00363 // key queue commands 00364 void AddKeyToInputQueue(PlayerContext*, char key); 00365 void ClearInputQueues(const PlayerContext*, bool hideosd); 00366 bool CommitQueuedInput(PlayerContext*); 00367 bool ProcessSmartChannel(const PlayerContext*, QString&); 00368 00369 // query key queues 00370 bool HasQueuedInput(void) const 00371 { return !GetQueuedInput().isEmpty(); } 00372 bool HasQueuedChannel(void) const 00373 { return queuedChanID || !GetQueuedChanNum().isEmpty(); } 00374 00375 // get queued up input 00376 QString GetQueuedInput(void) const; 00377 int GetQueuedInputAsInt(bool *ok = NULL, int base = 10) const; 00378 QString GetQueuedChanNum(void) const; 00379 uint GetQueuedChanID(void) const { return queuedChanID; } 00380 00381 // Source and input 00382 void SwitchSource(PlayerContext*, uint source_direction); 00383 void SwitchInputs(PlayerContext*, uint inputid); 00384 void ToggleInputs(PlayerContext*, uint inputid = 0); 00385 void SwitchCards(PlayerContext*, 00386 uint chanid = 0, QString channum = "", uint inputid = 0); 00387 00388 // Pause/play 00389 void PauseLiveTV(PlayerContext*); 00390 void UnpauseLiveTV(PlayerContext*, bool bQuietly = false); 00391 void DoPlay(PlayerContext*); 00392 float DoTogglePauseStart(PlayerContext*); 00393 void DoTogglePauseFinish(PlayerContext*, float time, bool showOSD); 00394 void DoTogglePause(PlayerContext*, bool showOSD); 00395 vector<bool> DoSetPauseState(PlayerContext *lctx, const vector<bool>&); 00396 bool ContextIsPaused(PlayerContext *ctx, const char *file, int location); 00397 00398 // Program jumping stuff 00399 void SetLastProgram(const ProgramInfo *rcinfo); 00400 ProgramInfo *GetLastProgram(void) const; 00401 00402 // Seek, skip, jump, speed 00403 void DoSeek(PlayerContext*, float time, const QString &mesg, 00404 bool timeIsOffset, bool honorCutlist); 00405 bool DoPlayerSeek(PlayerContext*, float time); 00406 enum ArbSeekWhence { 00407 ARBSEEK_SET = 0, 00408 ARBSEEK_REWIND, 00409 ARBSEEK_FORWARD, 00410 ARBSEEK_END 00411 }; 00412 void DoSeekAbsolute(PlayerContext *ctx, long long seconds, bool honorCutlist); 00413 void DoArbSeek(PlayerContext*, ArbSeekWhence whence, bool honorCutlist); 00414 void DoJumpFFWD(PlayerContext *ctx); 00415 void DoJumpRWND(PlayerContext *ctx); 00416 void NormalSpeed(PlayerContext*); 00417 void ChangeSpeed(PlayerContext*, int direction); 00418 void ToggleTimeStretch(PlayerContext*); 00419 void ChangeTimeStretch(PlayerContext*, int dir, bool allowEdit = true); 00420 void DVDJumpBack(PlayerContext*); 00421 void DVDJumpForward(PlayerContext*); 00422 float StopFFRew(PlayerContext*); 00423 void ChangeFFRew(PlayerContext*, int direction); 00424 void SetFFRew(PlayerContext*, int index); 00425 00426 // Private audio methods 00427 void EnableUpmix(PlayerContext*, bool enable, bool toggle = false); 00428 void ChangeAudioSync(PlayerContext*, int dir, int newsync = -9999); 00429 bool AudioSyncHandleAction(PlayerContext*, const QStringList &actions); 00430 void PauseAudioUntilBuffered(PlayerContext *ctx); 00431 00432 // Chapters, titles and angles 00433 int GetNumChapters(const PlayerContext*) const; 00434 void GetChapterTimes(const PlayerContext*, QList<long long> ×) const; 00435 int GetCurrentChapter(const PlayerContext*) const; 00436 int GetNumTitles(const PlayerContext *ctx) const; 00437 int GetCurrentTitle(const PlayerContext *ctx) const; 00438 int GetTitleDuration(const PlayerContext *ctx, int title) const; 00439 QString GetTitleName(const PlayerContext *ctx, int title) const; 00440 void DoSwitchTitle(PlayerContext*, int title); 00441 int GetNumAngles(const PlayerContext *ctx) const; 00442 int GetCurrentAngle(const PlayerContext *ctx) const; 00443 QString GetAngleName(const PlayerContext *ctx, int angle) const; 00444 void DoSwitchAngle(PlayerContext*, int angle); 00445 void DoJumpChapter(PlayerContext*, int chapter); 00446 00447 // Commercial skipping 00448 void DoSkipCommercials(PlayerContext*, int direction); 00449 void SetAutoCommercialSkip(const PlayerContext*, 00450 CommSkipMode skipMode = kCommSkipOff); 00451 00452 // Transcode 00453 void DoQueueTranscode(PlayerContext*, QString profile); 00454 00455 // Bookmarks 00456 bool IsBookmarkAllowed(const PlayerContext*) const; 00457 void SetBookmark(PlayerContext* ctx, bool clear = false); 00458 00459 // OSD 00460 bool ClearOSD(const PlayerContext*); 00461 void ToggleOSD(PlayerContext*, bool includeStatusOSD); 00462 void ToggleOSDDebug(PlayerContext*); 00463 void UpdateOSDDebug(const PlayerContext *ctx); 00464 void UpdateOSDProgInfo(const PlayerContext*, const char *whichInfo); 00465 void UpdateOSDStatus(const PlayerContext *ctx, QString title, QString desc, 00466 QString value, int type, QString units, 00467 int position = 0, 00468 enum OSDTimeout timeout = kOSDTimeout_Med); 00469 void UpdateOSDStatus(const PlayerContext *ctx, osdInfo &info, 00470 int type, enum OSDTimeout timeout); 00471 00472 void UpdateOSDSeekMessage(const PlayerContext*, 00473 const QString &mesg, enum OSDTimeout timeout); 00474 void UpdateOSDInput(const PlayerContext*, 00475 QString inputname = QString::null); 00476 void UpdateOSDSignal(const PlayerContext*, const QStringList &strlist); 00477 void UpdateOSDTimeoutMessage(PlayerContext*); 00478 void UpdateOSDAskAllowDialog(PlayerContext*); 00479 void SetUpdateOSDPosition(bool set_it); 00480 00481 // Captions/subtitles 00482 bool SubtitleZoomHandleAction(PlayerContext *ctx, 00483 const QStringList &actions); 00484 void ChangeSubtitleZoom(PlayerContext *ctx, int dir); 00485 00486 // PxP handling 00487 bool CreatePBP(PlayerContext *lctx, const ProgramInfo *info); 00488 bool CreatePIP(PlayerContext *lctx, const ProgramInfo *info); 00489 bool ResizePIPWindow(PlayerContext*); 00490 bool IsPBPSupported(const PlayerContext *ctx = NULL) const; 00491 bool IsPIPSupported(const PlayerContext *ctx = NULL) const; 00492 void PxPToggleView( PlayerContext *actx, bool wantPBP); 00493 void PxPCreateView( PlayerContext *actx, bool wantPBP); 00494 void PxPTeardownView(PlayerContext *actx); 00495 void PxPToggleType( PlayerContext *mctx, bool wantPBP); 00496 void PxPSwap( PlayerContext *mctx, PlayerContext *pipctx); 00497 bool PIPAddPlayer( PlayerContext *mctx, PlayerContext *ctx); 00498 bool PIPRemovePlayer(PlayerContext *mctx, PlayerContext *ctx); 00499 void PBPRestartMainPlayer(PlayerContext *mctx); 00500 void SetActive(PlayerContext *lctx, int index, bool osd_msg); 00501 00502 // Video controls 00503 void ToggleAspectOverride(PlayerContext*, 00504 AspectOverrideMode aspectMode = kAspect_Toggle); 00505 void ToggleAdjustFill(PlayerContext*, 00506 AdjustFillMode adjustfillMode = kAdjustFill_Toggle); 00507 void DoToggleStudioLevels(const PlayerContext *ctx); 00508 void DoToggleNightMode(const PlayerContext*); 00509 void DoTogglePictureAttribute(const PlayerContext*, 00510 PictureAdjustType type); 00511 void DoChangePictureAttribute( 00512 PlayerContext*, 00513 PictureAdjustType type, PictureAttribute attr, 00514 bool up, int newvalue = -1); 00515 bool PictureAttributeHandleAction(PlayerContext*, 00516 const QStringList &actions); 00517 static PictureAttribute NextPictureAdjustType( 00518 PictureAdjustType type, MythPlayer *mp, PictureAttribute attr); 00519 void HandleDeinterlacer(PlayerContext* ctx, const QString &action); 00520 00521 // Sundry on screen 00522 void ITVRestart(PlayerContext*, bool isLive); 00523 void EnableVisualisation(const PlayerContext*, bool enable, bool toggle = false, 00524 const QString &action = QString("")); 00525 00526 // Manual zoom mode 00527 void SetManualZoom(const PlayerContext *, bool enabled, QString msg); 00528 bool ManualZoomHandleAction(PlayerContext *actx, 00529 const QStringList &actions); 00530 00531 // Channel editing support 00532 void StartChannelEditMode(PlayerContext*); 00533 bool HandleOSDChannelEdit(PlayerContext*, QString action); 00534 void ChannelEditAutoFill(const PlayerContext*, InfoMap&) const; 00535 void ChannelEditAutoFill(const PlayerContext*, InfoMap&, 00536 const QMap<QString,bool>&) const; 00537 void ChannelEditXDSFill(const PlayerContext*, InfoMap&) const; 00538 void ChannelEditDDFill(InfoMap&, const QMap<QString,bool>&, bool) const; 00539 QString GetDataDirect(QString key, QString value, 00540 QString field, bool allow_partial = false) const; 00541 bool LoadDDMap(uint sourceid); 00542 void RunLoadDDMap(uint sourceid); 00543 00544 // General dialog handling 00545 bool DialogIsVisible(PlayerContext *ctx, const QString &dialog); 00546 void HandleOSDInfo(PlayerContext *ctx, QString action); 00547 void ShowNoRecorderDialog(const PlayerContext*, 00548 NoRecorderMsg msgType = kNoRecorders); 00549 00550 // AskAllow dialog handling 00551 void ShowOSDAskAllow(PlayerContext *ctx); 00552 void HandleOSDAskAllow(PlayerContext *ctx, QString action); 00553 void AskAllowRecording(PlayerContext*, const QStringList&, int, bool, bool); 00554 00555 // Program editing support 00556 void ShowOSDCutpoint(PlayerContext *ctx, const QString &type); 00557 bool HandleOSDCutpoint(PlayerContext *ctx, QString action, long long frame); 00558 void StartProgramEditMode(PlayerContext*); 00559 00560 // Already editing dialog 00561 void ShowOSDAlreadyEditing(PlayerContext *ctx); 00562 void HandleOSDAlreadyEditing(PlayerContext *ctx, QString action, 00563 bool was_paused); 00564 00565 // Sleep dialog handling 00566 void ShowOSDSleep(void); 00567 void HandleOSDSleep(PlayerContext *ctx, QString action); 00568 void SleepDialogTimeout(void); 00569 00570 // Idle dialog handling 00571 void ShowOSDIdle(void); 00572 void HandleOSDIdle(PlayerContext *ctx, QString action); 00573 void IdleDialogTimeout(void); 00574 00575 // Exit/delete dialog handling 00576 void ShowOSDStopWatchingRecording(PlayerContext *ctx); 00577 void ShowOSDPromptDeleteRecording(PlayerContext *ctx, QString title, 00578 bool force = false); 00579 bool HandleOSDVideoExit(PlayerContext *ctx, QString action); 00580 00581 // Menu dialog 00582 void ShowOSDMenu(const PlayerContext*, const QString category = "", 00583 const QString selected = ""); 00584 00585 void FillOSDMenuAudio (const PlayerContext *ctx, OSD *osd, 00586 QString category, const QString selected, 00587 QString ¤ttext, QString &backaction); 00588 void FillOSDMenuVideo (const PlayerContext *ctx, OSD *osd, 00589 QString category, const QString selected, 00590 QString ¤ttext, QString &backaction); 00591 void FillOSDMenuSubtitles(const PlayerContext *ctx, OSD *osd, 00592 QString category, const QString selected, 00593 QString ¤ttext, QString &backaction); 00594 void FillOSDMenuNavigate (const PlayerContext *ctx, OSD *osd, 00595 QString category, const QString selected, 00596 QString ¤ttext, QString &backaction); 00597 void FillOSDMenuJobs (const PlayerContext *ctx, OSD *osd, 00598 QString category, const QString selected, 00599 QString ¤ttext, QString &backaction); 00600 void FillOSDMenuPlayback (const PlayerContext *ctx, OSD *osd, 00601 QString category, const QString selected, 00602 QString ¤ttext, QString &backaction); 00603 void FillOSDMenuSchedule (const PlayerContext *ctx, OSD *osd, 00604 QString category, const QString selected, 00605 QString ¤ttext, QString &backaction); 00606 void FillOSDMenuSource (const PlayerContext *ctx, OSD *osd, 00607 QString category, const QString selected, 00608 QString ¤ttext, QString &backaction); 00609 void FillOSDMenuJumpRec (PlayerContext* ctx, const QString category = "", 00610 int level = 0, const QString selected = ""); 00611 00612 // LCD 00613 void UpdateLCD(void); 00614 void ShowLCDChannelInfo(const PlayerContext*); 00615 void ShowLCDDVDInfo(const PlayerContext*); 00616 00617 // Other stuff 00618 int GetLastRecorderNum(int player_idx) const; 00619 static QStringList GetValidRecorderList(uint chanid); 00620 static QStringList GetValidRecorderList(const QString &channum); 00621 static QStringList GetValidRecorderList(uint, const QString&); 00622 00623 static TVState RemoveRecording(TVState state); 00624 void RestoreScreenSaver(const PlayerContext*); 00625 00626 // for temp debugging only.. 00627 int find_player_index(const PlayerContext*) const; 00628 00629 private: 00630 // Configuration variables from database 00631 QString baseFilters; 00632 QString db_channel_format; 00633 uint db_idle_timeout; 00634 int db_playback_exit_prompt; 00635 uint db_autoexpire_default; 00636 bool db_auto_set_watched; 00637 bool db_end_of_rec_exit_prompt; 00638 bool db_jump_prefer_osd; 00639 bool db_use_gui_size_for_tv; 00640 bool db_start_in_guide; 00641 bool db_toggle_bookmark; 00642 bool db_run_jobs_on_remote; 00643 bool db_continue_embedded; 00644 bool db_use_fixed_size; 00645 bool db_browse_always; 00646 bool db_browse_all_tuners; 00647 bool db_use_channel_groups; 00648 bool db_remember_last_channel_group; 00649 ChannelGroupList db_channel_groups; 00650 00651 CommSkipMode autoCommercialSkip; 00652 bool tryUnflaggedSkip; 00653 00654 bool smartForward; 00655 float ff_rew_repos; 00656 bool ff_rew_reverse; 00657 bool jumped_back; 00658 vector<int> ff_rew_speeds; 00659 00660 uint vbimode; 00661 00662 QTime ctorTime; 00663 uint switchToInputId; 00664 00665 QMutex initFromDBLock; 00666 bool initFromDBDone; 00667 QWaitCondition initFromDBWait; 00668 00671 mutable bool wantsToQuit; 00672 bool stretchAdjustment; 00673 bool audiosyncAdjustment; 00674 bool subtitleZoomAdjustment; 00675 bool editmode; 00676 bool zoomMode; 00677 bool sigMonMode; 00678 bool endOfRecording; 00679 bool requestDelete; 00680 bool allowRerecord; 00681 bool doSmartForward; 00682 bool queuedTranscode; 00684 PictureAdjustType adjustingPicture; 00686 PictureAttribute adjustingPictureAttribute; 00687 00688 // Ask Allow state 00689 QMap<QString,AskProgramInfo> askAllowPrograms; 00690 QMutex askAllowLock; 00691 00692 MythDeque<QString> changePxP; 00693 QMutex progListsLock; 00694 QMap<QString,ProgramList> progLists; 00695 00696 mutable QMutex chanEditMapLock; 00697 InfoMap chanEditMap; 00698 00699 DDKeyMap ddMap; 00700 uint ddMapSourceId; 00701 DDLoader *ddMapLoader; 00702 00705 vector<SleepTimerInfo> sleep_times; 00706 uint sleep_index; 00707 uint sleepTimerTimeout; 00708 int sleepTimerId; 00709 int sleepDialogTimerId; 00710 00711 int idleTimerId; 00712 int idleDialogTimerId; 00713 00715 MythTimer keyRepeatTimer; 00716 00717 // CC/Teletex input state variables 00719 bool ccInputMode; 00720 00721 // Arbitrary Seek input state variables 00723 bool asInputMode; 00724 00725 // Channel changing state variables 00727 QString queuedInput; 00729 mutable QString queuedChanNum; 00731 uint queuedChanID; 00732 00733 // Channel changing timeout notification variables 00734 QTime lockTimer; 00735 bool lockTimerOn; 00736 QDateTime lastLockSeenTime; 00737 00738 // Channel browsing state variables 00739 TVBrowseHelper *browsehelper; 00740 00741 // Program Info for currently playing video 00742 // (or next video if InChangeState() is true) 00743 mutable QMutex lastProgramLock; 00744 ProgramInfo *lastProgram; 00745 bool inPlaylist; 00746 bool underNetworkControl; 00747 00748 // Program Jumping 00749 PIPState jumpToProgramPIPState; 00750 bool jumpToProgram; 00751 00752 // Video Players 00753 vector<PlayerContext*> player; 00755 int playerActive; 00757 mutable QReadWriteLock playerLock; 00758 00759 bool noHardwareDecoders; 00760 00761 // Remote Encoders 00763 RemoteEncoder *switchToRec; 00764 00765 // OSD info 00766 QMap<OSD*,const PlayerContext*> osd_lctx; 00767 00768 // LCD Info 00769 QString lcdTitle; 00770 QString lcdSubtitle; 00771 QString lcdCallsign; 00772 00773 // Window info (GUI is optional, transcoding, preview img, etc) 00774 TvPlayWindow *myWindow; 00775 00776 QRect player_bounds; 00778 QRect saved_gui_bounds; 00780 bool weDisabledGUI; 00782 bool disableDrawUnusedRects; 00783 00784 // embedded status 00785 bool isEmbedded; 00786 bool ignoreKeyPresses; 00787 vector<bool> saved_pause; 00788 00789 // IsTunable() cache, used by embedded program guide 00790 mutable QMutex is_tunable_cache_lock; 00791 QMap< uint,vector<InputInfo> > is_tunable_cache_inputs; 00792 00793 // Channel group stuff 00797 mutable QMutex channelGroupLock; 00798 volatile int channelGroupId; 00799 DBChanList channelGroupChannelList; 00800 00801 // Network Control stuff 00802 MythDeque<QString> networkControlCommands; 00803 00804 // Timers 00805 typedef QMap<int,PlayerContext*> TimerContextMap; 00806 typedef QMap<int,const PlayerContext*> TimerContextConstMap; 00807 mutable QMutex timerIdLock; 00808 volatile int lcdTimerId; 00809 volatile int lcdVolumeTimerId; 00810 volatile int networkControlTimerId; 00811 volatile int jumpMenuTimerId; 00812 volatile int pipChangeTimerId; 00813 volatile int switchToInputTimerId; 00814 volatile int ccInputTimerId; 00815 volatile int asInputTimerId; 00816 volatile int queueInputTimerId; 00817 volatile int browseTimerId; 00818 volatile int updateOSDPosTimerId; 00819 volatile int updateOSDDebugTimerId; 00820 volatile int endOfPlaybackTimerId; 00821 volatile int embedCheckTimerId; 00822 volatile int endOfRecPromptTimerId; 00823 volatile int videoExitDialogTimerId; 00824 volatile int pseudoChangeChanTimerId; 00825 volatile int speedChangeTimerId; 00826 volatile int errorRecoveryTimerId; 00827 mutable volatile int exitPlayerTimerId; 00828 TimerContextMap stateChangeTimerId; 00829 TimerContextMap signalMonitorTimerId; 00830 TimerContextMap tvchainUpdateTimerId; 00831 00832 public: 00833 // Constants 00834 static const int kInitFFRWSpeed; 00835 static const uint kInputKeysMax; 00836 static const uint kNextSource; 00837 static const uint kPreviousSource; 00838 static const uint kMaxPIPCount; 00839 static const uint kMaxPBPCount; 00840 00842 static const uint kInputModeTimeout; 00844 static const uint kLCDTimeout; 00846 static const uint kBrowseTimeout; 00848 static const uint kKeyRepeatTimeout; 00850 static const uint kPrevChanTimeout; 00852 static const uint kSleepTimerDialogTimeout; 00854 static const uint kIdleTimerDialogTimeout; 00856 static const uint kVideoExitDialogTimeout; 00857 00858 static const uint kEndOfPlaybackCheckFrequency; 00859 static const uint kEmbedCheckFrequency; 00860 static const uint kSpeedChangeCheckFrequency; 00861 static const uint kErrorRecoveryCheckFrequency; 00862 static const uint kEndOfRecPromptCheckFrequency; 00863 static const uint kEndOfPlaybackFirstCheckTimer; 00864 }; 00865 00866 #endif
1.7.6.1