IltmmWMProfile::get_MutualExclusionCount Example for C

For complete code, refer to the CNVWM demo.

// The example below checks all the streams for 
// a mutual object. If the quality is less than 50, 
// it is removed. 
void SetupMutualObjects(IltmmWMProfile *pProfile) 
{
   USES_CONVERSION; 

   IltmmWMMutualExclusion *pMutualExc = NULL; 
   IltmmWMStreamConfig *pStreamConfig = NULL; 
   long lMCount; 
   long lSCount; 
   long lStreamNumber; 
   long lQuality; 
   BSTR bstrData; 
   char strUpdate[255];
   int i;
   int j;

   IltmmWMProfile__get_MutualExclusionCount(pProfile, &lMCount); 

   // iterate through the objects
   for(i=0; i<lMCount; i++)
   {
      IltmmWMProfile__getMutualExclusion(pProfile, i, &pMutualExc); 

      IltmmWMMutualExclusion__get_StreamCount(pMutualExc, &lSCount); 

      if(lSCount == 0) 
      {
         IltmmWMProfile_RemoveMutualExclusion(pProfile, pMutualExc); 
         IltmmWMMutualExclusion_Release(pMutualExc); 
      }
      else
      {
         for(j=0; j<lSCount; j++)
         {
            // obtain the stream number
            IltmmWMMutualExclusion__getStream(pMutualExc, j, &lStreamNumber); 
            // get the stream using it's number
            IltmmWMProfile__getStreamByNumber (pProfile, lStreamNumber, &pStreamConfig); 
            // check it's quality, if it is less than 50, remove it... 
            IltmmWMStreamConfig__get_Quality(pStreamConfig, &lQuality); 
            if(lQuality < 50) 
            {
               // remove it... 
               IltmmWMMutualExclusion_RemoveStream(pMutualExc, lStreamNumber); 
            }

            // report the user with update... 
            IltmmWMMutualExclusion__get_Type(pMutualExc, &bstrData); 
            sprintf(strUpdate, "Updating Mutual object with type :\n %s", OLE2A(bstrData)); 
            SysFreeString(bstrData); 

            MessageBox(NULL, strUpdate, "Update...", MB_OK); 

            IltmmWMStreamConfig_Release(pStreamConfig); 
            IltmmWMMutualExclusion_Release(pMutualExc); 
         }
      }
   }
}