基于QT前端的Mplayer播放器项目之PC环境下的实现过程

移动开发
MPlayer是一款开源多媒体播放器,以GNU通用公共许可证发布。此款软件可在各主流作业系统使用,例如Linux和其他类Unix系统、微软的视窗系统及苹果电脑的Mac OS X系统。MPlayer是建基于命令行界面,在各作业系统可选择安装不同的图形界面。

一、PC环境搭建

主机环境:Red Hat Enterprise Linux 5.0

交叉编译工具:gcc-3.4.5-glibc-2.3.6

主机编译工具:gcc-4.1.2

1、主机端安装mplayer

将“项目代码/mplay源码”目录下的MPlayer-1.0rc2.tar.bz2、libmad-0.15.1b.tar.gz(1个mp3解码库)拷贝到linux系统中,如:/home/linux/mplayer目录下

安装libmad-0.15.1b.tar.gz

  1. #tar xvfz libmad-0.15.1b.tar.gz  
  2. #cd libmad-0.15.1b  
  3. #./configure  
  4. #make  
  5. #mkdir /lib/lib  
  6. #mkdir /lib/include  
  7. #cp mad.h /lib/include  
  8. #cp .libs/libmad.a /lib/lib  
  9. l         安装mplayer  
  10. #tar xvfj MPlayer-1.0.rc2.tar.bz2  
  11. #cd MPlayer-1.0rc2  
  12. #./configure --with-extraincdir=/lib/include --with-extralibdir=/lib/lib  
  13. #make  
  14. #make install 

此时可以试着播放一下mp3、avi等文件了

  1. # mplayer -ac mad 1.mp3  
  2. # mplayer -ac mad 2.avi 

2、安装、移植qtopia-4.2.0

注:需要先按照5.2节将tslib按照好,将“项目代码/qtopia源码”目录下的qtopia-opensource-src-4.2.0.tar.gz拷贝到linux系统中,如:/home/linux/Qtopia目录下

  1. # tar zxvf qtopia-opensource-src-4.2.0.tar.gz  
  2. # mv qtopia-opensource-4.2.0 source  
  3. # mkdir target //创建在source同级目录下创建目录target 

修改源码包

  1. # cd source  
  2. # cd src/libraries/qtopiabase/  
  3. # cp custom-linux-cassiopeia-g++.h custom-linux-arm-g++.h  
  4. # cp custom-linux-cassiopeia-g++.cpp custom-linux-arm-g++.cpp 

修改时区信息

  1. # vi src/libraries/qtopia/qtimezone.cpp  
  2. 将114行的 /usr/share/zoneinfo/ 改为/Qtipia/zoneinfo/ ,保存退出。  
  3. # vi src/settings/systemtime/settime.cpp  
  4. 将318行的 /usr/share/zoneinfo/ 改为/Qtipia/zoneinfo/ ,保存退出。 

裁减Qtopia core的库(下列操作后在屏幕上会出现一个光标,否则没有光标。根据需求配置)

  1. # vi qtopiacore/qconfig-qpe.h 

首先注释掉关于鼠标光标的宏定义,让程序运行时,触摸屏中央有光标出现:

  1. // Qtopia Core  
  2. /*  
  3. #ifndef QT_NO_QWS_CURSOR  
  4. # define QT_NO_QWS_CURSOR  
  5. #endif  
  6. */  
  7. /*  
  8. #ifndef QT_NO_QWS_MOUSE  
  9. # define QT_NO_QWS_MOUSE  
  10. #endif  
  11. #ifndef QT_NO_QWS_MOUSE_AUTO  
  12. # define QT_NO_QWS_MOUSE_AUTO  
  13. #endif  
  14. */ 

其它宏定义根据需要进行注释。

#p#

保存后将qconfig-qpe.h拷贝到global目录。

  1. # cp qtopiacore/qconfig-qpe.h qtopiacore/qt/src/corelib/global/qconfig-qpe.h (必须进行的操作) 

注释掉其他文件里的QT_NO_QWS_CURSOR的定义

  1. # vi qtopiacore/qt/src/corelib/global/qfeatures.h 

