| 302 | END_EVENT_TABLE() |
| 303 | |
| 304 | bool FindFFmpegLibs(wxWindow* parent) |
| 305 | { |
| 306 | wxString path; |
| 307 | |
| 308 | #if defined(__WXMSW__) |
| 309 | const wxString name = wxT("avformat.dll"); |
| 310 | #elif defined(__WXMAC__) |
| 311 | const wxString name = wxT("libavformat.dylib"); |
| 312 | #else |
| 313 | const wxString name = wxT("libavformat.so"); |
| 314 | #endif |
| 315 | |
| 316 | wxLogMessage(wxT("Looking for FFmpeg libraries...")); |
| 317 | |
| 318 | auto searchPaths = FFmpegFunctions::GetSearchPaths(false); |
| 319 | |
| 320 | if (!searchPaths.empty()) |
| 321 | path = searchPaths.front(); |
| 322 | |
| 323 | FindFFmpegDialog fd(parent, path, name); |
| 324 | |
| 325 | if (fd.ShowModal() == wxID_CANCEL) { |
| 326 | wxLogMessage(wxT("User canceled the dialog. Failed to find FFmpeg libraries.")); |
| 327 | return false; |
| 328 | } |
| 329 | |
| 330 | path = fd.GetLibPath(); |
| 331 | |
| 332 | const wxFileName fileName(path); |
| 333 | |
| 334 | if (fileName.FileExists()) |
| 335 | path = fileName.GetPath(); |
| 336 | |
| 337 | wxLogMessage(wxT("User-specified path = '%s'"), path); |
| 338 | |
| 339 | SettingTransaction transaction; |
| 340 | AVFormatPath.Write(path); |
| 341 | |
| 342 | // Try to load FFmpeg from the user provided path |
| 343 | if (!FFmpegFunctions::Load(true)) |
| 344 | { |
| 345 | wxLogError(wxT("User-specified path does not contain FFmpeg libraries.")); |
| 346 | return false; |
| 347 | } |
| 348 | |
| 349 | transaction.Commit(); |
| 350 | |
| 351 | wxLogMessage(wxT("User-specified FFmpeg file exists. Success.")); |
| 352 | |
| 353 | return true; |
| 354 | } |
| 355 | |
| 356 | BoolSetting FFmpegNotFoundDontShow{ L"/FFmpeg/NotFoundDontShow", false }; |
| 357 | |