Exemple #1
0
        public HRESULT GetItemByIndex(uint unIndex, out Guid pguidKey, PropVariant pValue)
        {
            var hr = _type.GetItemByIndex(unIndex, out pguidKey, pValue);

            Trace("index: " + unIndex + " guid: " + pguidKey.ToName() + " value: " + (pValue != null  ? pValue.ToString() : "<null>") + " hr: " + hr);
            return(hr);
        }
Exemple #2
0
        public static IEnumerable <KeyValuePair <Guid, _MF_ATTRIBUTE_TYPE> > Enumerate(this IMFMediaType input)
        {
            if (input == null)
            {
                yield break;
            }

            for (var i = 0; i < Count(input); i++)
            {
                input.GetItemByIndex((uint)i, out Guid guid, null).ThrowOnError();
                input.GetItemType(guid, out var type).ThrowOnError();
                yield return(new KeyValuePair <Guid, _MF_ATTRIBUTE_TYPE>(guid, type));
            }
        }
 private string DescribeMediaType(IMFMediaType mediaType)
 {
     int attributeCount;
     mediaType.GetCount(out attributeCount);
     var sb = new StringBuilder();
     for (int n = 0; n < attributeCount; n++)
     {
         Guid key;
         var val = new PropVariant();
         mediaType.GetItemByIndex(n, out key, ref val);
         string propertyName = FieldDescriptionHelper.Describe(typeof(MediaFoundationAttributes), key);
         sb.AppendFormat("{0}={1}\r\n", propertyName, val.Value);
         val.Clear();
     }
     return sb.ToString();
 }
 private static void DescribeAttribute(IMFMediaType mediaType, int n, StringBuilder sb)
 {
     var variantPtr = Marshal.AllocHGlobal(MarshalHelpers.SizeOf<PropVariant>());
     try
     {
         Guid key;
         mediaType.GetItemByIndex(n, out key, variantPtr);
         var val = MarshalHelpers.PtrToStructure<PropVariant>(variantPtr);
         string propertyName = FieldDescriptionHelper.Describe(typeof (MediaFoundationAttributes), key);
         sb.AppendFormat("{0}={1}\r\n", propertyName, val.Value);
     }
     finally
     {
         PropVariant.Clear(variantPtr);
         Marshal.FreeHGlobal(variantPtr);
     }
 }
Exemple #5
0
        private static void DescribeAttribute(IMFMediaType mediaType, int n, StringBuilder sb)
        {
            var variantPtr = Marshal.AllocHGlobal(MarshalHelpers.SizeOf <PropVariant>());

            try
            {
                Guid key;
                mediaType.GetItemByIndex(n, out key, variantPtr);
                var    val          = MarshalHelpers.PtrToStructure <PropVariant>(variantPtr);
                string propertyName = FieldDescriptionHelper.Describe(typeof(MediaFoundationAttributes), key);
                sb.AppendFormat("{0}={1}\r\n", propertyName, val.Value);
            }
            finally
            {
                PropVariant.Clear(variantPtr);
                Marshal.FreeHGlobal(variantPtr);
            }
        }
        private string DescribeMediaType(IMFMediaType mediaType)
        {
            int attributeCount;

            mediaType.GetCount(out attributeCount);
            var sb = new StringBuilder();

            for (int n = 0; n < attributeCount; n++)
            {
                Guid key;
                var  val = new PropVariant();
                mediaType.GetItemByIndex(n, out key, ref val);
                string propertyName = FieldDescriptionHelper.Describe(typeof(MediaFoundationAttributes), key);
                sb.AppendFormat("{0}={1}\r\n", propertyName, val.Value);
                val.Clear();
            }
            return(sb.ToString());
        }