22 VLCRecorder* VLCRecorder::mTheInstance = NULL;
27 if(mTheInstance == NULL)
45 VLCRecorder::VLCRecorder() :
52 VLCRecorder::~VLCRecorder()
57 return QFile::exists(mVLCPath);
62 suggestedVLCLocations.push_front(this->getVLCDefaultLocation());
63 foreach(QString path, suggestedVLCLocations)
65 if(this->isValidVLC(path))
67 this->setVLCPath(path);
75 return mCommandLine->isRunning();
80 return mCommandLine->waitForStarted(msecs);
85 return mCommandLine->waitForFinished(msecs);
96 mCommandLine->launch(
"\""+mVLCPath+
"\""+this->getVLCDefaultRecorderArguments(saveFile));
103 QString quit =
"quit\n";
104 mCommandLine->write(quit.toStdString().c_str());
107 void VLCRecorder::setVLCPath(QString path)
110 report(
"Found valid VLC application: "+mVLCPath);
113 bool VLCRecorder::isValidVLC(QString vlcPath)
115 QFileInfo info(vlcPath);
116 if(info.exists() && !QString::compare(info.baseName(),
"vlc", Qt::CaseInsensitive))
121 QString VLCRecorder::getVLCDefaultLocation()
123 QString defaultLocation(
"");
125 defaultLocation =
"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe";
128 defaultLocation =
"/Applications/VLC.app/Contents/MacOS/VLC";
131 defaultLocation =
"/usr/bin/vlc";
133 return defaultLocation;
136 QString VLCRecorder::getVLCDefaultRecorderArguments(QString saveFile)
138 QString defaultArguements(
"");
140 saveFile = saveFile.replace(
"/",
"\\");
141 defaultArguements =
" -I luacli screen:// :screen-fps=10.000000 :live-caching=300 :sout=#transcode{vcodec=h264,acodec=none}:file{dst="+saveFile+
"} :sout-keep ";
144 CX_LOG_WARNING(
"VLC 2.2.1 fails on Mac. VLC version 2.1.2 works.");
145 defaultArguements =
" -I cli screen:// \":sout=#transcode{vcodec=h264,vb=800,fps=10,scale=1,acodec=none}:duplicate{dst=standard{access=file,mux=mp4,dst="+saveFile+
"}}\"";
148 defaultArguements =
" -I cli screen:// :screen-fps=10.000000 :live-caching=300 \":sout=#transcode{vcodec=h264,vb=0,fps=10,scale=0,acodec=none}:file{dst="+saveFile+
"}\" :sout-keep";
150 return defaultArguements;
static VLCRecorder * getInstance()
bool waitForFinished(int msecs=30000)
void reportError(QString msg)
Lets you use the third party application VLC to record a video of the screen.
bool waitForStarted(int msecs=30000)
void startRecording(QString saveFile)
void findVLCApplication(QStringList suggestedVLCLocations=QStringList())
VLCRecorder * vlc()
Shortcut for accessing the vlc recorder.
Namespace for all CustusX production code.