title: MF_MT_AUDIO_BITS_PER_SAMPLE Always Returns Zero for PCM Audio
body: <p>I've been trying to retrieve the bits per sample in the Media Foundation Framework but it always returns 0, or gives an 'requested attribute not found' HRESULT.</p>
  <p>Here's the code I've tried, the</p>
  <pre><code>DWORD streamIndex = 0, flag = 0;
  LONGLONG audioTimestamp = 0;
  ComPtr&lt;IMFSample&gt; pAudioSample = nullptr;
  HRESULT result = mImpl-&gt;mAudioSourceReader-&gt;ReadSample(mImpl-&gt;mAudioStreamIndex, 0, &amp;streamIndex, &amp;flag, &amp;audioTimestamp, &amp;pAudioSample);
  if (result != S_OK) {
      LogError(&quot;Failed to read audio sample..&quot;);
      return false;
  } 
  
  ComPtr&lt;IMFMediaType&gt; pAudioSampleMediaType;
  if (S_OK != mImpl-&gt;mAudioSourceReader-&gt;GetCurrentMediaType(mImpl-&gt;mAudioStreamIndex, &amp;pAudioSampleMediaType)) {
      LogError(&quot;Failed to set resampler input...&quot;);
      return false;
  }
  
  uint32_t inBitsPerSample;
  result = pAudioSampleMediaType-&gt;GetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, &amp;inBitsPerSample);
  result = pAudioSample-&gt;GetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, &amp;inBitsPerSample);
  
  inBitsPerSample = MFGetAttributeUINT32(pAudioSample.Get(), MF_MT_AUDIO_BITS_PER_SAMPLE, 0);
  </code></pre>
  <p>The program is working, but I have set the value to 32, this presumably works because I have a 32 bit audio file. Is there something else I need to do to retrieve the bits per sample from an audio sample?</p>
  <p>Many thanks,
  Peter</p>
  <p>Edit:</p>
  <p>Details of the media are:</p>
  <pre><code>Video file with LPCM Audio (mp4 container)
  Sample Rate 48000 Hz
  Bits Per Sample 16
  Channel Count 6
  </code></pre>