protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat) { _comObj = new DmoMP3DecoderObject(); var mediaObject = new MediaObject(Marshal.GetComInterfaceForObject(_comObj, typeof(IMediaObject))); return mediaObject; }
protected override MediaObject CreateMediaObject(WaveFormat inputFormat, WaveFormat outputFormat) { _comObj = new DmoMP3DecoderObject(); var mediaObject = new MediaObject(Marshal.GetComInterfaceForObject(_comObj, typeof(IMediaObject))); return(mediaObject); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (_comObj != null) { Marshal.ReleaseComObject(_comObj); _comObj = null; } }
/// <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)); }
/// <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; } }
/// <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; } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if(_comObj != null) { Marshal.ReleaseComObject(_comObj); _comObj = null; } }