注释掉如下内容:

  1. /*  
  2. #if !defined(QT_NO_QWS_CURSOR) && (defined(QT_NO_CURSOR))  
  3. #define QT_NO_QWS_CURSOR  
  4. #endif  
  5. */ 

保存退出。

  1. # vi qtopiacore/qt/src/corelib/global/qglobal.h 

注释掉以下内容:

  1. //# define QT_NO_QWS_CURSOR  
  2. #vim qtopiacore/qt/tools/qvfb/qvfbshmem.cpp 

注释掉asm/page.h

  1. //#include <asm/page.h> 
  2. #vim qtopiacore/qt/tools/qvfb/qvfbmmap.cpp 

注释掉asm/page.h

  1. //#include <asm/page.h> 

并修改如下内容

  1. unsigned char *data;  
  2. uint data_offset_value = sizeof(QVFbHeader);  
  3. if (data_offset_value % PAGE_SIZE)  
  4. data_offset_value += PAGE_SIZE - (data_offset_value % PAGE_SIZE); 

为:

  1. unsigned char *data;  
  2. uint data_offset_value = sizeof(QVFbHeader);  
  3. const int page_size = getpagesize();  
  4. if (data_offset_value % page_size)  
  5. data_offset_value += page_size - (data_offset_value % page_size);  
  6. # vim src/libraries/qtopiabase/qmemoryfile_unix.cpp +128 

修改:

  1. f = ::open(tmpFile.toLatin1(), O_CREAT | O_WRONLY); 

为:

  1. f = ::open(tmpFile.toLatin1(), O_CREAT | O_WRONLY ,0777); 

修改交叉工具

  1. #vim qtopiacore/qt/mkspecs/qws/linux-arm-g++/qmake.conf 

将文件中的arm-linux-***全部修改为arm-softfloat-linux-gnu-**

这样做的前提是我的交叉工具链是arm-softfloat-linux-gnu,如果你的是arm-linux就不用改了。

#p#

生成Makefile

#cd ../target    //为了不破坏源码,选择在此目录下配置、编译源码

  1. #../source/configure -release -image /Qtopia -prefix /Qtopia -xplatform linux-arm-g++   
  2. -arch arm -no-qvfb -displaysize 320x240 -no-modem -extra-qtopiacore-config "-release   
  3. -xplatform qws/linux-arm-g++ -embedded arm -qconfig qpe -depths 4,8,16,32   
  4. -qt-sql-sqlite -no-mouse-linuxtp -qt-mouse-tslib -I/home/linux/tslib/include   
  5. -L/home/linux/tslib/lib " 2>../configureERR.txt  

注意:这里/Qtopia是***Qtopia的安装路径,安装到主机的某个路径下,最终这个路径和目标板上的路径必须一致。

主要配置选项说明如下:

  1. -xplatform linux-arm-g++ -arch arm 

目标平台为arm-linux,体系结构为arm。

  1. -no-qvfb 

目标平台已支持framebuffer,因而不使用虚拟帧缓冲。

  1. -extra-qtopiacore-config 

为Qtopia core 配置选项。

  1. -xplatform qws/linux-arm-g++ -embedded arm 

目标平台编译配置文件使用qtopiacore/qt/mkspecs/qws/linux-arm-g++目录下的配置文件,嵌入式平台为arm。

  1. -qconfig qpe 

使用配置文件qconfig-qpe.h,若使用qconfig-large.h配置文件,则使用-qconfig large选项。

  1. -qt-sql-sqlite 

数据库支持Sqlite。

  1. -qt-kbd-usb 

键盘支持usb协议。

  1. -no-mouse-linuxtp -qt-mouse-tslib  
  2. -I/home/linux/tslib/include -L/home/linux/tslib/lib 

触摸屏协议不支持linuxtp,支持tslib,并在后面添加上刚才编译的tslib的头文件和库。

  1. ../qtopiaconfigureERR.txt 

***将配置过程中的错误输出到qtopiaconfigureERR.txt文件中。

编译

  1. #make  
  2. #make install 

