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

An ImportPlugin for FLAC data. More...

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

Public Member Functions

 FLACImportPlugin ()
 
 ~FLACImportPlugin ()
 
wxString GetPluginStringID () override
 
TranslatableString GetPluginFormatDescription () override
 
std::unique_ptr< ImportFileHandleOpen (const FilePath &Filename, AudacityProject *) override
 
- 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 FLAC data.

Definition at line 98 of file ImportFLAC.cpp.

Constructor & Destructor Documentation

◆ FLACImportPlugin()

FLACImportPlugin::FLACImportPlugin ( )
inline

Definition at line 101 of file ImportFLAC.cpp.

101 :
102 ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
103 {
104 }
wxArrayStringEx FileExtensions
Definition: Identifier.h:225
static const auto exts
Definition: ImportFLAC.cpp:38
ImportPlugin(FileExtensions supportedExtensions)

◆ ~FLACImportPlugin()

FLACImportPlugin::~FLACImportPlugin ( )
inline

Definition at line 106 of file ImportFLAC.cpp.

106{ }

Member Function Documentation

◆ GetPluginFormatDescription()

TranslatableString FLACImportPlugin::GetPluginFormatDescription ( )
overridevirtual

Implements ImportPlugin.

Definition at line 269 of file ImportFLAC.cpp.

270{
271 return DESC;
272}
#define DESC
Definition: ImportFLAC.cpp:36

References DESC.

◆ GetPluginStringID()

wxString FLACImportPlugin::GetPluginStringID ( )
inlineoverridevirtual

Implements ImportPlugin.

Definition at line 108 of file ImportFLAC.cpp.

108{ return wxT("libflac"); }
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ Open()

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

Implements ImportPlugin.

Definition at line 275 of file ImportFLAC.cpp.

277{
278 // First check if it really is a FLAC file
279
280 int cnt;
281 wxFile binaryFile;
282 if (!binaryFile.Open(filename)) {
283 return nullptr; // File not found
284 }
285
286 // FIXME: TRAP_ERR wxFILE ops in FLAC Import could fail.
287 // Seek() return value is not examined, for example.
288#ifdef USE_LIBID3TAG
289 // Skip any ID3 tags that might be present
290 id3_byte_t query[ID3_TAG_QUERYSIZE];
291 cnt = binaryFile.Read(query, sizeof(query));
292 cnt = id3_tag_query(query, cnt);
293 binaryFile.Seek(cnt);
294#endif
295
296 char buf[5];
297 cnt = binaryFile.Read(buf, 4);
298 binaryFile.Close();
299
300 if (cnt == wxInvalidOffset || strncmp(buf, FLAC_HEADER, 4) != 0) {
301 // File is not a FLAC file
302 return nullptr;
303 }
304
305 // Open the file for import
306 auto handle = std::make_unique<FLACImportFileHandle>(filename);
307
308 bool success = handle->Init();
309 if (!success) {
310 return nullptr;
311 }
312
313 // This std::move is needed to "upcast" the pointer type
314 return std::move(handle);
315}
#define FLAC_HEADER
Definition: ImportFLAC.cpp:34

References FLAC_HEADER.


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