Example #1
0
HRESULT Trace::Log_ProcessInput(ABI::Windows::Foundation::Diagnostics::ILoggingActivity **ppActivity,DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags,REFERENCE_TIME presentationTime)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;
	fields->AddUInt32(HStringReference(L"InputStreamId").Get(), dwInputStreamID);

	if (pSample != nullptr)
	{
		REFERENCE_TIME sampleTime = 0,duration = 0;
		DWORD dwSampleFlags = 0, dwBufferCount = 0;
		pSample->GetSampleTime(&sampleTime);
		pSample->GetSampleDuration(&duration);
		pSample->GetSampleFlags(&dwSampleFlags);
		pSample->GetBufferCount(&dwBufferCount);
		fields->AddTimeSpan(HStringReference(L"Time").Get(), ABI::Windows::Foundation::TimeSpan() = { sampleTime });
		fields->AddTimeSpan(HStringReference(L"Duration").Get(), ABI::Windows::Foundation::TimeSpan() = { duration });
		fields->AddUInt32(HStringReference(L"SampleFlags").Get(), dwSampleFlags);
		fields->AddUInt32(HStringReference(L"BufferCount").Get(), dwBufferCount);
	}
	else
	{
		fields->AddEmpty(HStringReference(L"InputStreamId").Get());
		fields->AddEmpty(HStringReference(L"Time").Get());
		fields->AddEmpty(HStringReference(L"Duration").Get());
		fields->AddEmpty(HStringReference(L"SampleFlags").Get());
	}
	fields->AddTimeSpan(HStringReference(L"PresentationTime").Get(), ABI::Windows::Foundation::TimeSpan() = { presentationTime });
	fields->AddUInt32(HStringReference(L"Flags").Get(), dwFlags);

	hr = g_spLogChannel->StartActivityWithFields(HStringReference(MFT_PROCESS_INPUT).Get(), fields.Get(), ppActivity);
	return hr;
}
Example #2
0
HRESULT Trace::Log_ProcessOutput(ABI::Windows::Foundation::Diagnostics::ILoggingActivity **ppActivity,DWORD dwFlags, DWORD cOutputBufferCount,MFT_OUTPUT_DATA_BUFFER *pOutBuffer,REFERENCE_TIME presentationTime)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;
	fields->AddUInt32(HStringReference(L"OutputBufferCount").Get(), cOutputBufferCount);
	fields->AddTimeSpan(HStringReference(L"PresentationTime").Get(), ABI::Windows::Foundation::TimeSpan() = { presentationTime });
	fields->AddUInt32(HStringReference(L"Flags").Get(), dwFlags);
	hr = g_spLogChannel->StartActivityWithFields(HStringReference(MFT_PROCESS_OUTPUT).Get(), fields.Get(), ppActivity);
	return hr;
}
Example #3
0
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;
}
Example #4
0
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;
}
Example #5
0
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);

}
Example #6
0
HRESULT Trace::Log_SetLinearScale(size_t bins)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;

	fields->AddUInt32(HStringReference(L"NumberOfElements").Get(), bins);
	return g_spLogChannel->LogEventWithFields(HStringReference(APP_SETLINEARSCALE).Get(),fields.Get());
}
Example #7
0
HRESULT Trace::Log_SetOutputType(DWORD dwStreamID, IMFMediaType *pMediaType)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = GetMediaProperties(&fields, pMediaType);
	if (FAILED(hr))
		return hr;
	fields->AddUInt32(HStringReference(L"StreamId").Get(), dwStreamID);
	hr = g_spLogChannel->LogEventWithFields(HStringReference(MFT_SET_OUTPUT_TYPE).Get(), fields.Get());
	return hr;
}
Example #8
0
HRESULT Trace::Log_Configure(float outFrameRate, float overlapPercentage, unsigned fftLength)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;

	fields->AddSingle(HStringReference(L"OutFrameRate").Get(),outFrameRate);
	fields->AddSingle(HStringReference(L"Overlap").Get(), overlapPercentage);
	fields->AddUInt32(HStringReference(L"FFTLength").Get(), fftLength);
	return g_spLogChannel->LogEventWithFields(HStringReference(APP_CONFIGURE).Get(), fields.Get());
}
Example #9
0
HRESULT Trace::Log_ProcessMessage(MFT_MESSAGE_TYPE msgType, ULONG_PTR ulParam)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;
	fields->AddUInt32(HStringReference(L"Type").Get(), msgType);
	fields->AddUInt64(HStringReference(L"Param").Get(), ulParam);

	hr = g_spLogChannel->LogEventWithFields(HStringReference(MFT_PROCESS_MESSAGE).Get(), fields.Get());
	return hr;
}
Example #10
0
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);
}
Example #11
0
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());
}
Example #12
0
HRESULT Trace::Log_SetLogFScale(float lowFrequency, float highFrequency, unsigned outElementCount)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;

	fields->AddSingle(HStringReference(L"LowFrequency").Get(), lowFrequency);
	fields->AddSingle(HStringReference(L"HighFrequency").Get(), highFrequency);
	fields->AddUInt32(HStringReference(L"OutElementCount").Get(), outElementCount);
	return g_spLogChannel->LogEventWithFields(HStringReference(APP_SETLOGFSCALE).Get(), fields.Get());

}
Example #13
0
HRESULT Trace::Log_StartGetFrame(ABI::Windows::Foundation::Diagnostics::ILoggingActivity **ppActivity, REFERENCE_TIME presentationTime,const REFERENCE_TIME *pTimes,size_t queueSize)
{
	ComPtr<ILoggingFields> fields;
	HRESULT hr = CreateLoggingFields(&fields);
	if (FAILED(hr))
		return hr;

	fields->AddTimeSpan(HStringReference(L"PresentationTime").Get(), ABI::Windows::Foundation::TimeSpan() = { presentationTime });
	if (queueSize > 0)
		fields->AddTimeSpanArray(HStringReference(L"Queue").Get(), queueSize, (ABI::Windows::Foundation::TimeSpan *) pTimes);
	else
		fields->AddEmpty(HStringReference(L"Queue").Get());

	fields->AddUInt32(HStringReference(L"Queue.size").Get(),queueSize);
	return g_spLogChannel->StartActivityWithFields(HStringReference(APP_GETFRAME).Get(), fields.Get(), ppActivity);
}
Example #14
0
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());

}