将安装和的目录考到nfsroot目录下

  1. #cp /Qtopia /rootfs -a 

 

3、熟悉主机开发环境

提供给PC端的开发工具

上面的qtopia编译安装完成后,会在咱们前面创建的target目录下生成很多开发工具。

先看一下供主机端使用的工具

  1. [root@localhost bin]# pwd  
  2. /home/linux/Qtopia/target/qtopiacore/host/bin  
  3. [root@localhost bin]# ls  
  4. assistant linguist lupdate qmake rcc        uic  
  5. designer   lrelease moc      qvfb   templates uic3 

如果系统以前有其它qt开发工具,把环境变量修改一下,保证它们不要和我们这几个工具冲突。下面可以试一下你的designer了。

  1. #./designer 

二、在PC端实现基于qt前端的mplayer播放器

创建工程目录/home/linux/mplayer

1、搭建ui界面

利用前面安装的designer搭建ui界面,并将其保存至/home/linux/mplayer/mplayer.ui

  1. #./designer 

圆角矩形标注: 加了一个widget,留作mplayer的播放区

2、编写程序

在/home/linux/mymplayer/下创建mplayer.cpp、mplayer.h、main.cpp 、image.qrc

Main.cpp

  1. #include <QApplication> 
  2. #include "mplayer.h"  
  3. int main(int argc, char **argv)  
  4. {  
  5. QApplication app(argc, argv);  
  6. MPlayer player;   //实例最终的MPlayer类  
  7. player.show();     //显示界面  
  8. return app.exec(); //运行程序  
  9. }  
  10. mplayer.h  
  11. #ifndef _MPLAYER_H  
  12. #define _MPLAYER_H  
  13. #include <QIcon> 
  14. #include <QProcess> 
  15. #include <QTimer> 
  16. #include <QStringList> 
  17. #include <QDir> 
  18. #include <QTime> 
  19. #include <QString> 
  20. #include "ui_mplayer.h"  
  21. class MPlayer:public QDialog,private Ui_Dialog  
  22. {  
  23. Q_OBJECT  
  24. public:  
  25. MPlayer(QWidget *parent = 0);  
  26. public:  
  27. QTime int_to_time(int);  
  28. public slots:              
  29. void play_pause_slots(); //暂停  
  30. void stop_slots();      //停止  
  31. void previous_slots();   //上一曲  
  32. void next_slots();       //下一曲  
  33. void seek_slots(int);  
  34. void get_time_slots();        //得到播放时间  
  35. void set_volume_slots(int);    //设置音量  
  36. void set_sound_slots();       //静音  
  37. void playerReward_slots();    //快退  
  38. void playerForward_slots();    //快进  
  39. void back_message_slots();    //更新显示信息  
  40. private:  
  41. QProcess *process;  
  42. QStringList files;  
  43. QDir directory;  
  44. int file_count;  
  45. QString file_name;  
  46. bool isPlay;  
  47. bool isSound;  
  48. bool isStop;  
  49. QTimer *timer;  
  50. int file_length;  
  51. int curr_time;  
  52. };  
  53. #endif 

#p#

