public void DoTests() { Config(); StringBuilder sb = null; short iLen = 0; m_pProp.GetConnectionName(sb, ref iLen); sb = new StringBuilder(iLen); m_pProp.GetConnectionName(sb, ref iLen); Debug.Assert(sb.ToString() == "0"); sb = null; iLen = 0; m_pProp.GetStreamGroupName(sb, ref iLen); sb = new StringBuilder(iLen); m_pProp.GetStreamGroupName(sb, ref iLen); }
private void GetAudioOutput() { int cOutputs = 0; short i; IWMOutputMediaProps pProps = null; AMMediaType pMediaType = null; int cbType = 0; // // Sanity check // if (IsDisposed()) { throw new COMException("Instance has been Disposed", E_Unexpected); } // // Find out the output count // m_pReader.GetOutputCount(out cOutputs); // // Find one audio output. // Note: This sample only shows how to handle one audio output. // If there is more than one audio output, the first one will be picked. // StringBuilder sName = null; for (i = 0; i < cOutputs; i++) { m_pReader.GetOutputProps(i, out pProps); try { // // Find out the space needed for pMediaType // cbType = 0; pMediaType = null; pProps.GetMediaType(pMediaType, ref cbType); // Get the name of the output we'll be using sName = null; short iName = 0; pProps.GetConnectionName(sName, ref iName); sName = new StringBuilder(iName); pProps.GetConnectionName(sName, ref iName); pMediaType = new AMMediaType(); pMediaType.formatSize = cbType - Marshal.SizeOf(typeof(AMMediaType)); // // Get the value for MediaType // pProps.GetMediaType(pMediaType, ref cbType); try { if (MediaType.Audio == pMediaType.majorType) { m_pWfx = new WaveFormatEx(); Marshal.PtrToStructure(pMediaType.formatPtr, m_pWfx); break; } } finally { WMUtils.FreeWMMediaType(pMediaType); } } finally { Marshal.ReleaseComObject(pProps); } } if (i == cOutputs) { throw new COMException("Could not find an audio stream in the specified file", E_Unexpected); } m_dwAudioOutputNum = i; // Only deliver samples for the single output SetStreams(sName.ToString()); }