| 339 | } |
| 340 | |
| 341 | bool FileSourceFFmpegFile::openFile(const QString & filePath, |
| 342 | QWidget * mainWindow, |
| 343 | FileSourceFFmpegFile *other, |
| 344 | bool parseFile) |
| 345 | { |
| 346 | // Check if the file exists |
| 347 | this->fileInfo.setFile(filePath); |
| 348 | if (!this->fileInfo.exists() || !this->fileInfo.isFile()) |
| 349 | return false; |
| 350 | |
| 351 | if (this->isFileOpened) |
| 352 | { |
| 353 | // Close the file? |
| 354 | // TODO |
| 355 | } |
| 356 | |
| 357 | this->openFileAndFindVideoStream(filePath); |
| 358 | if (!this->isFileOpened) |
| 359 | return false; |
| 360 | |
| 361 | // Save the full file path |
| 362 | this->fullFilePath = filePath; |
| 363 | |
| 364 | // Install a watcher for the file (if file watching is active) |
| 365 | this->updateFileWatchSetting(); |
| 366 | this->fileChanged = false; |
| 367 | |
| 368 | // If another (already opened) bitstream is given, copy bitstream info from there; Otherwise scan |
| 369 | // the bitstream. |
| 370 | if (other && other->isFileOpened) |
| 371 | { |
| 372 | this->nrFrames = other->nrFrames; |
| 373 | this->keyFrameList = other->keyFrameList; |
| 374 | } |
| 375 | else if (parseFile) |
| 376 | { |
| 377 | if (!this->scanBitstream(mainWindow)) |
| 378 | return false; |
| 379 | |
| 380 | this->seekFileToBeginning(); |
| 381 | } |
| 382 | |
| 383 | return true; |
| 384 | } |
| 385 | |
| 386 | // Check if we are supposed to watch the file for changes. If no, remove the file watcher. If yes, |
| 387 | // install one. |
nothing calls this directly
no test coverage detected