Exemplo n.º 1
0
        /// <summary>
        /// Open the media.
        /// Create the structures.
        /// </summary>
        protected override void OpenMediaAsync()
        {
            // Create a parser
            this.wavParser = new WavParser(this.stream);

            // Parse the header
            this.wavParser.ParseWaveHeader();

            this.wavParser.WaveFormatEx.ValidateWaveFormat();

            this.startPosition = this.currentPosition = this.wavParser.DataPosition;

            // Init
            Dictionary <MediaStreamAttributeKeys, string>  streamAttributes = new Dictionary <MediaStreamAttributeKeys, string>();
            Dictionary <MediaSourceAttributesKeys, string> sourceAttributes = new Dictionary <MediaSourceAttributesKeys, string>();
            List <MediaStreamDescription> availableStreams = new List <MediaStreamDescription>();

            // Stream Description
            streamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = this.wavParser.WaveFormatEx.ToHexString();
            MediaStreamDescription msd = new MediaStreamDescription(MediaStreamType.Audio, streamAttributes);

            this.audioDesc = msd;
            availableStreams.Add(this.audioDesc);

            sourceAttributes[MediaSourceAttributesKeys.Duration] = this.wavParser.Duration.ToString();
            ReportOpenMediaCompleted(sourceAttributes, availableStreams);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Close the media. Release the resources.
 /// </summary>
 protected override void CloseMedia()
 {
     // Close the stream
     this.startPosition = this.currentPosition = 0;
     this.wavParser     = null;
     this.audioDesc     = null;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Implementation of the IDisposable pattern
 /// </summary>
 /// <param name="disposing">Are we being destroyed</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.wavParser != null)
         {
             this.wavParser.Dispose();
             this.wavParser = null;
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Close the media. Release the resources.
        /// </summary>
        protected override void CloseMedia()
        {
            this.startPosition = this.currentPosition = 0;

            if (wavParser != null)
            {
                this.wavParser.Dispose();
            }

            this.wavParser = null;
            this.audioDesc = null;
            this.stream    = null;
        }
        /// <summary>
        /// Open the media.
        /// Create the structures.
        /// </summary>
        protected override void OpenMediaAsync()
        {
            // Create a parser
            this.wavParser = new WavParser(this.stream);

            // Parse the header
            this.wavParser.ParseWaveHeader();

            this.wavParser.WaveFormatEx.ValidateWaveFormat();

            this.startPosition = this.currentPosition = this.wavParser.DataPosition;

            // Init
            Dictionary<MediaStreamAttributeKeys, string> streamAttributes = new Dictionary<MediaStreamAttributeKeys, string>();
            Dictionary<MediaSourceAttributesKeys, string> sourceAttributes = new Dictionary<MediaSourceAttributesKeys, string>();
            List<MediaStreamDescription> availableStreams = new List<MediaStreamDescription>();

            // Stream Description
            streamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = this.wavParser.WaveFormatEx.ToHexString();
            MediaStreamDescription msd = new MediaStreamDescription(MediaStreamType.Audio, streamAttributes);

            this.audioDesc = msd;
            availableStreams.Add(this.audioDesc);

            sourceAttributes[MediaSourceAttributesKeys.Duration] = this.wavParser.Duration.ToString();
            ReportOpenMediaCompleted(sourceAttributes, availableStreams);
        }
 /// <summary>
 /// Implementation of the IDisposable pattern
 /// </summary>
 /// <param name="disposing">Are we being destroyed</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.wavParser != null)
         {
             this.wavParser.Dispose();
             this.wavParser = null;
         }
     }
 }
 /// <summary>
 /// Close the media. Release the resources.
 /// </summary>
 protected override void CloseMedia()
 {
     // Close the stream
     this.startPosition = this.currentPosition = 0;
     this.wavParser = null;
     this.audioDesc = null;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Close the media. Release the resources.
        /// </summary>
        protected override void CloseMedia()
        {
            this.startPosition = this.currentPosition = 0;

            if(wavParser != null)
                this.wavParser.Dispose();

            this.wavParser = null;
            this.audioDesc = null;
            this.stream = null;
        }