Print Live Streams Example for C++

HRESULT PrintLiveStream(IltmsLiveStream* stream) 
{ 
	HRESULT hr; 
 
	// print the live stream's properties to stdout 
	_tprintf(_T("--- Live Stream ---\n\n")); 
 
 
	{ 
		CComBSTR v; 
		hr = stream->get_Path(&v); 
		if (FAILED(hr)) 
			goto error; 
		_tprintf(_T("Path = \"%s\"\n"), (LPCTSTR)CString(v)); 
 
	} 
   { 
	   CComPtr<IltmsDevices> devices; 
	   long selection; 
	   CComBSTR v; 
	   hr = stream->get_VideoDevices(&devices); 
	   if (FAILED(hr)) 
		   goto error; 
	   hr = devices->get_Selection(&selection); 
	   if (FAILED(hr)) 
		   goto error; 
	   if (selection < 0) 
	   { 
		   v = L"<none selected>"; 
	   } 
	   else 
	   { 
		   CComPtr<IltmsDevice> device; 
 
		   hr = devices->Item(selection, &device); 
		   if (FAILED(hr)) 
			   goto error; 
		   hr = device->get_FriendlyName(&v); 
		   if (FAILED(hr)) 
			   goto error; 
 
	   } 
	   _tprintf(_T("Video Device = \"%s\"\n"), (LPCTSTR)CString(v)); 
   } 
   { 
	   CComPtr<IltmsDevices> devices; 
	   long selection; 
	   CComBSTR v; 
	   hr = stream->get_AudioDevices(&devices); 
	   if (FAILED(hr)) 
		   goto error; 
	   hr = devices->get_Selection(&selection); 
	   if (FAILED(hr)) 
		   goto error; 
	   if (selection < 0) 
	   { 
		   v = L"<none selected>"; 
	   } 
	   else 
	   { 
		   CComPtr<IltmsDevice> device; 
 
		   hr = devices->Item(selection, &device); 
		   if (FAILED(hr)) 
			   goto error; 
		   hr = device->get_FriendlyName(&v); 
		   if (FAILED(hr)) 
			   goto error; 
 
	   } 
	   _tprintf(_T("Audio Device = \"%s\"\n"), (LPCTSTR)CString(v)); 
   } 
 
   { 
	   long v; 
	   hr = stream->get_VideoWidth(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("Video Width = %ld\n"), v); 
 
   } 
   { 
	   long v; 
	   hr = stream->get_VideoHeight(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("Video Height = %ld\n"), v); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_UseVideoInputSize(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("UseVideoInputSize = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   double v; 
	   hr = stream->get_VideoFrameRate(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("VideoFrameRate = %g\n"), v); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_UseVideoInputFrameRate(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("UseVideoInputFrameRate = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   long v; 
	   hr = stream->get_VideoBitRate(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("VideoBitRate = %ld\n"), v); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_QSVAcceleration(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("QSVAcceleration = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_CUDAAcceleration(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("CUDAAcceleration = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   CComPtr<IltmsAudioTypes> audiotypes; 
	   long selection; 
	   CComBSTR v; 
	   hr = stream->get_AudioTypes(&audiotypes); 
	   if (FAILED(hr)) 
		   goto error; 
	   hr = audiotypes->get_Selection(&selection); 
	   if (FAILED(hr)) 
		   goto error; 
	   if (selection < 0) 
	   { 
		   v = L"<none selected>"; 
	   } 
	   else 
	   { 
		   CComPtr<IltmsAudioType> audiotype; 
 
		   hr = audiotypes->Item(selection, &audiotype); 
		   if (FAILED(hr)) 
			   goto error; 
		   hr = audiotype->get_FriendlyName(&v); 
		   if (FAILED(hr)) 
			   goto error; 
 
	   } 
	   _tprintf(_T("Audio Type = \"%s\"\n"), (LPCTSTR)CString(v)); 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_UseDeviceEncoding(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("UseDeviceEncoding = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   double v; 
	   hr = stream->get_MinimumFragmentDuration(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("MinimumFragmentDuration = %g\n"), v); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_Enable(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("Enable = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_ActivateOnDemand(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("ActivateOnDemand = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   LONG v; 
	   hr = stream->get_IdleTimeOut(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("IdleTimeOut = %ld\n"), v); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_QSVDecoding(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("QSVDecoding = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_CUDADecoding(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   _tprintf(_T("CUDADecoding = %s\n"), (v == VARIANT_TRUE) ? _T("true") : _T("false")); 
 
   } 
   { 
	   VARIANT_BOOL v; 
	   hr = stream->get_HasVideoDeviceURL(&v); 
	   if (FAILED(hr)) 
		   goto error; 
	   if (v != VARIANT_FALSE) 
	   { 
		   CComBSTR v; 
		   hr = stream->get_VideoDeviceURL(&v); 
		   if (FAILED(hr)) 
			   goto error; 
		   _tprintf(_T("VideoDeviceURL = \"%s\"\n"), (LPCTSTR)CString(v)); 
 
	   } 
   } 
 
error: 
   _tprintf(_T("\n")); 
   return hr; 
} 
 
 
 
HRESULT PrintLiveStreams(IltmsServer* server) 
{ 
	HRESULT hr; 
	long count; 
 
	CComPtr<IltmsLiveStreams> streams; 
 
	hr = server->GetLiveStreams(&streams); 
	if (FAILED(hr)) 
		goto error; 
 
	hr = streams->get_Count(&count); 
	if (FAILED(hr)) 
		goto error; 
 
	for (long index = 0; index < count; index++) 
	{ 
		CComPtr<IltmsLiveStream> stream; 
		hr = streams->GetLiveStream(index, &stream); 
		if (FAILED(hr)) 
			goto error; 
		hr = PrintLiveStream(stream); 
		if (FAILED(hr)) 
			goto error; 
	} 
error: 
	return hr; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Media Streaming C API Help