mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Use enum class ProgressResult, don't interconvert with int or bool
This commit is contained in:
@@ -517,11 +517,9 @@ bool Importer::Import(const wxString &fName,
|
||||
else
|
||||
inFile->SetStreamUsage(0,TRUE);
|
||||
|
||||
int res;
|
||||
auto res = inFile->Import(trackFactory, tracks, tags);
|
||||
|
||||
res = inFile->Import(trackFactory, tracks, tags);
|
||||
|
||||
if (res == eProgressSuccess || res == eProgressStopped)
|
||||
if (res == ProgressResult::Success || res == ProgressResult::Stopped)
|
||||
{
|
||||
// LOF ("list-of-files") has different semantics
|
||||
if (extension.IsSameAs(wxT("lof"), false))
|
||||
@@ -538,7 +536,7 @@ bool Importer::Import(const wxString &fName,
|
||||
}
|
||||
}
|
||||
|
||||
if (res == eProgressCancelled || res == eProgressFailed)
|
||||
if (res == ProgressResult::Cancelled || res == ProgressResult::Failed)
|
||||
{
|
||||
pProj->mbBusyImporting = false;
|
||||
return false;
|
||||
|
@@ -208,7 +208,7 @@ public:
|
||||
|
||||
///! Imports audio
|
||||
///\return import status (see Import.cpp)
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
///! Reads next audio frame
|
||||
@@ -223,8 +223,7 @@ public:
|
||||
|
||||
///! Writes decoded data into WaveTracks. Called by DecodeFrame
|
||||
///\param sc - stream context
|
||||
///\return 0 on success, 1 on error or interruption
|
||||
int WriteData(streamContext *sc);
|
||||
ProgressResult WriteData(streamContext *sc);
|
||||
|
||||
///! Writes extracted metadata to tags object
|
||||
///\param avf - file context
|
||||
@@ -467,7 +466,7 @@ auto FFmpegImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
ProgressResult FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
@@ -572,7 +571,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
}
|
||||
// This is the heart of the importing process
|
||||
// The result of Import() to be returend. It will be something other than zero if user canceled or some error appears.
|
||||
int res = eProgressSuccess;
|
||||
auto res = ProgressResult::Success;
|
||||
|
||||
#ifdef EXPERIMENTAL_OD_FFMPEG
|
||||
mUsingOD = false;
|
||||
@@ -623,27 +622,27 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
sc->m_stream->codec->channels * mNumStreams
|
||||
).as_long_long()
|
||||
);
|
||||
if (res != eProgressSuccess)
|
||||
if (res != ProgressResult::Success)
|
||||
break;
|
||||
}
|
||||
}
|
||||
tasks.push_back(std::move(odTask));
|
||||
}
|
||||
//Now we add the tasks and let them run, or DELETE them if the user cancelled
|
||||
if (res == eProgressSuccess)
|
||||
if (res == ProgressResult::Success)
|
||||
for (int i = 0; i < (int)tasks.size(); i++)
|
||||
ODManager::Instance()->AddNewTask(std::move(tasks[i]));
|
||||
} else {
|
||||
#endif
|
||||
|
||||
// Read next frame.
|
||||
for (streamContext *sc; (sc = ReadNextFrame()) != NULL && (res == eProgressSuccess);)
|
||||
for (streamContext *sc; (sc = ReadNextFrame()) != NULL && (res == ProgressResult::Success);)
|
||||
{
|
||||
// ReadNextFrame returns 1 if stream is not to be imported
|
||||
if (sc != (streamContext*)1)
|
||||
{
|
||||
// Decode frame until it is not possible to decode any further
|
||||
while (sc->m_pktRemainingSiz > 0 && (res == eProgressSuccess || res == eProgressStopped))
|
||||
while (sc->m_pktRemainingSiz > 0 && (res == ProgressResult::Success || res == ProgressResult::Stopped))
|
||||
{
|
||||
if (DecodeFrame(sc,false) < 0)
|
||||
break;
|
||||
@@ -659,7 +658,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
}
|
||||
|
||||
// Flush the decoders.
|
||||
if ((mNumStreams != 0) && (res == eProgressSuccess || res == eProgressStopped))
|
||||
if ((mNumStreams != 0) && (res == ProgressResult::Success || res == ProgressResult::Stopped))
|
||||
{
|
||||
for (int i = 0; i < mNumStreams; i++)
|
||||
{
|
||||
@@ -678,7 +677,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
#endif //EXPERIMENTAL_OD_FFMPEG
|
||||
|
||||
// Something bad happened - destroy everything!
|
||||
if (res == eProgressCancelled || res == eProgressFailed)
|
||||
if (res == ProgressResult::Cancelled || res == ProgressResult::Failed)
|
||||
return res;
|
||||
//else if (res == 2), we just stop the decoding as if the file has ended
|
||||
|
||||
@@ -712,7 +711,7 @@ int FFmpegImportFileHandle::DecodeFrame(streamContext *sc, bool flushing)
|
||||
return import_ffmpeg_decode_frame(sc, flushing);
|
||||
}
|
||||
|
||||
int FFmpegImportFileHandle::WriteData(streamContext *sc)
|
||||
ProgressResult FFmpegImportFileHandle::WriteData(streamContext *sc)
|
||||
{
|
||||
// Find the stream index in mScs array
|
||||
int streamid = -1;
|
||||
@@ -729,7 +728,7 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
|
||||
// Stream is not found. This should not really happen
|
||||
if (streamid == -1)
|
||||
{
|
||||
return 1;
|
||||
return ProgressResult::Success;
|
||||
}
|
||||
|
||||
// Allocate the buffer to store audio.
|
||||
@@ -785,7 +784,7 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
|
||||
free(tmp[chn]);
|
||||
}
|
||||
free(tmp);
|
||||
return 1;
|
||||
return ProgressResult::Success;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -806,7 +805,7 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc)
|
||||
free(tmp);
|
||||
|
||||
// Try to update the progress indicator (and see if user wants to cancel)
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
int64_t filesize = avio_size(mFormatContext->pb);
|
||||
// PTS (presentation time) is the proper way of getting current position
|
||||
if (sc->m_pkt->pts != int64_t(AV_NOPTS_VALUE) && mFormatContext->duration != int64_t(AV_NOPTS_VALUE))
|
||||
|
@@ -154,7 +154,7 @@ public:
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
ByteCount GetFileUncompressedBytes() override;
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
wxInt32 GetStreamCount() override { return 1; }
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
FLAC__uint64 mNumSamples;
|
||||
FLAC__uint64 mSamplesDone;
|
||||
bool mStreamInfoDone;
|
||||
int mUpdateResult;
|
||||
ProgressResult mUpdateResult;
|
||||
TrackHolders mChannels;
|
||||
movable_ptr<ODDecodeFlacTask> mDecoderTask;
|
||||
};
|
||||
@@ -277,7 +277,7 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
|
||||
mFile->mSamplesDone += frame->header.blocksize;
|
||||
|
||||
mFile->mUpdateResult = mFile->mProgress->Update((wxULongLong_t) mFile->mSamplesDone, mFile->mNumSamples != 0 ? (wxULongLong_t)mFile->mNumSamples : 1);
|
||||
if (mFile->mUpdateResult != eProgressSuccess)
|
||||
if (mFile->mUpdateResult != ProgressResult::Success)
|
||||
{
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ FLACImportFileHandle::FLACImportFileHandle(const wxString & name)
|
||||
: ImportFileHandle(name),
|
||||
mSamplesDone(0),
|
||||
mStreamInfoDone(false),
|
||||
mUpdateResult(eProgressSuccess)
|
||||
mUpdateResult(ProgressResult::Success)
|
||||
{
|
||||
mFormat = (sampleFormat)
|
||||
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample);
|
||||
@@ -439,7 +439,7 @@ auto FLACImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
}
|
||||
|
||||
|
||||
int FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
ProgressResult FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
@@ -507,7 +507,7 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
i.as_long_long(),
|
||||
fileTotalFrames.as_long_long()
|
||||
);
|
||||
if (mUpdateResult != eProgressSuccess)
|
||||
if (mUpdateResult != ProgressResult::Success)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
//END OD
|
||||
|
||||
|
||||
if (mUpdateResult == eProgressFailed || mUpdateResult == eProgressCancelled) {
|
||||
if (mUpdateResult == ProgressResult::Failed || mUpdateResult == ProgressResult::Cancelled) {
|
||||
return mUpdateResult;
|
||||
}
|
||||
|
||||
|
@@ -1088,7 +1088,7 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
{
|
||||
wxMessageBox(wxT("File doesn't contain any audio streams."),
|
||||
wxT("GStreamer Importer"));
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
}
|
||||
|
||||
// Get the ball rolling...
|
||||
@@ -1097,7 +1097,7 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
{
|
||||
wxMessageBox(wxT("Unable to import file, state change failed."),
|
||||
wxT("GStreamer Importer"));
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
}
|
||||
|
||||
// Get the duration of the stream
|
||||
@@ -1106,8 +1106,8 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
|
||||
// Handle bus messages and update progress while files is importing
|
||||
bool success = true;
|
||||
int updateResult = eProgressSuccess;
|
||||
while (ProcessBusMessage(success) && success && updateResult == eProgressSuccess)
|
||||
int updateResult = ProgressResult::Success;
|
||||
while (ProcessBusMessage(success) && success && updateResult == ProgressResult::Success)
|
||||
{
|
||||
gint64 position;
|
||||
|
||||
@@ -1123,7 +1123,7 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
gst_element_set_state(mPipeline.get(), GST_STATE_NULL);
|
||||
|
||||
// Something bad happened
|
||||
if (!success || updateResult == eProgressFailed || updateResult == eProgressCancelled)
|
||||
if (!success || updateResult == ProgressResult::Failed || updateResult == ProgressResult::Cancelled)
|
||||
{
|
||||
return updateResult;
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ public:
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
ByteCount GetFileUncompressedBytes() override;
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
wxInt32 GetStreamCount() override { return 1; }
|
||||
@@ -232,7 +232,7 @@ auto LOFImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LOFImportFileHandle::Import(TrackFactory * WXUNUSED(trackFactory), TrackHolders &outTracks,
|
||||
ProgressResult LOFImportFileHandle::Import(TrackFactory * WXUNUSED(trackFactory), TrackHolders &outTracks,
|
||||
Tags * WXUNUSED(tags))
|
||||
{
|
||||
outTracks.clear();
|
||||
@@ -242,7 +242,7 @@ int LOFImportFileHandle::Import(TrackFactory * WXUNUSED(trackFactory), TrackHold
|
||||
if(mTextFile->Eof())
|
||||
{
|
||||
mTextFile->Close();
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
}
|
||||
|
||||
wxString line = mTextFile->GetFirstLine();
|
||||
@@ -262,9 +262,9 @@ int LOFImportFileHandle::Import(TrackFactory * WXUNUSED(trackFactory), TrackHold
|
||||
|
||||
// exited ok
|
||||
if(mTextFile->Close())
|
||||
return eProgressSuccess;
|
||||
return ProgressResult::Success;
|
||||
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
}
|
||||
|
||||
static int CountNumTracks(AudacityProject *proj)
|
||||
|
@@ -100,7 +100,7 @@ struct private_data {
|
||||
TrackHolders channels;
|
||||
ProgressDialog *progress;
|
||||
unsigned numChannels;
|
||||
int updateResult;
|
||||
ProgressResult updateResult;
|
||||
bool id3checked;
|
||||
bool eof; /* having supplied both underlying file and guard pad data */
|
||||
};
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
ByteCount GetFileUncompressedBytes() override;
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
wxInt32 GetStreamCount() override { return 1; }
|
||||
@@ -208,7 +208,7 @@ auto MP3ImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MP3ImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult MP3ImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
outTracks.clear();
|
||||
@@ -221,7 +221,7 @@ int MP3ImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra
|
||||
mPrivateData.inputBuffer = new unsigned char [INPUT_BUFFER_SIZE];
|
||||
mPrivateData.inputBufferFill = 0;
|
||||
mPrivateData.progress = mProgress.get();
|
||||
mPrivateData.updateResult= eProgressSuccess;
|
||||
mPrivateData.updateResult= ProgressResult::Success;
|
||||
mPrivateData.id3checked = false;
|
||||
mPrivateData.numChannels = 0;
|
||||
mPrivateData.trackFactory= trackFactory;
|
||||
@@ -233,8 +233,8 @@ int MP3ImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra
|
||||
|
||||
bool res = (mad_decoder_run(&mDecoder, MAD_DECODER_MODE_SYNC) == 0) &&
|
||||
(mPrivateData.numChannels > 0) &&
|
||||
!(mPrivateData.updateResult == eProgressCancelled) &&
|
||||
!(mPrivateData.updateResult == eProgressFailed);
|
||||
!(mPrivateData.updateResult == ProgressResult::Cancelled) &&
|
||||
!(mPrivateData.updateResult == ProgressResult::Failed);
|
||||
|
||||
mad_decoder_finish(&mDecoder);
|
||||
|
||||
@@ -406,7 +406,7 @@ enum mad_flow input_cb(void *_data, struct mad_stream *stream)
|
||||
data->updateResult = data->progress->Update((wxULongLong_t)data->file->Tell(),
|
||||
(wxULongLong_t)data->file->Length() != 0 ?
|
||||
(wxULongLong_t)data->file->Length() : 1);
|
||||
if(data->updateResult != eProgressSuccess)
|
||||
if(data->updateResult != ProgressResult::Success)
|
||||
return MAD_FLOW_STOP;
|
||||
|
||||
if (data->eof) {
|
||||
|
@@ -124,7 +124,7 @@ public:
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
ByteCount GetFileUncompressedBytes() override;
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
wxInt32 GetStreamCount() override
|
||||
@@ -229,7 +229,7 @@ auto OggImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
outTracks.clear();
|
||||
@@ -300,7 +300,7 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra
|
||||
endian = 1; // big endian
|
||||
|
||||
/* number of samples currently in each channel's buffer */
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
long bytesRead = 0;
|
||||
long samplesRead = 0;
|
||||
int bitstream = 0;
|
||||
@@ -361,15 +361,15 @@ int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTra
|
||||
samplesSinceLastCallback -= SAMPLES_PER_CALLBACK;
|
||||
|
||||
}
|
||||
} while (updateResult == eProgressSuccess && bytesRead != 0);
|
||||
} while (updateResult == ProgressResult::Success && bytesRead != 0);
|
||||
|
||||
delete[]mainBuffer;
|
||||
|
||||
int res = updateResult;
|
||||
auto res = updateResult;
|
||||
if (bytesRead < 0)
|
||||
res = eProgressFailed;
|
||||
res = ProgressResult::Failed;
|
||||
|
||||
if (res == eProgressFailed || res == eProgressCancelled) {
|
||||
if (res == ProgressResult::Failed || res == ProgressResult::Cancelled) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
ByteCount GetFileUncompressedBytes() override;
|
||||
int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
wxInt32 GetStreamCount() override { return 1; }
|
||||
@@ -324,7 +324,7 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
|
||||
return oldCopyPref;
|
||||
}
|
||||
|
||||
int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
wxString copyEdit = AskCopyOrEdit();
|
||||
|
||||
if (copyEdit == wxT("cancel"))
|
||||
return eProgressCancelled;
|
||||
return ProgressResult::Cancelled;
|
||||
|
||||
// Fall back to "copy" if it doesn't match anything else, since it is safer
|
||||
bool doEdit = false;
|
||||
@@ -372,7 +372,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
auto fileTotalFrames =
|
||||
(sampleCount)mInfo.frames; // convert from sf_count_t
|
||||
auto maxBlockSize = channels.begin()->get()->GetMaxBlockSize();
|
||||
int updateResult = false;
|
||||
auto updateResult = ProgressResult::Cancelled;
|
||||
|
||||
// If the format is not seekable, we must use 'copy' mode,
|
||||
// because 'edit' mode depends on the ability to seek to an
|
||||
@@ -405,7 +405,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
fileTotalFrames.as_long_long()
|
||||
);
|
||||
updateCounter = 0;
|
||||
if (updateResult != eProgressSuccess)
|
||||
if (updateResult != ProgressResult::Success)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -443,13 +443,13 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
// PRL: guard against excessive memory buffer allocation in case of many channels
|
||||
using type = decltype(maxBlockSize);
|
||||
if (mInfo.channels < 1)
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
auto maxBlock = std::min(maxBlockSize,
|
||||
std::numeric_limits<type>::max() /
|
||||
(mInfo.channels * SAMPLE_SIZE(mFormat))
|
||||
);
|
||||
if (maxBlock < 1)
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
|
||||
SampleBuffer srcbuffer;
|
||||
wxASSERT(mInfo.channels >= 0);
|
||||
@@ -457,7 +457,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
{
|
||||
maxBlock /= 2;
|
||||
if (maxBlock < 1)
|
||||
return eProgressFailed;
|
||||
return ProgressResult::Failed;
|
||||
}
|
||||
|
||||
SampleBuffer buffer(maxBlock, mFormat);
|
||||
@@ -497,13 +497,13 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
framescompleted.as_long_long(),
|
||||
fileTotalFrames.as_long_long()
|
||||
);
|
||||
if (updateResult != eProgressSuccess)
|
||||
if (updateResult != ProgressResult::Success)
|
||||
break;
|
||||
|
||||
} while (block > 0);
|
||||
}
|
||||
|
||||
if (updateResult == eProgressFailed || updateResult == eProgressCancelled) {
|
||||
if (updateResult == ProgressResult::Failed || updateResult == ProgressResult::Cancelled) {
|
||||
return updateResult;
|
||||
}
|
||||
|
||||
|
@@ -155,7 +155,7 @@ public:
|
||||
// do the actual import, creating whatever tracks are necessary with
|
||||
// the TrackFactory and calling the progress callback every iteration
|
||||
// through the importing loop
|
||||
virtual int Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
virtual ProgressResult Import(TrackFactory *trackFactory, TrackHolders &outTracks,
|
||||
Tags *tags) = 0;
|
||||
|
||||
// Return number of elements in stream list
|
||||
|
@@ -157,7 +157,7 @@ class QTImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
}
|
||||
|
||||
int Import(TrackFactory *trackFactory,
|
||||
ProgressResult Import(TrackFactory *trackFactory,
|
||||
TrackHolders &outTracks,
|
||||
Tags *tags) override;
|
||||
|
||||
@@ -229,7 +229,7 @@ auto QTImportFileHandle::GetFileUncompressedBytes() -> ByteCount
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
ProgressResult QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
TrackHolders &outTracks,
|
||||
Tags *tags)
|
||||
{
|
||||
@@ -237,7 +237,7 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
|
||||
OSErr err = noErr;
|
||||
MovieAudioExtractionRef maer = NULL;
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
auto totSamples =
|
||||
(sampleCount) GetMovieDuration(mMovie); // convert from TimeValue
|
||||
decltype(totSamples) numSamples = 0;
|
||||
@@ -372,9 +372,9 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
if (numFrames == 0 || flags & kQTMovieAudioExtractionComplete) {
|
||||
break;
|
||||
}
|
||||
} while (updateResult == eProgressSuccess);
|
||||
} while (updateResult == ProgressResult::Success);
|
||||
|
||||
res = (updateResult == eProgressSuccess && err == noErr);
|
||||
res = (updateResult == ProgressResult::Success && err == noErr);
|
||||
|
||||
if (res) {
|
||||
for (const auto &channel: channels) {
|
||||
@@ -403,7 +403,7 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
MovieAudioExtractionEnd(maer);
|
||||
}
|
||||
|
||||
return (res ? eProgressSuccess : eProgressFailed);
|
||||
return (res ? ProgressResult::Success : ProgressResult::Failed);
|
||||
}
|
||||
|
||||
static const struct
|
||||
|
@@ -102,7 +102,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
double rate = 44100.0;
|
||||
double percent = 100.0;
|
||||
TrackHolders channels;
|
||||
int updateResult = eProgressSuccess;
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
||||
{
|
||||
SF_INFO sndInfo;
|
||||
@@ -255,7 +255,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
// This is not supposed to happen, sndfile.h says result is always
|
||||
// a count, not an invalid value for error
|
||||
wxASSERT(false);
|
||||
updateResult = eProgressFailed;
|
||||
updateResult = ProgressResult::Failed;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -282,13 +282,13 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
framescompleted.as_long_long(),
|
||||
totalFrames.as_long_long()
|
||||
);
|
||||
if (updateResult != eProgressSuccess)
|
||||
if (updateResult != ProgressResult::Success)
|
||||
break;
|
||||
|
||||
} while (block > 0 && framescompleted < totalFrames);
|
||||
}
|
||||
|
||||
if (updateResult == eProgressFailed || updateResult == eProgressCancelled) {
|
||||
if (updateResult == ProgressResult::Failed || updateResult == ProgressResult::Cancelled) {
|
||||
// It's a shame we can't return proper error code
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user