Esempio n. 1
0
        private void AddTransforms(IEnumerable<IMFActivate> effects, string type)
        {
            foreach (var mft in effects)
            {
                int attributeCount;
                mft.GetCount(out attributeCount);
                var sb = new StringBuilder();
                sb.AppendFormat(type);
                sb.AppendLine();
                for (int n = 0; n < attributeCount; n++)
                {
                    Guid key;
                    var value = new PropVariant();
                    mft.GetItemByIndex(n, out key, ref value);
                    string propertyName = FieldDescriptionHelper.Describe(typeof(MediaFoundationAttributes), key);
                    if (key == MediaFoundationAttributes.MFT_INPUT_TYPES_Attributes || key == MediaFoundationAttributes.MFT_OUTPUT_TYPES_Attributes)
                    {
                        var types = value.GetBlobAsArrayOf<MFT_REGISTER_TYPE_INFO>();
                        sb.AppendFormat("{0}: {1} items:", propertyName, types.Length);
                        sb.AppendLine();
                        foreach (var t in types)
                        {
                            sb.AppendFormat("    {0}-{1}",
                                FieldDescriptionHelper.Describe(typeof(MediaTypes), t.guidMajorType),
                                FieldDescriptionHelper.Describe(typeof(AudioSubtypes), t.guidSubtype));
                            sb.AppendLine();
                        }
                    }
                    else if (key == MediaFoundationAttributes.MF_TRANSFORM_CATEGORY_Attribute)
                    {
                        sb.AppendFormat("{0}: {1}", propertyName, FieldDescriptionHelper.Describe(typeof(MediaFoundationTransformCategories), (Guid)value.Value));
                        sb.AppendLine();
                    }
                    else if (value.DataType == (VarEnum.VT_VECTOR | VarEnum.VT_UI1))
                    {
                        var b = (byte[])value.Value;
                        sb.AppendFormat("{0}: Blob of {1} bytes", propertyName, b.Length);
                        sb.AppendLine();
                    }
                    else
                    {
                        sb.AppendFormat("{0}: {1}", propertyName, value.Value);
                        sb.AppendLine();
                    }

                    value.Clear();
                }
                Transforms.Add(sb.ToString());
            }
        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 private static extern int PropVariantClear(ref PropVariant pvar);
Esempio n. 4
0
 internal static extern int PropVariantClear(ref PropVariant pvar);
Esempio n. 5
0
 /// <summary>
 /// allows freeing up memory, might turn this into a Dispose method?
 /// </summary>
 // Token: 0x060006AD RID: 1709 RVA: 0x00014C4A File Offset: 0x00012E4A
 public void Clear()
 {
     PropVariant.PropVariantClear(ref this);
 }