Audacity 3.2.0
Public Member Functions | List of all members
FFmpegImportPlugin Class Referencefinal

An ImportPlugin for FFmpeg data. More...

Inheritance diagram for FFmpegImportPlugin:
[legend]
Collaboration diagram for FFmpegImportPlugin:
[legend]

Public Member Functions

 FFmpegImportPlugin ()
 
 ~FFmpegImportPlugin ()
 
wxString GetPluginStringID () override
 
TranslatableString GetPluginFormatDescription () override
 
TranslatableString FailureHint () const override
 User visible message suggesting what to do when a file type isn't recognized; default empty string. More...
 
std::unique_ptr< ImportFileHandleOpen (const FilePath &Filename, AudacityProject *) override
 ! Probes the file and opens it if appropriate More...
 
- Public Member Functions inherited from ImportPlugin
virtual wxString GetPluginStringID ()=0
 
virtual TranslatableString GetPluginFormatDescription ()=0
 
virtual FileExtensions GetSupportedExtensions ()
 
virtual TranslatableString FailureHint () const
 User visible message suggesting what to do when a file type isn't recognized; default empty string. More...
 
bool SupportsExtension (const FileExtension &extension)
 
virtual std::unique_ptr< ImportFileHandleOpen (const FilePath &Filename, AudacityProject *)=0
 
virtual ~ImportPlugin ()
 

Additional Inherited Members

- Protected Member Functions inherited from ImportPlugin
 ImportPlugin (FileExtensions supportedExtensions)
 
- Protected Attributes inherited from ImportPlugin
const FileExtensions mExtensions
 

Detailed Description

An ImportPlugin for FFmpeg data.

A representative of FFmpeg loader in the Audacity import plugin list

Definition at line 154 of file ImportFFmpeg.cpp.

Constructor & Destructor Documentation

◆ FFmpegImportPlugin()

FFmpegImportPlugin::FFmpegImportPlugin ( )
inline

Definition at line 157 of file ImportFFmpeg.cpp.

157 :
158 ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
159 {
160 }
wxArrayStringEx FileExtensions
Definition: Identifier.h:225
static const auto exts
ImportPlugin(FileExtensions supportedExtensions)

◆ ~FFmpegImportPlugin()

FFmpegImportPlugin::~FFmpegImportPlugin ( )
inline

Definition at line 162 of file ImportFFmpeg.cpp.

162{ }

Member Function Documentation

◆ FailureHint()

TranslatableString FFmpegImportPlugin::FailureHint ( ) const
inlineoverridevirtual

User visible message suggesting what to do when a file type isn't recognized; default empty string.

Should end with one newline if not empty

Reimplemented from ImportPlugin.

Definition at line 167 of file ImportFFmpeg.cpp.

168 {
169 return !FFmpegFunctions::Load()
170 ? XO("Try installing FFmpeg.\n") : TranslatableString{};
171 }
XO("Cut/Copy/Paste")
Holds a msgid for the translation catalog; may also bind format arguments.
static std::shared_ptr< FFmpegFunctions > Load(bool fromUserPathOnly=false)

References FFmpegFunctions::Load(), and XO().

Here is the call graph for this function:

◆ GetPluginFormatDescription()

TranslatableString FFmpegImportPlugin::GetPluginFormatDescription ( )
overridevirtual

Implements ImportPlugin.

Definition at line 280 of file ImportFFmpeg.cpp.

281{
282 return DESC;
283}
#define DESC

References DESC.

◆ GetPluginStringID()

wxString FFmpegImportPlugin::GetPluginStringID ( )
inlineoverridevirtual

Implements ImportPlugin.

Definition at line 164 of file ImportFFmpeg.cpp.

164{ return wxT("libav"); }
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ Open()

std::unique_ptr< ImportFileHandle > FFmpegImportPlugin::Open ( const FilePath Filename,
AudacityProject  
)
overridevirtual

! Probes the file and opens it if appropriate

Implements ImportPlugin.

Definition at line 285 of file ImportFFmpeg.cpp.

287{
288 auto ffmpeg = FFmpegFunctions::Load();
289
290 //Check if we're loading explicitly supported format
291 wxString extension = filename.AfterLast(wxT('.'));
293 {
294 //Audacity is trying to load something that is declared as
295 //officially supported by this plugin.
296 //If we don't have FFmpeg configured - tell the user about it.
297 //Since this will be happening often, use disableable "FFmpeg not found" dialog
298 //insdead of usual AudacityMessageBox()
299 bool newsession = NewImportingSession.Read();
300 if (!ffmpeg)
301 {
302 auto dontShowDlg = FFmpegNotFoundDontShow.Read();
303 if (dontShowDlg == 0 && newsession)
304 {
306 gPrefs->Flush();
307 FFmpegNotFoundDialog{ nullptr }.ShowModal();
308
309 ffmpeg = FFmpegFunctions::Load();
310 }
311 }
312 }
313 if (!ffmpeg)
314 {
315 return nullptr;
316 }
317
318 // Construct the handle only after any reloading of ffmpeg functions
319 auto handle = std::make_unique<FFmpegImportFileHandle>(filename);
320
321 // Open the file for import
322 bool success = handle->Init();
323
324 if (!success) {
325 return nullptr;
326 }
327
328 return handle;
329}
BoolSetting FFmpegNotFoundDontShow
Definition: FFmpeg.cpp:355
BoolSetting NewImportingSession
Definition: Import.cpp:860
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
bool SupportsExtension(const FileExtension &extension)
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:259
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
virtual bool Flush() noexcept=0

References anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, FFmpegNotFoundDontShow, audacity::BasicSettings::Flush(), gPrefs, FFmpegFunctions::Load(), NewImportingSession, Setting< T >::Read(), ImportPlugin::SupportsExtension(), Setting< T >::Write(), and wxT().

Here is the call graph for this function:

The documentation for this class was generated from the following file: