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

movable_ptr(_with_deleter) -> std::unique_ptr

This commit is contained in:
Paul Licameli
2018-04-16 13:47:44 -04:00
parent b8a8712ba0
commit a9e7a7e5d5
53 changed files with 69 additions and 69 deletions

View File

@@ -35,7 +35,7 @@ ODComputeSummaryTask::ODComputeSummaryTask()
mHasUpdateRan=false;
}
movable_ptr<ODTask> ODComputeSummaryTask::Clone() const
std::unique_ptr<ODTask> ODComputeSummaryTask::Clone() const
{
auto clone = std::make_unique<ODComputeSummaryTask>();
clone->mDemandSample = GetDemandSample();

View File

@@ -36,7 +36,7 @@ class ODComputeSummaryTask final : public ODTask
ODComputeSummaryTask();
virtual ~ODComputeSummaryTask(){};
movable_ptr<ODTask> Clone() const override;
std::unique_ptr<ODTask> Clone() const override;
///Subclasses should override to return respective type.
unsigned int GetODType() override { return eODPCMSummary; }

View File

@@ -82,7 +82,7 @@ public:
bool SeekingAllowed() ;
private:
void InsertCache(movable_ptr<FFMpegDecodeCache> &&cache);
void InsertCache(std::unique_ptr<FFMpegDecodeCache> &&cache);
//puts the actual audio samples into the blockfile's data array
int FillDataFromCache(samplePtr & data, sampleFormat outFormat, sampleCount & start, size_t& len, unsigned int channel);
@@ -100,7 +100,7 @@ private:
ScsPtr mScs; //!< Pointer to array of pointers to stream contexts.
ODDecodeFFmpegTask::Streams mChannels;
std::shared_ptr<FFmpegContext> mContext; //!< Format description, also contains metadata and some useful info
std::vector<movable_ptr<FFMpegDecodeCache>> mDecodeCache;
std::vector<std::unique_ptr<FFMpegDecodeCache>> mDecodeCache;
int mNumSamplesInCache;
sampleCount mCurrentPos; //the index of the next sample to be decoded
size_t mCurrentLen; //length of the last packet decoded
@@ -140,7 +140,7 @@ ODDecodeFFmpegTask::~ODDecodeFFmpegTask()
}
movable_ptr<ODTask> ODDecodeFFmpegTask::Clone() const
std::unique_ptr<ODTask> ODDecodeFFmpegTask::Clone() const
{
auto clone = std::make_unique<ODDecodeFFmpegTask>(mScs, Streams{ mChannels }, mContext, mStreamIndex);
clone->mDemandSample=GetDemandSample();
@@ -623,7 +623,7 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing)
return ret;
}
void ODFFmpegDecoder::InsertCache(movable_ptr<FFMpegDecodeCache> &&cache) {
void ODFFmpegDecoder::InsertCache(std::unique_ptr<FFMpegDecodeCache> &&cache) {
int searchStart = 0;
int searchEnd = mDecodeCache.size(); //size() is also a valid insert index.
int guess = 0;

View File

@@ -37,7 +37,7 @@ public:
ODDecodeFFmpegTask(const ScsPtr &scs, Streams &&channels, const std::shared_ptr<FFmpegContext> &context, int streamIndex);
virtual ~ODDecodeFFmpegTask();
movable_ptr<ODTask> Clone() const override;
std::unique_ptr<ODTask> Clone() const override;
///Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
ODFileDecoder* CreateFileDecoder(const wxString & fileName) override;

View File

@@ -33,7 +33,7 @@ ODDecodeFlacTask::~ODDecodeFlacTask()
}
movable_ptr<ODTask> ODDecodeFlacTask::Clone() const
std::unique_ptr<ODTask> ODDecodeFlacTask::Clone() const
{
auto clone = std::make_unique<ODDecodeFlacTask>();
clone->mDemandSample = GetDemandSample();

View File

@@ -51,7 +51,7 @@ class ODDecodeFlacTask final : public ODDecodeTask
virtual ~ODDecodeFlacTask();
movable_ptr<ODTask> Clone() const override;
std::unique_ptr<ODTask> Clone() const override;
///Creates an ODFileDecoder that decodes a file of filetype the subclass handles.
ODFileDecoder* CreateFileDecoder(const wxString & fileName) override;

View File

@@ -90,7 +90,7 @@ protected:
std::vector<std::weak_ptr<ODDecodeBlockFile>> mBlockFiles;
std::vector<movable_ptr<ODFileDecoder>> mDecoders;
std::vector<std::unique_ptr<ODFileDecoder>> mDecoders;
int mMaxBlockFiles;

View File

@@ -142,7 +142,7 @@ void ODManager::RemoveTaskIfInQueue(ODTask* task)
///
///@param task the task to add
///@param lockMutex locks the mutexes if true (default). This function is used within other ODManager calls, which many need to set this to false.
void ODManager::AddNewTask(movable_ptr<ODTask> &&mtask, bool lockMutex)
void ODManager::AddNewTask(std::unique_ptr<ODTask> &&mtask, bool lockMutex)
{
auto task = mtask.get();
ODWaveTrackTaskQueue* queue = NULL;

View File

@@ -62,7 +62,7 @@ class ODManager final
void DecrementCurrentThreads();
///Adds a wavetrack, creates a queue member.
void AddNewTask(movable_ptr<ODTask> &&mtask, bool lockMutex=true);
void AddNewTask(std::unique_ptr<ODTask> &&mtask, bool lockMutex=true);
///Wakes the queue loop up by signalling its condition variable.
void SignalTaskQueueLoop();
@@ -140,7 +140,7 @@ class ODManager final
static std::unique_ptr<ODManager> pMan;
//List of tracks and their active and inactive tasks.
std::vector<movable_ptr<ODWaveTrackTaskQueue>> mQueues;
std::vector<std::unique_ptr<ODWaveTrackTaskQueue>> mQueues;
ODLock mQueuesMutex;
//List of current Task to do.

View File

@@ -55,7 +55,7 @@ class ODTask /* not final */
virtual ~ODTask(){};
//clones everything except information about the tracks.
virtual movable_ptr<ODTask> Clone() const = 0;
virtual std::unique_ptr<ODTask> Clone() const = 0;
///Subclasses should override to return respective type.
virtual unsigned int GetODType(){return eODNone;}

View File

@@ -101,7 +101,7 @@ void ODWaveTrackTaskQueue::AddWaveTrack(WaveTrack* track)
mTracksMutex.Unlock();
}
void ODWaveTrackTaskQueue::AddTask(movable_ptr<ODTask> &&mtask)
void ODWaveTrackTaskQueue::AddTask(std::unique_ptr<ODTask> &&mtask)
{
ODTask *task = mtask.get();

View File

@@ -72,7 +72,7 @@ class ODWaveTrackTaskQueue final
int GetNumWaveTracks();
///Add a task to the queue.
void AddTask(movable_ptr<ODTask> &&mtask);
void AddTask(std::unique_ptr<ODTask> &&mtask);
//returns true if either tracks or tasks are empty
bool IsEmpty();
@@ -106,7 +106,7 @@ class ODWaveTrackTaskQueue final
ODLock mTracksMutex;
///the list of tasks associated with the tracks. This class owns these tasks.
std::vector<movable_ptr<ODTask>> mTasks;
std::vector<std::unique_ptr<ODTask>> mTasks;
ODLock mTasksMutex;
};