mplayer.cpp

  1. #include "mplayer.h"  
  2. #include <QDebug> 
  3. #include <unistd.h> 
  4. MPlayer::MPlayer(QWidget *parent):QDialog(parent)  
  5. {  
  6. setupUi(this); //初始化界面  
  7. isPlay = true;  
  8. isSound = true;  
  9. isStop = false;  
  10. /************************为按键添加图标**************************/  
  11. //play  
  12. QIcon icon_play;  
  13. icon_play.addPixmap(QPixmap(QString::fromUtf8("images/pause_enabled.png")), QIcon::Normal, QIcon::Off);  
  14. pushButton_2->setIcon(icon_play);  
  15. //stop  
  16. QIcon icon_stop;  
  17. icon_stop.addPixmap(QPixmap(QString::fromUtf8("images/stop_enabled.png")), QIcon::Normal, QIcon::Off);  
  18. pushButton_3->setIcon(icon_stop);  
  19. //reward  
  20. QIcon icon_reward;  
  21. icon_reward.addPixmap(QPixmap(QString::fromUtf8("images/reward_enabled.png")), QIcon::Normal, QIcon::Off);  
  22. pushButton_4->setIcon(icon_reward);  
  23. //forward  
  24. QIcon icon_forward;  
  25. icon_forward.addPixmap(QPixmap(QString::fromUtf8("images/forward_enabled.png")), QIcon::Normal, QIcon::Off);  
  26. pushButton_5->setIcon(icon_forward);  
  27. //sound  
  28. QIcon icon_sound;  
  29. icon_sound.addPixmap(QPixmap(QString::fromUtf8("images/sound_enabled.png")), QIcon::Normal, QIcon::Off);  
  30. pushButton->setIcon(icon_sound);  
  31. QIcon icon_previous;  
  32. icon_previous.addPixmap(QPixmap(QString::fromUtf8("images/previous_disabled.png")), QIcon::Normal, QIcon::Off);  
  33. pushButton_6->setIcon(icon_previous);  
  34. QIcon icon_next;  
  35. icon_next.addPixmap(QPixmap(QString::fromUtf8("images/next_enabled.png")), QIcon::Normal, QIcon::Off);  
  36. pushButton_7->setIcon(icon_next);  
  37. /************************设置按钮无边框**********************************/  
  38. pushButton->setFlat(true);  
  39. pushButton_2->setFlat(true);  
  40. pushButton_3->setFlat(true);  
  41. pushButton_4->setFlat(true);  
  42. pushButton_5->setFlat(true);  
  43. pushButton_6->setFlat(true);  
  44. pushButton_7->setFlat(true);  
  45. /*************************获得播放列表***************************/  
  46. directory.setPath("./movie");  
  47. files = directory.entryList(QDir::AllEntries,QDir::Time);  
  48. file_name = files[2]; //文件0和1为 ”.” ”..”,所以从文件2开始播放  
  49. file_count = 2;  
  50. label_3->setText(files[2]);  
  51. /*************************初始化进度条及QProcess类**************/  
  52. horizontalSlider->setPageStep(1);  
  53. process = new QProcess(this);  
  54. process->setProcessChannelMode(QProcess::MergedChannels);  
  55. /*************************初始化信号、槽*************************/  
  56. connect(pushButton_2,SIGNAL(clicked()),this,SLOT(play_pause_slots()));  
  57. connect(pushButton_3,SIGNAL(clicked()),this,SLOT(stop_slots()));  
  58. connect(pushButton_4,SIGNAL(clicked()),this,SLOT(playerReward_slots()));  
  59. connect(pushButton_5,SIGNAL(clicked()),this,SLOT(playerForward_slots()));  
  60. connect(pushButton_6,SIGNAL(clicked()),this,SLOT(previous_slots()));  
  61. connect(pushButton_7,SIGNAL(clicked()),this,SLOT(next_slots()));  
  62. //connect(horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(seek_slots(int)));  
  63. connect(spinBox,SIGNAL(valueChanged(int)),this,SLOT(set_volume_slots(int)));  
  64. connect(pushButton,SIGNAL(clicked()),this,SLOT(set_sound_slots()));  
  65. connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(back_message_slots()));  
  66. //当process可以读到Mplayer的返回信息时,产生readyReadStandardOutput()信号  
  67. //process->start("mplayer -slave -quiet -ac mad 2.avi");  
  68. //add -wid QWidget->winId();  
  69. QString common = "mplayer -slave -quiet -ac mad -zoom movie/" + file_name + " -wid " + QString::number(widget->winId()); //这里的widget是ui中MPlayer的显示区  
  70. process->start(common);      //开始运行程序  
  71. spinBox->setValue(40);       
  72. timer = new QTimer(this);  
  73. connect(timer,SIGNAL(timeout()),this,SLOT(get_time_slots()));  
  74. //定时获取MPlayer的时间信息  
  75. timer->start(1000); //启动定时器 1秒timeout 1次  
  76. }  
  77. void MPlayer::play_pause_slots()  
  78. {  
  79. if(!isPlay)  
  80. {  
  81. if(isStop)  
  82. {  
  83. file_name = files[file_count];  
  84. QString common = "mplayer -slave -quiet -ac mad -zoom movie/" + file_name + " -wid " + QString::number(widget->winId());  
  85. process->start(common);  
  86. QIcon icon_stop;  
  87. icon_stop.addPixmap(QPixmap(QString::fromUtf8("images/stop_enabled.png")), QIcon::Normal, QIcon::Off);  
  88. pushButton_3->setIcon(icon_stop);  
  89. isStop = false;  
  90. }  
  91. else  
  92. {  
  93. process->write("pause ");  
  94. }  
  95. QIcon icon_play;  
  96. icon_play.addPixmap(QPixmap(QString::fromUtf8("images/pause_enabled.png")), QIcon::Normal, QIcon::Off);  
  97. pushButton_2->setIcon(icon_play);  
  98. isPlay = true;  
  99. }  
  100. else  
  101. {  
  102. QIcon icon_pause;  
  103. icon_pause.addPixmap(QPixmap(QString::fromUtf8("images/play_enabled.png")), QIcon::Normal, QIcon::Off);  
  104. pushButton_2->setIcon(icon_pause);  
  105. isPlay = false;  
  106. process->write("pause ");  
  107. }  
  108. }  
  109. void MPlayer::stop_slots()  
  110. {  
  111. if(!isStop)  
  112. {  
  113. process->write("quit ");  
  114. QIcon icon_pause;  
  115. icon_pause.addPixmap(QPixmap(QString::fromUtf8("images/play_enabled.png")), QIcon::Normal, QIcon::Off);  
  116. pushButton_2->setIcon(icon_pause);  
  117. isPlay = false;  
  118. QIcon icon_stop;  
  119. icon_stop.addPixmap(QPixmap(QString::fromUtf8("images/stop_disabled.png")), QIcon::Normal, QIcon::Off);  
  120. pushButton_3->setIcon(icon_stop);  
  121. isStop = true;  
  122. label->setText("00:00:00");  
  123. label_2->setText("00:00:00");  
  124. }  
  125. }  
  126. void MPlayer::previous_slots()  
  127. {  
  128. if(file_count > 2)  
  129. {  
  130. if(file_count == (files.size()-1))  
  131. {  
  132. QIcon icon_next;  
  133. icon_next.addPixmap(QPixmap(QString::fromUtf8("images/next_enabled.png")), QIcon::Normal, QIcon::Off);  
  134. pushButton_7->setIcon(icon_next);  
  135. }  
  136. process->write("quit ");  
  137. process = new QProcess(this);  
  138. connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(back_message_slots()));  
  139. file_count--;  
  140. if(!isStop)  
  141. {  
  142. file_name = files[file_count];  
  143. QString common = "mplayer -slave -quiet -ac mad -zoom movie/" + file_name + " -wid " + QString::number(widget->winId());  
  144. process->start(common);  
  145. }  
  146. if(file_count == 2)  
  147. {  
  148. QIcon icon_previous;  
  149. icon_previous.addPixmap(QPixmap(QString::fromUtf8("images/previous_disabled.png")), QIcon::Normal, QIcon::Off);  
  150. pushButton_6->setIcon(icon_previous);  
  151. }  
  152. label_3->setText(files[file_count]);  
  153. }  
  154. }  
  155. void MPlayer::next_slots()  
  156. {  
  157. if(file_count < (files.size()-1))  
  158. {  
  159. if(file_count == 2)  
  160. {  
  161. QIcon icon_previous;  
  162. icon_previous.addPixmap(QPixmap(QString::fromUtf8("images/previous_enabled.png")), QIcon::Normal, QIcon::Off);  
  163. pushButton_6->setIcon(icon_previous);  
  164. }  
  165. process->write("quit ");       
  166. process = new QProcess(this);  
  167. connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(back_message_slots()));  
  168. file_count++;  
  169. if(!isStop)  
  170. {  
  171. file_name = files[file_count];  
  172. QString common = "mplayer -slave -quiet -ac mad -zoom movie/" + file_name + " -wid " + QString::number(widget->winId());  
  173. process->start(common);  
  174. }  
  175. if(file_count == (files.size()-1))  
  176. {     
  177. QIcon icon_next;  
  178. icon_next.addPixmap(QPixmap(QString::fromUtf8("images/next_disabled.png")), QIcon::Normal, QIcon::Off);  
  179. pushButton_7->setIcon(icon_next);  
  180. }  
  181. }  
  182. label_3->setText(files[file_count]);  
  183. }  
  184. void MPlayer::seek_slots(int seek_num)  
  185. {  
  186. qDebug()<<seek_num;  
  187. if(process && process->state() == QProcess::Running )  
  188. {  
  189. process->write(QString("seek " + QString::number(qMin(seek_num,100)) + "1 ").toAscii());  
  190. }  
  191. }  
  192. void MPlayer::get_time_slots()  
  193. {  
  194. if(isPlay)  
  195. ]{  
  196. p  
  197. rocess->write("get_time_pos ");  
  198. process->write("get_time_length ");  
  199. }  
  200. }  
  201. void MPlayer::set_volume_slots(int volume)  
  202. {  
  203. qDebug()<<volume;  
  204. process->write(QString("volume +" + QString::number(volume) + " ").toAscii());  
  205. //process->write(QString("volume +1 ").toAscii());  
  206. }  
  207. void MPlayer::set_sound_slots()  
  208. {  
  209. if(isSound)  
  210. {  
  211. process->write("mute 1 ");  
  212. QIcon icon_sound;  
  213. icon_sound.addPixmap(QPixmap(QString::fromUtf8("images/nosound_enabled.png")), QIcon::Normal, QIcon::Off);  
  214. pushButton->setIcon(icon_sound);  
  215. isSound = false;  
  216. }  
  217. else  
  218. {  
  219. process->write("mute 0 ");  
  220. QIcon icon_sound;  
  221. icon_sound.addPixmap(QPixmap(QString::fromUtf8("images/sound_enabled.png")), QIcon::Normal, QIcon::Off);  
  222. pushButton->setIcon(icon_sound);  
  223. isSound = true;  
  224. }  
  225. }  
  226. void MPlayer::playerReward_slots()  
  227. {  
  228. //bool ok;  
  229. //int m=moviePosition.toInt(&ok);  
  230. if (process && process->state()==QProcess::Running && !isPlay)  
  231. {  
  232. //QString cmd="seek "+QString::number(qMax(m-10,0))+" 1 ";  
  233. //process->write(cmd.toAscii());  
  234. qDebug()<<"Reward";  
  235. }  
  236. }  
  237. void MPlayer::playerForward_slots()  
  238. {  
  239. //     groupBox->setVisible(false);  
  240. //bool ok;  
  241. //int m=moviePosition.toInt(&ok);  
  242. /*    if (process && process->state()==QProcess::Running && !isPlay)  
  243. {  
  244. //QString cmd="seek "+QString::number(qMin(m+10,100))+" 1 ";  
  245. //process->write(cmd.toAscii());  
  246. qDebug()<<"Forward";  
  247. }*/  
  248. }  
  249. void MPlayer::back_message_slots()  
  250. {  
  251. while(process->canReadLine())  
  252. {  
  253. QString message(process->readLine());  
  254. QStringList messagemessage_list = message.split("=");  
  255. if(message_list[0] == "ANS_TIME_POSITION")  
  256. {  
  257. curr_time = message_list[1].toDouble();//toInt();  
  258. QTime time = int_to_time(curr_time);  
  259. label->setText(time.toString("hh:mm:ss"));  
  260. horizontalSlider->setValue(100 * curr_time / file_length);  
  261. }  
  262. else if(message_list[0] == "ANS_LENGTH")  
  263. {  
  264. file_length = message_list[1].toDouble();//toInt();  
  265. QTime time = int_to_time(file_length);  
  266. label_2->setText(time.toString("hh:mm:ss"));       
  267. }  
  268. }  
  269. }  
  270. QTime MPlayer::int_to_time(int second)  
  271. {  
  272. int sec = 0min = 0hour = 0;  
  273.  
  274. QTime time;  
  275. if(second < 60)      
  276. {  
  277. sec = second;  
  278. min = 0;  
  279. hour = 0;  
  280. }  
  281. if(second >= 60 && second < 3600)  
  282. {  
  283. sec = second % 60;  
  284. min = second / 60;  
  285. hour = 0;  
  286. }  
  287. if(second >= 3600)  
  288. {  
  289. sec = second % 60;  
  290. min = (second / 60) % 60;  
  291. hour = second / 3600;  
  292. }  
  293. time.setHMS(hour,min,sec);  
  294. return time;  
  295. }  
  296. image.qrc  
  297. <RCC> 
  298. <qresource prefix="images" > 
  299. <file>images/player_play.png</file> 
  300. <file>images/player_stop.png</file> 
  301. <file>images/player_pause.png</file> 
  302. <file>images/play_enabled.png</file> 
  303. <file>images/pause_enabled.png</file> 
  304. <file>images/reward_enabled.png</file> 
  305. <file>images/forward_enabled.png</file> 
  306. <file>images/stop_enabled.png</file> 
  307. <file>images/sound_enabled.png</file> 
  308. <file>images/nosound_enabled.png</file> 
  309. <file>images/previous_enabled.png</file> 
  310. <file>images/previous_disabled.png</file> 
  311. <file>images/next_enabled.png</file> 
  312. <file>images/next_disabled.png</file> 
  313. </qresource> 
  314. </RCC> 

