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

Public Member Functions

 ExportFLAC ()
 
int GetFormatCount () const override
 
FormatInfo GetFormatInfo (int) const override
 Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique. More...
 
bool ParseConfig (int, const rapidjson::Value &config, ExportProcessor::Parameters &parameters) const override
 Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent. More...
 
std::vector< std::string > GetMimeTypes (int) const override
 
std::unique_ptr< ExportOptionsEditorCreateOptionsEditor (int, ExportOptionsEditor::Listener *listener) const override
 Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting. More...
 
std::unique_ptr< ExportProcessorCreateProcessor (int format) const override
 
- Public Member Functions inherited from ExportPlugin
 ExportPlugin ()
 
virtual ~ExportPlugin ()
 
virtual int GetFormatCount () const =0
 
virtual FormatInfo GetFormatInfo (int index) const =0
 Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique. More...
 
virtual std::unique_ptr< ExportOptionsEditorCreateOptionsEditor (int formatIndex, ExportOptionsEditor::Listener *listener) const =0
 Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting. More...
 
virtual std::vector< std::string > GetMimeTypes (int formatIndex) const
 
virtual bool ParseConfig (int formatIndex, const rapidjson::Value &config, ExportProcessor::Parameters &parameters) const
 Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent. More...
 
virtual bool CheckFileName (wxFileName &filename, int format=0) const
 
virtual std::unique_ptr< ExportProcessorCreateProcessor (int format) const =0
 

Detailed Description

Definition at line 207 of file ExportFLAC.cpp.

Constructor & Destructor Documentation

◆ ExportFLAC()

ExportFLAC::ExportFLAC ( )
default

Member Function Documentation

◆ CreateOptionsEditor()

std::unique_ptr< ExportOptionsEditor > ExportFLAC::CreateOptionsEditor ( int  formatIndex,
ExportOptionsEditor::Listener listener 
) const
overridevirtual

Creates format-dependent options editor, that is used to create a valid set of parameters to be used in exporting.

Parameters
listenerOption listener object that could be used by the editor to report on option changes.

Implements ExportPlugin.

Definition at line 282 of file ExportFLAC.cpp.

283{
284 return std::make_unique<PlainExportOptionsEditor>(FlacOptions, listener);
285}
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > FlacOptions
Definition: ExportFLAC.cpp:50

References anonymous_namespace{ExportFLAC.cpp}::FlacOptions.

◆ CreateProcessor()

std::unique_ptr< ExportProcessor > ExportFLAC::CreateProcessor ( int  format) const
overridevirtual
Parameters
formatControl which of the multiple formats this exporter is capable of exporting should be used. Used where a single export plug-in handles a number of related formats, but they have separate entries in the Format drop-down list box. For example, the options to export to "Other PCM", "AIFF 16 Bit" and "WAV 16 Bit" are all the same libsndfile export plug-in, but with subformat set to 0, 1, and 2 respectively.

Implements ExportPlugin.

Definition at line 287 of file ExportFLAC.cpp.

288{
289 return std::make_unique<FLACExportProcessor>();
290}

◆ GetFormatCount()

int ExportFLAC::GetFormatCount ( ) const
overridevirtual

Implements ExportPlugin.

Definition at line 232 of file ExportFLAC.cpp.

233{
234 return 1;
235}

◆ GetFormatInfo()

FormatInfo ExportFLAC::GetFormatInfo ( int  index) const
overridevirtual

Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn't guaranteed to be unique.

Parameters
indexShould not exceed the number of formats provided by GetFormatCount()

Implements ExportPlugin.

Definition at line 237 of file ExportFLAC.cpp.

238{
239 return {
240 wxT("FLAC"), XO("FLAC Files"), { wxT("flac") }, FLAC__MAX_CHANNELS, true
241 };
242}
wxT("CloseDown"))
XO("Cut/Copy/Paste")

References wxT(), and XO().

Here is the call graph for this function:

◆ GetMimeTypes()

std::vector< std::string > ExportFLAC::GetMimeTypes ( int  formatIndex) const
overridevirtual
Returns
Mime type(s) supported by the format.

Reimplemented from ExportPlugin.

Definition at line 276 of file ExportFLAC.cpp.

277{
278 return { "audio/x-flac" };
279}

◆ ParseConfig()

bool ExportFLAC::ParseConfig ( int  formatIndex,
const rapidjson::Value &  config,
ExportProcessor::Parameters parameters 
) const
overridevirtual

Attempt to parse configuration JSON object and produce a suitable set of parameters. Configuration is format dependent.

Parameters
formatIndexInternal format index
configConfiguration JSON object
parametersWhere to put parameters
Returns
Whether the parsing was successful

Reimplemented from ExportPlugin.

Definition at line 244 of file ExportFLAC.cpp.

245{
246 if(!config.IsObject() ||
247 !config.HasMember("level") || !config["level"].IsNumber() ||
248 !config.HasMember("bit_depth") || !config["bit_depth"].IsNumber())
249 return false;
250
251 const auto level = ExportValue(std::to_string(config["level"].GetInt()));
252 const auto bitDepth = ExportValue(std::to_string(config["bit_depth"].GetInt()));
253
254 for(const auto& desc : FlacOptions)
255 {
256 const auto& option = desc.option;
257 if((option.id == FlacOptionIDLevel &&
258 std::find(option.values.begin(),
259 option.values.end(),
260 level) == option.values.end())
261 ||
262 (desc.option.id == FlacOptionIDBitDepth &&
263 std::find(option.values.begin(),
264 option.values.end(),
265 bitDepth) == option.values.end()))
266 return false;
267 }
269 { FlacOptionIDLevel, level },
270 { FlacOptionIDBitDepth, bitDepth }
271 };
272 std::swap(parameters, result);
273 return true;
274}
std::variant< bool, int, double, std::string > ExportValue
A type of option values (parameters) used by exporting plugins.
Definition: ExportTypes.h:38
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
Definition: ExportPlugin.h:93
const TranslatableString desc
Definition: ExportPCM.cpp:51
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:634

References anonymous_namespace{ExportPCM.cpp}::desc, anonymous_namespace{ExportFLAC.cpp}::FlacOptionIDBitDepth, anonymous_namespace{ExportFLAC.cpp}::FlacOptionIDLevel, anonymous_namespace{ExportFLAC.cpp}::FlacOptions, and anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

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