Print Live Stream Controls Example for C++

HRESULT PrintLiveStreamControl(IltmsLiveStreamControl* stream) 
{ 
   HRESULT hr; 
 
   // print the live stream control properties to stdout 
   _tprintf(_T("--- Live Stream Control ---\n\n")); 
   { 
      LONG v; 
 
      hr = stream->get_Handle(&v); 
      if (FAILED(hr)) 
         goto error; 
      _tprintf(_T("Handle = 0x%.8X\n"), v); 
   } 
   { 
      ltmsLiveStreamState v; 
 
      hr = stream->get_State(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      CString s; 
      switch (v) 
      { 
      case ltmsLiveStreamState_Stopped: 
         s = _T("Stopped"); 
         break; 
 
      case ltmsLiveStreamState_Activating: 
         s = _T("Activating"); 
         break; 
 
      case ltmsLiveStreamState_Active: 
         s = _T("Active"); 
         break; 
 
      case ltmsLiveStreamState_Inactive: 
         s = _T("Inactive"); 
         break; 
 
      case ltmsLiveStreamState_Error: 
         s = _T("Error"); 
         break; 
      } 
 
      _tprintf(_T("State = %s\n"), (LPCTSTR)s); 
   } 
   { 
      CComBSTR v; 
 
      hr = stream->get_Path(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      _tprintf(_T("Path = \"%s\"\n"), (LPCTSTR)CString(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_IdleTime(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      _tprintf(_T("IdleTime = %ld\n"), v); 
   } 
   { 
      LONG v; 
 
      hr = stream->get_IdleTimeOut(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      _tprintf(_T("IdleTimeOut = %ld\n"), v); 
   } 
   { 
      ltmsLiveStreamVideoEncoding v; 
 
      hr = stream->get_VideoEncoding(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      CString s; 
      switch (v) 
      { 
      case ltmsLiveStreamVideoEncoding_None: 
         s = _T("None"); 
         break; 
 
      case ltmsLiveStreamVideoEncoding_H264_Source: 
         s = _T("Source"); 
         break; 
 
      case ltmsLiveStreamVideoEncoding_H264_Software: 
         s = _T("Software"); 
         break; 
 
      case ltmsLiveStreamVideoEncoding_H264_QSV: 
         s = _T("QSV"); 
         break; 
 
      case ltmsLiveStreamVideoEncoding_H264_CUDA: 
         s = _T("CUDA"); 
         break; 
      } 
 
      _tprintf(_T("VideoEncoding = %s\n"), (LPCTSTR)s); 
   } 
   { 
      ltmsLiveStreamAudioEncoding v; 
 
      hr = stream->get_AudioEncoding(&v); 
      if (FAILED(hr)) 
         goto error; 
 
      CString s; 
      switch (v) 
      { 
      case ltmsLiveStreamAudioEncoding_None: 
         s = _T("None"); 
         break; 
 
      case ltmsLiveStreamAudioEncoding_AAC_Source: 
         s = _T("Source"); 
         break; 
 
      case ltmsLiveStreamAudioEncoding_AAC_Software: 
         s = _T("Software"); 
         break; 
      } 
 
      _tprintf(_T("AudioEncoding = %s\n"), (LPCTSTR)s); 
   } 
 
error: 
   _tprintf(_T("\n")); 
   return hr; 
} 
 
HRESULT PrintLiveStreamControls(IltmsServer* server) 
{ 
   HRESULT hr; 
   long count; 
   CComPtr streams; 
 
   hr = server->GetLiveStreamControls(&streams); 
   if (FAILED(hr)) 
      goto error; 
 
   hr = streams->get_Count(&count); 
   if (FAILED(hr)) 
      goto error; 
 
   for (long index = 0; index < count; index++) 
   { 
      CComPtr stream; 
      hr = streams->Item(index, &stream); 
      if (FAILED(hr)) 
         goto error; 
 
      hr = PrintLiveStreamControl(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