【文件属性】:
文件名称:qt播放器qt mediaplayer
文件大小:1.5MB
文件格式:RAR
更新时间:2013-01-17 08:34:18
qt 播放器
在网上找了一个别人的旧版本的播放器~自己更改了一天,终于可运行了,希望分享下同共学习;
不过出了少少问题:希望有经验的一起指导下:
运行环境:qt creator +windows
1、原计划是可支持视频播放的,现在只能加载间频(mp3),一加载视频就卡死
2.、自定义的进度条不起作用,不知为什么百分比槽连接不成功
connect(wmp, SIGNAL(PositionChange(double, double)),this, SLOT(Slot_onPositionChange(double, double)));
3、我用的是QAxWidget控件,这个是不是只支持windows的呢?或者还有没其实更好的?
/*******************************************************************************************
项目名:QT播放器 Qt Mediaplayer
工程师:枫儿
完成时间:2009年12月28日
技术支持:嵌入式家园 www.studyarm.cn www.mcupark.com
*******************************************************************************************/
#include "playerwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
PlayerWindow::PlayerWindow()
{
//setCaption(tr("Media Player"));
fileFilters = tr("Video files (*.mpg *.mpeg *.avi *.wmv)\n" //原来字符串换行也可这样用
"Audio files (*.mp3 *.wav)");
updateTimer = 0;
setMouseTracking(true);
this->wmp = new QAxWidget(this);
wmp->setControl("{22D6F312-B0F6-11D0-94AB-0080C74C7E95}");
// wmp->setProperty("ShowControls", QVariant(false, 0));
wmp->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
connect(wmp, SIGNAL(PlayStateChange(int, int)),this, SLOT(Slot_onPlayStateChange(int, int)));
connect(wmp, SIGNAL(ReadyStateChange(ReadyStateConstants)),this, SLOT(Slot_onReadyStateChange(ReadyStateConstants)));
connect(wmp, SIGNAL(PositionChange(double, double)),this, SLOT(Slot_onPositionChange(double, double)));
this->openButton = new QPushButton(tr("&Open"));
connect(openButton, SIGNAL(clicked()), this, SLOT(Slot_openFile()));
this->playPauseButton = new QPushButton(tr("&Play"));
connect(playPauseButton, SIGNAL(clicked()), wmp, SLOT(Play()));
this->stopButton = new QPushButton(tr("&Stop"));
connect(stopButton, SIGNAL(clicked()), wmp, SLOT(Stop()));
this->seekSlider = new QSlider(Qt::Horizontal, this);
seekSlider->setEnabled(false);
connect(seekSlider, SIGNAL(valueChanged(int)),this, SLOT(Slot_sliderValueChanged(int)));
connect(seekSlider, SIGNAL(sliderPressed()),wmp, SLOT(Pause()));
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addWidget(openButton);
buttonLayout->addWidget(playPauseButton);
buttonLayout->addWidget(stopButton);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(wmp);
mainLayout->addLayout(buttonLayout);
mainLayout->addWidget(seekSlider);
this->setLayout(mainLayout);
}
【文件预览】:
QTmediaplayer
----main.cpp(639B)
----QTmediaplayer.suo(11KB)
----QTmediaplayer.pro(104B)
----QTmediaplayer.sln(965B)
----vc80.pdb(404KB)
----QTmediaplayer.vcproj.FENGER.fenger01.user(1KB)
----QTmediaplayer.pro.user(16KB)
----QTmediaplayer.vcproj.4EC093DAC072419.Administrator.user(1KB)
----Makefile.Debug(6KB)
----release()
----QTmediaplayer.vcproj(9KB)
----Makefile.Release(6KB)
----playerwindow.cpp(4KB)
----QTmediaplayer.ncb(2.86MB)
----vc80.idb(387KB)
----playerwindow.h(1KB)
----Makefile(6KB)
----debug()
--------BuildLog.htm(8KB)
--------moc_playerwindow.o(464KB)
--------QTmediaplayer.exe(2.23MB)
--------moc_playerwindow.cpp(3KB)
--------main.obj(38KB)
--------main.o(461KB)
--------moc_playerwindow.obj(38KB)
--------playerwindow.o(595KB)