diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2017-05-26 12:56:59 +0200 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2017-05-26 13:58:19 +0200 |
commit | ed4f4ac68bea6f8ca8c6a7d7a0cc2ac0f8a9afa9 (patch) | |
tree | 92151fe02a5230dbfa3eff7e505f7f28d83e57ac /plugins | |
parent | 1f554ad47197a3ddbef786632c6646887d8ed526 (diff) |
Use the new mixxx::Logger
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/soundsourcem4a/soundsourcem4a.cpp | 53 | ||||
-rw-r--r-- | plugins/soundsourcemediafoundation/soundsourcemediafoundation.cpp | 85 | ||||
-rw-r--r-- | plugins/soundsourcewv/soundsourcewv.cpp | 14 |
3 files changed, 82 insertions, 70 deletions
diff --git a/plugins/soundsourcem4a/soundsourcem4a.cpp b/plugins/soundsourcem4a/soundsourcem4a.cpp index 63f41eb4b9..57034bd69e 100644 --- a/plugins/soundsourcem4a/soundsourcem4a.cpp +++ b/plugins/soundsourcem4a/soundsourcem4a.cpp @@ -1,6 +1,7 @@ #include "soundsourcem4a.h" #include "util/sample.h" +#include "util/logging.h" #ifdef __WINDOWS__ #include <io.h> @@ -23,6 +24,8 @@ namespace mixxx { namespace { +const Logger kLogger("SoundSourceM4A"); + // MP4SampleId is 1-based const MP4SampleId kSampleBlockIdMin = 1; @@ -85,9 +88,9 @@ MP4TrackId findFirstAudioTrackId(MP4FileHandle hFile, const QString& fileName) { for (u_int32_t trackId = kMinTrackId; trackId <= maxTrackId; ++trackId) { const char* trackType = MP4GetTrackType(hFile, trackId); if (!isValidTrackType(trackType)) { - qWarning() << "Unsupported track type" + kLogger.warning() << "Unsupported track type" << QString((trackType == nullptr) ? "" : trackType); - qWarning() << "Skipping track" + kLogger.warning() << "Skipping track" << trackId << "of" << maxTrackId @@ -97,9 +100,9 @@ MP4TrackId findFirstAudioTrackId(MP4FileHandle hFile, const QString& fileName) { } const char* mediaDataName = MP4GetTrackMediaDataName(hFile, trackId); if (!isValidMediaDataName(mediaDataName)) { - qWarning() << "Unsupported media data name" + kLogger.warning() << "Unsupported media data name" << QString((mediaDataName == nullptr) ? "" : mediaDataName); - qWarning() << "Skipping track" + kLogger.warning() << "Skipping track" << trackId << "of" << maxTrackId @@ -115,9 +118,9 @@ MP4TrackId findFirstAudioTrackId(MP4FileHandle hFile, const QString& fileName) { if (MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4AudioType)) { return trackId; } else { - qWarning() << "Unsupported MPEG4 audio type" + kLogger.warning() << "Unsupported MPEG4 audio type" << int(mpeg4AudioType); - qWarning() << "Skipping track" + kLogger.warning() << "Skipping track" << trackId << "of" << maxTrackId @@ -129,9 +132,9 @@ MP4TrackId findFirstAudioTrackId(MP4FileHandle hFile, const QString& fileName) { return trackId; } } else { - qWarning() << "Unsupported audio type" + kLogger.warning() << "Unsupported audio type" << int(audioType); - qWarning() << "Skipping track" + kLogger.warning() << "Skipping track" << trackId << "of" << maxTrackId @@ -140,7 +143,7 @@ MP4TrackId findFirstAudioTrackId(MP4FileHandle hFile, const QString& fileName) { continue; } VERIFY_OR_DEBUG_ASSERT(!"unreachable code") { - qWarning() << "Skipping track" + kLogger.warning() << "Skipping track" << trackId << "of" << maxTrackId @@ -185,13 +188,13 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr m_hFile = MP4Read(getLocalFileName().toUtf8().constData()); #endif if (MP4_INVALID_FILE_HANDLE == m_hFile) { - qWarning() << "Failed to open file for reading:" << getUrlString(); + kLogger.warning() << "Failed to open file for reading:" << getUrlString(); return OpenResult::FAILED; } m_trackId = findFirstAudioTrackId(m_hFile, getLocalFileName()); if (MP4_INVALID_TRACK_ID == m_trackId) { - qWarning() << "No AAC track found:" << getUrlString(); + kLogger.warning() << "No AAC track found:" << getUrlString(); return OpenResult::ABORTED; } @@ -201,7 +204,7 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr // can't currently handle these. m_framesPerSampleBlock = MP4GetTrackFixedSampleDuration(m_hFile, m_trackId); if (MP4_INVALID_DURATION == m_framesPerSampleBlock) { - qWarning() << "Unable to determine the fixed sample duration of track" + kLogger.warning() << "Unable to determine the fixed sample duration of track" << m_trackId << "in file" << getUrlString(); // TODO(XXX): The following check for FFmpeg or any another available // AAC decoder should be done at runtime and not at compile time. @@ -217,7 +220,7 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr #else // Fallback: Use a default value if FFmpeg is not available (checked // at compile time). - qWarning() << "Fallback: Using a default sample duration of" + kLogger.warning() << "Fallback: Using a default sample duration of" << kDefaultFramesPerSampleBlock << "sample frames per block"; m_framesPerSampleBlock = kDefaultFramesPerSampleBlock; #endif // __FFMPEGFILE__ @@ -226,7 +229,7 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr const MP4SampleId numberOfSamples = MP4GetTrackNumberOfSamples(m_hFile, m_trackId); if (0 >= numberOfSamples) { - qWarning() << "Failed to read number of samples from file:" << getUrlString(); + kLogger.warning() << "Failed to read number of samples from file:" << getUrlString(); return OpenResult::FAILED; } m_maxSampleBlockId = kSampleBlockIdMin + (numberOfSamples - 1); @@ -236,7 +239,7 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr const u_int32_t maxSampleBlockInputSize = MP4GetTrackMaxSampleSize(m_hFile, m_trackId); if (maxSampleBlockInputSize == 0) { - qWarning() << "Failed to read MP4 DecoderConfigDescriptor.bufferSizeDB:" + kLogger.warning() << "Failed to read MP4 DecoderConfigDescriptor.bufferSizeDB:" << getUrlString(); return OpenResult::FAILED; } @@ -244,7 +247,7 @@ SoundSource::OpenResult SoundSourceM4A::tryOpen(const AudioSourceConfig& audioSr // Workaround for a possible bug in libmp4v2 2.0.0 (Ubuntu 16.04) // that returns 4278190742 when opening a corrupt file. // https://bugs.launchpad.net/mixxx/+bug/1594169 - qWarning() << "MP4 DecoderConfigDescriptor.bufferSizeDB =" + kLogger.warning() << "MP4 DecoderConfigDescriptor.bufferSizeDB =" << maxSampleBlockInputSize << ">" << kMaxSampleBlockInputSizeLimit @@ -268,7 +271,7 @@ bool SoundSourceM4A::openDecoder() { m_hDecoder = NeAACDecOpen(); if (m_hDecoder == nullptr) { - qWarning() << "Failed to open the AAC decoder!"; + kLogger.warning() << "Failed to open the AAC decoder!"; return false; } NeAACDecConfigurationPtr pDecoderConfig = NeAACDecGetCurrentConfiguration( @@ -283,7 +286,7 @@ bool SoundSourceM4A::openDecoder() { pDecoderConfig->defObjectType = LC; if (!NeAACDecSetConfiguration(m_hDecoder, pDecoderConfig)) { - qWarning() << "Failed to configure AAC decoder!"; + kLogger.warning() << "Failed to configure AAC decoder!"; return false; } @@ -293,7 +296,7 @@ bool SoundSourceM4A::openDecoder() { &configBufferSize)) { // Failed to get mpeg-4 audio config... this is ok. // NeAACDecInit2() will simply use default values instead. - qWarning() << "Failed to read the MP4 audio configuration." + kLogger.warning() << "Failed to read the MP4 audio configuration." << "Continuing with default values."; } @@ -302,7 +305,7 @@ bool SoundSourceM4A::openDecoder() { if (0 > NeAACDecInit2(m_hDecoder, configBuffer, configBufferSize, &samplingRate, &channelCount)) { free(configBuffer); - qWarning() << "Failed to initialize the AAC decoder!"; + kLogger.warning() << "Failed to initialize the AAC decoder!"; return false; } else { free(configBuffer); @@ -431,7 +434,7 @@ SINT SoundSourceM4A::seekSampleFrame(SINT frameIndex) { const SINT skipFrameCount = skipSampleFrames(prefetchFrameCount); DEBUG_ASSERT(skipFrameCount <= prefetchFrameCount); if (skipFrameCount < prefetchFrameCount) { - qWarning() << "Failed to prefetch sample data while seeking" + kLogger.warning() << "Failed to prefetch sample data while seeking" << skipFrameCount << "<" << prefetchFrameCount; } @@ -479,7 +482,7 @@ SINT SoundSourceM4A::readSampleFrames( if (!MP4ReadSample(m_hFile, m_trackId, m_curSampleBlockId, &pInputBuffer, &inputBufferLength, nullptr, nullptr, nullptr, nullptr)) { - qWarning() + kLogger.warning() << "Failed to read MP4 input data for sample block" << m_curSampleBlockId << "(" << "min =" << kSampleBlockIdMin << "," << "max =" @@ -527,7 +530,7 @@ SINT SoundSourceM4A::readSampleFrames( decodeBufferCapacity * sizeof(*pDecodeBuffer)); // Verify the decoding result if (0 != decFrameInfo.error) { - qWarning() << "AAC decoding error:" + kLogger.warning() << "AAC decoding error:" << decFrameInfo.error << NeAACDecGetErrorMessage(decFrameInfo.error) << getUrlString(); @@ -537,13 +540,13 @@ SINT SoundSourceM4A::readSampleFrames( // Verify the decoded sample data for consistency if (getChannelCount() != decFrameInfo.channels) { - qWarning() << "Corrupt or unsupported AAC file:" + kLogger.warning() << "Corrupt or unsupported AAC file:" << "Unexpected number of channels" << decFrameInfo.channels << "<>" << getChannelCount(); break; // abort } if (getSamplingRate() != SINT(decFrameInfo.samplerate)) { - qWarning() << "Corrupt or unsupported AAC file:" + kLogger.warning() << "Corrupt or unsupported AAC file:" << "Unexpected sampling rate" << decFrameInfo.samplerate << "<>" << getSamplingRate(); break; // abort diff --git a/plugins/soundsourcemediafoundation/soundsourcemediafoundation.cpp b/plugins/soundsourcemediafoundation/soundsourcemediafoundation.cpp index 1cc90fd0e9..dec2af968c 100644 --- a/plugins/soundsourcemediafoundation/soundsourcemediafoundation.cpp +++ b/plugins/soundsourcemediafoundation/soundsourcemediafoundation.cpp @@ -5,10 +5,11 @@ #include <propvarutil.h> #include "util/sample.h" +#include "util/logging.h" namespace { -const char* const kLogPreamble = "SoundSourceMediaFoundation:"; +const mixxx::Logger kLogger("SoundSourceMediaFoundation"); const SINT kBytesPerSample = sizeof(CSAMPLE); const SINT kBitsPerSample = kBytesPerSample * 8; @@ -54,7 +55,7 @@ SoundSourceMediaFoundation::~SoundSourceMediaFoundation() { SoundSource::OpenResult SoundSourceMediaFoundation::tryOpen(const AudioSourceConfig& audioSrcCfg) { VERIFY_OR_DEBUG_ASSERT(!SUCCEEDED(m_hrCoInitialize)) { - qWarning() << kLogPreamble + kLogger.warning() << "Cannot reopen file" << getUrlString(); return OpenResult::FAILED; @@ -66,14 +67,14 @@ SoundSource::OpenResult SoundSourceMediaFoundation::tryOpen(const AudioSourceCon m_hrCoInitialize = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (FAILED(m_hrCoInitialize)) { - qWarning() << kLogPreamble + kLogger.warning() << "failed to initialize COM"; return OpenResult::FAILED; } // Initialize the Media Foundation platform. m_hrMFStartup = MFStartup(MF_VERSION); if (FAILED(m_hrCoInitialize)) { - qWarning() << kLogPreamble + kLogger.warning() << "failed to initialize Media Foundation"; return OpenResult::FAILED; } @@ -89,14 +90,14 @@ SoundSource::OpenResult SoundSourceMediaFoundation::tryOpen(const AudioSourceCon &m_pSourceReader); if (FAILED(hr)) { - qWarning() << kLogPreamble + kLogger.warning() << "Error opening input file:" << fileName; return OpenResult::FAILED; } if (!configureAudioStream(audioSrcCfg)) { - qWarning() << kLogPreamble + kLogger.warning() << "Failed to configure audio stream"; return OpenResult::FAILED; } @@ -104,7 +105,7 @@ SoundSource::OpenResult SoundSourceMediaFoundation::tryOpen(const AudioSourceCon m_streamUnitConverter = StreamUnitConverter(getSamplingRate()); if (!readProperties()) { - qWarning() << kLogPreamble + kLogger.warning() << "Failed to read file properties"; return OpenResult::FAILED; } @@ -208,7 +209,7 @@ SINT SoundSourceMediaFoundation::seekSampleFrame( skipSampleFrames(frameIndex - m_currentFrameIndex); } if (m_currentFrameIndex != frameIndex) { - qWarning() << kLogPreamble + kLogger.warning() << "Seek to frame" << frameIndex << "failed"; @@ -223,7 +224,7 @@ SINT SoundSourceMediaFoundation::seekSampleFrame( m_currentFrameIndex = frameIndex; } } else { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSourceReader::SetCurrentPosition() failed" << hrSetCurrentPosition; safeRelease(&m_pSourceReader); // kill the reader @@ -279,7 +280,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( &streamPos, // [out] LONGLONG *pllTimestamp, &pSample); // [out] IMFSample **ppSample if (FAILED(hrReadSample)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSourceReader::ReadSample() failed" << hrReadSample << "-> abort decoding"; @@ -287,7 +288,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( break; // abort } if (dwFlags & MF_SOURCE_READERF_ERROR) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSourceReader::ReadSample()" << "detected stream errors" << "(MF_SOURCE_READERF_ERROR)" @@ -299,7 +300,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( DEBUG_ASSERT(pSample == nullptr); break; // finished reading } else if (dwFlags & MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSourceReader::ReadSample()" << "detected that the media type has changed" << "(MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED)" @@ -318,7 +319,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( HRESULT hrGetBufferCount = pSample->GetBufferCount(&dwSampleBufferCount); if (FAILED(hrGetBufferCount)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSample::GetBufferCount() failed" << hrGetBufferCount << "-> abort decoding"; @@ -329,7 +330,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( DWORD dwSampleTotalLengthInBytes = 0; HRESULT hrGetTotalLength = pSample->GetTotalLength(&dwSampleTotalLengthInBytes); if (FAILED(hrGetTotalLength)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSample::GetTotalLength() failed" << hrGetTotalLength << "-> abort decoding"; @@ -346,7 +347,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( sampleBufferCapacity *= 2; } if (m_sampleBuffer.getCapacity() < sampleBufferCapacity) { - qDebug() << kLogPreamble + kLogger.debug() << "Enlarging sample buffer capacity" << m_sampleBuffer.getCapacity() << "->" @@ -359,7 +360,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( IMFMediaBuffer* pMediaBuffer = nullptr; HRESULT hrGetBufferByIndex = pSample->GetBufferByIndex(dwSampleBufferIndex, &pMediaBuffer); if (FAILED(hrGetBufferByIndex)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFSample::GetBufferByIndex() failed" << hrGetBufferByIndex << "-> abort decoding"; @@ -374,7 +375,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( nullptr, &lockedSampleBufferLengthInBytes); if (FAILED(hrLock)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFMediaBuffer::Lock() failed" << hrLock << "-> abort decoding"; @@ -413,7 +414,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( writableChunk.size()); HRESULT hrUnlock = pMediaBuffer->Unlock(); VERIFY_OR_DEBUG_ASSERT(SUCCEEDED(hrUnlock)) { - qWarning() << kLogPreamble + kLogger.warning() << "IMFMediaBuffer::Unlock() failed" << hrUnlock; // ignore and continue @@ -424,7 +425,7 @@ SINT SoundSourceMediaFoundation::readSampleFrames( safeRelease(&pSample); if (dwSampleBufferIndex < dwSampleBufferCount) { // Failed to read data from all buffers -> kill the reader - qWarning() << kLogPreamble + kLogger.warning() << "Failed to read all buffered samples" << "-> abort and stop decoding"; safeRelease(&m_pSourceReader); @@ -456,7 +457,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->SetStreamSelection( MF_SOURCE_READER_ALL_STREAMS, false); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to deselect all streams"; return false; } @@ -464,7 +465,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->SetStreamSelection( kStreamIndex, true); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to select first audio stream"; return false; } @@ -474,7 +475,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->GetCurrentMediaType( kStreamIndex, &pAudioType); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get current media type from stream"; return false; } @@ -484,7 +485,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->GetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, &avgBytesPerSecond); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "error getting MF_MT_AUDIO_AVG_BYTES_PER_SECOND"; return false; } @@ -494,7 +495,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set major type to audio"; safeRelease(&pAudioType); return false; @@ -502,7 +503,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_Float); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set subtype format to float"; safeRelease(&pAudioType); return false; @@ -510,7 +511,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, true); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set all samples independent"; safeRelease(&pAudioType); return false; @@ -518,7 +519,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, true); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set fixed size samples"; safeRelease(&pAudioType); return false; @@ -527,7 +528,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32( MF_MT_AUDIO_BITS_PER_SAMPLE, kBitsPerSample); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set bits per sample:" << kBitsPerSample; safeRelease(&pAudioType); @@ -538,7 +539,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32( MF_MT_SAMPLE_SIZE, sampleSize); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set sample size:" << sampleSize; safeRelease(&pAudioType); @@ -549,7 +550,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->GetUINT32( MF_MT_AUDIO_NUM_CHANNELS, &numChannels); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get actual number of channels"; return false; } else { @@ -560,7 +561,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32( MF_MT_AUDIO_NUM_CHANNELS, numChannels); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set number of channels:" << numChannels; safeRelease(&pAudioType); @@ -573,7 +574,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->GetUINT32( MF_MT_AUDIO_SAMPLES_PER_SECOND, &samplesPerSecond); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get samples per second"; return false; } else { @@ -584,7 +585,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->SetUINT32( MF_MT_AUDIO_SAMPLES_PER_SECOND, samplesPerSecond); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set samples per second:" << samplesPerSecond; safeRelease(&pAudioType); @@ -598,7 +599,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->SetCurrentMediaType( kStreamIndex, nullptr, pAudioType); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to set media type"; safeRelease(&pAudioType); return false; @@ -611,7 +612,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->GetCurrentMediaType( kStreamIndex, &pAudioType); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to retrieve completed media type"; return false; } @@ -620,7 +621,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = m_pSourceReader->SetStreamSelection( kStreamIndex, true); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to select first audio stream (again)"; return false; } @@ -628,7 +629,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->GetUINT32( MF_MT_AUDIO_NUM_CHANNELS, &numChannels); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get actual number of channels"; return false; } @@ -637,7 +638,7 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a hr = pAudioType->GetUINT32( MF_MT_AUDIO_SAMPLES_PER_SECOND, &samplesPerSecond); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get the actual sample rate"; return false; } @@ -646,14 +647,14 @@ bool SoundSourceMediaFoundation::configureAudioStream(const AudioSourceConfig& a UINT32 leftoverBufferSizeInBytes = 0; hr = pAudioType->GetUINT32(MF_MT_SAMPLE_SIZE, &leftoverBufferSizeInBytes); if (FAILED(hr)) { - qWarning() << kLogPreamble << hr + kLogger.warning() << hr << "failed to get sample buffer size (in bytes)"; return false; } DEBUG_ASSERT((leftoverBufferSizeInBytes % kBytesPerSample) == 0); m_sampleBuffer.resetCapacity(leftoverBufferSizeInBytes / kBytesPerSample); DEBUG_ASSERT(m_sampleBuffer.getCapacity() > 0); - qDebug() << kLogPreamble + kLogger.debug() << "Sample buffer capacity" << m_sampleBuffer.getCapacity(); @@ -672,11 +673,11 @@ bool SoundSourceMediaFoundation::readProperties() { hr = m_pSourceReader->GetPresentationAttribute(MF_SOURCE_READER_MEDIASOURCE, MF_PD_DURATION, &prop); if (FAILED(hr)) { - qWarning() << kLogPreamble << "error getting duration"; + kLogger.warning() << "error getting duration"; return false; } setFrameCount(m_streamUnitConverter.toFrameIndex(prop.hVal.QuadPart)); - qDebug() << kLogPreamble << "Frame count" << getFrameCount(); + kLogger.debug() << "Frame count" << getFrameCount(); PropVariantClear(&prop); diff --git a/plugins/soundsourcewv/soundsourcewv.cpp b/plugins/soundsourcewv/soundsourcewv.cpp index d2a0393fdb..c8fba4d32a 100644 --- a/plugins/soundsourcewv/soundsourcewv.cpp +++ b/plugins/soundsourcewv/soundsourcewv.cpp @@ -1,9 +1,17 @@ +#include <QFile> + #include "soundsourcewv.h" -#include <QFile> +#include "util/logging.h" namespace mixxx { +namespace { + +const Logger kLogger("SoundSourceWV"); + +} // anonymous namespace + //static WavpackStreamReader SoundSourceWV::s_streamReader = { SoundSourceWV::ReadBytesCallback, @@ -52,7 +60,7 @@ SoundSource::OpenResult SoundSourceWV::tryOpen(const AudioSourceConfig& audioSrc m_wpc = WavpackOpenFileInputEx(&s_streamReader, m_pWVFile, m_pWVCFile, msg, openFlags, 0); if (!m_wpc) { - qDebug() << "SSWV::open: failed to open file : " << msg; + kLogger.debug() << "failed to open file : " << msg; return OpenResult::FAILED; } @@ -107,7 +115,7 @@ SINT SoundSourceWV::seekSampleFrame(SINT frameIndex) { m_curFrameIndex = frameIndex; return frameIndex; } else { - qDebug() << "SSWV::seek : could not seek to frame #" << frameIndex; + kLogger.debug() << "could not seek to frame #" << frameIndex; return WavpackGetSampleIndex(m_wpc); } } |