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

WaveClip does not depend on ondemand files besides ODTaskThread...

... Lifting the specification of factory function arguments for Sequence even
higher

This frees ODPCMAliasBlockFile from cycles
This commit is contained in:
Paul Licameli
2019-06-22 13:47:01 -04:00
parent 91a2ff2560
commit f1b04c79d8
7 changed files with 42 additions and 68 deletions

View File

@@ -28,6 +28,8 @@ Licensed under the GNU General Public License v2 or later
#include <wx/wxprec.h>
#include "../FFmpeg.h" // which brings in avcodec.h, avformat.h
#include "../WaveClip.h"
#include "../blockfile/ODDecodeBlockFile.h"
#include "../ondemand/ODManager.h"
#ifndef WX_PRECOMP
// Include your minimal set of headers here, or wx.h
@@ -596,7 +598,14 @@ ProgressResult FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
const auto blockLen =
limitSampleBufferSize( maxBlockSize, sampleDuration - i );
t->AppendCoded(mFilename, i, blockLen, c, ODTask::eODFFMPEG);
t->RightmostOrNewClip()->AppendBlockFile(
[&]( wxFileNameWrapper filePath, size_t len ) {
return make_blockfile<ODDecodeBlockFile>(
std::move(filePath), wxFileNameWrapper{ mFilename },
i, len, c, ODTask::eODFFMPEG);
},
blockLen
);
// This only works well for single streams since we assume
// each stream is of the same duration and channels

View File

@@ -42,6 +42,8 @@
#include "ImportPlugin.h"
#include "../Tags.h"
#include "../WaveClip.h"
#include "../blockfile/ODDecodeBlockFile.h"
#include "../prefs/QualityPrefs.h"
#include "../widgets/ProgressDialog.h"
@@ -483,7 +485,14 @@ ProgressResult FLACImportFileHandle::Import(TrackFactory *trackFactory,
auto iter = mChannels.begin();
for (size_t c = 0; c < mNumChannels; ++c, ++iter)
iter->get()->AppendCoded(mFilename, i, blockLen, c, ODTask::eODFLAC);
iter->get()->RightmostOrNewClip()->AppendBlockFile(
[&]( wxFileNameWrapper filePath, size_t len ) {
return make_blockfile<ODDecodeBlockFile>(
std::move(filePath), wxFileNameWrapper{ mFilename },
i, len, c, ODTask::eODFLAC);
},
blockLen
);
mUpdateResult = mProgress->Update(
i.as_long_long(),

View File

@@ -36,8 +36,10 @@
#include "sndfile.h"
#include "../WaveClip.h"
#include "../ondemand/ODManager.h"
#include "../ondemand/ODComputeSummaryTask.h"
#include "../blockfile/ODPCMAliasBlockFile.h"
#include "../prefs/QualityPrefs.h"
#include "../widgets/ProgressDialog.h"
@@ -407,7 +409,18 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
auto iter = channels.begin();
for (int c = 0; c < mInfo.channels; ++iter, ++c)
iter->get()->AppendAlias(mFilename, i, blockLen, c,useOD);
iter->get()->RightmostOrNewClip()->AppendBlockFile(
[&]( wxFileNameWrapper filePath, size_t len ) {
return useOD
? make_blockfile<ODPCMAliasBlockFile>(
std::move(filePath), wxFileNameWrapper{ mFilename },
i, len, c)
: make_blockfile<PCMAliasBlockFile>(
std::move(filePath), wxFileNameWrapper{ mFilename },
i, len, c);
},
blockLen
);
if (++updateCounter == 50) {
updateResult = mProgress->Update(