Audacity 3.2.0
Classes | Functions | Variables
anonymous_namespace{FFmpegPrefs.cpp} Namespace Reference

Classes

struct  State
 

Functions

void OnFFmpegFindButton (State &state)
 
void SetFFmpegVersionText (State &state)
 
void AddControls (ShuttleGui &S)
 

Variables

LibraryPrefs::RegisteredControls reg { wxT("FFmpeg"), AddControls }
 

Function Documentation

◆ AddControls()

void anonymous_namespace{FFmpegPrefs.cpp}::AddControls ( ShuttleGui S)

Definition at line 36 of file FFmpegPrefs.cpp.

37{
38 auto pState = std::make_shared<State>();
39 pState->parent = S.GetParent();
40
41 S.StartStatic(XO("FFmpeg Import/Export Library"));
42 {
43 S.StartTwoColumn();
44 {
45 auto version =
46 XO("No compatible FFmpeg library was found");
47
48 pState->FFmpegVersion = S
49 .Position(wxALIGN_CENTRE_VERTICAL)
50 .AddReadOnlyText(XO("FFmpeg Library Version:"), version.Translation());
51
52 S.AddVariableText(XO("FFmpeg Library:"),
53 true, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
54
55 auto pFindButton =
56 S
57#if defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
58 .Disable()
59#endif
60 .AddButton(XXO("Loca&te..."),
61 wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
62 if (pFindButton)
63 pFindButton->Bind(wxEVT_BUTTON, [pState](wxCommandEvent&){
64 OnFFmpegFindButton(*pState);
65 });
66
67 S.AddVariableText(XO("FFmpeg Library:"),
68 true, wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
69
70 auto pDownButton =
71 S
72#if defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
73 .Disable()
74#endif
75 .AddButton(XXO("Dow&nload"),
76 wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
77 if (pDownButton)
78 pDownButton->Bind(wxEVT_BUTTON, [pState](wxCommandEvent&){
79 HelpSystem::ShowHelp(pState->parent,
80 wxT("FAQ:Installing_the_FFmpeg_Import_Export_Library"), true);
81 });
82 }
83 S.EndTwoColumn();
84 }
85 S.EndStatic();
86
87 SetFFmpegVersionText(*pState);
88}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:231
void SetFFmpegVersionText(State &state)
Definition: FFmpegPrefs.cpp:30

References OnFFmpegFindButton(), S, SetFFmpegVersionText(), HelpSystem::ShowHelp(), wxT(), XO(), and XXO().

Here is the call graph for this function:

◆ OnFFmpegFindButton()

void anonymous_namespace{FFmpegPrefs.cpp}::OnFFmpegFindButton ( State state)

Definition at line 90 of file FFmpegPrefs.cpp.

91{
92 bool showerrs =
93#if defined(_DEBUG)
94 true;
95#else
96 false;
97#endif
98 // Load the libs ('true' means that all errors will be shown)
99 bool locate = !LoadFFmpeg(showerrs);
100
101 // Libs are fine, don't show "locate" dialog unless user really wants it
102 if (!locate) {
103 int response = AudacityMessageBox(
104 XO(
105"Audacity has automatically detected valid FFmpeg libraries.\nDo you still want to locate them manually?"),
106 XO("Success"),
107 wxCENTRE | wxYES_NO | wxNO_DEFAULT |wxICON_QUESTION);
108 if (response == wxYES) {
109 locate = true;
110 }
111 }
112
113 if (locate) {
114 // Show "Locate FFmpeg" dialog
115 FindFFmpegLibs(state.parent);
116 LoadFFmpeg(showerrs);
117 }
119}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
bool FindFFmpegLibs(wxWindow *parent)
Definition: FFmpeg.cpp:303
bool LoadFFmpeg(bool showerror)
Definition: FFmpeg.cpp:39

References AudacityMessageBox(), FindFFmpegLibs(), LoadFFmpeg(), anonymous_namespace{FFmpegPrefs.cpp}::State::parent, SetFFmpegVersionText(), and XO().

Referenced by AddControls().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFFmpegVersionText()

void anonymous_namespace{FFmpegPrefs.cpp}::SetFFmpegVersionText ( State state)

Definition at line 30 of file FFmpegPrefs.cpp.

31{
32 auto FFmpegVersion = state.FFmpegVersion;
33 FFmpegVersion->SetValue(GetFFmpegVersion());
34}
TranslatableString GetFFmpegVersion()
Definition: FFmpeg.cpp:75
void SetValue(const wxString &value)
Definition: ReadOnlyText.h:124

References anonymous_namespace{FFmpegPrefs.cpp}::State::FFmpegVersion, GetFFmpegVersion(), and ReadOnlyText::SetValue().

Referenced by AddControls(), and OnFFmpegFindButton().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ reg

LibraryPrefs::RegisteredControls anonymous_namespace{FFmpegPrefs.cpp}::reg { wxT("FFmpeg"), AddControls }

Definition at line 121 of file FFmpegPrefs.cpp.