Qt로 MPlayer를 제어하던 중 문제가 발생했습니다.
안녕하세요.
저는 요즘 한창 Qt로 MPlayer를 제어하는 중입니다.
4주동안 온갖 삽질과 뻘짓을 해가면서
마침내 QT/X11 콘솔로 컴파일을 했을 때는 아무 문제없이 실행이 잘 됩니다.
그런데, 이걸 가상 프레임 버퍼로 실행했을 때는 제가 생각한 방향과는 정반대로 실행되네요......
어떤 분은 winId() 값의 문제라고 말씀하시던데,
저는 어디가 문제인지 잘 모르겠습니다.
//여기서부터는 소스입니다.
#include "moviemainwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*
* Constructs a MovieMainWindow as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
*/
MovieMainWindow::MovieMainWindow( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
// (void)statusBar();
if ( !name )
setName( "MovieMainWindow" );
//위젯 내부의 위젯 screen을 생성합니다.
this->screen = new ScreenMainWindow(this, "", WStyle_Customize|WStyle_NormalBorder);
this->screen->move( QPoint(0, 0) );
this->screen->show();
this->playBtn = new QPushButton("play", this);
this->playBtn->setGeometry( 60, 180, 40, 30 );
this->pauseBtn = new QPushButton("pause", this);
this->pauseBtn->setGeometry( 100, 180, 40, 30 );
this->stopBtn = new QPushButton("stop", this);
this->stopBtn->setGeometry( 140, 180, 40, 30);
QObject::connect(playBtn, SIGNAL(clicked()), this, SLOT(play()));
QObject::connect(pauseBtn, SIGNAL(clicked()), this, SLOT(pause()));
QObject::connect(stopBtn, SIGNAL(clicked()), this, SLOT(stop()));
languageChange();
resize( QSize(240, 210).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
}
/*
* Destroys the object and frees any allocated resources
*/
MovieMainWindow::~MovieMainWindow()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void MovieMainWindow::languageChange()
{
setCaption( tr( "Movie" ) );
}
//재생 부분입니다.
void MovieMainWindow::play()
{
this->proc1 = new QProcess(this);
this->proc1->addArgument( "mplayer" );
this->proc1->addArgument( "-slave" );
this->proc1->addArgument( "-identify" );
this->proc1->addArgument( "-quiet" );
this->proc1->addArgument( "-wid" );
this->proc1->addArgument( this->WID.setNum((int)(this->screen->winId())) );
this->proc1->addArgument( "/MPlayer/MPlayer-1.0pre8/[P]test.avi" );
this->proc1->start();
}
//일시정지구요.
void MovieMainWindow::pause()
{
this->proc1->writeToStdin( "pause\n" );
}
//정지할 때 완전히 엠플레이어를 종료하도록 설정했습니다.
void MovieMainWindow::stop()
{
this->proc1->writeToStdin( "quit\n" );
}
X11에서는 제가 의도한 대로 위젯의 내부에 MPlayer가 재생됩니다.
하지만, 가상 프레임 버퍼에서 실행했을 때는 모니터의 한가운데에서 MPlayer가 단독으로 실행됩니다.
누군가 해결책을 좀 제시해 주시면 정말 감사하겠습니다.
오늘내일 안에 결과물을 내야 하는 거라서요....다시금 부탁드립니다.


댓글 달기