Exemple #1
0
        public HResult GetStreamCount(
            MFInt pcInputStreams,
            MFInt pcOutputStreams
            )
        {
            HResult hr = HResult.S_OK;

            try
            {
                // Trace("GetStreamCount"); not interesting

                lock (m_TransformLockObject)
                {
                    // This template requires a fixed number of input and output
                    // streams (1 for each).
                    if (pcInputStreams != null)
                    {
                        pcInputStreams.Assign(1);
                    }

                    if (pcOutputStreams != null)
                    {
                        pcOutputStreams.Assign(1);
                    }
                }
            }
            catch (Exception e)
            {
                hr = (HResult)Marshal.GetHRForException(e);
            }

            return(hr); // CheckReturn(hr);
        }
Exemple #2
0
        /// <summary>
        /// Gets information from the registry about a Media Foundation transform (MFT).
        /// </summary>
        /// <param name="clsidMFT">The CLSID of the MFT to query.</param>
        /// <param name="name">Receives the name of the MFT.</param>
        /// <param name="inputTypes">Receives an array of input types supported by the MFT.</param>
        /// <param name="outputTypes">Receives an array of output types supported by the MFT.</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 GetInfo(Guid clsidMFT, out string name, out MFTRegisterTypeInfo[] inputTypes, out MFTRegisterTypeInfo[] outputTypes)
        {
            ArrayList inTypes       = new ArrayList();
            ArrayList outTypes      = new ArrayList();
            MFInt     inTypesCount  = new MFInt();
            MFInt     outTypesCount = new MFInt();

            HResult hr = MFExtern.MFTGetInfo(clsidMFT, out name, inTypes, inTypesCount, outTypes, outTypesCount, IntPtr.Zero);

            inputTypes = new MFTRegisterTypeInfo[inTypesCount];

            for (int i = 0; i < inTypesCount.ToInt32(); i++)
            {
                inputTypes[i] = (MFTRegisterTypeInfo)inTypes[i];
            }

            outputTypes = new MFTRegisterTypeInfo[outTypesCount];

            for (int i = 0; i < outTypesCount.ToInt32(); i++)
            {
                outputTypes[i] = (MFTRegisterTypeInfo)outTypes[i];
            }

            return(hr);
        }
Exemple #3
0
 public static extern void MFTEnum(
     [In, MarshalAs(UnmanagedType.Struct)] Guid guidCategory,
     [In] int Flags, // Must be zero
     [In, MarshalAs(UnmanagedType.LPStruct)] MFTRegisterTypeInfo pInputType,
     [In, MarshalAs(UnmanagedType.LPStruct)] MFTRegisterTypeInfo pOutputType,
     [In] IMFAttributes pAttributes,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "0", MarshalTypeRef = typeof(GAMarshaler))]
     ArrayList ppclsidMFT,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "0", MarshalTypeRef = typeof(GAMarshaler))]
     MFInt pcMFTs
     );
Exemple #4
0
 public static extern HResult _MFTGetInfo(
     [In, MarshalAs(UnmanagedType.Struct)] Guid clsidMFT,
     [MarshalAs(UnmanagedType.LPWStr)] out string pszName,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "0", MarshalTypeRef = typeof(RTIMarshaler))]
     ArrayList ppInputTypes,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "0", MarshalTypeRef = typeof(RTIMarshaler))]
     MFInt pcInputTypes,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "1", MarshalTypeRef = typeof(RTIMarshaler))]
     ArrayList ppOutputTypes,
     [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = "1", MarshalTypeRef = typeof(RTIMarshaler))]
     MFInt pcOutputTypes,
     IntPtr ip             // Must be IntPtr.Zero due to MF bug, but should be out IMFAttributes ppAttributes
     );
Exemple #5
0
        public HResult GetStreamLimits(
            MFInt pdwInputMinimum,
            MFInt pdwInputMaximum,
            MFInt pdwOutputMinimum,
            MFInt pdwOutputMaximum
            )
        {
            HResult hr = HResult.S_OK;

            try
            {
                Trace("GetStreamLimits");

                // This template requires a fixed number of input and output
                // streams (1 for each).

                lock (m_TransformLockObject)
                {
                    // Fixed stream limits.
                    if (pdwInputMinimum != null)
                    {
                        pdwInputMinimum.Assign(1);
                    }
                    if (pdwInputMaximum != null)
                    {
                        pdwInputMaximum.Assign(1);
                    }
                    if (pdwOutputMinimum != null)
                    {
                        pdwOutputMinimum.Assign(1);
                    }
                    if (pdwOutputMaximum != null)
                    {
                        pdwOutputMaximum.Assign(1);
                    }
                }
            }
            catch (Exception e)
            {
                hr = (HResult)Marshal.GetHRForException(e);
            }

            return(CheckReturn(hr));
        }