Пример #1
0
        public bool FindAudioInfo(ref WM_MEDIA_TYPE mediaType, ref WaveFormat waveFormat)
        {
            bool            success = false;
            IWMStreamConfig stream  = null;
            IWMMediaProps   props   = null;
            Guid            mediaTypeGuid;

            IWMProfile profile = (IWMProfile)_reader;

            for (uint i = 0; i < _readerStreamCount; i++)
            {
                profile.GetStream(i, out stream);

                props = (IWMMediaProps)stream;

                WMMediaProps mediaProps = new WMMediaProps(props);

                mediaType     = mediaProps.MediaType;
                mediaTypeGuid = mediaType.majortype;

                if (mediaTypeGuid == MediaTypes.WMMEDIATYPE_Audio)
                {
                    Logger.WriteLogMessage("Found audio stream [" + i + "], format type [" + mediaType.formattype + "].");

                    waveFormat = (WaveFormat)Marshal.PtrToStructure(mediaType.pbFormat, typeof(WaveFormat));
                    success    = true;
                    break;
                }
            }

            return(success);
        }
Пример #2
0
        public bool FindAudioInfo(ref WM_MEDIA_TYPE mediaType, ref WaveFormat waveFormat)
        {
            bool success = false;
            IWMStreamConfig stream = null;
            IWMMediaProps props = null;
            Guid mediaTypeGuid;

            IWMProfile profile = (IWMProfile)_reader;

            for (uint i = 0; i < _readerStreamCount; i++)
            {
                profile.GetStream(i, out stream);

                props = (IWMMediaProps)stream;

                WMMediaProps mediaProps = new WMMediaProps(props);

                mediaType = mediaProps.MediaType;
                mediaTypeGuid = mediaType.majortype;

                if (mediaTypeGuid == MediaTypes.WMMEDIATYPE_Audio)
                {
                    Logger.WriteLogMessage("Found audio stream [" + i + "], format type [" + mediaType.formattype + "].");

                    waveFormat = (WaveFormat)Marshal.PtrToStructure(mediaType.pbFormat, typeof(WaveFormat));
                    success = true;
                    break;
                }
            }

            return success;
        }