diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-07-30 06:03:36 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-07-30 06:03:36 (GMT) |
commit | f7b08934580ddc2716fbf4ac3ecd9684158d3cf7 (patch) | |
tree | 0574d7e40629e4adf9df99da982f66195f3d1182 /tools/qmlviewer/qmlviewer.cpp | |
parent | 8b168b8f969c1eafaeb0276a3c81b58a388f93d2 (diff) | |
download | Qt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.zip Qt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.tar.gz Qt-f7b08934580ddc2716fbf4ac3ecd9684158d3cf7.tar.bz2 |
Video size and aspect ratio.
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index d7d8b82..098f749 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -298,7 +298,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection())); recordMenu->addAction(recordAction); - QAction *recordOptions = new QAction(tr("Recording &Options..."), parent); + QAction *recordOptions = new QAction(tr("Video &Options..."), parent); connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions())); recordMenu->addAction(recordOptions); @@ -416,7 +416,17 @@ void QmlViewer::pickRecordingFile() void QmlViewer::chooseRecordingOptions() { + // File recdlg->file->setText(record_file); + + // Size + recdlg->sizeOriginal->setText(tr("Original (%1x%2)").arg(canvas->width()).arg(canvas->height())); + if (recdlg->sizeWidth->value()<=1) { + recdlg->sizeWidth->setValue(canvas->width()); + recdlg->sizeHeight->setValue(canvas->height()); + } + + // Rate if (record_rate == 24) recdlg->hz24->setChecked(true); else if (record_rate == 25) @@ -429,9 +439,24 @@ void QmlViewer::chooseRecordingOptions() recdlg->hzCustom->setChecked(true); recdlg->hz->setText(QString::number(record_rate)); } + + // Profile recdlg->setArguments(record_args.join(" ")); if (recdlg->exec()) { + // File record_file = recdlg->file->text(); + // Size + if (recdlg->sizeOriginal->isChecked()) + record_outsize = QSize(); + else if (recdlg->size720p->isChecked()) + record_outsize = QSize(1280,720); + else if (recdlg->sizeVGA->isChecked()) + record_outsize = QSize(640,480); + else if (recdlg->sizeQVGA->isChecked()) + record_outsize = QSize(320,240); + else + record_outsize = QSize(recdlg->sizeWidth->value(),recdlg->sizeHeight->value()); + // Rate if (recdlg->hz24->isChecked()) record_rate = 24; else if (recdlg->hz25->isChecked()) @@ -443,6 +468,7 @@ void QmlViewer::chooseRecordingOptions() else { record_rate = recdlg->hz->text().toDouble(); } + // Profile record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts); } } @@ -686,7 +712,7 @@ void QmlViewer::senseFfmpeg() proc.waitForFinished(2000); QString ffmpegHelp = proc.readAllStandardOutput(); ffmpegAvailable = ffmpegHelp.contains("-s "); - ffmpegHelp = tr("Video recording use ffmpeg:")+"\n\n"+ffmpegHelp; + ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp; QDialog *d = new QDialog(recdlg); QVBoxLayout *l = new QVBoxLayout(d); @@ -729,6 +755,10 @@ void QmlViewer::setRecording(bool on) args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32"); args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height()); args << "-i" << "-"; + if (record_outsize.isValid()) { + args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height()); + args << "-aspect" << QString::number(double(canvas->width())/canvas->height()); + } args += record_args; args << record_file; proc->start("ffmpeg",args); @@ -770,6 +800,8 @@ void QmlViewer::setRecording(bool on) break; QString name; name.sprintf(framename.toLocal8Bit(),frame++); + if (record_outsize.isValid()) + *img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); if (record_dither=="ordered") img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name); else if (record_dither=="threshold") |