public ImageOverFilter()
            : base("CSharp Image Overlay Filter")
        {
            vid.DSplugin = true;



            NativeMethods.AllocConsole();
            IntPtr         stdHandle      = NativeMethods.GetStdHandle(STD_OUTPUT_HANDLE);
            SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true);
            FileStream     fileStream     = new FileStream(safeFileHandle, FileAccess.Write);
            Encoding       encoding       = System.Text.Encoding.GetEncoding(MY_CODE_PAGE);
            StreamWriter   standardOutput = new StreamWriter(fileStream, encoding);

            standardOutput.AutoFlush = true;
            Console.SetOut(standardOutput);
            Console.WriteLine("This text you can see in console window.");

            AMMediaType pmt = new AMMediaType()
            {
                majorType = MediaType.Video, subType = MediaSubType.YUY2, formatType = MediaType.Video, formatPtr = IntPtr.Zero
            };

            SetMediaType(PinDirection.Input, pmt);
            pmt.Free();

            pmt = new AMMediaType()
            {
                majorType = MediaType.Video, subType = MediaSubType.RGB24, formatType = MediaType.Video, formatPtr = IntPtr.Zero
            };
            SetMediaType(PinDirection.Output, pmt);
            pmt.Free();
        }
Exemple #2
0
        public int GetNumberOfCapabilities(out int iCount, out int iSize)
        {
            iCount = 0;
            AMMediaType mt = new AMMediaType();

            while (GetMediaType(iCount, ref mt) == S_OK)
            {
                mt.Free(); iCount++;
            }
            ;
            iSize = Marshal.SizeOf(typeof(VideoStreamConfigCaps));
            return(NOERROR);
        }
Exemple #3
0
        public int GetNumberOfCapabilities(out int iCount, out int iSize)
        {
#if HAMED_LOG_METHOD_INFO
            MethodBase method = new StackTrace().GetFrame(0).GetMethod();
            Console.WriteLine(this.GetType().FullName + " - " + method.Name + " - " + method.ToString());
#endif

            iCount = 0;
            AMMediaType mt = new AMMediaType();
            while (GetMediaType(iCount, ref mt) == S_OK)
            {
                mt.Free(); iCount++;
            }
            ;
            iSize = Marshal.SizeOf(typeof(VideoStreamConfigCaps));
            return(NOERROR);
        }
Exemple #4
0
 public void Dispose()
 {
     _sourceStream = null;
     m_Filter      = null;
     if (m_pAllocator != IntPtr.Zero)
     {
         Marshal.Release(m_pAllocator);
         m_pAllocator = IntPtr.Zero;
     }
     AMMediaType.Free(ref m_mt);
     if (m_ConnectedPin != IntPtr.Zero)
     {
         Marshal.Release(m_ConnectedPin);
         m_ConnectedPin = IntPtr.Zero;
     }
     if (m_QualitySink != IntPtr.Zero)
     {
         Marshal.Release(m_QualitySink);
         m_QualitySink = IntPtr.Zero;
     }
 }