MCPcopy Create free account
hub / github.com/audacity/audacity / FindFFmpegLibs

Function FindFFmpegLibs

modules/import-export/mod-ffmpeg/FFmpeg.cpp:304–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302END_EVENT_TABLE()
303
304bool 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
356BoolSetting FFmpegNotFoundDontShow{ L"/FFmpeg/NotFoundDontShow", false };
357

Callers 3

OnFFmpegFindButtonFunction · 0.85
CheckFFmpegMethod · 0.85
CheckFileNameMethod · 0.85

Calls 7

LoadFunction · 0.85
GetLibPathMethod · 0.80
emptyMethod · 0.45
ShowModalMethod · 0.45
GetPathMethod · 0.45
WriteMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected