mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Bug 2515 - Exporting to a disk with insufficient space gives messages that are not user-friendly or helpful
This commit is contained in:
parent
0b633c564a
commit
6149b57dc0
@ -1530,4 +1530,16 @@ void ShowExportErrorDialog(wxString ErrorCode,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowDiskFullExportErrorDialog()
|
||||||
|
{
|
||||||
|
ShowErrorDialog(nullptr,
|
||||||
|
XO("Warning"),
|
||||||
|
XO("Audacity failed to write to a file.\n"
|
||||||
|
"Perhaps the file is not writable or the disk is full.\n"
|
||||||
|
"For tips on freeing up space, click the help button."
|
||||||
|
),
|
||||||
|
"Error:_Disk_full_or_not_writable"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,5 +332,6 @@ void ShowExportErrorDialog(wxString ErrorCode,
|
|||||||
TranslatableString message = AudacityExportMessageStr(),
|
TranslatableString message = AudacityExportMessageStr(),
|
||||||
const TranslatableString& caption = AudacityExportCaptionStr());
|
const TranslatableString& caption = AudacityExportCaptionStr());
|
||||||
|
|
||||||
|
void ShowDiskFullExportErrorDialog();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -892,6 +892,7 @@ void ExportFFmpeg::FreeResources()
|
|||||||
av_log_set_callback(av_log_default_callback);
|
av_log_set_callback(av_log_default_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All paths in this that fail must report their error to the user.
|
||||||
bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
||||||
{
|
{
|
||||||
int nBytesToWrite = 0;
|
int nBytesToWrite = 0;
|
||||||
@ -901,14 +902,18 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
|||||||
|
|
||||||
nBytesToWrite = frameSize;
|
nBytesToWrite = frameSize;
|
||||||
pRawSamples = (uint8_t*)pFrame;
|
pRawSamples = (uint8_t*)pFrame;
|
||||||
if (av_fifo_realloc2(mEncAudioFifo.get(), av_fifo_size(mEncAudioFifo.get()) + frameSize) < 0)
|
if (av_fifo_realloc2(mEncAudioFifo.get(), av_fifo_size(mEncAudioFifo.get()) + frameSize) < 0) {
|
||||||
|
ShowExportErrorDialog("FFmpeg:905");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Put the raw audio samples into the FIFO.
|
// Put the raw audio samples into the FIFO.
|
||||||
ret = av_fifo_generic_write(mEncAudioFifo.get(), pRawSamples, nBytesToWrite,NULL);
|
ret = av_fifo_generic_write(mEncAudioFifo.get(), pRawSamples, nBytesToWrite,NULL);
|
||||||
|
|
||||||
if(ret != nBytesToWrite)
|
if (ret != nBytesToWrite) {
|
||||||
|
ShowExportErrorDialog("FFmpeg:913");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) {
|
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) {
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
@ -954,14 +959,7 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
|||||||
// Write the encoded audio frame to the output file.
|
// Write the encoded audio frame to the output file.
|
||||||
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
|
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
|
||||||
{
|
{
|
||||||
ShowErrorDialog(nullptr,
|
ShowDiskFullExportErrorDialog();
|
||||||
XO("Warning"),
|
|
||||||
XO("Audacity failed to write to a file.\n"
|
|
||||||
"Perhaps the file is not writable or the disk is full.\n"
|
|
||||||
"For tips on freeing up space, click the help button."
|
|
||||||
),
|
|
||||||
"Error:_Disk_full_or_not_writable"
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1040,9 +1038,8 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
|
|||||||
|
|
||||||
if (!EncodeAudioFrame(
|
if (!EncodeAudioFrame(
|
||||||
pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels)) {
|
pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels)) {
|
||||||
// TODO: more precise message, and fix redundancy with messages
|
// All errors should already have been reported.
|
||||||
// already given on some of the failure paths of the above call
|
//ShowDiskFullExportErrorDialog();
|
||||||
ShowExportErrorDialog("FFmpeg:1041");
|
|
||||||
updateResult = ProgressResult::Cancelled;
|
updateResult = ProgressResult::Cancelled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
|||||||
reinterpret_cast<FLAC__int32**>( tmpsmplbuf.get() ),
|
reinterpret_cast<FLAC__int32**>( tmpsmplbuf.get() ),
|
||||||
samplesThisRun) ) {
|
samplesThisRun) ) {
|
||||||
// TODO: more precise message
|
// TODO: more precise message
|
||||||
ShowExportErrorDialog("FLAC:410");
|
ShowDiskFullExportErrorDialog();
|
||||||
updateResult = ProgressResult::Cancelled;
|
updateResult = ProgressResult::Cancelled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
|
|||||||
|
|
||||||
if ( outFile.Write(mp2Buffer.get(), mp2BufferNumBytes).GetLastError() ) {
|
if ( outFile.Write(mp2Buffer.get(), mp2BufferNumBytes).GetLastError() ) {
|
||||||
// TODO: more precise message
|
// TODO: more precise message
|
||||||
ShowExportErrorDialog("MP2:346");
|
ShowDiskFullExportErrorDialog();
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1963,7 +1963,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
|
|||||||
|
|
||||||
if (bytes > (int)outFile.Write(buffer.get(), bytes)) {
|
if (bytes > (int)outFile.Write(buffer.get(), bytes)) {
|
||||||
// TODO: more precise message
|
// TODO: more precise message
|
||||||
ShowExportErrorDialog("MP3:1966");
|
ShowDiskFullExportErrorDialog();
|
||||||
updateResult = ProgressResult::Cancelled;
|
updateResult = ProgressResult::Cancelled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||||||
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
||||||
outFile.Write(page.body, page.body_len).GetLastError()) {
|
outFile.Write(page.body, page.body_len).GetLastError()) {
|
||||||
// TODO: more precise message
|
// TODO: more precise message
|
||||||
ShowExportErrorDialog("OGG:341");
|
ShowDiskFullExportErrorDialog();
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user