コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: SSE4/vmf-1
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    coordinatesIsNeeded(true)
{
    ui->setupUi(this);
    ui->enableGpsCheckbox->setChecked(coordinatesIsNeeded);
    ui->videoSlider->setEnabled(false);
    connect(ui->actionOpen, SIGNAL(triggered()), SLOT(openFile()));
    connect(&timer, SIGNAL(timeout()), this, SLOT(stepVideo()));
    connect(ui->videoSlider, SIGNAL(sliderMoved(int)), this, SLOT(startVideo(int)));
    connect(ui->videoSlider, SIGNAL(valueChanged(int)), this, SLOT(startVideo(int)));
    connect(ui->calcSpeedButton, SIGNAL(clicked()), this, SLOT(calculateSpeed()));
    connect(ui->enableGpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(changeGpsOutputState(int)));
    connect(ui->playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
    connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
    ui->playPauseButton->setIcon(icon);

    icon = pStyle->standardIcon(QStyle::SP_MediaStop);
    ui->stopButton->setIcon(icon);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
コード例 #2
0
ファイル: MediaEngine.cpp プロジェクト: BBCbbb/ppsspp
bool MediaEngine::seekTo(s64 timestamp, int videoPixelMode) {
	if (timestamp <= 0) {
		return true;
	}

	// Just doing it the not so great way to be sure audio is in sync.
	int timeout = 1000;
	while (getVideoTimeStamp() < timestamp - 3003) {
		if (getAudioTimeStamp() < getVideoTimeStamp() - 4180 * 2) {
			getNextAudioFrame(NULL, NULL, NULL);
		}
		if (!stepVideo(videoPixelMode, true)) {
			return false;
		}
		if (--timeout <= 0) {
			return true;
		}
	}

	while (getAudioTimeStamp() < getVideoTimeStamp() - 4180 * 2) {
		if (getNextAudioFrame(NULL, NULL, NULL) == 0) {
			return false;
		}
		if (--timeout <= 0) {
			return true;
		}
	}

	return true;
}