/// <summary>
        /// Determines if a key exists in an IMFAttributes instance.
        /// </summary>
        /// <param name="attributes">A valid IMFAttributes instance.</param>
        /// <param name="guidKey">The key to test.</param>
        /// <returns>True if the instance have a value for the given key ; False otherwise.</returns>
        public static bool IsKeyExists(this IMFAttributes attributes, Guid guidKey)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            HResult hr = attributes.GetItem(guidKey, null);

            return(hr != HResult.MF_E_ATTRIBUTENOTFOUND);
        }
Exemple #2
0
        private static int CopyAttribute(IMFAttributes pSrc, IMFAttributes pDest, Guid key)
        {
            var variant = new PropVariant();

            var hr = pSrc.GetItem(key, variant);

            if (Succeeded(hr))
            {
                hr = pDest.SetItem(key, variant);
            }
            return(hr);
        }
Exemple #3
0
        HResult CopyAttribute(IMFAttributes pSrc, IMFAttributes pDest, Guid key)
        {
            PropVariant var = new PropVariant();

            HResult hr = HResult.S_OK;

            hr = pSrc.GetItem(key, var);
            if (Succeeded(hr))
            {
                hr = pDest.SetItem(key, var);
            }

            return(hr);
        }
Exemple #4
0
        private static MFVideoArea GetArea(IMFAttributes ia, Guid g)
        {
            PropVariant pv = new PropVariant();

            HResult hr = ia.GetItem(g, pv);

            if (hr == HResult.MF_E_ATTRIBUTENOTFOUND)
            {
                return(null);
            }

            MFError.ThrowExceptionForHR(hr);

            return(pv.GetBlob(typeof(MFVideoArea)) as MFVideoArea);
        }
Exemple #5
0
        public static object GetValue(this IMFAttributes obj, Guid key)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            var pv = new PropVariant();

            if (obj.GetItem(key, pv).IsError)
            {
                return(null);
            }

            return(pv.Value);
        }
Exemple #6
0
        public static object GetValue(this IMFAttributes input, Guid key)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            using (var pv = new PropVariant())
            {
                if (input.GetItem(key, pv).IsError)
                {
                    return(null);
                }

                return(pv.Value);
            }
        }
        /// <summary>
        /// Retrieves the value associated with a key.
        /// </summary>
        /// <param name="attributes">A valid IMFAttributes instance.</param>
        /// <param name="guidKey">The key that identifies the value to retrieve.</param>
        /// <param name="value">The value.</param>
        /// <returns>If this function succeeds, it returns the S_OK member. Otherwise, it returns another HResult's member that describe the error.</returns>
        public static HResult GetItem(this IMFAttributes attributes, Guid guidKey, out object value)
        {
            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            HResult hr = 0;

            value = null;

            using (PropVariant variant = new PropVariant())
            {
                hr = attributes.GetItem(guidKey, variant);
                if (hr.Succeeded())
                {
                    value = variant.GetObject();
                }
            }

            return(hr);
        }
Exemple #8
0
        int CopyAttribute(IMFAttributes pSrc, IMFAttributes pDest, Guid key)
        {
            PropVariant var = new PropVariant();

            int hr = S_Ok;

            hr = pSrc.GetItem(key, var);
            if (Succeeded(hr))
            {
                hr = pDest.SetItem(key, var);
            }

            return hr;
        }
Exemple #9
0
        private static int CopyAttribute(IMFAttributes pSrc, IMFAttributes pDest, Guid key)
        {
            var variant = new PropVariant();

            var hr = pSrc.GetItem(key, variant);
            if (Succeeded(hr))
                hr = pDest.SetItem(key, variant);
            return hr;
        }
Exemple #10
0
 public HResult GetItem(Guid guidKey, PropVariant pValue)
 {
     return(m_Attribs.GetItem(guidKey, pValue));
 }