summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-05-12 02:48:02 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-05-12 02:48:02 (GMT)
commit779c414bb96ab501e839261a4e9f2c94b9d21aa9 (patch)
treeb3e63cd5509ebc45f1650a5aa7dff4f9d3417538 /tools
parent7a3557acf5e0a9570e7e7e033a096eef5ca87055 (diff)
downloadQt-779c414bb96ab501e839261a4e9f2c94b9d21aa9.zip
Qt-779c414bb96ab501e839261a4e9f2c94b9d21aa9.tar.gz
Qt-779c414bb96ab501e839261a4e9f2c94b9d21aa9.tar.bz2
Allow extra video recording args on cmdline.
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlviewer/main.cpp5
-rw-r--r--tools/qmlviewer/qmlviewer.cpp19
-rw-r--r--tools/qmlviewer/qmlviewer.h6
3 files changed, 27 insertions, 3 deletions
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
index 9a008d2..f5a80b0 100644
--- a/tools/qmlviewer/main.cpp
+++ b/tools/qmlviewer/main.cpp
@@ -32,6 +32,7 @@ void usage()
qWarning(" - 'ffmpeg' for other formats");
qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode");
qWarning(" -recordperiod <milliseconds> ............. set time between recording frames");
+ qWarning(" -record arg .............................. add a recording process argument");
qWarning(" -autorecord [from-]<tomilliseconds> ...... set recording to start and stop");
qWarning(" -devicekeys .............................. use numeric keys (see F1)");
qWarning(" -cache ................................... disk cache remote content");
@@ -76,6 +77,7 @@ int main(int argc, char ** argv)
int autorecord_to = 0;
QString dither = "none";
QString recordfile;
+ QStringList recordargs;
QString skin;
bool devkeys = false;
bool cache = false;
@@ -94,6 +96,8 @@ int main(int argc, char ** argv)
period = QString(argv[++i]).toInt();
} else if (arg == "-recordfile") {
recordfile = QString(argv[++i]);
+ } else if (arg == "-record") {
+ recordargs << QString(argv[++i]);
} else if (arg == "-recorddither") {
dither = QString(argv[++i]);
} else if (arg == "-autorecord") {
@@ -142,6 +146,7 @@ int main(int argc, char ** argv)
if (devkeys)
viewer.setDeviceKeys(true);
viewer.setRecordDither(dither);
+ viewer.setRecordArgs(recordargs);
viewer.show();
return app.exec();
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index bd52b46..08b1497 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -68,8 +68,9 @@ QSize QmlViewer::sizeHint() const
if (skin)
return QMainWindow::sizeHint();
else {
+ // Kludge to force QMainWindow to be EXACTLY the right size for the canvas.
QSize sh = canvas->sizeHint();
- sh.setHeight(sh.height()+menuBar()->sizeHint().height());
+ sh.setHeight(sh.height()+menuBar()->sizeHint().height()+1);
return sh;
}
}
@@ -313,6 +314,11 @@ void QmlViewer::setAutoRecord(int from, int to)
}
}
+void QmlViewer::setRecordArgs(const QStringList& a)
+{
+ record_args = a;
+}
+
void QmlViewer::setRecordFile(const QString& f)
{
record_file = f;
@@ -383,8 +389,10 @@ void QmlViewer::setRecording(bool on)
// Stream video to ffmpeg
QProcess *proc = new QProcess(this);
+ connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int)));
frame_stream = proc;
+qDebug() << canvas->width() << canvas->height();
QStringList args;
args << "-sameq"; // ie. high
args << "-y";
@@ -393,8 +401,10 @@ void QmlViewer::setRecording(bool on)
args << "-pix_fmt" << "rgb32";
args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height());
args << "-i" << "-";
+ args += record_args;
args << record_file;
- proc->start("ffmpeg",args,QIODevice::WriteOnly);
+ proc->start("ffmpeg",args);
+
} else {
// Store frames, save to GIF/PNG
frame_stream = 0;
@@ -481,6 +491,11 @@ void QmlViewer::setRecording(bool on)
qDebug() << "Recording: " << (recordTimer.isActive()?"ON":"OFF");
}
+void QmlViewer::ffmpegFinished(int code)
+{
+ qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError();
+}
+
void QmlViewer::timerEvent(QTimerEvent *event)
{
if (event->timerId() == recordTimer.timerId()) {
diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h
index 3f17912..0748de4 100644
--- a/tools/qmlviewer/qmlviewer.h
+++ b/tools/qmlviewer/qmlviewer.h
@@ -24,6 +24,7 @@
class QFxView;
class PreviewDeviceSkin;
class QFxTestEngine;
+class QProcess;
class QmlViewer : public QMainWindow
{
@@ -34,6 +35,7 @@ public:
void setRecordDither(const QString& s) { record_dither = s; }
void setRecordPeriod(int ms);
void setRecordFile(const QString&);
+ void setRecordArgs(const QStringList&);
int recordPeriod() const { return record_period; }
void setRecording(bool on);
bool isRecording() const { return recordTimer.isActive(); }
@@ -52,6 +54,7 @@ public slots:
void takeSnapShot();
void toggleRecording();
void toggleRecordingWithSelection();
+ void ffmpegFinished(int code);
protected:
virtual void keyPressEvent(QKeyEvent *);
@@ -67,11 +70,12 @@ private:
void init(QFxTestEngine::TestMode, const QString &, const QString& fileName);
QBasicTimer recordTimer;
QList<QImage*> frames;
- QIODevice* frame_stream;
+ QProcess* frame_stream;
QBasicTimer autoStartTimer;
QTime autoTimer;
QString record_dither;
QString record_file;
+ QStringList record_args;
int record_period;
int record_autotime;
bool devicemode;