modify mplayerInit
This commit is contained in:
parent
e8b4b46109
commit
de0c8b8383
|
@ -43,11 +43,11 @@ void MainWindow::initMainWindow()
|
|||
ui->volume_slider->setMaximum(100); // 最大音量 100
|
||||
// 当前音量从 mplayer 属性获取
|
||||
|
||||
// QSlider* slider = new QSlider(Qt::Horizontal);
|
||||
// slider->setMinimum(0); // 设置最小值
|
||||
// slider->setMaximum(100); // 设置最大值
|
||||
// slider->setValue(50); // 设置当前值
|
||||
// slider->setSingleStep(1); // 设置步长
|
||||
// QSlider* slider = new QSlider(Qt::Horizontal);
|
||||
// slider->setMinimum(0); // 设置最小值
|
||||
// slider->setMaximum(100); // 设置最大值
|
||||
// slider->setValue(50); // 设置当前值
|
||||
// slider->setSingleStep(1); // 设置步长
|
||||
|
||||
}
|
||||
|
||||
|
@ -67,17 +67,19 @@ void MainWindow::mplayerInit()
|
|||
// 重定向标准输出
|
||||
dup2(fd[1],1);
|
||||
// 使用 exec 启动 mplayer
|
||||
execlp("mplayer","mplayer","-idle","-slave","-quiet","-input","file=fifo_cmd","./song/01.mp3",NULL);
|
||||
// execlp("mplayer","mplayer","-idle","-slave","-quiet","/home/flykhan/qtmplayer/song/StopLove.mp3",NULL);
|
||||
execlp("mplayer","mplayer","-idle","-slave","-quiet","-input","file=fifo_cmd","/home/flykhan/qtmplayer/song/StopLove.mp3",NULL);
|
||||
_exit(-1); // 异常退出
|
||||
}
|
||||
else if(pid>0) // 父进程
|
||||
{
|
||||
// 打开管道
|
||||
// 以写的方式打开(阻塞到某进程 以读的方式打开)
|
||||
fifo_fd = open("fifo_cmd",O_WRONLY);
|
||||
int fifo_fd = open("fifo_cmd",O_WRONLY);
|
||||
if(fifo_fd < 0){
|
||||
perror("open");
|
||||
return 0;
|
||||
// return 0;
|
||||
_exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue