Ticket #4376: threading.patch

File threading.patch, 3.9 KB (added by andrei@…, 18 years ago)
  • libs/libmythtv/tv_play.h

     
    208208    void TreeMenuSelected(OSDListTreeType *tree, OSDGenericTree *item);
    209209
    210210  protected:
    211     void doEditSchedule(int editType = kScheduleProgramGuide);
    212     static void *EPGMenuHandler(void *param);
    213     static void *FinderMenuHandler(void *param);
    214     static void *ScheduleMenuHandler(void *param);
    215     static void *RecordedShowMenuHandler(void *param);
    216 
    217211    void RunTV(void);
    218212    static void *EventThread(void *param);
    219213
  • libs/libmythtv/tv_play.cpp

     
    20412041        case QEvent::KeyPress:
    20422042        {
    20432043            QKeyEvent *k = new QKeyEvent(*(QKeyEvent *)e);
    2044  
    2045             // can't process these events in the Qt event loop.
    2046             keyListLock.lock();
    2047             keyList.append(k);
    2048             keyListLock.unlock();
    2049 
     2044            ProcessKeypress(k);
    20502045            return true;
    20512046        }
    20522047        case QEvent::Paint:
     
    51045099        nvp->DrawUnusedRects(sync);
    51055100}
    51065101
    5107 void TV::doEditSchedule(int editType)
     5102void TV::EditSchedule(int editType)
    51085103{
    51095104    if (!playbackinfo)
    51105105    {
    51115106        VERBOSE(VB_IMPORTANT,
    5112                 LOC_ERR + "doEditSchedule(): no active playbackinfo.");
     5107                LOC_ERR + "EditSchedule(): no active playbackinfo.");
    51135108        return;
    51145109    }
    51155110
     
    51485143                    allowsecondary = nvp->getVideoOutput()->AllowPreviewEPG();
    51495144
    51505145                // Start up EPG
    5151                 changeChannel = RunProgramGuide(chanid, channum, true, this, allowsecondary);
     5146                changeChannel = RunProgramGuide(chanid, channum, false, this, allowsecondary);
    51525147                break;
    51535148            }
    51545149            case kPlaybackBox:
     
    51905185        {
    51915186            default:
    51925187            case kScheduleProgramGuide:
    5193                 RunProgramGuide(chanid, channum, true);
     5188                RunProgramGuide(chanid, channum, false);
    51945189                break;
    51955190            case kScheduleProgramFinder:
    51965191                RunProgramFind(true, false);
     
    52585253    menurunning = false;
    52595254}
    52605255
    5261 void *TV::EPGMenuHandler(void *param)
    5262 {
    5263     TV *obj = (TV *)param;
    5264     obj->doEditSchedule(kScheduleProgramGuide);
    5265 
    5266     return NULL;
    5267 }
    5268 
    5269 void *TV::FinderMenuHandler(void *param)
    5270 {
    5271     TV *obj = (TV *)param;
    5272     obj->doEditSchedule(kScheduleProgramFinder);
    5273 
    5274     return NULL;
    5275 }
    5276 
    5277 void *TV::ScheduleMenuHandler(void *param)
    5278 {
    5279     TV *obj = (TV *)param;
    5280     obj->doEditSchedule(kScheduledRecording);
    5281 
    5282     return NULL;
    5283 }
    5284 
    5285 void *TV::RecordedShowMenuHandler(void *param)
    5286 {
    5287     TV *obj = (TV *)param;
    5288     obj->doEditSchedule(kPlaybackBox);
    5289 
    5290     return NULL;
    5291 }
    5292 
    5293 void TV::EditSchedule(int editType)
    5294 {
    5295     if (menurunning == true)
    5296         return;
    5297     menurunning = true;
    5298     pthread_t tid;
    5299     pthread_attr_t attr;
    5300     pthread_attr_init(&attr);
    5301     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    5302 
    5303     switch (editType)
    5304     {
    5305         default:
    5306         case kScheduleProgramGuide:
    5307                 pthread_create(&tid, &attr, TV::EPGMenuHandler, this);
    5308                 break;
    5309         case kScheduleProgramFinder:
    5310                 pthread_create(&tid, &attr, TV::FinderMenuHandler, this);
    5311                 break;
    5312         case kScheduledRecording:
    5313                 pthread_create(&tid, &attr, TV::ScheduleMenuHandler, this);
    5314                 break;
    5315         case kPlaybackBox:
    5316                 pthread_create(&tid, &attr, TV::RecordedShowMenuHandler, this);
    5317                 break;
    5318     }
    5319 
    5320     pthread_attr_destroy(&attr);
    5321 }
    5322 
    53235256void TV::ChangeVolume(bool up)
    53245257{
    53255258    AudioOutput *aud = nvp->getAudioOutput();