Audacity 3.2.0
Public Member Functions | List of all members
OggImportPlugin Class Referencefinal
Inheritance diagram for OggImportPlugin:
[legend]
Collaboration diagram for OggImportPlugin:
[legend]

Public Member Functions

 OggImportPlugin ()
 
 ~OggImportPlugin ()
 
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

Definition at line 56 of file ImportOGG.cpp.

Constructor & Destructor Documentation

◆ OggImportPlugin()

OggImportPlugin::OggImportPlugin ( )
inline

Definition at line 59 of file ImportOGG.cpp.

60 : ImportPlugin( FileExtensions( exts.begin(), exts.end() ) )
61 {
62 }
wxArrayStringEx FileExtensions
Definition: Identifier.h:225
static const auto exts
Definition: ImportOGG.cpp:37
ImportPlugin(FileExtensions supportedExtensions)

◆ ~OggImportPlugin()

OggImportPlugin::~OggImportPlugin ( )
inline

Definition at line 64 of file ImportOGG.cpp.

64{ }

Member Function Documentation

◆ GetPluginFormatDescription()

TranslatableString OggImportPlugin::GetPluginFormatDescription ( )
overridevirtual

Implements ImportPlugin.

Definition at line 138 of file ImportOGG.cpp.

139{
140 return DESC;
141}
#define DESC
Definition: ImportOGG.cpp:35

References DESC.

◆ GetPluginStringID()

wxString OggImportPlugin::GetPluginStringID ( )
inlineoverridevirtual

Implements ImportPlugin.

Definition at line 66 of file ImportOGG.cpp.

66{ return wxT("liboggvorbis"); }
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ Open()

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

Implements ImportPlugin.

Definition at line 143 of file ImportOGG.cpp.

145{
146 // Suppress some compiler warnings about unused global variables in the library header
147 wxUnusedVar(OV_CALLBACKS_DEFAULT);
148 wxUnusedVar(OV_CALLBACKS_NOCLOSE);
149 wxUnusedVar(OV_CALLBACKS_STREAMONLY);
150 wxUnusedVar(OV_CALLBACKS_STREAMONLY_NOCLOSE);
151
152 auto vorbisFile = std::make_unique<OggVorbis_File>();
153 auto file = std::make_unique<wxFFile>(filename, wxT("rb"));
154
155 if (!file->IsOpened()) {
156 // No need for a message box, it's done automatically (but how?)
157 return nullptr;
158 }
159
160 int err = ov_open(file->fp(), vorbisFile.get(), NULL, 0);
161
162 if (err < 0) {
163 TranslatableString message;
164
165 switch (err) {
166 case OV_EREAD:
167 message = XO("Media read error");
168 break;
169 case OV_ENOTVORBIS:
170 message = XO("Not an Ogg Vorbis file");
171 break;
172 case OV_EVERSION:
173 message = XO("Vorbis version mismatch");
174 break;
175 case OV_EBADHEADER:
176 message = XO("Invalid Vorbis bitstream header");
177 break;
178 case OV_EFAULT:
179 message = XO("Internal logic fault");
180 break;
181 }
182
183 // what to do with message?
184 return nullptr;
185 }
186
187 return std::make_unique<OggImportFileHandle>(filename, std::move(file), std::move(vorbisFile));
188}
XO("Cut/Copy/Paste")
Holds a msgid for the translation catalog; may also bind format arguments.

References wxT(), and XO().

Here is the call graph for this function:

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