1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 22:21:11 +02:00

Import.cpp does not depend on subclasses of ImportPlugin...

... freeing 15 files from the big strongly connected component:

ImportFFmpeg & ODDecodeFFMpegTask (still in a cycle of two)
ImportFLAC
ImportGStreamer
ImportLOF
ImportMIDI
ImportMP3
ImportOGG
ImportPCM
ImportQT
ProjectFileManager
ProjectFSCK
ProjectManager
ProjectSelectionManager
ODDecodeFlacTask

And eight header files in src/import are deleted.

This breaks a lot of cycles because Import, which is still in the big component,
no longer includes ImportLOF, which recursively uses ProjectManager. A
registration system for the subclasses of ImportFileHandle allows that
recursion without the cyclic compilation dependencies.
This commit is contained in:
Paul Licameli
2019-06-06 17:43:34 -04:00
parent 3cf124d92a
commit e2cf1d93c2
25 changed files with 202 additions and 424 deletions

View File

@@ -27,7 +27,6 @@
*//*******************************************************************/
#include "../Audacity.h" // for USE_* macros
#include "ImportMP3.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
@@ -40,6 +39,7 @@
#include <wx/intl.h>
#include "../Prefs.h"
#include "Import.h"
#include "ImportPlugin.h"
#include "../Tags.h"
#include "../prefs/QualityPrefs.h"
@@ -55,14 +55,10 @@ static const auto exts = {
#ifndef USE_LIBMAD
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
unusableImportPluginList.push_back(
static Importer::RegisteredUnusableImportPlugin registered{
std::make_unique<UnusableImportPlugin>
(DESC, FileExtensions( exts.begin(), exts.end() ) )
);
}
};
#else /* USE_LIBMAD */
@@ -120,6 +116,8 @@ public:
wxString GetPluginStringID() override { return wxT("libmad"); }
wxString GetPluginFormatDescription() override;
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
unsigned SequenceNumber() const override;
};
class MP3ImportFileHandle final : public ImportFileHandle
@@ -157,12 +155,6 @@ private:
mad_decoder mDecoder;
};
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( std::make_unique<MP3ImportPlugin>() );
}
/* The MAD callbacks */
enum mad_flow input_cb(void *_data, struct mad_stream *stream);
enum mad_flow output_cb(void *_data,
@@ -263,6 +255,15 @@ ProgressResult MP3ImportFileHandle::Import(
return privateData.updateResult;
}
unsigned MP3ImportPlugin::SequenceNumber() const
{
return 40;
}
static Importer::RegisteredImportPlugin registered{
std::make_unique< MP3ImportPlugin >()
};
MP3ImportFileHandle::~MP3ImportFileHandle()
{
}