1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Make better discrimination of wxLogMessage, wxLogDebug, and wxLogError usage so user doesn't see lots of irrelevant info in log window, only messages and errors they should need to see. For example, user doesn't need to see every step of loading FFmpeg in release build, only errors, if they occur.

Comment out in FreqWindow.cpp the wxLog* stuff that can just be done with breakpoints ("Starting FreqWindow::Plot()" et al).
This commit is contained in:
v.audacity 2010-08-10 05:13:28 +00:00
parent a6cb818f42
commit 0ae919f656
9 changed files with 106 additions and 103 deletions

View File

@ -1116,7 +1116,7 @@ bool AudacityApp::OnInit()
// So we also call StartMonitoring when STOP is called.
project->MayStartMonitoring();
mLogger = new wxLogWindow(NULL,wxT("Debug Log"),false,false);
mLogger = new wxLogWindow(NULL, wxT("Audacity Log"), false, false);
mLogger->SetActiveTarget(mLogger);
mLogger->EnableLogging(true);
mLogger->SetLogLevel(wxLOG_Max);

View File

@ -547,11 +547,10 @@ bool ShowDependencyDialogIfNeeded(AudacityProject *project,
if (!isSaving)
{
wxString msg =
_("Your project is currently self-contained; it does not depend on any external audio files.");
if (project->GetUndoManager()->UndoAvailable())
msg +=
_("\n\nIf you Undo back to a state where it has external dependencies on imported files, it will no \
longer be self-contained. If you then Save without copying those files in, you may lose data.");
_("Your project is currently self-contained; it does not depend on any external audio files. \
\n\nIf you change the project to a state where it has external dependencies on imported \
files, it will no longer be self-contained. If you then Save without copying those files in, \
you may lose data.");
wxMessageBox(msg,
_("Dependency Check"),
wxOK | wxICON_INFORMATION,

View File

@ -154,14 +154,14 @@ void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl)
default: cpt = wxT("Log"); break;
}
#ifdef EXPERIMENTAL_OD_FFMPEG
//if the decoding happens thru OD then this gets called from a non main thread, which means wxLogMessage
//if the decoding happens thru OD then this gets called from a non main thread, which means wxLogDebug
//will crash.
//TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print
if(!wxThread::IsMain())
printf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str());
else
#endif
wxLogMessage(wxT("%s: %s"),cpt.c_str(),printstring.c_str());
wxLogDebug(wxT("%s: %s"),cpt.c_str(),printstring.c_str());
}
//======================= Unicode aware uri protocol for FFmpeg
@ -564,9 +564,9 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
wxString path;
wxString name;
wxLogMessage(wxT("Looking for FFmpeg libraries..."));
wxLogDebug(wxT("Looking for FFmpeg libraries..."));
if (!mLibAVFormatPath.IsEmpty()) {
wxLogMessage(wxT("mLibAVFormatPath is not empty, = %s"),mLibAVFormatPath.c_str());
wxLogDebug(wxT("mLibAVFormatPath is not empty, = %s"),mLibAVFormatPath.c_str());
wxFileName fn = mLibAVFormatPath;
path = fn.GetPath();
name = fn.GetFullName();
@ -574,7 +574,7 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
else {
path = GetLibAVFormatPath();
name = GetLibAVFormatName();
wxLogMessage(wxT("mLibAVFormatPath is empty, starting with path '%s', name '%s'"),path.c_str(),name.c_str());
wxLogDebug(wxT("mLibAVFormatPath is empty, starting with path '%s', name '%s'"),path.c_str(),name.c_str());
}
FindFFmpegDialog fd(parent,
@ -583,18 +583,18 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
GetLibraryTypeString());
if (fd.ShowModal() == wxID_CANCEL) {
wxLogMessage(wxT("User canceled the dialog. Failed to find libraries."));
wxLogDebug(wxT("User canceled the dialog. Failed to find libraries."));
return false;
}
path = fd.GetLibPath();
wxLogMessage(wxT("User-specified path = %s"),path.c_str());
wxLogDebug(wxT("User-specified path = %s"),path.c_str());
if (!::wxFileExists(path)) {
wxLogMessage(wxT("User-specified file doesn't exist! Failed to find libraries."));
wxLogDebug(wxT("User-specified file doesn't exist! Failed to find libraries."));
return false;
}
wxLogMessage(wxT("User-specified file exists. Success."));
wxLogDebug(wxT("User-specified file exists. Success."));
mLibAVFormatPath = path;
gPrefs->Write(wxT("/FFmpeg/FFmpegLibPath"), mLibAVFormatPath);
@ -604,15 +604,15 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
{
wxLogMessage(wxT("Trying to load FFmpeg libraries"));
wxLogDebug(wxT("Trying to load FFmpeg libraries"));
if (ValidLibsLoaded()) {
wxLogMessage(wxT("Libraries already loaded - freeing"));
wxLogDebug(wxT("Libraries already loaded - freeing"));
FreeLibs();
}
// First try loading it from a previously located path
if (!mLibAVFormatPath.IsEmpty()) {
wxLogMessage(wxT("mLibAVFormatPath is not empty, = %s. Loading from it."),mLibAVFormatPath.c_str());
wxLogDebug(wxT("mLibAVFormatPath is not empty, = %s. Loading from it."),mLibAVFormatPath.c_str());
mLibsLoaded = InitLibs(mLibAVFormatPath,showerr);
}
@ -620,7 +620,7 @@ bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
if (!mLibsLoaded && !GetLibAVFormatPath().IsEmpty()) {
wxFileName fn(GetLibAVFormatPath(), GetLibAVFormatName());
wxString path = fn.GetFullPath();
wxLogMessage(wxT("Trying to load from default path %s."),path.c_str());
wxLogDebug(wxT("Trying to load from default path %s."),path.c_str());
mLibsLoaded = InitLibs(path,showerr);
if (mLibsLoaded) {
mLibAVFormatPath = path;
@ -630,7 +630,7 @@ bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
// If not successful, try loading using system search paths
if (!ValidLibsLoaded()) {
wxString path = GetLibAVFormatName();
wxLogMessage(wxT("Trying to load from system paths. File name is %s"),path.c_str());
wxLogDebug(wxT("Trying to load from system paths. File name is %s"),path.c_str());
mLibsLoaded = InitLibs(path,showerr);
if (mLibsLoaded) {
mLibAVFormatPath = path;
@ -641,7 +641,7 @@ bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
/*
if (!ValidLibsLoaded())
{
wxLogMessage(wxT("Failed to load libraries altogether."));
wxLogError(wxT("Failed to load libraries altogether."));
int dontShowDlg;
FFmpegNotFoundDialog *dlg;
gPrefs->Read(wxT("/FFmpeg/NotFoundDontShow"),&dontShowDlg,0);
@ -659,7 +659,7 @@ bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
return false;
}
wxLogMessage(wxT("Libraries loaded successfully!"));
wxLogDebug(wxT("Libraries loaded successfully!"));
return true;
}
@ -685,27 +685,27 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
FreeLibs();
#if defined(__WXMSW__)
wxLogMessage(wxT("Looking up PATH..."));
wxLogDebug(wxT("Looking up PATH..."));
// First take PATH environment variable (store it's content)
if (wxGetEnv(wxT("PATH"),&syspath))
{
wxLogMessage(wxT("PATH = %s"),syspath.c_str());
wxLogDebug(wxT("PATH = %s"),syspath.c_str());
wxString fmtdirsc = wxPathOnly(libpath_format) + wxT(";");
wxString scfmtdir = wxT(";") + wxPathOnly(libpath_format);
wxString fmtdir = wxPathOnly(libpath_format);
wxLogMessage(wxT("Checking that %s is in PATH..."),fmtdir.c_str());
wxLogDebug(wxT("Checking that %s is in PATH..."),fmtdir.c_str());
// If the directory, where libavformat is, is not in PATH - add it
if (!syspath.Contains(fmtdirsc) && !syspath.Contains(scfmtdir) && !syspath.Contains(fmtdir))
{
wxLogMessage(wxT("not in PATH!"));
wxLogDebug(wxT("not in PATH!"));
if (syspath.Last() == wxT(';'))
{
wxLogMessage(wxT("Appending %s ..."),fmtdir.c_str());
wxLogDebug(wxT("Appending %s ..."),fmtdir.c_str());
syspath.Append(fmtdirsc);
}
else
{
wxLogMessage(wxT("Appending %s ..."),scfmtdir.c_str());
wxLogDebug(wxT("Appending %s ..."),scfmtdir.c_str());
syspath.Append(scfmtdir);
}
@ -716,23 +716,23 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
}
else
{
wxLogMessage(wxT("wxSetEnv(%s) failed."),syspath.c_str());
wxLogDebug(wxT("wxSetEnv(%s) failed."),syspath.c_str());
}
}
else
{
wxLogMessage(wxT("in PATH."));
wxLogDebug(wxT("in PATH."));
}
}
else
{
wxLogMessage(wxT("PATH does not exist."));
wxLogDebug(wxT("PATH does not exist."));
}
#endif
//Load libavformat
avformat = new wxDynamicLibrary();
wxLogMessage(wxT("Loading avformat from %s"),libpath_format.c_str());
wxLogDebug(wxT("Loading avformat from %s"),libpath_format.c_str());
if (showerr)
mLogger->SetActiveTarget(NULL);
gotError = !avformat->Load(libpath_format, wxDL_LAZY);
@ -751,7 +751,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
if (!util) {
name.SetFullName(GetLibAVUtilName());
avutil = util = new wxDynamicLibrary();
wxLogMessage(wxT("Loading avutil from %s"),name.GetFullPath().c_str());
wxLogDebug(wxT("Loading avutil from %s"),name.GetFullPath().c_str());
if (showerr)
mLogger->SetActiveTarget(NULL);
util->Load(name.GetFullPath(), wxDL_LAZY);
@ -762,7 +762,7 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
if (!codec) {
name.SetFullName(GetLibAVCodecName());
avcodec = codec = new wxDynamicLibrary();
wxLogMessage(wxT("Loading avcodec from %s"),name.GetFullPath().c_str());
wxLogDebug(wxT("Loading avcodec from %s"),name.GetFullPath().c_str());
if (showerr)
mLogger->SetActiveTarget(NULL);
codec->Load(name.GetFullPath(), wxDL_LAZY);
@ -782,17 +782,17 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
if ( pathfix )
{
wxString oldpath = syspath.BeforeLast(wxT(';'));
wxLogMessage(wxT("Returning PATH to normal..."));
wxLogDebug(wxT("Returning PATH to normal..."));
wxSetEnv(wxT("PATH"),oldpath.c_str());
}
if (gotError) {
wxLogMessage(wxT("Failed to load FFmpeg libs"));
wxLogError(wxT("Failed to load FFmpeg libs"));
FreeLibs();
return false;
}
wxLogMessage(wxT("Importing symbols..."));
wxLogDebug(wxT("Importing symbols..."));
INITDYN(avformat,av_register_all);
INITDYN(avformat,av_open_input_file);
INITDYN(avformat,av_find_stream_info);
@ -882,12 +882,12 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
INITDYN(util,avutil_version);
//FFmpeg initialization
wxLogMessage(wxT("All symbols loaded successfully. Initializing the library."));
wxLogDebug(wxT("All symbols loaded successfully. Initializing the library."));
this->avcodec_init();
this->avcodec_register_all();
this->av_register_all();
wxLogMessage(wxT("Retrieving library version."));
wxLogDebug(wxT("Retrieving library version."));
int avcver = this->avcodec_version();
int avfver = this->avformat_version();
int avuver = this->avutil_version();
@ -895,20 +895,20 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
mAVFormatVersion = wxString::Format(wxT("%d.%d.%d"),avfver >> 16 & 0xFF, avfver >> 8 & 0xFF, avfver & 0xFF);
mAVUtilVersion = wxString::Format(wxT("%d.%d.%d"),avuver >> 16 & 0xFF, avuver >> 8 & 0xFF, avuver & 0xFF);
wxLogMessage(wxT("AVCodec version 0x%06x - %s (built against 0x%06x - %s)"),avcver,mAVCodecVersion.c_str(),LIBAVCODEC_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVCODEC_VERSION)).c_str());
wxLogMessage(wxT("AVFormat version 0x%06x - %s (built against 0x%06x - %s)"),avfver,mAVFormatVersion.c_str(),LIBAVFORMAT_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVFORMAT_VERSION)).c_str());
wxLogMessage(wxT("AVUtil version 0x%06x - %s (built against 0x%06x - %s)"),avuver,mAVUtilVersion.c_str(),LIBAVUTIL_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVUTIL_VERSION)).c_str());
wxLogDebug(wxT("AVCodec version 0x%06x - %s (built against 0x%06x - %s)"),avcver,mAVCodecVersion.c_str(),LIBAVCODEC_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVCODEC_VERSION)).c_str());
wxLogDebug(wxT("AVFormat version 0x%06x - %s (built against 0x%06x - %s)"),avfver,mAVFormatVersion.c_str(),LIBAVFORMAT_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVFORMAT_VERSION)).c_str());
wxLogDebug(wxT("AVUtil version 0x%06x - %s (built against 0x%06x - %s)"),avuver,mAVUtilVersion.c_str(),LIBAVUTIL_VERSION_INT,wxString::FromUTF8(AV_STRINGIFY(LIBAVUTIL_VERSION)).c_str());
int avcverdiff = (avcver >> 16 & 0xFF) - int(LIBAVCODEC_VERSION_MAJOR);
int avfverdiff = (avfver >> 16 & 0xFF) - int(LIBAVFORMAT_VERSION_MAJOR);
int avuverdiff = (avuver >> 16 & 0xFF) - int(LIBAVUTIL_VERSION_MAJOR);
wxLogMessage(wxT("AVCodec version mismatch is %d"),avcverdiff);
wxLogMessage(wxT("AVFormat version mismatch is %d"),avfverdiff);
wxLogMessage(wxT("AVUtil version mismatch is %d"),avuverdiff);
wxLogDebug(wxT("AVCodec version mismatch is %d"),avcverdiff);
wxLogDebug(wxT("AVFormat version mismatch is %d"),avfverdiff);
wxLogDebug(wxT("AVUtil version mismatch is %d"),avuverdiff);
//make sure that header and library major versions are the same
if (avcverdiff != 0 || avfverdiff != 0 || avuverdiff != 0)
{
wxLogMessage(wxT("Version mismatch! Libraries are unusable."));
wxLogError(wxT("Version mismatch! Libraries are unusable."));
return false;
}

View File

@ -62,10 +62,9 @@ extern "C" {
// if you needed them, any other audacity header files would go here
/* These defines apply whether or not ffmpeg is available */
#define INITDYN(w,f) if ((*(void**)&this->f=(void*)w->GetSymbol(wxT(#f))) == NULL) { wxLogMessage(wxT("Failed to load symbol ") wxT(#f)); return false; };
#define INITDYN(w,f) if ((*(void**)&this->f=(void*)w->GetSymbol(wxT(#f))) == NULL) { wxLogError(wxT("Failed to load symbol ") wxT(#f)); return false; };
/// Callback function to catch FFmpeg log messages.
/// Uses wxLogMessage.
void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl);
//----------------------------------------------------------------------------

View File

@ -378,7 +378,7 @@ void FreqWindow::GetAudio()
int selcount = 0;
int i;
bool warning = false;
wxLogMessage(wxT("Entering FreqWindow::GetAudio()"));
//wxLogDebug(wxT("Entering FreqWindow::GetAudio()"));
TrackListIterator iter(p->GetTracks());
Track *t = iter.First();
while (t) {
@ -431,11 +431,11 @@ void FreqWindow::GetAudio()
wxString msg;
msg.Printf(_("Too much audio was selected. Only the first %.1f seconds of audio will be analyzed."),
(mDataLen / mRate));
wxLogMessage(wxT("About to show length warning message"));
//wxLogDebug(wxT("About to show length warning message"));
wxMessageBox(msg);
wxLogMessage(wxT("Length warning message done"));
//wxLogDebug(wxT("Length warning message done"));
}
wxLogMessage(wxT("Leaving FreqWindow::GetAudio()"));
//wxLogDebug(wxT("Leaving FreqWindow::GetAudio()"));
}
void FreqWindow::OnSize(wxSizeEvent & event)
@ -924,7 +924,7 @@ void FreqWindow::OnCloseButton(wxCommandEvent & WXUNUSED(event))
void FreqWindow::Plot()
{
wxLogMessage(wxT("Starting FreqWindow::Plot()"));
//wxLogDebug(wxT("Starting FreqWindow::Plot()"));
if (mData) {
delete[]mData;
mData = NULL;
@ -939,12 +939,12 @@ void FreqWindow::Plot()
wxSizeEvent dummy;
OnSize( dummy );
wxLogMessage(wxT("Leaving FreqWindow::Plot()"));
//wxLogDebug(wxT("Leaving FreqWindow::Plot()"));
}
void FreqWindow::Recalc()
{
wxLogMessage(wxT("Starting FreqWindow::Recalc()"));
//wxLogDebug(wxT("Starting FreqWindow::Recalc()"));
if (mProcessed)
delete[] mProcessed;
mProcessed = NULL;
@ -1002,7 +1002,7 @@ void FreqWindow::Recalc()
wss = 1.0;
//Progress dialog over FFT operation
wxLogMessage(wxT("Starting progress dialogue in FreqWindow::Recalc()"));
//wxLogDebug(wxT("Starting progress dialogue in FreqWindow::Recalc()"));
ProgressDialog *mProgress = new ProgressDialog(_("FreqWindow"),_("Drawing Spectrum"));
int start = 0;
@ -1099,7 +1099,7 @@ void FreqWindow::Recalc()
mProgress->Update(1 - static_cast<float>(mDataLen - start) / mDataLen);
}
wxLogMessage(wxT("Finished updating progress dialogue in FreqWindow::Recalc()"));
//wxLogDebug(wxT("Finished updating progress dialogue in FreqWindow::Recalc()"));
switch (alg) {
double scale;
case 0: // Spectrum
@ -1211,7 +1211,7 @@ void FreqWindow::Recalc()
delete[]out2;
delete[]win;
wxLogMessage(wxT("About to draw plot in FreqWindow::Recalc()"));
//wxLogDebug(wxT("About to draw plot in FreqWindow::Recalc()"));
DrawPlot();
mFreqPlot->Refresh(true);
delete mProgress;

View File

@ -262,14 +262,14 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
// and the default video/audio codecs that the format uses.
if ((mEncFormatDesc = FFmpegLibsInst->guess_format(shortname, OSINPUT(mName), NULL)) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't determine format description for file \"%s\"."), mName.c_str());
wxLogError(wxT("FFmpeg : ERROR - Can't determine format description for file \"%s\"."), mName.c_str());
return false;
}
// mEncFormatCtx is used by libavformat to carry around context data re our output file.
if ((mEncFormatCtx = FFmpegLibsInst->av_alloc_format_context()) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't allocate output format context."));
wxLogError(wxT("FFmpeg : ERROR - Can't allocate output format context."));
return false;
}
@ -280,7 +280,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
// At the moment Audacity can export only one audio stream
if ((mEncAudioStream = FFmpegLibsInst->av_new_stream(mEncFormatCtx, 1)) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."), mName.c_str());
wxLogError(wxT("FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."), mName.c_str());
return false;
}
@ -292,7 +292,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
{
if ((err = ufile_fopen(&mEncFormatCtx->pb, mName, URL_WRONLY)) < 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d."), mName.c_str(),err);
wxLogError(wxT("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d."), mName.c_str(),err);
return false;
}
}
@ -301,7 +301,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
memset(&fpOutFile, 0, sizeof(AVFormatParameters));
if ((err = FFmpegLibsInst->av_set_parameters(mEncFormatCtx, &fpOutFile)) < 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't set output parameters for output file \"%s\". Error code is %d."), mName.c_str(),err);
wxLogError(wxT("FFmpeg : ERROR - Can't set output parameters for output file \"%s\". Error code is %d."), mName.c_str(),err);
return false;
}
@ -326,7 +326,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, Tags *m
// Write headers to the output file.
if ((err = FFmpegLibsInst->av_write_header(mEncFormatCtx)) < 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d."), mName.c_str(),err);
wxLogError(wxT("FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d."), mName.c_str(),err);
return false;
}
@ -450,7 +450,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Is the required audio codec compiled into libavcodec?
if ((codec = FFmpegLibsInst->avcodec_find_encoder(mEncAudioCodecCtx->codec_id)) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't find audio codec 0x%x."),mEncAudioCodecCtx->codec_id);
wxLogError(wxT("FFmpeg : ERROR - Can't find audio codec 0x%x."),mEncAudioCodecCtx->codec_id);
wxMessageBox(wxString::Format(_("FFmpeg cannot find audio codec 0x%x.\nSupport for this codec is probably not compiled in."),mEncAudioCodecCtx->codec_id));
return false;
}
@ -464,11 +464,11 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Open the codec.
if (FFmpegLibsInst->avcodec_open(mEncAudioCodecCtx, codec) < 0 || mEncAudioCodecCtx->frame_size == 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't open audio codec 0x%x."),mEncAudioCodecCtx->codec_id);
wxLogError(wxT("FFmpeg : ERROR - Can't open audio codec 0x%x."),mEncAudioCodecCtx->codec_id);
return false;
}
wxLogMessage(wxT("FFmpeg : Audio Output Codec Frame Size: %d samples."), mEncAudioCodecCtx->frame_size);
wxLogDebug(wxT("FFmpeg : Audio Output Codec Frame Size: %d samples."), mEncAudioCodecCtx->frame_size);
if ((mEncAudioCodecCtx->codec_id >= CODEC_ID_PCM_S16LE) && (mEncAudioCodecCtx->codec_id <= CODEC_ID_PCM_DVD))
{
@ -477,7 +477,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Allocate a buffer for the encoder to store encoded audio frames into.
if ((mEncAudioEncodedBuf = (uint8_t*)FFmpegLibsInst->av_malloc(mEncAudioEncodedBufSiz)) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't allocate buffer to hold encoded audio."));
wxLogError(wxT("FFmpeg : ERROR - Can't allocate buffer to hold encoded audio."));
return false;
}
@ -493,7 +493,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
// Allocate a buffer to read OUT of the FIFO into. The FIFO maintains its own buffer internally.
if ((mEncAudioFifoOutBuf = (uint8_t*)FFmpegLibsInst->av_malloc(2*MAX_AUDIO_PACKET_SIZE)) == NULL)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."));
wxLogError(wxT("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."));
return false;
}
@ -545,7 +545,7 @@ bool ExportFFmpeg::Finalize()
if (mEncAudioCodecCtx->frame_size != 1 && codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)
mEncAudioCodecCtx->frame_size = nFifoBytes / (mEncAudioCodecCtx->channels * sizeof(int16_t));
wxLogMessage(wxT("FFmpeg : Audio FIFO still contains %d bytes, writing %d sample frame ..."),
wxLogDebug(wxT("FFmpeg : Audio FIFO still contains %d bytes, writing %d sample frame ..."),
nFifoBytes, mEncAudioCodecCtx->frame_size);
// Pull the bytes out from the FIFO and feed them to the encoder.
@ -586,7 +586,7 @@ bool ExportFFmpeg::Finalize()
if (FFmpegLibsInst->av_interleaved_write_frame(mEncFormatCtx, &pkt) != 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Couldn't write last audio frame to output file."));
wxLogError(wxT("FFmpeg : ERROR - Couldn't write last audio frame to output file."));
break;
}
}
@ -668,14 +668,14 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, int frameSize)
if (mEncAudioCodecCtx->frame_size == 1) { wxASSERT(pkt.size == mEncAudioEncodedBufSiz); }
if (pkt.size < 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Can't encode audio frame."));
wxLogError(wxT("FFmpeg : ERROR - Can't encode audio frame."));
return false;
}
// Rescale from the codec time_base to the AVStream time_base.
if (mEncAudioCodecCtx->coded_frame && mEncAudioCodecCtx->coded_frame->pts != int64_t(AV_NOPTS_VALUE))
pkt.pts = FFmpegLibsInst->av_rescale_q(mEncAudioCodecCtx->coded_frame->pts, mEncAudioCodecCtx->time_base, mEncAudioStream->time_base);
//wxLogMessage(wxT("FFmpeg : (%d) Writing audio frame with PTS: %lld."), mEncAudioCodecCtx->frame_number, pkt.pts);
//wxLogDebug(wxT("FFmpeg : (%d) Writing audio frame with PTS: %lld."), mEncAudioCodecCtx->frame_number, pkt.pts);
pkt.stream_index = mEncAudioStream->index;
pkt.data = mEncAudioEncodedBuf;
@ -684,7 +684,7 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, int frameSize)
// Write the encoded audio frame to the output file.
if ((ret = FFmpegLibsInst->av_interleaved_write_frame(mEncFormatCtx, &pkt)) != 0)
{
wxLogMessage(wxT("FFmpeg : ERROR - Failed to write audio frame to file."));
wxLogError(wxT("FFmpeg : ERROR - Failed to write audio frame to file."));
return false;
}
}
@ -703,8 +703,13 @@ int ExportFFmpeg::Export(AudacityProject *project,
mSubFormat = AdjustFormatIndex(subformat);
if (channels > ExportFFmpegOptions::fmts[mSubFormat].maxchannels)
{
wxLogMessage(wxT("Attempted to export %d channels, but max. channels = %d"),channels,ExportFFmpegOptions::fmts[mSubFormat].maxchannels);
wxMessageBox(wxString::Format(_("Attempted to export %d channels, but max. channels for selected output format is %d"),channels,ExportFFmpegOptions::fmts[mSubFormat].maxchannels),_("Error"));
wxLogError(wxT("Attempted to export %d channels, but max. channels = %d"),channels,ExportFFmpegOptions::fmts[mSubFormat].maxchannels);
wxMessageBox(
wxString::Format(
_("Attempted to export %d channels, but maximum number of channels for selected output format is %d"),
channels,
ExportFFmpegOptions::fmts[mSubFormat].maxchannels),
_("Error"));
return false;
}
mName = fName;

View File

@ -343,8 +343,8 @@ int Importer::Import(wxString fName,
// False if override filter is not found
bool foundOverride = false;
gPrefs->Read(wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"), &usersSelectionOverrides, false);
wxLogMessage(wxT("LastOpenType is %s"),type.c_str());
wxLogMessage(wxT("OverrideExtendedImportByOpenFileDialogChoice is %i"),usersSelectionOverrides);
wxLogDebug(wxT("LastOpenType is %s"),type.c_str());
wxLogDebug(wxT("OverrideExtendedImportByOpenFileDialogChoice is %i"),usersSelectionOverrides);
if (usersSelectionOverrides)
{
@ -355,7 +355,7 @@ int Importer::Import(wxString fName,
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
{
// This plugin corresponds to user-selected filter, try it first.
wxLogMessage(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
importPlugins.Insert(plugin);
foundOverride = true;
}
@ -369,46 +369,46 @@ int Importer::Import(wxString fName,
{
ExtImportItem *item = &(*mExtImportItems)[i];
bool matches_ext = false, matches_mime = false;
wxLogMessage(wxT("Testing extensions"));
wxLogDebug(wxT("Testing extensions"));
for (size_t j = 0; j < item->extensions.Count(); j++)
{
wxLogMessage(wxT("%s"),item->extensions[j].Lower().c_str());
wxLogDebug(wxT("%s"),item->extensions[j].Lower().c_str());
if (wxMatchWild (item->extensions[j].Lower(),fName.Lower(), false))
{
wxLogMessage(wxT("Match!"));
wxLogDebug(wxT("Match!"));
matches_ext = true;
break;
}
}
if (item->extensions.Count() == 0)
{
wxLogMessage(wxT("Match! (empty list)"));
wxLogDebug(wxT("Match! (empty list)"));
matches_ext = true;
}
if (matches_ext)
wxLogMessage(wxT("Testing mime types"));
wxLogDebug(wxT("Testing mime types"));
else
wxLogMessage(wxT("Not testing mime types"));
wxLogDebug(wxT("Not testing mime types"));
for (size_t j = 0; matches_ext && j < item->mime_types.Count(); j++)
{
if (wxMatchWild (item->mime_types[j].Lower(),mime_type.Lower(), false))
{
wxLogMessage(wxT("Match!"));
wxLogDebug(wxT("Match!"));
matches_mime = true;
break;
}
}
if (item->mime_types.Count() == 0)
{
wxLogMessage(wxT("Match! (empty list)"));
wxLogDebug(wxT("Match! (empty list)"));
matches_mime = true;
}
if (matches_ext && matches_mime)
{
wxLogMessage(wxT("Complete match!"));
wxLogDebug(wxT("Complete match!"));
for (size_t j = 0; j < item->filter_objects.Count() && (item->divider < 0 || (int) j < item->divider); j++)
{
wxLogMessage(wxT("Inserting %s"),item->filter_objects[j]->GetPluginStringID().c_str());
wxLogDebug(wxT("Inserting %s"),item->filter_objects[j]->GetPluginStringID().c_str());
importPlugins.Append(item->filter_objects[j]);
}
foundItem = true;
@ -420,7 +420,7 @@ int Importer::Import(wxString fName,
bool prioritizeMp3 = false;
if (usersSelectionOverrides && !foundOverride)
importPlugins.Clear();
wxLogMessage(wxT("Applying default rule"));
wxLogDebug(wxT("Applying default rule"));
// Special treatment for mp3 files
if (wxMatchWild (wxT("*.mp3"),fName.Lower(), false))
prioritizeMp3 = true;
@ -434,19 +434,19 @@ int Importer::Import(wxString fName,
// Skip MP3 import plugin. Opens some non-mp3 audio files (ac3 for example) as garbage.
if (plugin->GetPluginFormatDescription().CompareTo( _("MP3 files") ) != 0)
{
wxLogMessage(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
wxLogDebug(wxT("Inserting %s"),plugin->GetPluginStringID().c_str());
importPlugins.Append(plugin);
}
else if (prioritizeMp3)
{
if (usersSelectionOverrides)
{
wxLogMessage(wxT("Inserting %s at 1"),plugin->GetPluginStringID().c_str());
wxLogDebug(wxT("Inserting %s at 1"),plugin->GetPluginStringID().c_str());
importPlugins.Insert((size_t) 1, plugin);
}
else
{
wxLogMessage(wxT("Inserting %s at 0"),plugin->GetPluginStringID().c_str());
wxLogDebug(wxT("Inserting %s at 0"),plugin->GetPluginStringID().c_str());
importPlugins.Insert((size_t) 0, plugin);
}
}
@ -464,7 +464,7 @@ int Importer::Import(wxString fName,
inFile = plugin->Open(fName);
if ( (inFile != NULL) && (inFile->GetStreamCount() > 0) )
{
wxLogMessage(wxT("Open() succeeded"));
wxLogMessage(wxT("Open(%s) succeeded"), fName.Lower().c_str());
// File has more than one stream - display stream selector
if (inFile->GetStreamCount() > 1)
{
@ -510,7 +510,7 @@ int Importer::Import(wxString fName,
}
importPluginNode = importPluginNode->GetNext();
}
wxLogMessage(wxT("Opening failed."));
wxLogError(wxT("Importer::Import: Opening failed."));
// None of our plugins can handle this file. It might be that
// Audacity supports this format, but support was not compiled in.
// If so, notify the user of this fact

View File

@ -379,14 +379,14 @@ bool FFmpegImportFileHandle::Init()
int err = ufile_fopen_input(&mFormatContext, mName);
if (err < 0)
{
wxLogMessage(wxT("FFmpeg : av_open_input_file() failed for file %s"),mName.c_str());
wxLogError(wxT("FFmpeg : av_open_input_file() failed for file %s"),mName.c_str());
return false;
}
err = FFmpegLibsInst->av_find_stream_info(mFormatContext);
if (err < 0)
{
wxLogMessage(wxT("FFmpeg : av_find_stream_info() failed for file %s"),mName.c_str());
wxLogError(wxT("FFmpeg : av_find_stream_info() failed for file %s"),mName.c_str());
return false;
}
@ -414,14 +414,14 @@ bool FFmpegImportFileHandle::InitCodecs()
AVCodec *codec = FFmpegLibsInst->avcodec_find_decoder(sc->m_codecCtx->codec_id);
if (codec == NULL)
{
wxLogMessage(wxT("FFmpeg : avcodec_find_decoder() failed. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
wxLogError(wxT("FFmpeg : avcodec_find_decoder() failed. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
//FFmpeg can't decode this stream, skip it
delete sc;
continue;
}
if (codec->type != sc->m_codecCtx->codec_type)
{
wxLogMessage(wxT("FFmpeg : Codec type mismatch, skipping. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
wxLogError(wxT("FFmpeg : Codec type mismatch, skipping. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
//Non-audio codec reported as audio? Nevertheless, we don't need THIS.
delete sc;
continue;
@ -429,7 +429,7 @@ bool FFmpegImportFileHandle::InitCodecs()
if (FFmpegLibsInst->avcodec_open(sc->m_codecCtx, codec) < 0)
{
wxLogMessage(wxT("FFmpeg : avcodec_open() failed. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
wxLogError(wxT("FFmpeg : avcodec_open() failed. Index[%02d], Codec[%02x - %s]"),i,sc->m_codecCtx->codec_id,sc->m_codecCtx->codec_name);
//Can't open decoder - skip this stream
delete sc;
continue;
@ -534,7 +534,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
if (mScs[s]->m_stream->start_time != int64_t(AV_NOPTS_VALUE))
{
stream_delay = mScs[s]->m_stream->start_time;
wxLogMessage(wxT("Stream %d start_time = %d, that would be %f milliseconds."), s, mScs[s]->m_stream->start_time, double(mScs[s]->m_stream->start_time)/AV_TIME_BASE*1000);
wxLogError(wxT("Stream %d start_time = %d, that would be %f milliseconds."), s, mScs[s]->m_stream->start_time, double(mScs[s]->m_stream->start_time)/AV_TIME_BASE*1000);
}
if (stream_delay != 0)
{

View File

@ -244,7 +244,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
// BEGIN_TASK_PROFILING("On Demand Drag and Drop 5 80 mb files into audacity, 5 wavs per task");
//BEGIN_TASK_PROFILING("On Demand open an 80 mb wav stereo file");
if (doEdit) {
wxLogDebug(wxT("Importing PCM Start\n"));
wxLogDebug(wxT("Importing PCM Start"));
// If this mode has been selected, we form the tracks as
// aliases to the files we're editing, i.e. ("foo.wav", 12000-18000)
@ -270,7 +270,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
//now go over the wavetrack/waveclip/sequence and load all the blockfiles into a ComputeSummaryTask.
//Add this task to the ODManager and the Track itself.
wxLogDebug(wxT("Importing PCM \n"));
wxLogDebug(wxT("Importing PCM"));
if(useOD)
{