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; 
    char temp[50]; 

   // Show all the information regarding the streams

   IltmmWMProfile__get_StreamCount(pProfile, &lStreamCount); 

   for(i=0; i<lStreamCount; i++)
   {
      IltmmWMProfile__getStream(pProfile, i, &pStreamConfig); 

      sprintf(temp, "[[ Stream %d ]]\n", i); 
      printf(temp); 

      // Get the major type of the stream
      IltmmWMStreamConfig__get_StreamType(pStreamConfig, &bstrString); 
      printf("Stream type : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Stream number
      IltmmWMStreamConfig__get_StreamNumber(pStreamConfig, &lValue); 
      printf("Stream number : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get Stream name
      IltmmWMStreamConfig__get_StreamName(pStreamConfig, &bstrString); 
      printf("Stream name : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Connection name
      IltmmWMStreamConfig__get_ConnectionName(pStreamConfig, &bstrString); 
      printf("Stream connection name : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Bitrate
      IltmmWMStreamConfig__get_Bitrate(pStreamConfig, &lValue); 
      printf("Stream bitrate : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get the maximum latency (time in milliseconds) between stream reception and display
      IltmmWMStreamConfig__get_BufferWindow(pStreamConfig, &lValue); 
      printf("Stream buffer window : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get the major type of the media in the stream
      IltmmWMStreamConfig__get_Type(pStreamConfig, &bstrString); 
      printf("Major type of the stream media : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get the maximum key frame time interval (in 100-nano seconds) 
      IltmmWMStreamConfig__get_MaxKeyFrameSpacing(pStreamConfig, &fValue); 
      printf("Maximum key frame time interval : ");
      sprintf(temp, "%.Ef", fValue); 
      printf(temp); 
      printf("\n");

      // Get the Quality, range from 0 to 100
      // where zero denotes maximum frame rate and 100 denotes maximum quality. 
      IltmmWMStreamConfig__get_Quality(pStreamConfig, &lValue); 
      printf("Stream quality : ");
      printf(ltoa(lValue, temp, 10)); 
      if(lValue == -1) 
         printf(" ...(Unknown)"); 
      printf("\n\n");

      IltmmWMStreamConfig_Release(pStreamConfig); 
   }

   IltmmWMProfile_Release(pProfile); 
}

For complete code, refer to the CNVWM demo.

LPTSTR OLE2A(LPCOLESTR lpw)
{
   static CHAR convert[512];

   if(!lpw)
      return NULL;

   convert[0] = '\0';

   WideCharToMultiByte(CP_ACP, 0, lpw, -1, convert, 512, NULL, NULL);

   return convert;
}

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

   // Show all the information regarding the streams

   IltmmWMProfile_get_StreamCount(pProfile, &lStreamCount); 

   for(i=0; i<lStreamCount; i++)
   {
      IltmmWMProfile_GetStream(pProfile, i, &pStreamConfig); 

      sprintf(temp, "[[ Stream %d ]]\n", i); 
      printf(temp); 

      // Get the major type of the stream
      IltmmWMStreamConfig_get_StreamType(pStreamConfig, &bstrString); 
      printf("Stream type : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Stream number
      IltmmWMStreamConfig_get_StreamNumber(pStreamConfig, &lValue); 
      printf("Stream number : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get Stream name
      IltmmWMStreamConfig_get_StreamName(pStreamConfig, &bstrString); 
      printf("Stream name : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Connection name
      IltmmWMStreamConfig_get_ConnectionName(pStreamConfig, &bstrString); 
      printf("Stream connection name : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get Bitrate
      IltmmWMStreamConfig_get_Bitrate(pStreamConfig, &lValue); 
      printf("Stream bitrate : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get the maximum latency (time in milliseconds) between stream reception and display
      IltmmWMStreamConfig_get_BufferWindow(pStreamConfig, &lValue); 
      printf("Stream buffer window : ");
      printf(ltoa(lValue, temp, 10)); 
      printf("\n");

      // Get the major type of the media in the stream
      IltmmWMStreamConfig_get_Type(pStreamConfig, &bstrString); 
      printf("Major type of the stream media : ");
      printf(OLE2A(bstrString)); 
      printf("\n");
      SysFreeString(bstrString); 

      // Get the maximum key frame time interval (in 100-nano seconds) 
      IltmmWMStreamConfig_get_MaxKeyFrameSpacing(pStreamConfig, &fValue); 
      printf("Maximum key frame time interval : ");
      sprintf(temp, "%.Ef", fValue); 
      printf(temp); 
      printf("\n");

      // Get the Quality, range from 0 to 100
      // where zero denotes maximum frame rate and 100 denotes maximum quality. 
      IltmmWMStreamConfig_get_Quality(pStreamConfig, &lValue); 
      printf("Stream quality : ");
      printf(ltoa(lValue, temp, 10)); 
      if(lValue == -1) 
         printf(" ...(Unknown)"); 
      printf("\n\n");

      IltmmWMStreamConfig_Release(pStreamConfig); 
   }

   IltmmWMProfile_Release(pProfile); 
}