mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-09 00:21:16 +02:00
Use arrays of smart pointers to import plugins
This commit is contained in:
parent
7d89e5ff68
commit
28f0b11376
@ -38,6 +38,7 @@ and ImportLOF.cpp.
|
|||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "Import.h"
|
#include "Import.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include "ImportPlugin.h"
|
#include "ImportPlugin.h"
|
||||||
|
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
@ -62,8 +63,6 @@ and ImportLOF.cpp.
|
|||||||
#include "ImportGStreamer.h"
|
#include "ImportGStreamer.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
|
||||||
WX_DEFINE_LIST(ImportPluginList);
|
|
||||||
WX_DEFINE_LIST(UnusableImportPluginList);
|
|
||||||
WX_DEFINE_OBJARRAY(ExtImportItems);
|
WX_DEFINE_OBJARRAY(ExtImportItems);
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -125,9 +124,7 @@ bool Importer::Initialize()
|
|||||||
bool Importer::Terminate()
|
bool Importer::Terminate()
|
||||||
{
|
{
|
||||||
WriteImportItems();
|
WriteImportItems();
|
||||||
mImportPluginList->DeleteContents(true);
|
|
||||||
delete mImportPluginList;
|
delete mImportPluginList;
|
||||||
mUnusableImportPluginList->DeleteContents(true);//JKC
|
|
||||||
delete mUnusableImportPluginList;
|
delete mUnusableImportPluginList;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -135,10 +132,8 @@ bool Importer::Terminate()
|
|||||||
|
|
||||||
void Importer::GetSupportedImportFormats(FormatList *formatList)
|
void Importer::GetSupportedImportFormats(FormatList *formatList)
|
||||||
{
|
{
|
||||||
ImportPluginList::compatibility_iterator importPluginNode = mImportPluginList->GetFirst();
|
for(const auto &importPlugin : *mImportPluginList)
|
||||||
while(importPluginNode)
|
|
||||||
{
|
{
|
||||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
|
||||||
#ifdef __AUDACITY_OLD_STD__
|
#ifdef __AUDACITY_OLD_STD__
|
||||||
formatList->push_back(Format{importPlugin->GetPluginFormatDescription(),
|
formatList->push_back(Format{importPlugin->GetPluginFormatDescription(),
|
||||||
importPlugin->GetSupportedExtensions()});
|
importPlugin->GetSupportedExtensions()});
|
||||||
@ -146,7 +141,6 @@ void Importer::GetSupportedImportFormats(FormatList *formatList)
|
|||||||
formatList->emplace_back(importPlugin->GetPluginFormatDescription(),
|
formatList->emplace_back(importPlugin->GetPluginFormatDescription(),
|
||||||
importPlugin->GetSupportedExtensions());
|
importPlugin->GetSupportedExtensions());
|
||||||
#endif
|
#endif
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +159,6 @@ void Importer::ReadImportItems()
|
|||||||
wxString item_name;
|
wxString item_name;
|
||||||
wxString item_value;
|
wxString item_value;
|
||||||
ExtImportItem *new_item;
|
ExtImportItem *new_item;
|
||||||
ImportPluginList::compatibility_iterator importPluginNode;
|
|
||||||
|
|
||||||
if (this->mExtImportItems != NULL)
|
if (this->mExtImportItems != NULL)
|
||||||
delete this->mExtImportItems;
|
delete this->mExtImportItems;
|
||||||
@ -229,29 +222,27 @@ void Importer::ReadImportItems()
|
|||||||
/* Find corresponding filter object for each filter ID */
|
/* Find corresponding filter object for each filter ID */
|
||||||
for (size_t i = 0; i < new_item->filters.Count(); i++)
|
for (size_t i = 0; i < new_item->filters.Count(); i++)
|
||||||
{
|
{
|
||||||
for (importPluginNode = mImportPluginList->GetFirst();
|
bool found = false;
|
||||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
for (const auto &importPlugin : *mImportPluginList)
|
||||||
{
|
{
|
||||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
|
||||||
if (importPlugin->GetPluginStringID().Cmp(new_item->filters[i]) == 0)
|
if (importPlugin->GetPluginStringID().Cmp(new_item->filters[i]) == 0)
|
||||||
{
|
{
|
||||||
new_item->filter_objects.Add (importPlugin);
|
new_item->filter_objects.Add (importPlugin.get());
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* IDs that do not have corresponding filters, will be shown as-is */
|
/* IDs that do not have corresponding filters, will be shown as-is */
|
||||||
if (!importPluginNode)
|
if (!found)
|
||||||
new_item->filter_objects.Add (NULL);
|
new_item->filter_objects.Add (NULL);
|
||||||
}
|
}
|
||||||
/* Find all filter objects that are not present in the filter list */
|
/* Find all filter objects that are not present in the filter list */
|
||||||
for (importPluginNode = mImportPluginList->GetFirst();
|
for (const auto &importPlugin : *mImportPluginList)
|
||||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
|
||||||
for (size_t i = 0; i < new_item->filter_objects.Count(); i++)
|
for (size_t i = 0; i < new_item->filter_objects.Count(); i++)
|
||||||
{
|
{
|
||||||
if (importPlugin == new_item->filter_objects[i])
|
if (importPlugin.get() == new_item->filter_objects[i])
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -264,7 +255,7 @@ void Importer::ReadImportItems()
|
|||||||
if (new_item->divider < 0)
|
if (new_item->divider < 0)
|
||||||
index = new_item->filters.Count();
|
index = new_item->filters.Count();
|
||||||
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
new_item->filters.Insert(importPlugin->GetPluginStringID(),index);
|
||||||
new_item->filter_objects.Insert (importPlugin, index);
|
new_item->filter_objects.Insert (importPlugin.get(), index);
|
||||||
if (new_item->divider >= 0)
|
if (new_item->divider >= 0)
|
||||||
new_item->divider++;
|
new_item->divider++;
|
||||||
}
|
}
|
||||||
@ -337,18 +328,15 @@ void Importer::WriteImportItems()
|
|||||||
ExtImportItem *Importer::CreateDefaultImportItem()
|
ExtImportItem *Importer::CreateDefaultImportItem()
|
||||||
{
|
{
|
||||||
ExtImportItem *new_item;
|
ExtImportItem *new_item;
|
||||||
ImportPluginList::compatibility_iterator importPluginNode;
|
|
||||||
|
|
||||||
new_item = new ExtImportItem();
|
new_item = new ExtImportItem();
|
||||||
new_item->extensions.Add(wxT("*"));
|
new_item->extensions.Add(wxT("*"));
|
||||||
new_item->mime_types.Add(wxT("*"));
|
new_item->mime_types.Add(wxT("*"));
|
||||||
|
|
||||||
for (importPluginNode = mImportPluginList->GetFirst();
|
for (const auto &importPlugin : *mImportPluginList)
|
||||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
|
||||||
{
|
{
|
||||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
|
||||||
new_item->filters.Add (importPlugin->GetPluginStringID());
|
new_item->filters.Add (importPlugin->GetPluginStringID());
|
||||||
new_item->filter_objects.Add (importPlugin);
|
new_item->filter_objects.Add (importPlugin.get());
|
||||||
}
|
}
|
||||||
new_item->divider = -1;
|
new_item->divider = -1;
|
||||||
return new_item;
|
return new_item;
|
||||||
@ -366,12 +354,13 @@ bool Importer::Import(const wxString &fName,
|
|||||||
|
|
||||||
wxString extension = fName.AfterLast(wxT('.'));
|
wxString extension = fName.AfterLast(wxT('.'));
|
||||||
|
|
||||||
|
using ImportPluginPtrs = std::vector< ImportPlugin* >;
|
||||||
|
|
||||||
// This list is used to call plugins in correct order
|
// This list is used to call plugins in correct order
|
||||||
ImportPluginList importPlugins;
|
ImportPluginPtrs importPlugins;
|
||||||
ImportPluginList::compatibility_iterator importPluginNode;
|
|
||||||
|
|
||||||
// This list is used to remember plugins that should have been compatible with the file.
|
// This list is used to remember plugins that should have been compatible with the file.
|
||||||
ImportPluginList compatiblePlugins;
|
ImportPluginPtrs compatiblePlugins;
|
||||||
|
|
||||||
// If user explicitly selected a filter,
|
// If user explicitly selected a filter,
|
||||||
// then we should try importing via corresponding plugin first
|
// then we should try importing via corresponding plugin first
|
||||||
@ -389,17 +378,14 @@ bool Importer::Import(const wxString &fName,
|
|||||||
|
|
||||||
if (usersSelectionOverrides)
|
if (usersSelectionOverrides)
|
||||||
{
|
{
|
||||||
importPluginNode = mImportPluginList->GetFirst();
|
for (const auto &plugin : *mImportPluginList)
|
||||||
while (importPluginNode)
|
|
||||||
{
|
{
|
||||||
ImportPlugin *plugin = importPluginNode->GetData();
|
|
||||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||||
{
|
{
|
||||||
// This plugin corresponds to user-selected filter, try it first.
|
// This plugin corresponds to user-selected filter, try it first.
|
||||||
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
|
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
|
||||||
importPlugins.Insert(plugin);
|
importPlugins.insert(importPlugins.begin(), plugin.get());
|
||||||
}
|
}
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,13 +441,12 @@ bool Importer::Import(const wxString &fName,
|
|||||||
if (!(item->filter_objects[j]))
|
if (!(item->filter_objects[j]))
|
||||||
continue;
|
continue;
|
||||||
wxLogDebug(wxT("Inserting %s"),item->filter_objects[j]->GetPluginStringID().c_str());
|
wxLogDebug(wxT("Inserting %s"),item->filter_objects[j]->GetPluginStringID().c_str());
|
||||||
importPlugins.Append(item->filter_objects[j]);
|
importPlugins.push_back(item->filter_objects[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all plugins that support the extension
|
// Add all plugins that support the extension
|
||||||
importPluginNode = mImportPluginList->GetFirst();
|
|
||||||
|
|
||||||
// Here we rely on the fact that the first plugin in mImportPluginList is libsndfile.
|
// Here we rely on the fact that the first plugin in mImportPluginList is libsndfile.
|
||||||
// We want to save this for later insertion ahead of libmad, if libmad supports the extension.
|
// We want to save this for later insertion ahead of libmad, if libmad supports the extension.
|
||||||
@ -469,14 +454,14 @@ bool Importer::Import(const wxString &fName,
|
|||||||
// is not changed by user selection overrides or any other mechanism, but we include an assert
|
// is not changed by user selection overrides or any other mechanism, but we include an assert
|
||||||
// in case subsequent code revisions to the constructor should break this assumption that
|
// in case subsequent code revisions to the constructor should break this assumption that
|
||||||
// libsndfile is first.
|
// libsndfile is first.
|
||||||
ImportPlugin *libsndfilePlugin = importPluginNode->GetData();
|
ImportPlugin *libsndfilePlugin = mImportPluginList->begin()->get();
|
||||||
wxASSERT(libsndfilePlugin->GetPluginStringID().IsSameAs(wxT("libsndfile")));
|
wxASSERT(libsndfilePlugin->GetPluginStringID().IsSameAs(wxT("libsndfile")));
|
||||||
|
|
||||||
while (importPluginNode)
|
for (const auto &plugin : *mImportPluginList)
|
||||||
{
|
{
|
||||||
ImportPlugin *plugin = importPluginNode->GetData();
|
|
||||||
// Make sure its not already in the list
|
// Make sure its not already in the list
|
||||||
if (importPlugins.Find(plugin) == NULL)
|
if (importPlugins.end() ==
|
||||||
|
std::find(importPlugins.begin(), importPlugins.end(), plugin.get()))
|
||||||
{
|
{
|
||||||
if (plugin->SupportsExtension(extension))
|
if (plugin->SupportsExtension(extension))
|
||||||
{
|
{
|
||||||
@ -491,45 +476,40 @@ bool Importer::Import(const wxString &fName,
|
|||||||
if (plugin->GetPluginStringID().IsSameAs(wxT("libmad")))
|
if (plugin->GetPluginStringID().IsSameAs(wxT("libmad")))
|
||||||
{
|
{
|
||||||
// Make sure libsndfile is not already in the list
|
// Make sure libsndfile is not already in the list
|
||||||
if (importPlugins.Find(libsndfilePlugin) == NULL)
|
if (importPlugins.end() ==
|
||||||
|
std::find(importPlugins.begin(), importPlugins.end(), libsndfilePlugin))
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("Appending %s"),libsndfilePlugin->GetPluginStringID().c_str());
|
wxLogDebug(wxT("Appending %s"),libsndfilePlugin->GetPluginStringID().c_str());
|
||||||
importPlugins.Append(libsndfilePlugin);
|
importPlugins.push_back(libsndfilePlugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxLogDebug(wxT("Appending %s"),plugin->GetPluginStringID().c_str());
|
wxLogDebug(wxT("Appending %s"),plugin->GetPluginStringID().c_str());
|
||||||
importPlugins.Append(plugin);
|
importPlugins.push_back(plugin.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add remaining plugins, except for libmad, which should not be used as a fallback for anything.
|
// Add remaining plugins, except for libmad, which should not be used as a fallback for anything.
|
||||||
// Otherwise, if FFmpeg (libav) has not been installed, libmad will still be there near the
|
// Otherwise, if FFmpeg (libav) has not been installed, libmad will still be there near the
|
||||||
// end of the preference list importPlugins, where it will claim success importing FFmpeg file
|
// end of the preference list importPlugins, where it will claim success importing FFmpeg file
|
||||||
// formats unsuitable for it, and produce distorted results.
|
// formats unsuitable for it, and produce distorted results.
|
||||||
importPluginNode = mImportPluginList->GetFirst();
|
for (const auto &plugin : *mImportPluginList)
|
||||||
while (importPluginNode)
|
|
||||||
{
|
{
|
||||||
ImportPlugin *plugin = importPluginNode->GetData();
|
|
||||||
if (!(plugin->GetPluginStringID().IsSameAs(wxT("libmad"))))
|
if (!(plugin->GetPluginStringID().IsSameAs(wxT("libmad"))))
|
||||||
{
|
{
|
||||||
// Make sure its not already in the list
|
// Make sure its not already in the list
|
||||||
if (importPlugins.Find(plugin) == NULL)
|
if (importPlugins.end() ==
|
||||||
|
std::find(importPlugins.begin(), importPlugins.end(), plugin.get()))
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("Appending %s"),plugin->GetPluginStringID().c_str());
|
wxLogDebug(wxT("Appending %s"),plugin->GetPluginStringID().c_str());
|
||||||
importPlugins.Append(plugin);
|
importPlugins.push_back(plugin.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
importPluginNode = importPlugins.GetFirst();
|
// Try the import plugins, in the permuted sequences just determined
|
||||||
while(importPluginNode)
|
for (const auto plugin : importPlugins)
|
||||||
{
|
{
|
||||||
ImportPlugin *plugin = importPluginNode->GetData();
|
|
||||||
// Try to open the file with this plugin (probe it)
|
// Try to open the file with this plugin (probe it)
|
||||||
wxLogMessage(wxT("Opening with %s"),plugin->GetPluginStringID().c_str());
|
wxLogMessage(wxT("Opening with %s"),plugin->GetPluginStringID().c_str());
|
||||||
auto inFile = plugin->Open(fName);
|
auto inFile = plugin->Open(fName);
|
||||||
@ -583,18 +563,14 @@ bool Importer::Import(const wxString &fName,
|
|||||||
// that may recognize the extension, so we allow the loop to
|
// that may recognize the extension, so we allow the loop to
|
||||||
// continue.
|
// continue.
|
||||||
}
|
}
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
wxLogError(wxT("Importer::Import: Opening failed."));
|
wxLogError(wxT("Importer::Import: Opening failed."));
|
||||||
|
|
||||||
// None of our plugins can handle this file. It might be that
|
// None of our plugins can handle this file. It might be that
|
||||||
// Audacity supports this format, but support was not compiled in.
|
// Audacity supports this format, but support was not compiled in.
|
||||||
// If so, notify the user of this fact
|
// If so, notify the user of this fact
|
||||||
UnusableImportPluginList::compatibility_iterator unusableImporterNode
|
for (const auto &unusableImportPlugin : *mUnusableImportPluginList)
|
||||||
= mUnusableImportPluginList->GetFirst();
|
|
||||||
while(unusableImporterNode)
|
|
||||||
{
|
{
|
||||||
UnusableImportPlugin *unusableImportPlugin = unusableImporterNode->GetData();
|
|
||||||
if( unusableImportPlugin->SupportsExtension(extension) )
|
if( unusableImportPlugin->SupportsExtension(extension) )
|
||||||
{
|
{
|
||||||
errorMessage.Printf(_("This version of Audacity was not compiled with %s support."),
|
errorMessage.Printf(_("This version of Audacity was not compiled with %s support."),
|
||||||
@ -603,7 +579,6 @@ bool Importer::Import(const wxString &fName,
|
|||||||
pProj->mbBusyImporting = false;
|
pProj->mbBusyImporting = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unusableImporterNode = unusableImporterNode->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* warnings for unsupported data types */
|
/* warnings for unsupported data types */
|
||||||
@ -617,7 +592,7 @@ bool Importer::Import(const wxString &fName,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (compatiblePlugins.GetCount() <= 0)
|
if (compatiblePlugins.empty())
|
||||||
{
|
{
|
||||||
// if someone has sent us a .cda file, send them away
|
// if someone has sent us a .cda file, send them away
|
||||||
if (extension.IsSameAs(wxT("cda"), false)) {
|
if (extension.IsSameAs(wxT("cda"), false)) {
|
||||||
@ -715,15 +690,12 @@ bool Importer::Import(const wxString &fName,
|
|||||||
// We DO have a plugin for this file, but import failed.
|
// We DO have a plugin for this file, but import failed.
|
||||||
wxString pluglist = wxEmptyString;
|
wxString pluglist = wxEmptyString;
|
||||||
|
|
||||||
importPluginNode = compatiblePlugins.GetFirst();
|
for (const auto &plugin : compatiblePlugins)
|
||||||
while(importPluginNode)
|
|
||||||
{
|
{
|
||||||
ImportPlugin *plugin = importPluginNode->GetData();
|
|
||||||
if (pluglist == wxEmptyString)
|
if (pluglist == wxEmptyString)
|
||||||
pluglist = plugin->GetPluginFormatDescription();
|
pluglist = plugin->GetPluginFormatDescription();
|
||||||
else
|
else
|
||||||
pluglist = pluglist + wxT(", ") + plugin->GetPluginFormatDescription();
|
pluglist = pluglist + wxT(", ") + plugin->GetPluginFormatDescription();
|
||||||
importPluginNode = importPluginNode->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessage.Printf(_("Audacity recognized the type of the file '%s'.\nImporters supposedly supporting such files are:\n%s,\nbut none of them understood this file format."),fName.c_str(), pluglist.c_str());
|
errorMessage.Printf(_("Audacity recognized the type of the file '%s'.\nImporters supposedly supporting such files are:\n%s,\nbut none of them understood this file format."),fName.c_str(), pluglist.c_str());
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#define _IMPORT_
|
#define _IMPORT_
|
||||||
|
|
||||||
#include "ImportRaw.h" // defines TrackHolders
|
#include "ImportRaw.h" // defines TrackHolders
|
||||||
|
#include "ImportForwards.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/arrstr.h>
|
#include <wx/arrstr.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
@ -85,9 +86,6 @@ class ExtImportItem
|
|||||||
wxArrayString mime_types;
|
wxArrayString mime_types;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImportPluginList;
|
|
||||||
class UnusableImportPluginList;
|
|
||||||
|
|
||||||
class Importer {
|
class Importer {
|
||||||
public:
|
public:
|
||||||
Importer();
|
Importer();
|
||||||
|
@ -286,7 +286,7 @@ private:
|
|||||||
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new FFmpegImportPlugin );
|
importPluginList.push_back( make_movable<FFmpegImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,10 +59,10 @@ static const wxChar *exts[] =
|
|||||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &unusableImportPluginList)
|
UnusableImportPluginList &unusableImportPluginList)
|
||||||
{
|
{
|
||||||
UnusableImportPlugin* flacIsUnsupported =
|
unusableImportPluginList.push_back(
|
||||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
make_movable<UnusableImportPlugin>
|
||||||
|
(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||||
unusableImportPluginList.push_back( flacIsUnsupported );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* USE_LIBFLAC */
|
#else /* USE_LIBFLAC */
|
||||||
@ -285,7 +285,7 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
|
|||||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new FLACImportPlugin );
|
importPluginList.push_back( make_movable<FLACImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,13 +9,15 @@
|
|||||||
#ifndef __AUDACITY_IMPORT_FORWARDS__
|
#ifndef __AUDACITY_IMPORT_FORWARDS__
|
||||||
#define __AUDACITY_IMPORT_FORWARDS__
|
#define __AUDACITY_IMPORT_FORWARDS__
|
||||||
|
|
||||||
#include <wx/list.h>
|
#include <vector>
|
||||||
#include "../MemoryX.h"
|
#include "../MemoryX.h"
|
||||||
|
|
||||||
class ImportPlugin;
|
class ImportPlugin;
|
||||||
class UnusableImportPlugin;
|
class UnusableImportPlugin;
|
||||||
|
|
||||||
WX_DECLARE_LIST(ImportPlugin, ImportPluginList);
|
using ImportPluginList =
|
||||||
WX_DECLARE_LIST(UnusableImportPlugin, UnusableImportPluginList);
|
std::vector< movable_ptr<ImportPlugin> >;
|
||||||
|
using UnusableImportPluginList =
|
||||||
|
std::vector< movable_ptr<UnusableImportPlugin> >;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -300,7 +300,7 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Add to list of importers
|
// Add to list of importers
|
||||||
importPluginList.push_back( plug.release() );
|
importPluginList.push_back( std::move(plug) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@ -178,7 +178,7 @@ LOFImportFileHandle::LOFImportFileHandle
|
|||||||
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new LOFImportPlugin );
|
importPluginList.push_back( make_movable<LOFImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString LOFImportPlugin::GetPluginFormatDescription()
|
wxString LOFImportPlugin::GetPluginFormatDescription()
|
||||||
|
@ -59,10 +59,10 @@ static const wxChar *exts[] =
|
|||||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &unusableImportPluginList)
|
UnusableImportPluginList &unusableImportPluginList)
|
||||||
{
|
{
|
||||||
UnusableImportPlugin* mp3IsUnsupported =
|
unusableImportPluginList.push_back(
|
||||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
make_movable<UnusableImportPlugin>
|
||||||
|
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||||
unusableImportPluginList.push_back( mp3IsUnsupported );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* USE_LIBMAD */
|
#else /* USE_LIBMAD */
|
||||||
@ -156,7 +156,7 @@ private:
|
|||||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new MP3ImportPlugin );
|
importPluginList.push_back( make_movable<MP3ImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The MAD callbacks */
|
/* The MAD callbacks */
|
||||||
|
@ -58,10 +58,10 @@ static const wxChar *exts[] =
|
|||||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &unusableImportPluginList)
|
UnusableImportPluginList &unusableImportPluginList)
|
||||||
{
|
{
|
||||||
UnusableImportPlugin* oggIsUnsupported =
|
unusableImportPluginList.push_back(
|
||||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
make_movable<UnusableImportPlugin>
|
||||||
|
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||||
unusableImportPluginList.push_back( oggIsUnsupported );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* USE_LIBVORBIS */
|
#else /* USE_LIBVORBIS */
|
||||||
@ -163,7 +163,7 @@ private:
|
|||||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new OggImportPlugin );
|
importPluginList.push_back( make_movable<OggImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString OggImportPlugin::GetPluginFormatDescription()
|
wxString OggImportPlugin::GetPluginFormatDescription()
|
||||||
|
@ -116,7 +116,7 @@ private:
|
|||||||
void GetPCMImportPlugin(ImportPluginList & importPluginList,
|
void GetPCMImportPlugin(ImportPluginList & importPluginList,
|
||||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new PCMImportPlugin );
|
importPluginList.push_back( make_movable<PCMImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString PCMImportPlugin::GetPluginFormatDescription()
|
wxString PCMImportPlugin::GetPluginFormatDescription()
|
||||||
|
@ -30,10 +30,10 @@ static const wxChar *exts[] =
|
|||||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &unusableImportPluginList)
|
UnusableImportPluginList &unusableImportPluginList)
|
||||||
{
|
{
|
||||||
UnusableImportPlugin* qtIsUnsupported =
|
unusableImportPluginList.push_back(
|
||||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
make_movable<UnusableImportPlugin>
|
||||||
|
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||||
unusableImportPluginList.push_back( qtIsUnsupported );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* USE_QUICKTIME */
|
#else /* USE_QUICKTIME */
|
||||||
@ -165,7 +165,7 @@ class QTImportFileHandle final : public ImportFileHandle
|
|||||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||||
UnusableImportPluginList &unusableImportPluginList)
|
UnusableImportPluginList &unusableImportPluginList)
|
||||||
{
|
{
|
||||||
importPluginList.push_back( new QTImportPlugin );
|
importPluginList.push_back( make_movable<QTImportPlugin>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString QTImportPlugin::GetPluginFormatDescription()
|
wxString QTImportPlugin::GetPluginFormatDescription()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user