Ticket #4376: tv_play.patch

File tv_play.patch, 5.7 KB (added by andrei@…, 16 years ago)
  • libs/libmythtv/tv_play.cpp

     
    40784078        res = activenvp->Rewind(-time);
    40794079
    40804080    if (muted)
    4081         muteTimer->start(kMuteTimeout, true);
     4081        SetMuteTimer(kMuteTimeout);
    40824082
    40834083    return res;
    40844084}
     
    43324332        activenvp->SkipCommercials(direction);
    43334333
    43344334    if (muted)
    4335         muteTimer->start(kMuteTimeout, true);
     4335        SetMuteTimer(kMuteTimeout);
    43364336}
    43374337
    43384338void TV::SwitchSource(uint source_direction)
     
    46404640    ClearInputQueues(false);
    46414641
    46424642    if (muted)
    4643         muteTimer->start(kMuteTimeout * 2, true);
     4643        SetMuteTimer(kMuteTimeout * 2);
    46444644
    46454645    UnpauseLiveTV();
    46464646}
     
    49724972    activerecorder->SetChannel(channum);
    49734973
    49744974    if (muted)
    4975         muteTimer->start(kMuteTimeout * 2, true);
     4975        SetMuteTimer(kMuteTimeout * 2);
    49764976
    49774977    UnpauseLiveTV();
    49784978}
     
    56855685
    56865686                // Start up EPG
    56875687                changeChannel = GuideGrid::Run(
    5688                     chanid, channum, true, this, allowsecondary);
     5688                    chanid, channum, false, this, allowsecondary);
    56895689
    56905690                break;
    56915691            }
     
    57285728        {
    57295729            default:
    57305730            case kScheduleProgramGuide:
    5731                 GuideGrid::Run(chanid, channum, true);
     5731                GuideGrid::Run(chanid, channum, false);
    57325732                break;
    57335733            case kScheduleProgramFinder:
    57345734                RunProgramFind(true, false);
     
    57965796    menurunning = false;
    57975797}
    57985798
    5799 void *TV::EPGMenuHandler(void *param)
    5800 {
    5801     TV *obj = (TV *)param;
    5802     obj->doEditSchedule(kScheduleProgramGuide);
    5803 
    5804     return NULL;
    5805 }
    5806 
    5807 void *TV::FinderMenuHandler(void *param)
    5808 {
    5809     TV *obj = (TV *)param;
    5810     obj->doEditSchedule(kScheduleProgramFinder);
    5811 
    5812     return NULL;
    5813 }
    5814 
    5815 void *TV::ScheduleMenuHandler(void *param)
    5816 {
    5817     TV *obj = (TV *)param;
    5818     obj->doEditSchedule(kScheduledRecording);
    5819 
    5820     return NULL;
    5821 }
    5822 
    5823 void *TV::RecordedShowMenuHandler(void *param)
    5824 {
    5825     TV *obj = (TV *)param;
    5826     obj->doEditSchedule(kPlaybackBox);
    5827 
    5828     return NULL;
    5829 }
    5830 
    58315799void TV::EditSchedule(int editType)
    58325800{
    5833     if (menurunning == true)
    5834         return;
    5835     menurunning = true;
    5836     pthread_t tid;
    5837     pthread_attr_t attr;
    5838     pthread_attr_init(&attr);
    5839     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    5840 
    5841     switch (editType)
    5842     {
    5843         default:
    5844         case kScheduleProgramGuide:
    5845                 pthread_create(&tid, &attr, TV::EPGMenuHandler, this);
    5846                 break;
    5847         case kScheduleProgramFinder:
    5848                 pthread_create(&tid, &attr, TV::FinderMenuHandler, this);
    5849                 break;
    5850         case kScheduledRecording:
    5851                 pthread_create(&tid, &attr, TV::ScheduleMenuHandler, this);
    5852                 break;
    5853         case kPlaybackBox:
    5854                 pthread_create(&tid, &attr, TV::RecordedShowMenuHandler, this);
    5855                 break;
    5856     }
    5857 
    5858     pthread_attr_destroy(&attr);
     5801    // post the request to the main UI thread
     5802    // it will be caught in eventFilter and processed as CustomEvent
     5803    // this will create the program guide window (widget)
     5804    // on the main thread and avoid a deadlock on Win32
     5805    QString message = QString("START_EPG %1").arg(editType);
     5806    MythEvent* me = new MythEvent(message);
     5807    qApp->postEvent(myWindow, me);
    58595808}
    58605809
    58615810void TV::ChangeVolume(bool up)
     
    61336082    keyRepeat = true;
    61346083}
    61356084
     6085void TV::SetMuteTimer(int timeout)
     6086{
     6087    // message to set the timer will be posted to the main UI thread
     6088    // where it will be caught in eventFilter and processed as CustomEvent
     6089    // this will properly set the mute timer
     6090    // otherwise it never fires on Win32
     6091    QString message = QString("UNMUTE %1").arg(timeout);
     6092    MythEvent* me = new MythEvent(message);
     6093    qApp->postEvent(myWindow, me);
     6094}
     6095
    61366096/** \fn TV::UnMute(void)
    61376097 *  \brief If the player exists and sound is muted, this unmutes the sound.
    61386098 */
     
    63056265                ncLock.unlock();
    63066266            }
    63076267        }
     6268        else if (message.left(7) == "UNMUTE ")
     6269        {
     6270            message = message.simplifyWhiteSpace();
     6271            QStringList tokens = QStringList::split(" ", message);
     6272            int timeout = tokens[1].toInt();
     6273            muteTimer->start(timeout, true);
     6274        }
     6275        else if (message.left(10) == "START_EPG ")
     6276        {
     6277            message = message.simplifyWhiteSpace();
     6278            QStringList tokens = QStringList::split(" ", message);
     6279            int editType = tokens[1].toInt();
     6280            doEditSchedule(editType);
     6281        }
    63086282
    63096283        pbinfoLock.lock();
    63106284        if (playbackinfo && message.left(14) == "COMMFLAG_START")
     
    75607534{
    75617535    OSDGenericTree *item, *subitem;
    75627536
    7563     if (activerbuffer->isDVD())
     7537    if (activerbuffer && activerbuffer->isDVD())
    75647538    {
    75657539        item = new OSDGenericTree(
    75667540            treeMenu, tr("DVD Root Menu"),    "JUMPTODVDROOTMENU");
  • libs/libmythtv/tv_play.h

     
    236236
    237237  protected:
    238238    void doEditSchedule(int editType = kScheduleProgramGuide);
    239     static void *EPGMenuHandler(void *param);
    240     static void *FinderMenuHandler(void *param);
    241     static void *ScheduleMenuHandler(void *param);
    242     static void *RecordedShowMenuHandler(void *param);
    243 
    244239    void RunTV(void);
    245240    static void *EventThread(void *param);
     241    void SetMuteTimer(int timeout);
    246242
    247243    bool eventFilter(QObject *o, QEvent *e);
    248244    static QStringList lastProgramStringList;