#p#

3、编译工程

拷贝qmake到当前工程目录下

  1. #cp /home/linux/Qtopia/target/qtopiacore/host/bin/qmake ./ 

生成项目文件、

  1. #qmake –project  
  2. 生成Makefile  
  3. #qmake 

编译

  1. #make 

成功后,可以生成mplayer可执行程序

建立movie和images

  1. #mkdir movie  
  2. #mkdir images  
  3. [root@localhost mplayer]# ls movie/  
  4. 1.mp3 2.avi 3.avi 4.avi 5.avi  
  5. [root@localhost mplayer]# ls images  
  6. forward_enabled.png nosound_enabled.png player_play.png        reward_enabled.png  
  7. images               pause_enabled.png    player_stop.png        sound_enabled.png  
  8. next_disabled.png    play_enabled.png     previous_disabled.png stop_disabled.png  
  9. next_enabled.png     player_pause.png     previous_enabled.png   stop_enabled.png 

运行程序

  1. [root@localhost mplayer]#./mplayer 

【编辑推荐】

Qt网络之获取本机网络信息

深度解析嵌入式QT开发环境搭建

浅谈自动化测试工具 QTP脚本的重用

QML教程:构建和安装QtComponents

开源软件是基于JVM 平台之Qt移植QtJambi

基于QT前端的mplayer播放器项目之功能体验

责任编辑:zhaolei 来源: 互联网
相关推荐

2011-06-10 13:42:50

QT mplayer 播放器

2011-09-06 11:08:21

QT播放器Mplayer

2011-06-13 09:33:04

2009-02-17 23:41:43

Mplayer播放器常见问题

2011-06-27 11:23:21

Qt 音乐播放器

2011-06-24 10:21:11

Qt phonon 多媒体

2015-05-21 15:25:42

VLC播放器

2015-10-19 17:28:00

MPlayer媒体播放器开源

2011-09-06 10:46:19

QT播放器

2011-06-16 17:54:30

Qt Mplayer

2010-06-09 11:17:34

openSUSE Mp

2011-07-20 16:21:20

iPhone 视频 播放器

2011-09-06 11:25:08

2011-09-05 18:08:01

MTK音频播放器

2011-08-30 09:48:07

Ubuntu

2023-03-06 16:20:08

视频播放器VLC

2011-07-04 15:13:31

QT MPlayer 移植

2011-06-13 11:24:55

QT MPlayer 移植

2012-04-05 13:19:06

WEBHTML5

2011-08-30 13:18:43

UbuntuQmmp
点赞
收藏

51CTO技术栈公众号