Audacity
3.0.3
|
A class representing a modular task to be used with the On-Demand structures. More...
#include <ODDecodeTask.h>
Public Member Functions | |
ODDecodeTask () | |
Creates a NEW task that decodes files. More... | |
virtual | ~ODDecodeTask () |
virtual bool | SeekingAllowed () |
void | DemandTrackUpdate (WaveTrack *track, double seconds) override |
const char * | GetTaskName () override |
Return the task name. More... | |
TranslatableString | GetTip () override |
unsigned int | GetODType () override |
Subclasses should override to return respective type. More... | |
virtual ODFileDecoder * | CreateFileDecoder (const wxString &fileName)=0 |
Creates an ODFileDecoder that decodes a file of filetype the subclass handles. More... | |
virtual ODFileDecoder * | GetOrCreateMatchingFileDecoder (ODDecodeBlockFile *blockFile) |
virtual int | GetNumFileDecoders () |
Public Member Functions inherited from ODTask | |
ODTask () | |
Constructs an ODTask. More... | |
virtual | ~ODTask () |
virtual std::unique_ptr< ODTask > | Clone () const =0 |
void | DoSome (float amountWork=0.0) |
void | DoAll () |
Call DoSome until PercentComplete >= 1.0. More... | |
virtual float | PercentComplete () |
return the amount of the task that has been completed. 0.0 to 1.0 More... | |
virtual bool | UsesCustomWorkUntilPercentage () |
virtual float | ComputeNextWorkUntilPercentageComplete () |
virtual bool | CanMergeWith (ODTask *otherTask) |
virtual void | StopUsingWaveTrack (WaveTrack *track) |
virtual void | ReplaceWaveTrack (Track *oldTrack, const std::shared_ptr< Track > &newTrack) |
Replaces all instances to a wavetrack with a NEW one, effectively transferring the task. More... | |
void | AddWaveTrack (const std::shared_ptr< WaveTrack > &track) |
Adds a WaveTrack to do the task for. More... | |
virtual int | GetNumWaveTracks () |
virtual std::shared_ptr< WaveTrack > | GetWaveTrack (int i) |
bool | IsComplete () |
return More... | |
void | TerminateAndBlock () |
virtual void | Terminate () |
releases memory that the ODTask owns. Subclasses should override. More... | |
virtual sampleCount | GetDemandSample () const |
virtual void | SetDemandSample (sampleCount sample) |
virtual void | RecalculatePercentComplete () |
does an od update and then recalculates the data. More... | |
int | GetTaskNumber () |
returns the number of tasks created before this instance. More... | |
void | SetNeedsODUpdate () |
bool | GetNeedsODUpdate () |
void | ResetNeedsODUpdate () |
virtual bool | IsTaskAssociatedWithProject (AudacityProject *proj) |
returns true if the task is associated with the project. More... | |
bool | IsRunning () |
Protected Member Functions | |
void | CalculatePercentComplete () override |
recalculates the percentage complete. More... | |
void | DoSomeInternal () override |
Computes and writes the data for one BlockFile if it still has a refcount. More... | |
void | Update () override |
by default creates the order of the wavetrack to load. More... | |
void | OrderBlockFiles (std::vector< std::weak_ptr< ODDecodeBlockFile > > &unorderedBlocks) |
Orders the input as either On-Demand or default layered order. More... | |
Protected Member Functions inherited from ODTask | |
virtual void | ODUpdate () |
void | SetIsRunning (bool value) |
Protected Attributes | |
std::vector< std::weak_ptr< ODDecodeBlockFile > > | mBlockFiles |
std::vector< std::unique_ptr< ODFileDecoder > > | mDecoders |
int | mMaxBlockFiles |
Protected Attributes inherited from ODTask | |
int | mTaskNumber |
volatile float | mPercentComplete |
ODLock | mPercentCompleteMutex |
volatile bool | mDoingTask |
volatile bool | mTaskStarted |
volatile bool | mTerminate |
ODLock | mTerminateMutex |
ODLock | mBlockUntilTerminateMutex |
std::vector< std::weak_ptr< WaveTrack > > | mWaveTracks |
ODLock | mWaveTrackMutex |
sampleCount | mDemandSample |
ODLock | mDemandSampleMutex |
volatile bool | mIsRunning |
ODLock | mIsRunningMutex |
Additional Inherited Members | |
Public Types inherited from ODTask | |
enum | { eODNone = 0x00000000, eODFLAC = 0x00000001, eODMP3 = 0x00000002, eODFFMPEG = 0x00000004, eODPCMSummary = 0x00001000, eODOTHER = 0x10000000 } |
Public Attributes inherited from ODTask | |
enum ODTask:: { ... } | ODTypeEnum |
A class representing a modular task to be used with the On-Demand structures.
Decodes a file into a simpleBlockFile, but not immediately.
Decodes files and writes block files in .au format, updating the ODDecodeBlockFile and the GUI of the newly available data.
This is an abstract class that subclasses will have to derive the types from. For any type there should only be one ODDecodeTask associated with a given track. There could be the ODDecodeBlockFiles of several FLACs in one track (after copy and pasting), so things aren't as simple as they seem - the implementation needs to be robust enough to allow all the user changes such as copy/paste, DELETE, and so on.
Definition at line 40 of file ODDecodeTask.h.
ODDecodeTask::ODDecodeTask | ( | ) |
Creates a NEW task that decodes files.
Definition at line 29 of file ODDecodeTask.cpp.
References mMaxBlockFiles.
|
inlinevirtual |
Definition at line 44 of file ODDecodeTask.h.
|
overrideprotectedvirtual |
recalculates the percentage complete.
Implements ODTask.
Definition at line 121 of file ODDecodeTask.cpp.
References mBlockFiles, mMaxBlockFiles, ODTask::mPercentComplete, and ODTask::mPercentCompleteMutex.
Referenced by DoSomeInternal().
|
pure virtual |
Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
Implemented in ODDecodeFlacTask.
Referenced by GetOrCreateMatchingFileDecoder().
|
overridevirtual |
changes the tasks associated with this Waveform to process the task from a different point in the track this is overridden from ODTask because certain classes don't allow users to seek sometimes, or not at all.
Reimplemented from ODTask.
Definition at line 257 of file ODDecodeTask.cpp.
References ODTask::DemandTrackUpdate(), and SeekingAllowed().
|
overrideprotectedvirtual |
Computes and writes the data for one BlockFile if it still has a refcount.
Implements ODTask.
Definition at line 36 of file ODDecodeTask.cpp.
References CalculatePercentComplete(), GetOrCreateMatchingFileDecoder(), ODFileDecoder::Init(), ODFileDecoder::IsInitialized(), mBlockFiles, mMaxBlockFiles, ODTask::mPercentComplete, ODTask::mPercentCompleteMutex, ODTask::mWaveTrackMutex, and ODTask::mWaveTracks.
|
virtual |
Definition at line 294 of file ODDecodeTask.cpp.
References mDecoders.
|
inlineoverridevirtual |
Subclasses should override to return respective type.
Reimplemented from ODTask.
Definition at line 59 of file ODDecodeTask.h.
References ODTask::eODNone.
Referenced by GetOrCreateMatchingFileDecoder(), and Update().
|
virtual |
there could be the ODDecodeBlockFiles of several FLACs in one track (after copy and pasting) so we keep a list of decoders that keep track of the file names, etc, and check the blocks against them. Blocks that have IsDataAvailable()==false are blockfiles to be decoded. if BlockFile::GetDecodeType()==ODDecodeTask::GetODType() then this decoder should handle it. Decoders are accessible with the methods below. These aren't thread-safe and should only be called from the decoding thread.
Definition at line 270 of file ODDecodeTask.cpp.
References CreateFileDecoder(), ODDecodeBlockFile::GetAudioFileName(), ODDecodeBlockFile::GetDecodeType(), GetODType(), and mDecoders.
Referenced by DoSomeInternal().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
protected |
Orders the input as either On-Demand or default layered order.
Definition at line 206 of file ODDecodeTask.cpp.
References ODTask::GetDemandSample(), ODDecodeBlockFile::GetGlobalEnd(), ODDecodeBlockFile::GetGlobalStart(), mBlockFiles, and mMaxBlockFiles.
Referenced by Update().
|
virtual |
Definition at line 128 of file ODDecodeTask.cpp.
References mDecoders.
Referenced by DemandTrackUpdate().
|
overrideprotectedvirtual |
by default creates the order of the wavetrack to load.
Readjusts the blockfile order in the default manner. If we have had an ODRequest Then it updates in the OD manner.
Reimplemented from ODTask.
Definition at line 138 of file ODDecodeTask.cpp.
References ODDecodeBlockFile::GetClipOffset(), GetODType(), ODDecodeBlockFile::GetStart(), ODTask::mWaveTrackMutex, ODTask::mWaveTracks, OrderBlockFiles(), ODDecodeBlockFile::SetClipOffset(), ODDecodeBlockFile::SetStart(), and SeqBlock::start.
|
protected |
Definition at line 91 of file ODDecodeTask.h.
Referenced by CalculatePercentComplete(), DoSomeInternal(), and OrderBlockFiles().
|
protected |
Definition at line 92 of file ODDecodeTask.h.
Referenced by ODDecodeFlacTask::CreateFileDecoder(), GetNumFileDecoders(), GetOrCreateMatchingFileDecoder(), and SeekingAllowed().
|
protected |
Definition at line 94 of file ODDecodeTask.h.
Referenced by CalculatePercentComplete(), DoSomeInternal(), ODDecodeTask(), and OrderBlockFiles().