Ejemplo n.º 1
0
        /// <summary>
        /// Gets the pin media types.
        /// </summary>
        /// <returns>Returns collection of supported media types.</returns>
        public IEnumerable <AMMediaType> GetMediaTypes()
        {
            IEnumMediaTypes mediaTypes = null;

            try
            {
                var hr = Object.EnumMediaTypes(out mediaTypes);
                DsError.ThrowExceptionForHR(hr);
                var currentMediaType = new AMMediaType[1];
                while (mediaTypes.Next(1, currentMediaType, out _) == 0)
                {
                    try
                    {
                        yield return(currentMediaType[0]);
                    }
                    finally
                    {
                        DsUtils.FreeAMMediaType(currentMediaType[0]);
                    }
                }
            }
            finally
            {
                if (mediaTypes != null)
                {
                    DsUtils.ReleaseComObject(mediaTypes);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Releases a com object
 /// </summary>
 /// <param name="line">Log line input</param>
 /// <param name="o">Object to release</param>
 public static void ComObject(string line, object o)
 {
     if (o != null)
     {
         DsUtils.ReleaseComObject(o);
         //Log.Log.Debug("  Release {0} returns {1}", line, hr);
     }
 }
Ejemplo n.º 3
0
 private void Dispose(bool disposed)
 {
     if (Object != null)
     {
         DsUtils.ReleaseComObject(Object);
         Object = null;
     }
 }
Ejemplo n.º 4
0
        public static int ComObject(object o)
        {
            int hr = 0;

            if (o != null)
            {
                DsUtils.ReleaseComObject(o);
                if (hr != 0)
                {
                    //StackTrace st = new StackTrace(true);
                    //Log.Log.Debug("  Release {0} returns {1}", o, hr);
                }
            }
            return(hr);
        }