mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-24 16:20:05 +02:00
NEW SOURCE FILE: Remove naked news and deletes in directory import
New source file is only a header however.
This commit is contained in:
commit
9c0ac0aaa4
@ -1213,6 +1213,7 @@
|
||||
5E74D2E31CC4429700D88B0B /* EditCursorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DD1CC4429700D88B0B /* EditCursorOverlay.cpp */; };
|
||||
5E74D2E41CC4429700D88B0B /* PlayIndicatorOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2DF1CC4429700D88B0B /* PlayIndicatorOverlay.cpp */; };
|
||||
5E74D2E51CC4429700D88B0B /* Scrubbing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E74D2E11CC4429700D88B0B /* Scrubbing.cpp */; };
|
||||
5E79B3411D5CC38D001D677D /* ImportGStreamer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E79B33F1D5CC38D001D677D /* ImportGStreamer.cpp */; };
|
||||
5E94A1BA1D1F1C8400A8713A /* wxPanelWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E94A1B81D1F1C8400A8713A /* wxPanelWrapper.cpp */; };
|
||||
5ED1D0AD1CDE55BD00471E3C /* Overlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */; };
|
||||
5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; };
|
||||
@ -2990,8 +2991,11 @@
|
||||
5E74D2E01CC4429700D88B0B /* PlayIndicatorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayIndicatorOverlay.h; sourceTree = "<group>"; };
|
||||
5E74D2E11CC4429700D88B0B /* Scrubbing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scrubbing.cpp; sourceTree = "<group>"; };
|
||||
5E74D2E21CC4429700D88B0B /* Scrubbing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scrubbing.h; sourceTree = "<group>"; };
|
||||
5E79B33F1D5CC38D001D677D /* ImportGStreamer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImportGStreamer.cpp; sourceTree = "<group>"; };
|
||||
5E79B3401D5CC38D001D677D /* ImportGStreamer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImportGStreamer.h; sourceTree = "<group>"; };
|
||||
5E94A1B81D1F1C8400A8713A /* wxPanelWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wxPanelWrapper.cpp; sourceTree = "<group>"; };
|
||||
5E94A1B91D1F1C8400A8713A /* wxPanelWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wxPanelWrapper.h; sourceTree = "<group>"; };
|
||||
5EB9EA281D5B81270050AF40 /* ImportForwards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImportForwards.h; sourceTree = "<group>"; };
|
||||
5ED18DB61CC16B1E00FAFE95 /* Reverb_libSoX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reverb_libSoX.h; sourceTree = "<group>"; };
|
||||
5ED18DB71CC290AB00FAFE95 /* wxFileNameWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wxFileNameWrapper.h; sourceTree = "<group>"; };
|
||||
5ED1D0A91CDE55BD00471E3C /* Overlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Overlay.cpp; sourceTree = "<group>"; };
|
||||
@ -4216,16 +4220,15 @@
|
||||
children = (
|
||||
28F67173197DFA1C00075C32 /* FormatClassifier.cpp */,
|
||||
28F67174197DFA1C00075C32 /* FormatClassifier.h */,
|
||||
28F67175197DFA1C00075C32 /* MultiFormatReader.cpp */,
|
||||
28F67176197DFA1C00075C32 /* MultiFormatReader.h */,
|
||||
28F67177197DFA1C00075C32 /* SpecPowerMeter.cpp */,
|
||||
28F67178197DFA1C00075C32 /* SpecPowerMeter.h */,
|
||||
1790B07F09883BFD008A330A /* Import.cpp */,
|
||||
1790B08009883BFD008A330A /* Import.h */,
|
||||
283135EA0DFB9D110076D551 /* ImportFFmpeg.cpp */,
|
||||
283135EB0DFB9D110076D551 /* ImportFFmpeg.h */,
|
||||
1790B08109883BFD008A330A /* ImportFLAC.cpp */,
|
||||
1790B08209883BFD008A330A /* ImportFLAC.h */,
|
||||
5EB9EA281D5B81270050AF40 /* ImportForwards.h */,
|
||||
5E79B33F1D5CC38D001D677D /* ImportGStreamer.cpp */,
|
||||
5E79B3401D5CC38D001D677D /* ImportGStreamer.h */,
|
||||
1790B08309883BFD008A330A /* ImportLOF.cpp */,
|
||||
1790B08409883BFD008A330A /* ImportLOF.h */,
|
||||
1790B08509883BFD008A330A /* ImportMIDI.cpp */,
|
||||
@ -4241,8 +4244,12 @@
|
||||
2801A6440BF9268700648258 /* ImportQT.h */,
|
||||
1790B08E09883BFD008A330A /* ImportRaw.cpp */,
|
||||
1790B08F09883BFD008A330A /* ImportRaw.h */,
|
||||
28F67175197DFA1C00075C32 /* MultiFormatReader.cpp */,
|
||||
28F67176197DFA1C00075C32 /* MultiFormatReader.h */,
|
||||
1790B09009883BFD008A330A /* RawAudioGuess.cpp */,
|
||||
1790B09109883BFD008A330A /* RawAudioGuess.h */,
|
||||
28F67177197DFA1C00075C32 /* SpecPowerMeter.cpp */,
|
||||
28F67178197DFA1C00075C32 /* SpecPowerMeter.h */,
|
||||
);
|
||||
path = import;
|
||||
sourceTree = "<group>";
|
||||
@ -7378,6 +7385,7 @@
|
||||
1790B16309883BFD008A330A /* FreqWindow.cpp in Sources */,
|
||||
1790B16509883BFD008A330A /* HistoryWindow.cpp in Sources */,
|
||||
1790B16609883BFD008A330A /* ImageManipulation.cpp in Sources */,
|
||||
5E79B3411D5CC38D001D677D /* ImportGStreamer.cpp in Sources */,
|
||||
1790B16709883BFD008A330A /* Import.cpp in Sources */,
|
||||
1790B16809883BFD008A330A /* ImportFLAC.cpp in Sources */,
|
||||
1790B16909883BFD008A330A /* ImportLOF.cpp in Sources */,
|
||||
|
@ -418,6 +418,7 @@ audacity_SOURCES = \
|
||||
import/Import.h \
|
||||
import/ImportFLAC.cpp \
|
||||
import/ImportFLAC.h \
|
||||
import/ImportForwards.h \
|
||||
import/ImportLOF.cpp \
|
||||
import/ImportLOF.h \
|
||||
import/ImportMP3.cpp \
|
||||
|
@ -17,6 +17,8 @@ the low-pass-like spectral behaviour of natural audio signals
|
||||
for classification of the sample format and the used endianness.
|
||||
|
||||
*//*******************************************************************/
|
||||
#include "FormatClassifier.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
@ -29,8 +31,6 @@ for classification of the sample format and the used endianness.
|
||||
#include "SpecPowerMeter.h"
|
||||
#include "sndfile.h"
|
||||
|
||||
#include "FormatClassifier.h"
|
||||
|
||||
FormatClassifier::FormatClassifier(const char* filename) :
|
||||
mReader(filename),
|
||||
mMeter(cSiglen)
|
||||
|
@ -11,6 +11,13 @@
|
||||
#ifndef __AUDACITY_FORMATCLASSIFIER_H_
|
||||
#define __AUDACITY_FORMATCLASSIFIER_H_
|
||||
|
||||
#include <vector>
|
||||
#include "../SampleFormat.h"
|
||||
#include "MultiFormatReader.h"
|
||||
#include "SpecPowerMeter.h"
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#ifndef SNDFILE_1
|
||||
#error Requires libsndfile 1.0.3 or higher
|
||||
#endif
|
||||
|
@ -37,6 +37,8 @@ and ImportLOF.cpp.
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "Import.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
#include <wx/textctrl.h>
|
||||
@ -61,10 +63,6 @@ and ImportLOF.cpp.
|
||||
#include "ImportGStreamer.h"
|
||||
#include "../Prefs.h"
|
||||
|
||||
WX_DEFINE_LIST(ImportPluginList);
|
||||
WX_DEFINE_LIST(UnusableImportPluginList);
|
||||
WX_DEFINE_OBJARRAY(ExtImportItems);
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Return reference to singleton
|
||||
@ -79,23 +77,17 @@ Importer & Importer::Get()
|
||||
|
||||
Importer::Importer()
|
||||
{
|
||||
mExtImportItems = NULL;
|
||||
}
|
||||
|
||||
Importer::~Importer()
|
||||
{
|
||||
if (mExtImportItems != NULL)
|
||||
{
|
||||
delete mExtImportItems;
|
||||
mExtImportItems = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool Importer::Initialize()
|
||||
{
|
||||
mImportPluginList = new ImportPluginList;
|
||||
mUnusableImportPluginList = new UnusableImportPluginList;
|
||||
mExtImportItems = NULL;
|
||||
ImportPluginList{}.swap(mImportPluginList);
|
||||
UnusableImportPluginList{}.swap(mUnusableImportPluginList);
|
||||
ExtImportItems{}.swap(mExtImportItems);
|
||||
|
||||
// build the list of import plugin and/or unusableImporters.
|
||||
// order is significant. If none match, they will all be tried
|
||||
@ -124,20 +116,16 @@ bool Importer::Initialize()
|
||||
bool Importer::Terminate()
|
||||
{
|
||||
WriteImportItems();
|
||||
mImportPluginList->DeleteContents(true);
|
||||
delete mImportPluginList;
|
||||
mUnusableImportPluginList->DeleteContents(true);//JKC
|
||||
delete mUnusableImportPluginList;
|
||||
ImportPluginList{}.swap( mImportPluginList );
|
||||
UnusableImportPluginList{}.swap( mUnusableImportPluginList );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Importer::GetSupportedImportFormats(FormatList *formatList)
|
||||
{
|
||||
ImportPluginList::compatibility_iterator importPluginNode = mImportPluginList->GetFirst();
|
||||
while(importPluginNode)
|
||||
for(const auto &importPlugin : mImportPluginList)
|
||||
{
|
||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
||||
#ifdef __AUDACITY_OLD_STD__
|
||||
formatList->push_back(Format{importPlugin->GetPluginFormatDescription(),
|
||||
importPlugin->GetSupportedExtensions()});
|
||||
@ -145,7 +133,6 @@ void Importer::GetSupportedImportFormats(FormatList *formatList)
|
||||
formatList->emplace_back(importPlugin->GetPluginFormatDescription(),
|
||||
importPlugin->GetSupportedExtensions());
|
||||
#endif
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,13 +150,8 @@ void Importer::ReadImportItems()
|
||||
wxStringTokenizer toker;
|
||||
wxString item_name;
|
||||
wxString item_value;
|
||||
ExtImportItem *new_item;
|
||||
ImportPluginList::compatibility_iterator importPluginNode;
|
||||
|
||||
if (this->mExtImportItems != NULL)
|
||||
delete this->mExtImportItems;
|
||||
|
||||
this->mExtImportItems = new ExtImportItems();
|
||||
ExtImportItems{}.swap(mExtImportItems);
|
||||
/* Rule string format is:
|
||||
* extension1:extension2:extension3\mime_type1:mime_type2:mime_type3|filter1:filter2:filter3\unusedfilter1:unusedfilter2
|
||||
* backslashes are escaped and unescaped internally
|
||||
@ -187,7 +169,7 @@ void Importer::ReadImportItems()
|
||||
if (toker.CountTokens() != 2)
|
||||
break;
|
||||
|
||||
new_item = new ExtImportItem();
|
||||
auto new_item = make_movable<ExtImportItem>();
|
||||
|
||||
/* First token is the filtering condition, second - the filter list */
|
||||
condition = toker.GetNextToken();
|
||||
@ -228,29 +210,27 @@ void Importer::ReadImportItems()
|
||||
/* Find corresponding filter object for each filter ID */
|
||||
for (size_t i = 0; i < new_item->filters.Count(); i++)
|
||||
{
|
||||
for (importPluginNode = mImportPluginList->GetFirst();
|
||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
||||
bool found = false;
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
{
|
||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
||||
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;
|
||||
}
|
||||
}
|
||||
/* IDs that do not have corresponding filters, will be shown as-is */
|
||||
if (!importPluginNode)
|
||||
if (!found)
|
||||
new_item->filter_objects.Add (NULL);
|
||||
}
|
||||
/* Find all filter objects that are not present in the filter list */
|
||||
for (importPluginNode = mImportPluginList->GetFirst();
|
||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
{
|
||||
bool found = false;
|
||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
||||
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;
|
||||
break;
|
||||
@ -263,12 +243,12 @@ void Importer::ReadImportItems()
|
||||
if (new_item->divider < 0)
|
||||
index = new_item->filters.Count();
|
||||
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)
|
||||
new_item->divider++;
|
||||
}
|
||||
}
|
||||
this->mExtImportItems->Add (new_item);
|
||||
this->mExtImportItems.push_back( std::move(new_item) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,9 +256,9 @@ void Importer::WriteImportItems()
|
||||
{
|
||||
size_t i;
|
||||
wxString val, name;
|
||||
for (i = 0; i < this->mExtImportItems->Count(); i++)
|
||||
for (i = 0; i < this->mExtImportItems.size(); i++)
|
||||
{
|
||||
ExtImportItem *item = &(mExtImportItems->Item(i));
|
||||
ExtImportItem *item = mExtImportItems[i].get();
|
||||
val.Clear();
|
||||
|
||||
for (size_t j = 0; j < item->extensions.Count(); j++)
|
||||
@ -318,7 +298,7 @@ void Importer::WriteImportItems()
|
||||
/* If we used to have more items than we have now, DELETE the excess items.
|
||||
We just keep deleting items and incrementing until we find there aren't any
|
||||
more to DELETE.*/
|
||||
i = this->mExtImportItems->Count();
|
||||
i = this->mExtImportItems.size();
|
||||
do {
|
||||
name.Printf (wxT("/ExtImportItems/Item%d"), (int)i);
|
||||
// No item to DELETE? Then it's time to finish.
|
||||
@ -333,21 +313,16 @@ void Importer::WriteImportItems()
|
||||
} while( true );
|
||||
}
|
||||
|
||||
ExtImportItem *Importer::CreateDefaultImportItem()
|
||||
movable_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
||||
{
|
||||
ExtImportItem *new_item;
|
||||
ImportPluginList::compatibility_iterator importPluginNode;
|
||||
|
||||
new_item = new ExtImportItem();
|
||||
auto new_item = make_movable<ExtImportItem>();
|
||||
new_item->extensions.Add(wxT("*"));
|
||||
new_item->mime_types.Add(wxT("*"));
|
||||
|
||||
for (importPluginNode = mImportPluginList->GetFirst();
|
||||
importPluginNode; importPluginNode = importPluginNode->GetNext())
|
||||
for (const auto &importPlugin : mImportPluginList)
|
||||
{
|
||||
ImportPlugin *importPlugin = importPluginNode->GetData();
|
||||
new_item->filters.Add (importPlugin->GetPluginStringID());
|
||||
new_item->filter_objects.Add (importPlugin);
|
||||
new_item->filter_objects.Add (importPlugin.get());
|
||||
}
|
||||
new_item->divider = -1;
|
||||
return new_item;
|
||||
@ -365,12 +340,13 @@ bool Importer::Import(const wxString &fName,
|
||||
|
||||
wxString extension = fName.AfterLast(wxT('.'));
|
||||
|
||||
using ImportPluginPtrs = std::vector< ImportPlugin* >;
|
||||
|
||||
// This list is used to call plugins in correct order
|
||||
ImportPluginList importPlugins;
|
||||
ImportPluginList::compatibility_iterator importPluginNode;
|
||||
ImportPluginPtrs importPlugins;
|
||||
|
||||
// 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,
|
||||
// then we should try importing via corresponding plugin first
|
||||
@ -388,26 +364,23 @@ bool Importer::Import(const wxString &fName,
|
||||
|
||||
if (usersSelectionOverrides)
|
||||
{
|
||||
importPluginNode = mImportPluginList->GetFirst();
|
||||
while (importPluginNode)
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
{
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||
{
|
||||
// This plugin corresponds to user-selected filter, try it first.
|
||||
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
|
||||
importPlugins.Insert(plugin);
|
||||
importPlugins.insert(importPlugins.begin(), plugin.get());
|
||||
}
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
wxLogMessage(wxT("File name is %s"),(const char *) fName.c_str());
|
||||
wxLogMessage(wxT("Mime type is %s"),(const char *) mime_type.Lower().c_str());
|
||||
|
||||
for (size_t i = 0; i < mExtImportItems->Count(); i++)
|
||||
for (const auto &uItem : mExtImportItems)
|
||||
{
|
||||
ExtImportItem *item = &(*mExtImportItems)[i];
|
||||
ExtImportItem *item = uItem.get();
|
||||
bool matches_ext = false, matches_mime = false;
|
||||
wxLogDebug(wxT("Testing extensions"));
|
||||
for (size_t j = 0; j < item->extensions.Count(); j++)
|
||||
@ -454,13 +427,12 @@ bool Importer::Import(const wxString &fName,
|
||||
if (!(item->filter_objects[j]))
|
||||
continue;
|
||||
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
|
||||
importPluginNode = mImportPluginList->GetFirst();
|
||||
|
||||
// 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.
|
||||
@ -468,14 +440,14 @@ bool Importer::Import(const wxString &fName,
|
||||
// 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
|
||||
// libsndfile is first.
|
||||
ImportPlugin *libsndfilePlugin = importPluginNode->GetData();
|
||||
ImportPlugin *libsndfilePlugin = mImportPluginList.begin()->get();
|
||||
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
|
||||
if (importPlugins.Find(plugin) == NULL)
|
||||
if (importPlugins.end() ==
|
||||
std::find(importPlugins.begin(), importPlugins.end(), plugin.get()))
|
||||
{
|
||||
if (plugin->SupportsExtension(extension))
|
||||
{
|
||||
@ -490,45 +462,40 @@ bool Importer::Import(const wxString &fName,
|
||||
if (plugin->GetPluginStringID().IsSameAs(wxT("libmad")))
|
||||
{
|
||||
// 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());
|
||||
importPlugins.Append(libsndfilePlugin);
|
||||
importPlugins.push_back(libsndfilePlugin);
|
||||
}
|
||||
}
|
||||
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.
|
||||
// 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
|
||||
// formats unsuitable for it, and produce distorted results.
|
||||
importPluginNode = mImportPluginList->GetFirst();
|
||||
while (importPluginNode)
|
||||
for (const auto &plugin : mImportPluginList)
|
||||
{
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
if (!(plugin->GetPluginStringID().IsSameAs(wxT("libmad"))))
|
||||
{
|
||||
// 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());
|
||||
importPlugins.Append(plugin);
|
||||
importPlugins.push_back(plugin.get());
|
||||
}
|
||||
}
|
||||
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
|
||||
importPluginNode = importPlugins.GetFirst();
|
||||
while(importPluginNode)
|
||||
// Try the import plugins, in the permuted sequences just determined
|
||||
for (const auto plugin : importPlugins)
|
||||
{
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
// Try to open the file with this plugin (probe it)
|
||||
wxLogMessage(wxT("Opening with %s"),plugin->GetPluginStringID().c_str());
|
||||
auto inFile = plugin->Open(fName);
|
||||
@ -582,18 +549,14 @@ bool Importer::Import(const wxString &fName,
|
||||
// that may recognize the extension, so we allow the loop to
|
||||
// continue.
|
||||
}
|
||||
importPluginNode = importPluginNode->GetNext();
|
||||
}
|
||||
wxLogError(wxT("Importer::Import: Opening failed."));
|
||||
|
||||
// None of our plugins can handle this file. It might be that
|
||||
// Audacity supports this format, but support was not compiled in.
|
||||
// If so, notify the user of this fact
|
||||
UnusableImportPluginList::compatibility_iterator unusableImporterNode
|
||||
= mUnusableImportPluginList->GetFirst();
|
||||
while(unusableImporterNode)
|
||||
for (const auto &unusableImportPlugin : mUnusableImportPluginList)
|
||||
{
|
||||
UnusableImportPlugin *unusableImportPlugin = unusableImporterNode->GetData();
|
||||
if( unusableImportPlugin->SupportsExtension(extension) )
|
||||
{
|
||||
errorMessage.Printf(_("This version of Audacity was not compiled with %s support."),
|
||||
@ -602,7 +565,6 @@ bool Importer::Import(const wxString &fName,
|
||||
pProj->mbBusyImporting = false;
|
||||
return false;
|
||||
}
|
||||
unusableImporterNode = unusableImporterNode->GetNext();
|
||||
}
|
||||
|
||||
/* warnings for unsupported data types */
|
||||
@ -616,7 +578,7 @@ bool Importer::Import(const wxString &fName,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (compatiblePlugins.GetCount() <= 0)
|
||||
if (compatiblePlugins.empty())
|
||||
{
|
||||
// if someone has sent us a .cda file, send them away
|
||||
if (extension.IsSameAs(wxT("cda"), false)) {
|
||||
@ -714,15 +676,12 @@ bool Importer::Import(const wxString &fName,
|
||||
// We DO have a plugin for this file, but import failed.
|
||||
wxString pluglist = wxEmptyString;
|
||||
|
||||
importPluginNode = compatiblePlugins.GetFirst();
|
||||
while(importPluginNode)
|
||||
for (const auto &plugin : compatiblePlugins)
|
||||
{
|
||||
ImportPlugin *plugin = importPluginNode->GetData();
|
||||
if (pluglist == wxEmptyString)
|
||||
pluglist = plugin->GetPluginFormatDescription();
|
||||
else
|
||||
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());
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define _IMPORT_
|
||||
|
||||
#include "ImportRaw.h" // defines TrackHolders
|
||||
#include "ImportForwards.h"
|
||||
#include <vector>
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/string.h>
|
||||
@ -44,7 +45,7 @@ class ExtImportItem;
|
||||
|
||||
using FormatList = std::vector<Format> ;
|
||||
WX_DEFINE_ARRAY_PTR(ImportPlugin *, ImportPluginPtrArray);
|
||||
WX_DECLARE_OBJARRAY(ExtImportItem, ExtImportItems);
|
||||
using ExtImportItems = std::vector< movable_ptr<ExtImportItem> >;
|
||||
|
||||
class ExtImportItem
|
||||
{
|
||||
@ -85,9 +86,6 @@ class ExtImportItem
|
||||
wxArrayString mime_types;
|
||||
};
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
|
||||
class Importer {
|
||||
public:
|
||||
Importer();
|
||||
@ -131,13 +129,13 @@ public:
|
||||
* Returns a pointer to internal items array.
|
||||
* External objects are allowed to change the array contents.
|
||||
*/
|
||||
ExtImportItems *GetImportItems() { return mExtImportItems; };
|
||||
ExtImportItems &GetImportItems() { return mExtImportItems; };
|
||||
|
||||
/**
|
||||
* Allocates NEW ExtImportItem, fills it with default data
|
||||
* and returns a pointer to it.
|
||||
*/
|
||||
ExtImportItem *CreateDefaultImportItem();
|
||||
movable_ptr<ExtImportItem> CreateDefaultImportItem();
|
||||
|
||||
// if false, the import failed and errorMessage will be set.
|
||||
bool Import(const wxString &fName,
|
||||
@ -149,9 +147,9 @@ public:
|
||||
private:
|
||||
static Importer mInstance;
|
||||
|
||||
ExtImportItems *mExtImportItems;
|
||||
ImportPluginList *mImportPluginList;
|
||||
UnusableImportPluginList *mUnusableImportPluginList;
|
||||
ExtImportItems mExtImportItems;
|
||||
ImportPluginList mImportPluginList;
|
||||
UnusableImportPluginList mUnusableImportPluginList;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -20,10 +20,12 @@ Licensed under the GNU General Public License v2 or later
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h" // needed before FFmpeg.h
|
||||
#include "ImportFFmpeg.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#include "../Audacity.h" // needed before FFmpeg.h
|
||||
#include "../FFmpeg.h" // which brings in avcodec.h, avformat.h
|
||||
#include "../ondemand/ODManager.h"
|
||||
#ifndef WX_PRECOMP
|
||||
@ -151,7 +153,6 @@ static const wxChar *exts[] =
|
||||
|
||||
// all the includes live here by default
|
||||
#include "Import.h"
|
||||
#include "ImportFFmpeg.h"
|
||||
#include "../Tags.h"
|
||||
#include "../Internat.h"
|
||||
#include "../WaveTrack.h"
|
||||
@ -282,10 +283,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
void GetFFmpegImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *WXUNUSED(unusableImportPluginList))
|
||||
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new FFmpegImportPlugin);
|
||||
importPluginList.push_back( make_movable<FFmpegImportPlugin>() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,12 +11,9 @@ LRN
|
||||
#ifndef __AUDACITY_IMPORT_FFMPEG__
|
||||
#define __AUDACITY_IMPORT_FFMPEG__
|
||||
|
||||
#include "ImportPlugin.h"
|
||||
#include "ImportForwards.h"
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
|
||||
void GetFFmpegImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportFLAC.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
@ -33,7 +36,6 @@
|
||||
#include <wx/defs.h>
|
||||
#include <wx/intl.h> // needed for _("translated stings") even if we
|
||||
// don't have libflac available
|
||||
#include "../Audacity.h"
|
||||
|
||||
#include "Import.h"
|
||||
#include "ImportPlugin.h"
|
||||
@ -54,19 +56,18 @@ static const wxChar *exts[] =
|
||||
|
||||
#ifndef USE_LIBFLAC
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList)
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
UnusableImportPlugin* flacIsUnsupported =
|
||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||
|
||||
unusableImportPluginList->Append(flacIsUnsupported);
|
||||
unusableImportPluginList.push_back(
|
||||
make_movable<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||
);
|
||||
}
|
||||
|
||||
#else /* USE_LIBFLAC */
|
||||
|
||||
#include "../Internat.h"
|
||||
#include "ImportFLAC.h"
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/utils.h>
|
||||
@ -281,10 +282,10 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
|
||||
}
|
||||
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *WXUNUSED(unusableImportPluginList))
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new FLACImportPlugin);
|
||||
importPluginList.push_back( make_movable<FLACImportPlugin>() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,11 +11,10 @@
|
||||
#ifndef __AUDACITY_IMPORT_FLAC__
|
||||
#define __AUDACITY_IMPORT_FLAC__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetFLACImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetFLACImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
|
||||
#endif
|
||||
|
23
src/import/ImportForwards.h
Normal file
23
src/import/ImportForwards.h
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// ImportForwards.h
|
||||
// Audacity
|
||||
//
|
||||
// Created by Paul Licameli on 8/10/16.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __AUDACITY_IMPORT_FORWARDS__
|
||||
#define __AUDACITY_IMPORT_FORWARDS__
|
||||
|
||||
#include <vector>
|
||||
#include "../MemoryX.h"
|
||||
|
||||
class ImportPlugin;
|
||||
class UnusableImportPlugin;
|
||||
|
||||
using ImportPluginList =
|
||||
std::vector< movable_ptr<ImportPlugin> >;
|
||||
using UnusableImportPluginList =
|
||||
std::vector< movable_ptr<UnusableImportPlugin> >;
|
||||
|
||||
#endif
|
@ -261,8 +261,8 @@ public:
|
||||
// ----------------------------------------------------------------------------
|
||||
// Instantiate GStreamerImportPlugin and add to the list of known importers
|
||||
void
|
||||
GetGStreamerImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList * WXUNUSED(unusableImportPluginList))
|
||||
GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
wxLogMessage(wxT("Audacity is built against GStreamer version %d.%d.%d-%d"),
|
||||
GST_VERSION_MAJOR,
|
||||
@ -300,7 +300,7 @@ GetGStreamerImportPlugin(ImportPluginList *importPluginList,
|
||||
return;
|
||||
|
||||
// Add to list of importers
|
||||
importPluginList->push_back(std::move(plug));
|
||||
importPluginList.push_back( std::move(plug) );
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -13,7 +13,7 @@ LRN
|
||||
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
void GetGStreamerImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetGStreamerImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -175,10 +175,10 @@ LOFImportFileHandle::LOFImportFileHandle
|
||||
scrollOffset = 0;
|
||||
}
|
||||
|
||||
void GetLOFImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList * WXUNUSED(unusableImportPluginList))
|
||||
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new LOFImportPlugin);
|
||||
importPluginList.push_back( make_movable<LOFImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString LOFImportPlugin::GetPluginFormatDescription()
|
||||
|
@ -54,10 +54,9 @@
|
||||
#ifndef __AUDACITY_IMPORT_LOF__
|
||||
#define __AUDACITY_IMPORT_LOF__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetLOFImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetLOFImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportMIDI.h"
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include "../Audacity.h"
|
||||
|
||||
#if defined(USE_MIDI)
|
||||
|
||||
//#include "allegro.h"
|
||||
@ -23,7 +24,6 @@
|
||||
|
||||
#include "../Internat.h"
|
||||
#include "../NoteTrack.h"
|
||||
#include "ImportMIDI.h"
|
||||
|
||||
bool ImportMIDI(const wxString &fName, NoteTrack * dest)
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ into a NoteTrack.
|
||||
|
||||
#if defined(USE_MIDI)
|
||||
|
||||
class wxString;
|
||||
class NoteTrack;
|
||||
|
||||
bool ImportMIDI(const wxString &fName, NoteTrack * dest);
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportMP3.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
@ -35,11 +38,9 @@
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/intl.h>
|
||||
#include "../Audacity.h"
|
||||
|
||||
#include "../Prefs.h"
|
||||
#include "Import.h"
|
||||
#include "ImportMP3.h"
|
||||
#include "ImportPlugin.h"
|
||||
#include "../Internat.h"
|
||||
#include "../Tags.h"
|
||||
@ -55,13 +56,13 @@ static const wxChar *exts[] =
|
||||
|
||||
#ifndef USE_LIBMAD
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList)
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
UnusableImportPlugin* mp3IsUnsupported =
|
||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||
|
||||
unusableImportPluginList->Append(mp3IsUnsupported);
|
||||
unusableImportPluginList.push_back(
|
||||
make_movable<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
);
|
||||
}
|
||||
|
||||
#else /* USE_LIBMAD */
|
||||
@ -152,10 +153,10 @@ private:
|
||||
mad_decoder mDecoder;
|
||||
};
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList * WXUNUSED(unusableImportPluginList))
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new MP3ImportPlugin);
|
||||
importPluginList.push_back( make_movable<MP3ImportPlugin>() );
|
||||
}
|
||||
|
||||
/* The MAD callbacks */
|
||||
|
@ -11,10 +11,9 @@
|
||||
#ifndef __AUDACITY_IMPORT_MP3__
|
||||
#define __AUDACITY_IMPORT_MP3__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetMP3ImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportOGG.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
@ -36,12 +39,10 @@
|
||||
#endif
|
||||
|
||||
#include <wx/intl.h>
|
||||
#include "../Audacity.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Internat.h"
|
||||
#include "../Tags.h"
|
||||
|
||||
#include "ImportOGG.h"
|
||||
|
||||
#define DESC _("Ogg Vorbis files")
|
||||
|
||||
@ -54,13 +55,13 @@ static const wxChar *exts[] =
|
||||
/* BPF There is no real reason to compile without LIBVORBIS, but if you do, you will needs this header */
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList)
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
UnusableImportPlugin* oggIsUnsupported =
|
||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||
|
||||
unusableImportPluginList->Append(oggIsUnsupported);
|
||||
unusableImportPluginList.push_back(
|
||||
make_movable<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
);
|
||||
}
|
||||
|
||||
#else /* USE_LIBVORBIS */
|
||||
@ -159,10 +160,10 @@ private:
|
||||
sampleFormat mFormat;
|
||||
};
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList * WXUNUSED(unusableImportPluginList))
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new OggImportPlugin);
|
||||
importPluginList.push_back( make_movable<OggImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString OggImportPlugin::GetPluginFormatDescription()
|
||||
|
@ -11,10 +11,9 @@
|
||||
#ifndef __AUDACITY_IMPORT_OGG__
|
||||
#define __AUDACITY_IMPORT_OGG__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetOGGImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetOGGImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -20,10 +20,10 @@
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportPCM.h"
|
||||
#include "../AudacityApp.h"
|
||||
#include "../Internat.h"
|
||||
#include "../Tags.h"
|
||||
#include "ImportPCM.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/string.h>
|
||||
@ -113,10 +113,10 @@ private:
|
||||
sampleFormat mFormat;
|
||||
};
|
||||
|
||||
void GetPCMImportPlugin(ImportPluginList * importPluginList,
|
||||
UnusableImportPluginList * WXUNUSED(unusableImportPluginList))
|
||||
void GetPCMImportPlugin(ImportPluginList & importPluginList,
|
||||
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
|
||||
{
|
||||
importPluginList->Append(new PCMImportPlugin);
|
||||
importPluginList.push_back( make_movable<PCMImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString PCMImportPlugin::GetPluginFormatDescription()
|
||||
|
@ -11,11 +11,10 @@
|
||||
#ifndef __AUDACITY_IMPORT_PCM__
|
||||
#define __AUDACITY_IMPORT_PCM__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetPCMImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetPCMImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,6 @@ but little else.
|
||||
#include <wx/arrstr.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/list.h>
|
||||
#include "../MemoryX.h"
|
||||
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
@ -197,7 +196,4 @@ private:
|
||||
wxArrayString mExtensions;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(ImportPlugin, ImportPluginList);
|
||||
WX_DECLARE_LIST(UnusableImportPlugin, UnusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@
|
||||
**********************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "ImportQT.h"
|
||||
#include "ImportPlugin.h"
|
||||
|
||||
#define DESC _("QuickTime files")
|
||||
@ -26,13 +27,13 @@ static const wxChar *exts[] =
|
||||
|
||||
#ifndef USE_QUICKTIME
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList)
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
UnusableImportPlugin* qtIsUnsupported =
|
||||
new UnusableImportPlugin(DESC, wxArrayString(WXSIZEOF(exts), exts));
|
||||
|
||||
unusableImportPluginList->Append(qtIsUnsupported);
|
||||
unusableImportPluginList.push_back(
|
||||
make_movable<UnusableImportPlugin>
|
||||
(DESC, wxArrayString(WXSIZEOF(exts), exts))
|
||||
);
|
||||
}
|
||||
|
||||
#else /* USE_QUICKTIME */
|
||||
@ -66,7 +67,6 @@ void GetQTImportPlugin(ImportPluginList *importPluginList,
|
||||
#include "../Internat.h"
|
||||
#include "../Tags.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "ImportQT.h"
|
||||
|
||||
#define kQTAudioPropertyID_MaxAudioSampleSize 'mssz'
|
||||
|
||||
@ -162,10 +162,10 @@ class QTImportFileHandle final : public ImportFileHandle
|
||||
Movie mMovie;
|
||||
};
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList)
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList)
|
||||
{
|
||||
importPluginList->Append(new QTImportPlugin);
|
||||
importPluginList.push_back( make_movable<QTImportPlugin>() );
|
||||
}
|
||||
|
||||
wxString QTImportPlugin::GetPluginFormatDescription()
|
||||
|
@ -11,10 +11,9 @@
|
||||
#ifndef __AUDACITY_IMPORT_QT__
|
||||
#define __AUDACITY_IMPORT_QT__
|
||||
|
||||
class ImportPluginList;
|
||||
class UnusableImportPluginList;
|
||||
#include "ImportForwards.h"
|
||||
|
||||
void GetQTImportPlugin(ImportPluginList *importPluginList,
|
||||
UnusableImportPluginList *unusableImportPluginList);
|
||||
void GetQTImportPlugin(ImportPluginList &importPluginList,
|
||||
UnusableImportPluginList &unusableImportPluginList);
|
||||
|
||||
#endif
|
||||
|
@ -22,8 +22,8 @@ and sample size to help you importing data of an unknown format.
|
||||
|
||||
|
||||
#include "../Audacity.h"
|
||||
|
||||
#include "ImportRaw.h"
|
||||
|
||||
#include "Import.h"
|
||||
|
||||
#include "../DirManager.h"
|
||||
|
@ -14,6 +14,8 @@ machine endianness representations.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "MultiFormatReader.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
@ -22,7 +24,18 @@ machine endianness representations.
|
||||
|
||||
#include <wx/defs.h>
|
||||
|
||||
#include "MultiFormatReader.h"
|
||||
MachineEndianness::MachineEndianness()
|
||||
{
|
||||
if (wxBYTE_ORDER == wxLITTLE_ENDIAN)
|
||||
{
|
||||
mFlag = MachineEndianness::Little;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFlag = MachineEndianness::Big;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MultiFormatReader::MultiFormatReader(const char* filename)
|
||||
: mpFid(NULL)
|
||||
|
@ -11,6 +11,9 @@
|
||||
#ifndef __AUDACITY_MULTIFORMATREADER_H__
|
||||
#define __AUDACITY_MULTIFORMATREADER_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class MachineEndianness
|
||||
{
|
||||
public:
|
||||
@ -20,17 +23,7 @@ public:
|
||||
Big
|
||||
} EndiannessT;
|
||||
|
||||
MachineEndianness()
|
||||
{
|
||||
if (wxBYTE_ORDER == wxLITTLE_ENDIAN)
|
||||
{
|
||||
mFlag = MachineEndianness::Little;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFlag = MachineEndianness::Big;
|
||||
}
|
||||
}
|
||||
MachineEndianness();
|
||||
~MachineEndianness()
|
||||
{}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "RawAudioGuess.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -22,7 +24,6 @@
|
||||
#include <wx/ffile.h>
|
||||
|
||||
#include "../Internat.h"
|
||||
#include "RawAudioGuess.h"
|
||||
|
||||
#define RAW_GUESS_DEBUG 0
|
||||
|
||||
|
@ -16,12 +16,13 @@ measurements in subbands or in the entire signal band.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "SpecPowerMeter.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <wx/defs.h>
|
||||
|
||||
#include "../FFT.h"
|
||||
#include "SpecPowerMeter.h"
|
||||
|
||||
SpecPowerMeter::SpecPowerMeter(int sigLen)
|
||||
{
|
||||
|
@ -146,10 +146,13 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
|
||||
PluginList->SetColumnWidth (0, wxLIST_AUTOSIZE_USEHEADER);
|
||||
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
for (unsigned int i = 0; i < items->Count(); i++)
|
||||
AddItemToTable (i, &(*items)[i]);
|
||||
if (items->Count() > 0)
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
{
|
||||
int i = -1;
|
||||
for (const auto &item : items)
|
||||
AddItemToTable (++i, item.get());
|
||||
}
|
||||
if (!items.empty())
|
||||
{
|
||||
RuleTable->SelectRow(0);
|
||||
RuleTable->SetGridCursor(0,0);
|
||||
@ -212,8 +215,8 @@ void ExtImportPrefs::SwapPluginRows (int row1, int row2)
|
||||
long d, d2;
|
||||
ImportPlugin *ip1, *ip2;
|
||||
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = &(*items)[last_selected];
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = items[last_selected].get();
|
||||
|
||||
t = PluginList->GetItemText (row1);
|
||||
d = PluginList->GetItemData (row1);
|
||||
@ -261,8 +264,8 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
||||
if (last_selected == -1)
|
||||
return false;
|
||||
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = &(*items)[last_selected];
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = items[last_selected].get();
|
||||
|
||||
if (code == WXK_UP && itemIndex == 0)
|
||||
return false;
|
||||
@ -298,7 +301,6 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
||||
void ExtImportPrefs::SwapRows (int row1, int row2)
|
||||
{
|
||||
int t;
|
||||
ExtImportItem *t1, *t2;
|
||||
wxString ts;
|
||||
if (row1 == row2)
|
||||
return;
|
||||
@ -308,11 +310,12 @@ void ExtImportPrefs::SwapRows (int row1, int row2)
|
||||
row1 = row2;
|
||||
row2 = t;
|
||||
}
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
t1 = items->Detach(row1);
|
||||
t2 = items->Detach(row1);
|
||||
items->Insert (t1, row1);
|
||||
items->Insert (t2, row1);
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
|
||||
auto &t1 = items[row1];
|
||||
auto &t2 = items[row2];
|
||||
std::swap(t1, t2);
|
||||
|
||||
for (int i = 0; i < RuleTable->GetNumberCols(); i++)
|
||||
{
|
||||
ts = RuleTable->GetCellValue (row2, i);
|
||||
@ -411,14 +414,14 @@ void ExtImportPrefs::OnRuleTableSelectRange (wxGridRangeSelectEvent& event)
|
||||
|
||||
void ExtImportPrefs::DoOnRuleTableSelect (int toprow)
|
||||
{
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
|
||||
if (toprow < 0 || toprow > (int)items->GetCount())
|
||||
if (toprow < 0 || toprow > (int)items.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExtImportItem *item = &(*items)[toprow];
|
||||
ExtImportItem *item = items[toprow].get();
|
||||
PluginList->DeleteAllItems();
|
||||
|
||||
int fcount;
|
||||
@ -463,8 +466,8 @@ void ExtImportPrefs::OnRuleTableEdit (wxGridEvent& event)
|
||||
{
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = &(*items)[row];
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = items[row].get();
|
||||
RuleTable->SaveEditControlValue();
|
||||
|
||||
wxString val = RuleTable->GetCellValue (row, col);
|
||||
@ -534,7 +537,7 @@ Audacity to trim spaces for you?"
|
||||
RuleTable->AutoSizeColumns ();
|
||||
}
|
||||
|
||||
void ExtImportPrefs::AddItemToTable (int index, ExtImportItem *item)
|
||||
void ExtImportPrefs::AddItemToTable (int index, const ExtImportItem *item)
|
||||
{
|
||||
wxString extensions, mime_types;
|
||||
if (item->extensions.Count() > 0)
|
||||
@ -566,11 +569,12 @@ void ExtImportPrefs::AddItemToTable (int index, ExtImportItem *item)
|
||||
|
||||
void ExtImportPrefs::OnAddRule(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
ExtImportItem *item = Importer::Get().CreateDefaultImportItem();
|
||||
items->Add (item);
|
||||
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
auto uitem = Importer::Get().CreateDefaultImportItem();
|
||||
auto item = uitem.get();
|
||||
items.push_back(std::move(uitem));
|
||||
AddItemToTable (RuleTable->GetNumberRows (), item);
|
||||
|
||||
RuleTable->SelectRow(RuleTable->GetNumberRows () - 1);
|
||||
RuleTable->SetGridCursor (RuleTable->GetNumberRows () - 1, 0);
|
||||
RuleTable->SetFocus();
|
||||
@ -580,7 +584,7 @@ void ExtImportPrefs::OnDelRule(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (last_selected < 0)
|
||||
return;
|
||||
ExtImportItems *items = Importer::Get().GetImportItems();
|
||||
auto &items = Importer::Get().GetImportItems();
|
||||
|
||||
int msgres = wxMessageBox (_("Do you really want to delete selected rule?"),
|
||||
_("Rule deletion confirmation"), wxYES_NO, RuleTable);
|
||||
@ -588,7 +592,7 @@ void ExtImportPrefs::OnDelRule(wxCommandEvent& WXUNUSED(event))
|
||||
return;
|
||||
|
||||
RuleTable->DeleteRows (last_selected);
|
||||
items->RemoveAt (last_selected);
|
||||
items.erase (items.begin() + last_selected);
|
||||
RuleTable->AutoSizeColumns ();
|
||||
if (last_selected >= RuleTable->GetNumberRows ())
|
||||
last_selected = RuleTable->GetNumberRows () - 1;
|
||||
|
@ -100,7 +100,7 @@ class ExtImportPrefs final : public PrefsPanel
|
||||
void DoOnRuleTableKeyDown (int keycode);
|
||||
bool DoOnPluginKeyDown (int code);
|
||||
void DoOnRuleTableSelect (int toprow);
|
||||
void AddItemToTable (int index, ExtImportItem *item);
|
||||
void AddItemToTable (int index, const ExtImportItem *item);
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui & S);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -432,6 +432,7 @@
|
||||
<ClInclude Include="..\..\..\src\effects\Phaser.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\VST\VSTControlMSW.h" />
|
||||
<ClInclude Include="..\..\..\src\import\FormatClassifier.h" />
|
||||
<ClInclude Include="..\..\..\src\import\ImportForwards.h" />
|
||||
<ClInclude Include="..\..\..\src\import\ImportGStreamer.h" />
|
||||
<ClInclude Include="..\..\..\src\import\MultiFormatReader.h" />
|
||||
<ClInclude Include="..\..\..\src\import\SpecPowerMeter.h" />
|
||||
|
@ -1795,6 +1795,9 @@
|
||||
<ClInclude Include="..\..\..\src\widgets\wxPanelWrapper.h">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\import\ImportForwards.h">
|
||||
<Filter>src\import</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\..\audacity.ico">
|
||||
|
Loading…
x
Reference in New Issue
Block a user