• 大小: 6.76MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-13
  • 语言: 其他
  • 标签: Qt  视频播放  

资源简介

QT 视频播放,支持多种视频播放,可以快进,快退,暂停,停止,调节声音。如初次运行请执行,文件夹下的mplayer的mplayer.exe即可。

资源截图

代码片段和文件信息

#include 
#include “implayer.h“
#include “ui_implayer.h“



IMplayer::IMplayer(QWidget *parent) :
    QMainWindow(parent)
    ui(new Ui::IMplayer)
{
    isMute = 0;
    isPlay = 1;
    isLength = 1;
    timePos = 0;
    timeLength = 0;

    ui->setupUi(this);
    ui->scheduleSlider->setRange(0999);
    ui->voiceSlider->setRange(0 99);

    mplayerProcess = new QProcess(this);
    mplayerProcess->setProcessChannelMode(QProcess::MergedChannels);
    //mplayerProgram = tr(“D:/workstation/IMplayer/mplayer/mplayer.exe“);
    mplayerProgram = tr(“../mplayer/mplayer.exe“);
    timeClock = new QTimer(this);

    connect(mplayerProcess SIGNAL(readyReadStandardOutput()) this SLOT(back_Message_slot()));
    connect(timeClock SIGNAL(timeout()) this SLOT(back_posMessage_slot()));

}

IMplayer::~IMplayer()
{
    delete ui;
}

void IMplayer::setUI()
{

}

void IMplayer::play(QString fileName)
{
    mplayerProcess->close();

    ui->posTimeLineEdit->setText(“00:00:00“);
    ui->lengthTimeLineEdit->setText(“00:00:00“);
    ui->scheduleSlider->setValue(0);
    ui->voiceSlider->setValue(99);
    ui->playPushButton->setEnabled(1);
    ui->pausePushButton->setEnabled(1);
    ui->stopPushButton->setEnabled(1);
    ui->stepPushButton->setEnabled(1);
    ui->backPushButton->setEnabled(1);
    ui->scheduleSlider->setEnabled(1);
    ui->voiceSlider->setEnabled(1);
    ui->quietPushButton->setEnabled(1);

    QStringList args;
    args << tr(“-slave“);
    args << “-quiet“;
    args << “-zoom“;
    args << tr(“-wid“) << QString::number((unsigned int)(ui->widget->winId()));
    args << “-vo“ << “directx:noaccel“;
    args << fileName;

    timePos = 0;
    //ui->posTimeLineEdit->setText(“00:00:00“);
    timeLength = 1;
    isLength = 1;

    mplayerProcess->start(mplayerProgram args);

    mplayerProcess->write(“get_time_length\n“);
}

void IMplayer::on_playPushButton_clicked()
{

    if(isPlay == 0)
    {
        mplayerProcess->write(“pause\n“);
        isPlay = 1;
        timeClock->start();
    }
}

void IMplayer::on_pausePushButton_clicked()
{
    if(isPlay == 1)
    {
        mplayerProcess->write(“pause\n“);
        //timeClock->isActive()= false;
        isPlay = 0;
        timeClock->stop();

    }
}

void IMplayer::on_stopPushButton_clicked()
{
    timeClock->stop();
    mplayerProcess->write(“pausing_keep stop\n“);

    ui->posTimeLineEdit->setText(“00:00:00“);
    ui->lengthTimeLineEdit->setText(“00:00:00“);
    ui->scheduleSlider->setValue(0);
    ui->voiceSlider->setValue(99);
    ui->playPushButton->setDisabled(1);
    ui->pausePushButton->setDisabled(1);
    ui->stopPushButton->setDisabled(1);
    ui->stepPushButton->setDisabled(1);
    ui->backPushButton->setDisabled(1);
    ui->scheduleSlider->setDisabled(1);
    ui->voiceSlider->setDisabled(1);
    ui->quietPushButton->setIcon(QIcon(tr(“:/images/images/voice.png“)));
    ui-

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       9972  2009-11-02 14:45  IMplayer\implayer\images\backward.png

     文件      10781  2009-11-02 14:45  IMplayer\implayer\images\mute.png

     文件       2073  2006-10-20 15:26  IMplayer\implayer\images\openfile.png

     文件       9057  2009-11-02 14:45  IMplayer\implayer\images\pause.png

     文件       9748  2009-11-02 14:45  IMplayer\implayer\images\play.png

     文件      17669  2010-08-17 11:04  IMplayer\implayer\images\quiet.png

     文件      10015  2009-11-02 14:45  IMplayer\implayer\images\step.png

     文件       9351  2009-11-02 14:45  IMplayer\implayer\images\stop.png

     文件       5896  2009-11-02 14:46  IMplayer\implayer\images\vocal.png

     文件      18217  2010-08-17 10:59  IMplayer\implayer\images\voice.png

     文件        445  2010-08-17 11:06  IMplayer\implayer\images.qrc

     文件       7209  2010-09-03 11:28  IMplayer\implayer\implayer.cpp

     文件       1401  2010-09-01 08:45  IMplayer\implayer\implayer.h

     文件        362  2010-08-19 15:55  IMplayer\implayer\implayer.pro

     文件      37243  2013-04-03 13:39  IMplayer\implayer\implayer.pro.user

     文件      13571  2010-09-03 11:40  IMplayer\implayer\implayer.pro.user.2.1pre1

     文件      16997  2010-08-30 09:33  IMplayer\implayer\implayer.ui

     文件        191  2010-09-01 13:09  IMplayer\implayer\main.cpp

     文件    1149147  2010-09-03 11:28  IMplayer\implayer-build-desktop\debug\implayer.exe

     文件     489974  2010-09-03 11:28  IMplayer\implayer-build-desktop\debug\implayer.o

     文件     114801  2010-09-03 10:50  IMplayer\implayer-build-desktop\debug\main.o

     文件       4030  2010-09-03 10:50  IMplayer\implayer-build-desktop\debug\moc_implayer.cpp

     文件     129484  2010-09-03 10:50  IMplayer\implayer-build-desktop\debug\moc_implayer.o

     文件        500  2010-08-16 11:00  IMplayer\implayer-build-desktop\debug\play.o

     文件     535942  2010-08-17 11:21  IMplayer\implayer-build-desktop\debug\qrc_images.cpp

     文件     110762  2010-08-17 11:21  IMplayer\implayer-build-desktop\debug\qrc_images.o

     文件       6245  2010-08-19 16:04  IMplayer\implayer-build-desktop\Makefile

     文件       6748  2010-08-19 16:04  IMplayer\implayer-build-desktop\Makefile.Debug

     文件       6843  2010-08-19 16:04  IMplayer\implayer-build-desktop\Makefile.Release

     文件      16528  2010-08-30 09:33  IMplayer\implayer-build-desktop\ui_implayer.h

............此处省略68个文件信息

评论

共有 条评论