Ticket #4568: ticket_4568.diff
File ticket_4568.diff, 21.0 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/guidegrid.h
38 38 static DBChanList Run(uint startChanId, 39 39 const QString &startChanNum, 40 40 bool thread = false, 41 TV *player = NULL, 42 bool allowsecondaryepg = true); 41 TV *player = NULL); 43 42 44 43 DBChanList GetSelection(void) const; 45 44 … … 85 84 protected: 86 85 GuideGrid(MythMainWindow *parent, 87 86 uint chanid = 0, QString channum = "", 88 TV *player = NULL, bool allowsecondaryepg = true,87 TV *player = NULL, 89 88 const char *name = "GuideGrid"); 90 89 ~GuideGrid(); 91 90 -
libs/libmythtv/tv_play.h
43 43 typedef QMap<QString,InfoMap> DDValueMap; 44 44 typedef QMap<QString,DDValueMap> DDKeyMap; 45 45 typedef ProgramInfo * (*RUNPLAYBACKBOX)(void *); 46 typedef void (*RUNVIEWSCHEDULED) (void *); 46 47 47 48 48 class VBIMode 49 49 { 50 50 public: … … 75 75 kScheduleProgramGuide = 0, 76 76 kScheduleProgramFinder, 77 77 kScheduledRecording, 78 kPlaybackBox, 78 kViewSchedule, 79 kPlaybackBox 79 80 }; 80 81 81 82 typedef enum … … 197 198 /// true if dialog is either videoplayexit, playexit or askdelete dialog 198 199 bool IsVideoExitDialog(void); 199 200 /// true if NVP is near the end 200 bool IsNearEnd(void) { return isnearend; } 201 bool IsNearEnd(void) const { return isnearend; } 202 /// true if tv player is paused 203 bool IsPaused(void) const { return paused; } 201 204 202 205 // Other queries 203 206 int GetLastRecorderNum(void) const; … … 239 242 protected: 240 243 void doEditSchedule(int editType = kScheduleProgramGuide); 241 244 static void *RecordedShowMenuHandler(void *param); 245 static void *ViewScheduledMenuHandler(void *param); 246 void VideoThemeCheck(QString str, bool stayPaused = false); 242 247 243 248 void RunTV(void); 244 249 static void *EventThread(void *param); … … 247 252 bool eventFilter(QObject *o, QEvent *e); 248 253 static QStringList lastProgramStringList; 249 254 static RUNPLAYBACKBOX RunPlaybackBoxPtr; 255 static RUNVIEWSCHEDULED RunViewScheduledPtr; 250 256 251 257 private: 252 258 bool RequestNextRecorder(bool showDialogs); -
libs/libmythtv/guidegrid.cpp
40 40 uint chanid, 41 41 const QString &channum, 42 42 bool thread, 43 TV *player, 44 bool allowsecondaryepg) 43 TV *player) 45 44 { 46 45 DBChanList channel_changed; 47 46 … … 52 51 53 52 GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), 54 53 chanid, channum, 55 player, allowsecondaryepg,"guidegrid");54 player, "guidegrid"); 56 55 57 56 gg->Show(); 58 57 … … 91 90 92 91 GuideGrid::GuideGrid(MythMainWindow *parent, 93 92 uint chanid, QString channum, 94 TV *player, bool allowsecondaryepg, 95 const char *name) 93 TV *player, const char *name) 96 94 : MythDialog(parent, name) 97 95 { 98 96 desiredDisplayChans = DISPLAY_CHANS = 6; … … 123 121 theme = new XMLParse(); 124 122 theme->SetWMult(wmult); 125 123 theme->SetHMult(hmult); 126 if (m_player && m_player->IsRunning() && allowsecondaryepg)124 if (m_player && m_player->IsRunning() && !m_player->IsPaused()) 127 125 theme->LoadTheme(xmldata, "programguide-video"); 128 126 else 129 127 theme->LoadTheme(xmldata, "programguide"); 130 128 131 129 LoadWindow(xmldata); 132 130 133 if (m_player && m_player->IsRunning() && !allowsecondaryepg)131 if (m_player && m_player->IsRunning() && m_player->IsPaused()) 134 132 videoRect = QRect(0, 0, 1, 1); 135 133 136 134 showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0); … … 202 200 203 201 int dNum = gContext->GetNumSetting("chanPerPage", 8); 204 202 205 if (m_player && m_player->IsRunning() && allowsecondaryepg)203 if (m_player && m_player->IsRunning() && !m_player->IsPaused()) 206 204 dNum = dNum * 2 / 3 + 1; 207 205 208 206 desiredDisplayChans = DISPLAY_CHANS = dNum; -
libs/libmythtv/tv_play.cpp
78 78 */ 79 79 RUNPLAYBACKBOX TV::RunPlaybackBoxPtr = NULL; 80 80 81 /**\ brief function pointer for RunViewScheduled in viewscheduled.cpp 82 */ 83 RUNVIEWSCHEDULED TV::RunViewScheduledPtr = NULL; 84 81 85 /* 82 86 \brief returns true if the recording completed when exiting. 83 87 */ … … 262 266 QString name(string); 263 267 if (name == "playbackbox") 264 268 RunPlaybackBoxPtr = (RUNPLAYBACKBOX)lptr; 269 else if (name == "viewscheduled") 270 RunViewScheduledPtr = (RUNVIEWSCHEDULED)lptr; 265 271 } 266 272 267 273 void TV::InitKeys(void) … … 406 412 REG_KEY("TV Playback", "PLAY", "Play", "Ctrl+P"); 407 413 REG_KEY("TV Playback", "JUMPPREV", "Jump to previously played recording", ""); 408 414 REG_KEY("TV Playback", "JUMPREC", "Display menu of recorded programs to jump to", ""); 415 REG_KEY("TV Playback", "VIEWSCHEDULED", "Display scheduled recording list", ""); 409 416 REG_KEY("TV Playback", "SIGNALMON", "Monitor Signal Quality", "F7"); 410 417 REG_KEY("TV Playback", "JUMPTODVDROOTMENU", "Jump to the DVD Root Menu", ""); 411 418 REG_KEY("TV Playback", "EXITSHOWNOPROMPTS","Exit Show without any prompts", ""); … … 3151 3158 jumpToProgram = true; 3152 3159 } 3153 3160 } 3161 else if (action == "VIEWSCHEDULED") 3162 EmbedWithNewThread(kViewSchedule); 3154 3163 else if (action == "JUMPREC") 3155 3164 { 3156 3165 if (gContext->GetNumSetting("JumpToProgramOSD", 1) … … 5675 5684 nvp->DrawUnusedRects(sync); 5676 5685 } 5677 5686 5687 void *TV::ViewScheduledMenuHandler(void *param) 5688 { 5689 TV *obj = (TV *)param; 5690 obj->doEditSchedule(kViewSchedule); 5691 return NULL; 5692 } 5693 5678 5694 void *TV::RecordedShowMenuHandler(void *param) 5679 5695 { 5680 5696 TV *obj = (TV *)param; 5681 5697 obj->doEditSchedule(kPlaybackBox); 5682 5683 5698 return NULL; 5684 5699 } 5685 5700 5701 /** 5702 * \brief Used by EditSchedule(). Unpauses embedded tv based on whether theme 5703 exists and/or if knob to continued playback is enabled 5704 */ 5705 void TV::VideoThemeCheck(QString str, bool stayPaused) 5706 { 5707 // see if embedded window is allowed 5708 bool allowembed = false; 5709 if (gContext->GetNumSetting("ContinueEmbeddedTVPlay", 0) || 5710 StateIsLiveTV(GetState())) 5711 { 5712 allowembed = (nvp && nvp->getVideoOutput() && 5713 nvp->getVideoOutput()->AllowEmbedding()); 5714 } 5715 5716 long long margin = (long long)(nvp->GetFrameRate() * 5717 nvp->GetAudioStretchFactor()); 5718 margin = margin * 5; 5719 QDomElement xmldata; 5720 XMLParse *theme = new XMLParse(); 5721 if (allowembed && theme->LoadTheme(xmldata, str) && 5722 !nvp->IsNearEnd(margin) && !stayPaused) 5723 { 5724 DoPause(false); 5725 } 5726 5727 if (theme) 5728 delete theme; 5729 } 5730 5686 5731 void TV::doEditSchedule(int editType) 5687 5732 { 5688 5733 if (!playbackinfo) … … 5714 5759 DBChanList changeChannel; 5715 5760 ProgramInfo *nextProgram = NULL; 5716 5761 5717 if (StateIsLiveTV(GetState())) 5762 bool stayPaused = paused; 5763 if (!paused) 5764 DoPause(false); 5765 5766 switch (editType) 5718 5767 { 5719 switch (editType) 5768 default: 5769 case kScheduleProgramGuide: 5770 VideoThemeCheck("programguide-video", stayPaused); 5771 GuideGrid::Run(chanid, channum, false, this); 5772 break; 5773 case kScheduleProgramFinder: 5774 RunProgramFind(true, false); 5775 break; 5776 case kScheduledRecording: 5720 5777 { 5721 default: 5722 case kScheduleProgramGuide: 5723 { 5724 // See if we can provide a channel preview in EPG 5725 bool allowsecondary = true; 5726 if (nvp && nvp->getVideoOutput()) 5727 allowsecondary = nvp->getVideoOutput()->AllowPreviewEPG(); 5728 5729 // Start up EPG 5730 changeChannel = GuideGrid::Run( 5731 chanid, channum, false, this, allowsecondary); 5732 5733 break; 5734 } 5735 case kPlaybackBox: 5736 { 5737 bool stayPaused = false; 5738 QDomElement pbbxmldata; 5739 XMLParse *theme = new XMLParse(); 5740 if (!theme->LoadTheme(pbbxmldata, "playback-video")) 5741 { 5742 stayPaused = paused; 5743 if (!paused) 5744 DoPause(false); 5745 } 5746 if (theme) 5747 delete theme; 5748 nextProgram = RunPlaybackBoxPtr((void *)this); 5749 if (nextProgram) 5750 { 5751 setLastProgram(nextProgram); 5752 jumpToProgram = true; 5753 exitPlayer = true; 5754 delete nextProgram; 5755 } 5756 if (paused && !stayPaused) 5757 DoPause(false); 5758 break; 5759 } 5778 QMutexLocker locker(&pbinfoLock); 5779 ScheduledRecording *record = new ScheduledRecording(); 5780 record->loadByProgram(playbackinfo); 5781 record->exec(); 5782 record->deleteLater(); 5783 break; 5760 5784 } 5761 if (IsEmbedding()) 5762 StopEmbeddingOutput(); 5763 } 5764 else 5765 { 5766 bool stayPaused = paused; 5767 if (!paused) 5768 DoPause(); 5769 5770 switch (editType) 5785 case kViewSchedule: 5771 5786 { 5772 default: 5773 case kScheduleProgramGuide: 5774 GuideGrid::Run(chanid, channum, false); 5775 break; 5776 case kScheduleProgramFinder: 5777 RunProgramFind(true, false); 5778 break; 5779 case kScheduledRecording: 5780 { 5781 QMutexLocker locker(&pbinfoLock); 5782 ScheduledRecording *record = new ScheduledRecording(); 5783 record->loadByProgram(playbackinfo); 5784 record->exec(); 5785 record->deleteLater(); 5786 break; 5787 } 5788 case kPlaybackBox: 5789 { 5790 long long margin = 5791 (long long)(nvp->GetFrameRate() * nvp->GetAudioStretchFactor()); 5792 // keep video paused if only 5 seconds left in recording 5793 margin = margin * 5; 5794 QDomElement pbbxmldata; 5795 XMLParse *theme = new XMLParse(); 5796 if (theme->LoadTheme(pbbxmldata, "playback-video")) 5797 { 5798 if (!stayPaused && paused && !nvp->IsNearEnd(margin)) 5799 { 5800 DoPause(false); 5801 stayPaused = true; 5802 } 5803 } 5804 if (theme) 5805 delete theme; 5806 nextProgram = RunPlaybackBoxPtr((void *)this); 5807 if (IsEmbedding()) 5808 StopEmbeddingOutput(); 5809 if (nextProgram) 5810 { 5811 setLastProgram(nextProgram); 5812 jumpToProgram = true; 5813 exitPlayer = true; 5814 delete nextProgram; 5815 } 5816 break; 5817 } 5787 VideoThemeCheck("conflict-video", stayPaused); 5788 RunViewScheduledPtr((void *)this); 5789 break; 5818 5790 } 5819 5820 if (!stayPaused) 5821 DoPause(); 5791 case kPlaybackBox: 5792 { 5793 VideoThemeCheck("playback-video", stayPaused); 5794 nextProgram = RunPlaybackBoxPtr((void *)this); 5795 } 5822 5796 } 5823 5797 5798 if (!stayPaused && paused) 5799 DoPause(false); 5800 5801 if (IsEmbedding()) 5802 StopEmbeddingOutput(); 5803 5804 if (nextProgram) 5805 { 5806 setLastProgram(nextProgram); 5807 jumpToProgram = true; 5808 exitPlayer = true; 5809 delete nextProgram; 5810 } 5824 5811 // Resize the window back to the MythTV Player size 5825 5812 if (!using_gui_size_for_tv) 5826 5813 { … … 5845 5832 */ 5846 5833 void TV::EmbedWithNewThread(int editType) 5847 5834 { 5848 (void) editType;5849 5850 5835 if (menurunning != true) 5851 5836 { 5852 5837 menurunning = true; … … 5855 5840 pthread_attr_init(&attr); 5856 5841 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 5857 5842 5858 pthread_create(&tid, &attr, TV::RecordedShowMenuHandler, this); 5843 switch (editType) 5844 { 5845 case kViewSchedule: 5846 pthread_create(&tid, &attr, TV::ViewScheduledMenuHandler, this); 5847 break; 5848 case kPlaybackBox: 5849 pthread_create(&tid, &attr, TV::RecordedShowMenuHandler, this); 5850 break; 5851 } 5852 5859 5853 pthread_attr_destroy(&attr); 5860 5854 5861 5855 return; … … 7228 7222 jumpToProgram = true; 7229 7223 } 7230 7224 } 7225 else if (action == "VIEWSCHEDULED") 7226 EmbedWithNewThread(kViewSchedule); 7231 7227 else if (action == "JUMPREC") 7232 7228 { 7233 7229 if (gContext->GetNumSetting("JumpToProgramOSD", 1) … … 7670 7666 7671 7667 item = new OSDGenericTree(treeMenu, tr("Schedule Recordings")); 7672 7668 subitem = new OSDGenericTree(item, tr("Program Guide"), "GUIDE"); 7669 subitem = new OSDGenericTree(item, tr("Upcoming Recordings"), 7670 "VIEWSCHEDULED"); 7673 7671 subitem = new OSDGenericTree(item, tr("Program Finder"), "FINDER"); 7674 7672 subitem = new OSDGenericTree(item, tr("Edit Recording Schedule"), 7675 7673 "SCHEDULE"); -
libs/libmythtv/videooutbase.h
115 115 int GetPictureAttribute(PictureAttribute) const; 116 116 virtual void InitPictureAttributes(void); 117 117 118 bool Allow PreviewEPG(void) { return allowpreviewepg; }118 bool AllowEmbedding(void) { return allowpreviewepg; } 119 119 120 120 /// \brief Returns true iff Motion Compensation acceleration is available. 121 121 virtual bool hasMCAcceleration(void) const { return false; } -
programs/mythfrontend/playbackbox.cpp
348 348 // theme stuff 349 349 theme->SetWMult(wmult); 350 350 theme->SetHMult(hmult); 351 if (m_player && theme->LoadTheme(xmldata,"playback-video")) 351 if (m_player && !m_player->IsPaused() && 352 theme->LoadTheme(xmldata,"playback-video")) 352 353 { 353 354 playbackVideoContainer = true; 354 355 previewPixmapEnabled = false; -
programs/mythfrontend/viewscheduled.h
9 9 #include "xmlparse.h" 10 10 #include "programinfo.h" 11 11 12 class TV; 13 class Timer; 12 14 13 15 class ViewScheduled : public MythDialog 14 16 { 15 17 Q_OBJECT 16 18 public: 17 ViewScheduled(MythMainWindow *parent, const char *name = 0); 19 ViewScheduled(MythMainWindow *parent, const char *name = 0, 20 TV *player = NULL); 18 21 ~ViewScheduled(); 22 static void * RunViewScheduled(void *player); 19 23 20 24 protected slots: 21 25 void edit(); … … 28 32 void cursorUp(bool page = false); 29 33 void pageDown() { cursorDown(true); } 30 34 void pageUp() { cursorUp(true); } 35 void timeout(void); 31 36 32 37 protected: 33 38 void paintEvent(QPaintEvent *); … … 49 54 50 55 void LoadWindow(QDomElement &); 51 56 void parseContainer(QDomElement &); 57 void EmbedTVWindow(void); 52 58 XMLParse *theme; 53 59 QDomElement xmldata; 54 60 … … 66 72 QRect showLevelRect; 67 73 QRect recStatusRect; 68 74 QRect fullRect; 75 QRect tvRect; 69 76 70 77 int listsize; 71 78 … … 85 92 QMap<int, int> inputref; 86 93 int maxinput; 87 94 int curinput; 95 96 TV *m_player; 97 QTimer *timer; 88 98 }; 89 99 90 100 #endif -
programs/mythfrontend/globalsettings.cpp
1907 1907 return gc; 1908 1908 } 1909 1909 1910 static HostCheckBox *ContinueEmbeddedTVPlay() 1911 { 1912 HostCheckBox *gc = new HostCheckBox("ContinueEmbeddedTVPlay"); 1913 gc->setLabel(QObject::tr("Continue Playback When Embedded")); 1914 gc->setValue(false); 1915 gc->setHelpText(QObject::tr( 1916 "This option, continues TV playback, when the TV window " 1917 "is embedded in the upcoming program list or recorded " 1918 "list. The default is to pause the recorded show when " 1919 "embedded")); 1920 return gc; 1921 } 1922 1910 1923 static HostCheckBox *AutomaticSetWatched() 1911 1924 { 1912 1925 HostCheckBox *gc = new HostCheckBox("AutomaticSetWatched"); … … 4410 4423 column2->addChild(ClearSavedPosition()); 4411 4424 column2->addChild(AltClearSavedPosition()); 4412 4425 column2->addChild(JumpToProgramOSD()); 4426 column2->addChild(ContinueEmbeddedTVPlay()); 4413 4427 column2->addChild(AutomaticSetWatched()); 4414 4428 columns->addChild(column2); 4415 4429 -
programs/mythfrontend/main.cpp
802 802 TV::InitKeys(); 803 803 804 804 TV::SetFuncPtr("playbackbox", (void *)PlaybackBox::RunPlaybackBox); 805 TV::SetFuncPtr("viewscheduled", (void *)ViewScheduled::RunViewScheduled); 805 806 } 806 807 807 808 -
programs/mythfrontend/viewscheduled.cpp
18 18 #include "scheduledrecording.h" 19 19 #include "customedit.h" 20 20 #include "proglist.h" 21 #include "tv .h"21 #include "tv_play.h" 22 22 23 23 #include "exitcodes.h" 24 24 #include "dialogbox.h" 25 25 #include "mythcontext.h" 26 26 #include "remoteutil.h" 27 27 28 ViewScheduled::ViewScheduled(MythMainWindow *parent, const char *name) 28 QWaitCondition vsbIsVisibleCond; 29 30 void *ViewScheduled::RunViewScheduled(void *player) 31 { 32 qApp->lock(); 33 34 ViewScheduled *vsb = new ViewScheduled(gContext->GetMainWindow(), 35 "view scheduled", (TV*)player); 36 vsb->Show(); 37 qApp->unlock(); 38 vsbIsVisibleCond.wait(); 39 delete vsb; 40 41 return NULL; 42 } 43 44 ViewScheduled::ViewScheduled(MythMainWindow *parent, const char *name, 45 TV* player) 29 46 : MythDialog(parent, name) 30 47 { 31 48 dateformat = gContext->GetSetting("ShortDateFormat", "M/d"); … … 40 57 showLevelRect = QRect(0, 0, 0, 0); 41 58 recStatusRect = QRect(0, 0, 0, 0); 42 59 60 m_player = player; 43 61 theme = new XMLParse(); 44 62 theme->SetWMult(wmult); 45 63 theme->SetHMult(hmult); 46 theme->LoadTheme(xmldata, "conflict"); 64 if (m_player && m_player->IsRunning() && !m_player->IsPaused()) 65 { 66 if (!theme->LoadTheme(xmldata, "conflict-video")) 67 theme->LoadTheme(xmldata, "conflict"); 68 } 69 else 70 theme->LoadTheme(xmldata, "conflict"); 47 71 LoadWindow(xmldata); 48 72 73 if (m_player) 74 { 75 timer = new QTimer(this); 76 connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); 77 timer->start(500); 78 EmbedTVWindow(); 79 } 80 49 81 LayerSet *container = theme->GetSet("selector"); 50 82 if (container) 51 83 { … … 84 116 gContext->SaveSetting("ViewSchedShowLevel", !showAll); 85 117 gContext->removeListener(this); 86 118 gContext->removeCurrentLocation(); 119 120 if (timer) 121 { 122 timer->deleteLater(); 123 timer = NULL; 124 } 125 87 126 delete theme; 88 127 } 89 128 129 void ViewScheduled::timeout(void) 130 { 131 if (m_player) 132 EmbedTVWindow(); 133 } 134 90 135 void ViewScheduled::keyPressEvent(QKeyEvent *e) 91 136 { 92 137 if (inEvent) … … 116 161 else if (action == "DETAILS") 117 162 details(); 118 163 else if (action == "ESCAPE" || action == "LEFT") 164 { 165 vsbIsVisibleCond.wakeAll(); 119 166 done(MythDialog::Accepted); 167 } 120 168 else if (action == "UP") 121 169 cursorUp(); 122 170 else if (action == "DOWN") … … 196 244 showLevelRect = area; 197 245 if (name.lower() == "status_info") 198 246 recStatusRect = area; 247 if (name.lower() == "tv_video") 248 tvRect = area; 199 249 } 200 250 201 251 void ViewScheduled::updateBackground(void) … … 736 786 } 737 787 curinput = 0; 738 788 } 789 790 void ViewScheduled::EmbedTVWindow(void) 791 { 792 if (m_player) 793 { 794 m_player->EmbedOutput(this->winId(), tvRect.x(), tvRect.y(), 795 tvRect.width(), tvRect.height()); 796 } 797 } 798