status_t MPlayer::stop() { LOGV("MPlayer::stop"); setStopState(); MPLAYER_PRINTF("mState=%d\n", mState); /* // paused, pre-started if ( mState != MP_STATE_STARTED ) { mCondition.signal(); // wake up prepare, pause loop } */ LOGV("wakeup mplayer thread..."); MPLAYER_PRINTF("wakeup mplayer thread...\n"); mCondition.signal(); // wake up prepare, pause loop mState=MP_STATE_STOPPED; // printf("wait mplayer thread, sleep 1sec\n"); sleep(1); return NO_ERROR; }
void PlayerWin::mousePressEvent(QMouseEvent *event) { if(event->button()==Qt::RightButton) { QMenu *menu= new QMenu; QAction *pauseAct = new QAction(tr(this->state==1?"暂停&P":"播放&P"), this); QAction *stopAct = new QAction(tr("停止&S"), this); QAction *wideAct = new QAction(tr(this->isWideModel==true?"退出精简模式":"精简模式"), this); QAction *openAct = new QAction(tr("打开本地文件&O"), this); QAction *loadAct = new QAction(tr("视频片切换"), this); QMenu *loadMenu= new QMenu; QAction *loadPreAct = new QAction(tr("上一片"), this); QAction *loadCurAct = new QAction(tr("重载当前"), this); QAction *loadNextAct = new QAction(tr("下一片"), this); loadMenu->addAction(loadPreAct); //loadMenu->addAction(loadCurAct); loadMenu->addAction(loadNextAct); loadAct->setMenu(loadMenu); QAction *subAct = new QAction(tr("外挂字幕"), this); subAct->setCheckable(true); subAct->setChecked((subtitleWidget->isVisible())?true:false); connect(pauseAct, SIGNAL(triggered()), this, SLOT(setPauseState())); connect(stopAct, SIGNAL(triggered()), this, SLOT(setStopState())); connect(wideAct, SIGNAL(triggered()), this, SLOT(setWideModel())); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); connect(loadPreAct, SIGNAL(triggered()), this, SLOT(loadPreSlice())); connect(loadCurAct, SIGNAL(triggered()), this, SLOT(loadCurSlice())); connect(loadNextAct, SIGNAL(triggered()), this, SLOT(loadNextSlice())); connect(subAct, SIGNAL(triggered(bool)), this, SLOT(showSubtitleWidget(bool))); menu->addAction(pauseAct); menu->addAction(stopAct); menu->addAction(wideAct); menu->addAction(openAct); menu->addSeparator(); menu->addAction(loadAct); menu->addAction(subAct); menu->exec(QCursor::pos()); }