/// <summary>
 /// Populate the InnerList with a list of filters from a particular category
 /// </summary>
 protected void GetFilters(Guid category)
 {
     using (var enumDev = new CreateDevEnum((ICreateDevEnum) new Platform.CreateDevEnum()))
     {
         foreach (var moniker in enumDev.GetClasses(category))
         {
             using (new ComWrapper <IMoniker>(moniker))
             {
                 InnerList.Add(new BaseFilter(moniker));
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        ///  This method gets a System.Runtime.InteropServices.ComTypes.IMoniker object.
        ///
        ///  HACK: The only way to create a System.Runtime.InteropServices.ComTypes.IMoniker from a moniker
        ///  string is to use System.Runtime.InteropServices.ComTypes.IMoniker.ParseDisplayName(). So I
        ///  need ANY System.Runtime.InteropServices.ComTypes.IMoniker object so that I can call
        ///  ParseDisplayName(). Does anyone have a better solution?
        ///
        ///  This assumes there is at least one video compressor filter
        ///  installed on the system.
        /// </summary>
        private static IMoniker GetAnyMoniker()
        {
            var category = FilterCategory.VideoCompressorCategory;

            if (staticMonikers != null)
            {
                return(staticMonikers[0]);
            }

            staticMonikers = new IMoniker[1];
            // Get the system device enumerator
            using (var enumDev = new CreateDevEnum((ICreateDevEnum) new Platform.CreateDevEnum()))
            {
                staticMonikers[0] = enumDev.GetClasses(category).FirstOrDefault();
            }

            return(staticMonikers[0]);
        }