mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Reviewed uses of type alias FileExtension, it belongs in more places
This commit is contained in:
parent
3f88df06ec
commit
d6d4ee3c29
@ -73,7 +73,7 @@ public:
|
|||||||
// import. If a filename matches any of these extensions,
|
// import. If a filename matches any of these extensions,
|
||||||
// this importer will get first dibs on importing it.
|
// this importer will get first dibs on importing it.
|
||||||
virtual FileExtensions GetSupportedExtensions() = 0;
|
virtual FileExtensions GetSupportedExtensions() = 0;
|
||||||
virtual bool SupportsExtension(const wxString & extension) = 0;
|
virtual bool SupportsExtension(const FileExtension & extension) = 0;
|
||||||
|
|
||||||
// Create the client that will be used to import a file.
|
// Create the client that will be used to import a file.
|
||||||
virtual ImporterClientInterface *CreateClient() = 0;
|
virtual ImporterClientInterface *CreateClient() = 0;
|
||||||
|
@ -631,7 +631,7 @@ bool MacroCommands::ApplySpecialCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString filename;
|
wxString filename;
|
||||||
wxString extension; // required for correct message
|
FileExtension extension; // required for correct message
|
||||||
if (command == wxT("ExportWAV"))
|
if (command == wxT("ExportWAV"))
|
||||||
extension = wxT(".wav");
|
extension = wxT(".wav");
|
||||||
else if (command == wxT("ExportOgg"))
|
else if (command == wxT("ExportOgg"))
|
||||||
|
@ -123,7 +123,7 @@ void ExportPlugin::SetDescription(const TranslatableString & description, int in
|
|||||||
mFormatInfos[index].mDescription = description;
|
mFormatInfos[index].mDescription = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportPlugin::AddExtension(const wxString &extension,int index)
|
void ExportPlugin::AddExtension(const FileExtension &extension, int index)
|
||||||
{
|
{
|
||||||
mFormatInfos[index].mExtensions.push_back(extension);
|
mFormatInfos[index].mExtensions.push_back(extension);
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ bool ExportPlugin::GetCanMetaData(int index)
|
|||||||
return mFormatInfos[index].mCanMetaData;
|
return mFormatInfos[index].mCanMetaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExportPlugin::IsExtension(const wxString & ext, int index)
|
bool ExportPlugin::IsExtension(const FileExtension & ext, int index)
|
||||||
{
|
{
|
||||||
bool isext = false;
|
bool isext = false;
|
||||||
for (int i = index; i < GetFormatCount(); i = GetFormatCount())
|
for (int i = index; i < GetFormatCount(); i = GetFormatCount())
|
||||||
@ -462,7 +462,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Exporter::Process(AudacityProject *project, unsigned numChannels,
|
bool Exporter::Process(AudacityProject *project, unsigned numChannels,
|
||||||
const wxChar *type, const wxString & filename,
|
const FileExtension &type, const wxString & filename,
|
||||||
bool selectedOnly, double t0, double t1)
|
bool selectedOnly, double t0, double t1)
|
||||||
{
|
{
|
||||||
// Save parms
|
// Save parms
|
||||||
@ -592,7 +592,7 @@ bool Exporter::GetFilename()
|
|||||||
mFormat = -1;
|
mFormat = -1;
|
||||||
|
|
||||||
wxString maskString;
|
wxString maskString;
|
||||||
wxString defaultFormat = mFormatName;
|
auto defaultFormat = mFormatName;
|
||||||
if( defaultFormat.empty() )
|
if( defaultFormat.empty() )
|
||||||
defaultFormat = gPrefs->Read(wxT("/Export/Format"),
|
defaultFormat = gPrefs->Read(wxT("/Export/Format"),
|
||||||
wxT("WAV"));
|
wxT("WAV"));
|
||||||
@ -683,7 +683,7 @@ bool Exporter::GetFilename()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ext = mFilename.GetExt();
|
const auto ext = mFilename.GetExt();
|
||||||
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
|
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
int AddFormat();
|
int AddFormat();
|
||||||
void SetFormat(const wxString & format, int index);
|
void SetFormat(const wxString & format, int index);
|
||||||
void SetDescription(const TranslatableString & description, int index);
|
void SetDescription(const TranslatableString & description, int index);
|
||||||
void AddExtension(const wxString &extension,int index);
|
void AddExtension(const FileExtension &extension, int index);
|
||||||
void SetExtensions(FileExtensions extensions, int index);
|
void SetExtensions(FileExtensions extensions, int index);
|
||||||
void SetMask(const wxString & mask, int index);
|
void SetMask(const wxString & mask, int index);
|
||||||
void SetMaxChannels(unsigned maxchannels, unsigned index);
|
void SetMaxChannels(unsigned maxchannels, unsigned index);
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
virtual unsigned GetMaxChannels(int index);
|
virtual unsigned GetMaxChannels(int index);
|
||||||
virtual bool GetCanMetaData(int index);
|
virtual bool GetCanMetaData(int index);
|
||||||
|
|
||||||
virtual bool IsExtension(const wxString & ext, int index);
|
virtual bool IsExtension(const FileExtension & ext, int index);
|
||||||
|
|
||||||
virtual bool DisplayOptions(wxWindow *parent, int format = 0);
|
virtual bool DisplayOptions(wxWindow *parent, int format = 0);
|
||||||
|
|
||||||
@ -185,12 +185,12 @@ public:
|
|||||||
virtual ~Exporter();
|
virtual ~Exporter();
|
||||||
|
|
||||||
void SetFileDialogTitle( const TranslatableString & DialogTitle );
|
void SetFileDialogTitle( const TranslatableString & DialogTitle );
|
||||||
void SetDefaultFormat( const wxString & Format ){ mFormatName = Format;};
|
void SetDefaultFormat( const FileExtension & Format ){ mFormatName = Format;};
|
||||||
|
|
||||||
bool Process(AudacityProject *project, bool selectedOnly,
|
bool Process(AudacityProject *project, bool selectedOnly,
|
||||||
double t0, double t1);
|
double t0, double t1);
|
||||||
bool Process(AudacityProject *project, unsigned numChannels,
|
bool Process(AudacityProject *project, unsigned numChannels,
|
||||||
const wxChar *type, const wxString & filename,
|
const FileExtension &type, const wxString & filename,
|
||||||
bool selectedOnly, double t0, double t1);
|
bool selectedOnly, double t0, double t1);
|
||||||
|
|
||||||
void DisplayOptions(int index);
|
void DisplayOptions(int index);
|
||||||
@ -227,7 +227,7 @@ private:
|
|||||||
void OnFilterChanged(wxFileCtrlEvent & evt);
|
void OnFilterChanged(wxFileCtrlEvent & evt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString mFormatName;
|
FileExtension mFormatName;
|
||||||
FileDialogWrapper *mDialog;
|
FileDialogWrapper *mDialog;
|
||||||
TranslatableString mFileDialogTitle;
|
TranslatableString mFileDialogTitle;
|
||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
|
@ -214,13 +214,13 @@ ExportFFmpeg::ExportFFmpeg()
|
|||||||
switch(newfmt)
|
switch(newfmt)
|
||||||
{
|
{
|
||||||
case FMT_M4A:
|
case FMT_M4A:
|
||||||
AddExtension(wxString(wxT("3gp")),fmtindex);
|
AddExtension(wxT("3gp"),fmtindex);
|
||||||
AddExtension(wxString(wxT("m4r")),fmtindex);
|
AddExtension(wxT("m4r"),fmtindex);
|
||||||
AddExtension(wxString(wxT("mp4")),fmtindex);
|
AddExtension(wxT("mp4"),fmtindex);
|
||||||
break;
|
break;
|
||||||
case FMT_WMA2:
|
case FMT_WMA2:
|
||||||
AddExtension(wxString(wxT("asf")),fmtindex);
|
AddExtension(wxT("asf"),fmtindex);
|
||||||
AddExtension(wxString(wxT("wmv")),fmtindex);
|
AddExtension(wxT("wmv"),fmtindex);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@ struct ExposedFormat
|
|||||||
{
|
{
|
||||||
FFmpegExposedFormat fmtid; //!< one of the FFmpegExposedFormat
|
FFmpegExposedFormat fmtid; //!< one of the FFmpegExposedFormat
|
||||||
const wxChar *name; //!< format name (internal, should be unique; if not - export dialog may show unusual behaviour)
|
const wxChar *name; //!< format name (internal, should be unique; if not - export dialog may show unusual behaviour)
|
||||||
const wxChar *extension; //!< default extension for this format. More extensions may be added later via AddExtension.
|
const FileExtension extension; //!< default extension for this format. More extensions may be added later via AddExtension.
|
||||||
const wxChar *shortname; //!< used to guess the format
|
const wxChar *shortname; //!< used to guess the format
|
||||||
unsigned maxchannels; //!< how many channels this format could handle
|
unsigned maxchannels; //!< how many channels this format could handle
|
||||||
const int canmetadata; //!< !=0 if format supports metadata, AV_CANMETA any avformat version, otherwise version support added
|
const int canmetadata; //!< !=0 if format supports metadata, AV_CANMETA any avformat version, otherwise version support added
|
||||||
|
@ -372,7 +372,7 @@ ExportPCM::ExportPCM()
|
|||||||
si.format = kFormats[i].format;
|
si.format = kFormats[i].format;
|
||||||
for (si.channels = 1; sf_format_check(&si); si.channels++)
|
for (si.channels = 1; sf_format_check(&si); si.channels++)
|
||||||
;
|
;
|
||||||
wxString ext = sf_header_extension(si.format);
|
auto ext = sf_header_extension(si.format);
|
||||||
|
|
||||||
SetFormat(kFormats[i].name, format);
|
SetFormat(kFormats[i].name, format);
|
||||||
SetCanMetaData(true, format);
|
SetCanMetaData(true, format);
|
||||||
|
@ -350,7 +350,7 @@ bool Importer::Import(const FilePath &fName,
|
|||||||
AudacityProject *pProj = GetActiveProject();
|
AudacityProject *pProj = GetActiveProject();
|
||||||
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
|
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
|
||||||
|
|
||||||
wxString extension = fName.AfterLast(wxT('.'));
|
const FileExtension extension{ fName.AfterLast(wxT('.')) };
|
||||||
|
|
||||||
// Always refuse to import MIDI, even though the FFmpeg plugin pretends to know how (but makes very bad renderings)
|
// Always refuse to import MIDI, even though the FFmpeg plugin pretends to know how (but makes very bad renderings)
|
||||||
#ifdef USE_MIDI
|
#ifdef USE_MIDI
|
||||||
|
@ -345,7 +345,7 @@ GStreamerImportPlugin::GetSupportedExtensions()
|
|||||||
// We refresh the extensions each time this is called in case the
|
// We refresh the extensions each time this is called in case the
|
||||||
// user had installed additional gstreamer plugins while Audacity
|
// user had installed additional gstreamer plugins while Audacity
|
||||||
// was active.
|
// was active.
|
||||||
mExtensions.Empty();
|
mExtensions.clear();
|
||||||
|
|
||||||
// Gather extensions from all factories that support audio
|
// Gather extensions from all factories that support audio
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ public:
|
|||||||
return mFormatName;
|
return mFormatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SupportsExtension(const wxString &extension)
|
bool SupportsExtension(const FileExtension &extension)
|
||||||
{
|
{
|
||||||
return mExtensions.Index(extension, false) != wxNOT_FOUND;
|
return mExtensions.Index(extension, false) != wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@
|
|||||||
|
|
||||||
// private helper classes and functions
|
// private helper classes and functions
|
||||||
namespace {
|
namespace {
|
||||||
void DoExport
|
void DoExport( AudacityProject &project, const FileExtension & Format )
|
||||||
(AudacityProject &project, const wxString & Format )
|
|
||||||
{
|
{
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user