예제 #1
0
        protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
        {
            _comObj = new DmoMP3DecoderObject();
            var mediaObject = new MediaObject(Marshal.GetComInterfaceForObject(_comObj, typeof(IMediaObject)));

            return mediaObject;
        }
예제 #2
0
        protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
        {
            _comObj = new DmoMP3DecoderObject();
            var mediaObject = new MediaObject(Marshal.GetComInterfaceForObject(_comObj, typeof(IMediaObject)));

            return(mediaObject);
        }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (_comObj != null)
     {
         Marshal.ReleaseComObject(_comObj);
         _comObj = null;
     }
 }
예제 #4
0
        /// <summary>
        /// Returns a <see cref="MediaObject"/> to decode the mp3 data.
        /// </summary>
        /// <param name="inputFormat">Format of the mp3 data to decode.</param>
        /// <param name="outputFormat">Output format.</param>
        /// <returns><see cref="MediaObject"/> to decode the mp3 data.</returns>
        protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
        {
            //this can be experimental. We maybe have to switch to the CoCreateInstance method.
            //IntPtr ptr = IntPtr.Zero;
            //NativeMethods.CoCreateInstance(new Guid("bbeea841-0a63-4f52-a7ab-a9b3a84ed38a"), IntPtr.Zero,
            //    NativeMethods.CLSCTX.CLSCTX_INPROC_SERVER, typeof (MediaObject).GUID, out ptr);

            _comObj = new DmoMP3DecoderObject();
            var ptr = Marshal.GetComInterfaceForObject(_comObj, typeof(IMediaObject));

            return(new MediaObject(ptr));
        }
예제 #5
0
 /// <summary>
 /// Disposes the <see cref="DmoMp3Decoder"/>.
 /// </summary>
 /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (_comObj != null)
     {
         Marshal.ReleaseComObject(_comObj);
         _comObj = null;
     }
     if (_frameInfoCollection != null)
     {
         _frameInfoCollection.Dispose();
         _frameInfoCollection = null;
     }
 }
예제 #6
0
 /// <summary>
 /// Disposes the <see cref="DmoMp3Decoder"/>.
 /// </summary>
 /// <param name="disposing">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (_comObj != null)
     {
         Marshal.ReleaseComObject(_comObj);
         _comObj = null;
     }
     if (_frameInfoCollection != null)
     {
         _frameInfoCollection.Dispose();
         _frameInfoCollection = null;
     }
 }
예제 #7
0
        /// <summary>
        /// Returns a <see cref="MediaObject"/> to decode the mp3 data.
        /// </summary>
        /// <param name="inputFormat">Format of the mp3 data to decode.</param>
        /// <param name="outputFormat">Output format.</param>
        /// <returns><see cref="MediaObject"/> to decode the mp3 data.</returns>
        protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat)
        {
            //this can be experimental. We maybe have to switch to the CoCreateInstance method.
            //IntPtr ptr = IntPtr.Zero;
            //NativeMethods.CoCreateInstance(new Guid("bbeea841-0a63-4f52-a7ab-a9b3a84ed38a"), IntPtr.Zero,
            //    NativeMethods.CLSCTX.CLSCTX_INPROC_SERVER, typeof (MediaObject).GUID, out ptr);

            _comObj = new DmoMP3DecoderObject();
            var ptr = Marshal.GetComInterfaceForObject(_comObj, typeof (IMediaObject));
            try
            {
                return new MediaObject(ptr);
            }
            catch (Exception)
            {
                Marshal.Release(ptr);
                Marshal.ReleaseComObject(_comObj);
                throw;
            }
        }
예제 #8
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if(_comObj != null)
     {
         Marshal.ReleaseComObject(_comObj);
         _comObj = null;
     }
 }