43 VLCRecorder* VLCRecorder::mTheInstance = NULL;
48 if(mTheInstance == NULL)
66 VLCRecorder::VLCRecorder() :
72 VLCRecorder::~VLCRecorder()
77 return QFile::exists(mVLCPath);
82 suggestedVLCLocations.push_front(this->getVLCDefaultLocation());
83 foreach(QString path, suggestedVLCLocations)
85 if(this->isValidVLC(path))
87 this->setVLCPath(path);
95 return mCommandLine->isRunning();
100 return mCommandLine->waitForStarted(msecs);
105 return mCommandLine->waitForFinished(msecs);
116 mCommandLine->launch(
"\""+mVLCPath+
"\""+this->getVLCDefaultRecorderArguments(saveFile));
123 QString quit =
"quit\n";
124 mCommandLine->write(quit.toStdString().c_str());
127 void VLCRecorder::setVLCPath(QString path)
130 report(
"Found valid VLC application: "+mVLCPath);
133 bool VLCRecorder::isValidVLC(QString vlcPath)
135 QFileInfo info(vlcPath);
136 if(info.exists() && !QString::compare(info.baseName(),
"vlc", Qt::CaseInsensitive))
141 QString VLCRecorder::getVLCDefaultLocation()
143 QString defaultLocation(
"");
145 defaultLocation =
"C:/Program Files (x86)/VideoLAN/VLC/vlc.exe";
148 defaultLocation =
"/Applications/VLC.app/Contents/MacOS/VLC";
151 defaultLocation =
"/usr/bin/vlc";
153 return defaultLocation;
156 QString VLCRecorder::getVLCDefaultRecorderArguments(QString saveFile)
158 QString defaultArguements(
"");
160 saveFile = saveFile.replace(
"/",
"\\");
161 defaultArguements =
" -I luacli screen:// :screen-fps=10.000000 :live-caching=300 :sout=#transcode{vcodec=h264,acodec=none}:file{dst="+saveFile+
"} :sout-keep ";
164 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+
"}}\"";
167 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";
169 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.