Exemple #1
0
 public AmMediaType GetMinimumFreq(IPin OutputPin)
 {
     AmMediaType[] types = OutputPin.GetAllMediaTypes();
     IAMStreamConfig cfg = (IAMStreamConfig)OutputPin;
     AmMediaType currentType = cfg.GetFormat();
     WaveFormatEx currentWave = currentType.GetStruct<WaveFormatEx>();
     ShowMsg(String.Format(
         "CurrentOut: bps:{0} bit; ch:{1}, freq:{2} Hz",
         currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec
         ));
     AmMediaType minimum = currentType;
     foreach (AmMediaType type in types)
     {
         WaveFormatEx wave = type.GetStruct<WaveFormatEx>();
         ShowMsg(String.Format(
             "bps:{0} bit; ch:{1}, freq:{2} Hz",
             wave.wBitsPerSample, wave.nChannels, wave.nSamplesPerSec
             ));
         if (wave.wFormatTag == currentWave.wFormatTag &&
             wave.nChannels == currentWave.nChannels &&
             wave.wBitsPerSample == currentWave.wBitsPerSample &&
             wave.nSamplesPerSec < currentWave.nSamplesPerSec)
         {
             minimum = type;
             currentWave = minimum.GetStruct<WaveFormatEx>();
         }
     }
     ShowMsg(String.Format(
         "Selected: bps:{0} bit; ch:{1}, freq:{2} Hz",
         currentWave.wBitsPerSample, currentWave.nChannels, currentWave.nSamplesPerSec
         ));
     return minimum;
 }