HRESULT Trace::Log_StartCopyRBData(ABI::Windows::Foundation::Diagnostics::ILoggingActivity **ppActivity, size_t bufferSize, const void *pReadPtr, const void *pWritePtr) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddUInt32(HStringReference(L"BufferSize").Get(), bufferSize); fields->AddUInt32WithFormat(HStringReference(L"pWrite").Get(), (UINT32)pWritePtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddUInt32WithFormat(HStringReference(L"pRead").Get(), (UINT32)pReadPtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); return g_spLogChannel->StartActivityWithFields(HStringReference(ANALYZER_GET_RB_DATA).Get(), fields.Get(), ppActivity); }
HRESULT Trace::Log_SA_Start_AppendInput(ABI::Windows::Foundation::Diagnostics::ILoggingActivity **ppActivity, REFERENCE_TIME sampleTime, size_t sampleCount,size_t samplesInBuffer, void *pWritePtr, void *pReadPtr, long inputSampleOffset, long expectedOffset) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddTimeSpan(HStringReference(L"Time").Get(), ABI::Windows::Foundation::TimeSpan() = { sampleTime }); fields->AddUInt32(HStringReference(L"SampleSize").Get(), sampleCount); fields->AddUInt32(HStringReference(L"BufferSize").Get(), samplesInBuffer); fields->AddUInt32WithFormat(HStringReference(L"pWrite").Get(), (UINT32)pWritePtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddUInt32WithFormat(HStringReference(L"pRead").Get(), (UINT32)pReadPtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddInt64(HStringReference(L"Offset").Get(), inputSampleOffset); fields->AddInt64(HStringReference(L"BufferOffset").Get(), expectedOffset); return g_spLogChannel->StartActivityWithFields(HStringReference(ANALYZER_APPEND_INPUT).Get(), fields.Get(), ppActivity); }
HRESULT Trace::Log_StopCopyRBData(ABI::Windows::Foundation::Diagnostics::ILoggingActivity *pActivity, bool bSuccess, size_t bufferSize, const void *pReadPtr, const void *pWritePtr) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddBoolean(HStringReference(L"Success").Get(), bSuccess); fields->AddUInt32(HStringReference(L"BufferSize").Get(), bufferSize); fields->AddUInt32WithFormat(HStringReference(L"pWrite").Get(), (UINT32)pWritePtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddUInt32WithFormat(HStringReference(L"pRead").Get(), (UINT32)pReadPtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); ComPtr<ILoggingActivity> spActivity = pActivity; ComPtr<ILoggingActivity2> spActivity2; spActivity.As(&spActivity2); HSTRING hName; spActivity->get_Name(&hName); return spActivity2->StopActivityWithFields(hName, fields.Get()); }
HRESULT Trace::Log_SA_Stop_AppendInput(ABI::Windows::Foundation::Diagnostics::ILoggingActivity *pActivity, REFERENCE_TIME sampleTime, size_t sampleSize, size_t samplesInBuffer, void *pWritePtr, void *pReadPtr, long expectedOffset) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddTimeSpan(HStringReference(L"Time").Get(), ABI::Windows::Foundation::TimeSpan() = { sampleTime }); fields->AddUInt32(HStringReference(L"SampleLength").Get(), sampleSize); fields->AddUInt32(HStringReference(L"BufferSize").Get(), samplesInBuffer); fields->AddUInt32WithFormat(HStringReference(L"pWrite").Get(), (UINT32)pWritePtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddUInt32WithFormat(HStringReference(L"pRead").Get(), (UINT32)pReadPtr, LoggingFieldFormat::LoggingFieldFormat_Hexadecimal); fields->AddInt64(HStringReference(L"BufferOffset").Get(), expectedOffset); ComPtr<ILoggingActivity> spActivity = pActivity; ComPtr<ILoggingActivity2> spActivity2; spActivity.As(&spActivity2); HSTRING hName; spActivity->get_Name(&hName); return spActivity2->StopActivityWithFields(hName, fields.Get()); }
HRESULT Trace::Log_ConfigureAnalyzer(UINT32 samplesPerAnalyzerOutputFrame, UINT32 overlap, UINT32 fftLength, HRESULT hConfigureResult) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddUInt32(HStringReference(L"SamplesPerFrame").Get(), samplesPerAnalyzerOutputFrame); fields->AddUInt32(HStringReference(L"Overlap").Get(), overlap); fields->AddUInt32(HStringReference(L"FFTLength").Get(), fftLength); fields->AddUInt32WithFormat(HStringReference(L"Result").Get(), hConfigureResult, LoggingFieldFormat::LoggingFieldFormat_HResult); hr = g_spLogChannel->LogEventWithFields(HStringReference(ANALYZER_CONFIGURE).Get(), fields.Get()); return hr; }
HRESULT Trace::Log_StopAnalyzerStep(ABI::Windows::Foundation::Diagnostics::ILoggingActivity * pActivity, REFERENCE_TIME time, HRESULT hResult) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddTimeSpan(HStringReference(L"Time").Get(), ABI::Windows::Foundation::TimeSpan() = { time }); fields->AddUInt32WithFormat(HStringReference(L"Result").Get(), hResult, LoggingFieldFormat::LoggingFieldFormat_HResult); ComPtr<ILoggingActivity> spActivity = pActivity; ComPtr<ILoggingActivity2> spActivity2; spActivity.As(&spActivity2); HSTRING hName; spActivity->get_Name(&hName); return spActivity2->StopActivityWithFields(hName, fields.Get()); }
HRESULT Trace::Log_ProcessEvent(DWORD dwStreamID, IMFMediaEvent * pEvent) { ComPtr<ILoggingFields> fields; HRESULT hr = CreateLoggingFields(&fields); if (FAILED(hr)) return hr; fields->AddUInt32(HStringReference(L"StreamId").Get(), dwStreamID); MediaEventType eventType; pEvent->GetType(&eventType); HRESULT hs; pEvent->GetStatus(&hs); fields->AddUInt32(HStringReference(L"Type").Get(), eventType); fields->AddUInt32WithFormat(HStringReference(L"Status").Get(), hs,LoggingFieldFormat::LoggingFieldFormat_HResult); hr = g_spLogChannel->LogEventWithFields(HStringReference(MFT_PROCESS_EVENT).Get(), fields.Get()); return hr; }