IltmmWMProfile::GetStream Example for C++

For complete code, refer to the CNVWM demo.

void GetStreamInfo(IltmmWMProfile *pProfile)
{
   USES_CONVERSION;
   IltmmWMStreamConfig *pStreamConfig = NULL;
   BSTR bstrString;
   long lStreamCount;
   int i;
   long lValue;
   double fValue;
   WCHAR temp[50];

   // Show all the information regarding the streams
   pProfile->get_StreamCount(&lStreamCount);

   for (i=0; i<lStreamCount; i++)
   {
      pProfile->GetStream(i, &pStreamConfig);
      wsprintf(temp, TEXT("[[ Stream %d ]]\n"), i);
      wprintf(temp);

      // Get the major type of the stream
      pStreamConfig->get_StreamType(&bstrString);
      wprintf(TEXT("Stream type : %s\n"), bstrString);
      SysFreeString(bstrString);

      // Get Stream number
      pStreamConfig->get_StreamNumber(&lValue);
      wprintf(TEXT("Stream number : %d\n"), lValue);

      // Get Stream name
      pStreamConfig->get_StreamName(&bstrString);
      wprintf(TEXT("Stream name : %s\n"), bstrString);
      SysFreeString(bstrString);

      // Get Connection name
      pStreamConfig->get_ConnectionName(&bstrString);
      wprintf(TEXT("Stream connection name : %s\n"), bstrString);
      SysFreeString(bstrString);

      // Get Bitrate
      pStreamConfig->get_Bitrate(&lValue);
      wprintf(TEXT("Stream bitrate : %d\n"), lValue);

      // Get the maximum latency (time in milliseconds) between stream reception and display
      pStreamConfig->get_BufferWindow(&lValue);
      wprintf(TEXT("Stream buffer window : %d\n"), lValue);

      // Get the major type of the media in the stream
      pStreamConfig->get_Type(&bstrString);
      wprintf(TEXT("Major type of the stream media : %s\n"), bstrString);
      SysFreeString(bstrString);

      // Get the maximum key frame time interval (in 100-nano seconds)
      pStreamConfig->get_MaxKeyFrameSpacing(&fValue);
      wprintf(TEXT("Maximum key frame time interval : %.Ef\n"), fValue);
      
      // Get the Quality, range from 0 to 100
      // where zero denotes maximum frame rate and 100 denotes maximum quality.
      pStreamConfig->get_Quality(&lValue);
      if(lValue == -1)
         wprintf(TEXT(" ...(Unknown)\n"));
      else
         wprintf(TEXT("Stream quality : %d\n"), lValue);
      
      wprintf(TEXT("\n"));

      pStreamConfig->Release();
   }
   pProfile->Release();
}