IltmmAnalogVideoDecoder::get_AvailableTVFormats Example for C

   HRESULT        hr;
   long           lSupportFormats, lTVFormat, lLines; 
   VARIANT_BOOL   vLocked, vVCRLocked, vEnable; 
   IltmmAnalogVideoDecoder* pAnVidDec = NULL;

   hr = IltmmCapture_get_AnalogVideoDecoder(g_capture, &pAnVidDec); 
   if (FAILED(hr)) 
      return hr; 

   hr = IltmmAnalogVideoDecoder_get_AvailableTVFormats(pAnVidDec, &lSupportFormats); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_TVFormat(pAnVidDec, &lTVFormat); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   if ((lTVFormat != AnalogVideo_NTSC_M ) && (lSupportFormats & AnalogVideo_NTSC_M)) 
   {
      hr = IltmmAnalogVideoDecoder_put_TVFormat(pAnVidDec, AnalogVideo_NTSC_M); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }
   hr = IltmmAnalogVideoDecoder_get_HorizontalLocked(pAnVidDec, &vLocked); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_VCRHorizontalLocking(pAnVidDec, &vVCRLocked); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }
   if (vVCRLocked == VARIANT_FALSE) 
   {
      hr = IltmmAnalogVideoDecoder_put_VCRHorizontalLocking(pAnVidDec, VARIANT_TRUE); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }

   hr = IltmmAnalogVideoDecoder_get_NumberOfLines(pAnVidDec, &lLines); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_OutputEnable (pAnVidDec, &vEnable); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }
   if (vEnable == VARIANT_FALSE) 
   {
      hr = IltmmAnalogVideoDecoder_put_OutputEnable (pAnVidDec, VARIANT_TRUE); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }

   IltmmAnalogVideoDecoder_Release(pAnVidDec); 
   pAnVidDec = NULL; 

L_MULTIMEDIATEX_API HRESULT IltmmAnalogVideoDecoder_get_AvailableTVFormats_Example (IltmmCapture* pCapture)
{
   HRESULT        hr;
   long           lSupportFormats, lTVFormat, lLines; 
   VARIANT_BOOL   vLocked, vVCRLocked, vEnable; 
   IltmmAnalogVideoDecoder* pAnVidDec = NULL;

   hr = IltmmCapture_get_AnalogVideoDecoder(pCapture, &pAnVidDec); 
   if (FAILED(hr)) 
   return hr; 

   hr = IltmmAnalogVideoDecoder_get_AvailableTVFormats(pAnVidDec, &lSupportFormats); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_TVFormat(pAnVidDec, &lTVFormat); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   if ((lTVFormat != AnalogVideo_NTSC_M ) && (lSupportFormats & AnalogVideo_NTSC_M)) 
   {
      hr = IltmmAnalogVideoDecoder_put_TVFormat(pAnVidDec, AnalogVideo_NTSC_M); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }
   hr = IltmmAnalogVideoDecoder_get_HorizontalLocked(pAnVidDec, &vLocked); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_VCRHorizontalLocking(pAnVidDec, &vVCRLocked); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }
   if (vVCRLocked == VARIANT_FALSE) 
   {
      hr = IltmmAnalogVideoDecoder_put_VCRHorizontalLocking(pAnVidDec, VARIANT_TRUE); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }

   hr = IltmmAnalogVideoDecoder_get_NumberOfLines(pAnVidDec, &lLines); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }

   hr = IltmmAnalogVideoDecoder_get_OutputEnable (pAnVidDec, &vEnable); 
   if (FAILED(hr)) 
   {
      IltmmAnalogVideoDecoder_Release(pAnVidDec); 
      pAnVidDec = NULL; 
      return hr; 
   }
   if (vEnable == VARIANT_FALSE) 
   {
      hr = IltmmAnalogVideoDecoder_put_OutputEnable (pAnVidDec, VARIANT_TRUE); 
      if (FAILED(hr)) 
      {
         IltmmAnalogVideoDecoder_Release(pAnVidDec); 
         pAnVidDec = NULL; 
         return hr; 
      }
   }

   IltmmAnalogVideoDecoder_Release(pAnVidDec); 
   pAnVidDec = NULL; 

   return S_OK;
}