예제 #1
0
        public Form1()
        {
            InitializeComponent();

            MFFactoryClass m_objMFFactory = new MFFactoryClass();

            m_objMFFactory.PropsSet("hpu_pipeline", "false");
        }
예제 #2
0
        void GetNoSignalFrame()
        {
            Uri uri1 = new Uri("800m800.jpeg", UriKind.Relative);
            StreamResourceInfo sri          = Application.GetResourceStream(uri1);
            Bitmap             bm           = new Bitmap(sri.Stream);
            IntPtr             hBitmap      = bm.GetHbitmap();
            MFFactoryClass     frameFactory = new MFFactoryClass();

            frameFactory.MFFrameCreateFromHBITMAP(hBitmap.ToInt64(), out noSignalFrame, "");
            noSignalFrame.MFResize(eMFCC.eMFCC_Default, 1920, 1080, -1, out noSignalFrame, "", "");
        }
예제 #3
0
 private void thread_DoWork(CancellationToken token)
 {
     while (!token.IsCancellationRequested)
     {
         StreamResourceInfo sri          = Application.GetResourceStream(new Uri("/APP;component/Resources/noinputselected.png", UriKind.Relative));
         Bitmap             bm           = new Bitmap(sri.Stream);
         IntPtr             hBitmap      = bm.GetHbitmap();
         MFFactoryClass     frameFactory = new MFFactoryClass();
         frameFactory.MFFrameCreateFromHBITMAP(hBitmap.ToInt64(), out noSignalFrame, "");
         noSignalFrame.MFResize(eMFCC.eMFCC_Default, 1920, 1080, -1, out noSignalFrame, "", "");
     }
 }
예제 #4
0
        private void ChnageGPUPipelineProperty_btn_Click(object sender, EventArgs e)
        {
            m_objFile.FilePlayStop(0);
            Marshal.ReleaseComObject(m_objFile);

            MFFactoryClass m_objMFFactory = new MFFactoryClass();

            m_objMFFactory.PropsSet("gpu_pipeline", gpu_pipelineProperty);
            ChnageGPUPipelineProperty_btn.BackColor = ChnageGPUPipelineProperty_btn.BackColor == Color.Red ? Color.Green : Color.Red;
            gpu_pipelineProperty = gpu_pipelineProperty == "true" ? "false" : "true";

            StartMFile();
        }
예제 #5
0
        private void Reproduce_btn_Click(object sender, EventArgs e)
        {
            try
            {
                m_objPlaylist.FilePlayStop(0);
                Marshal.ReleaseComObject(m_objPlaylist);
            }
            catch
            { }
            m_objMFFactory = new MFFactoryClass();
            m_objMFFactory.PropsSet("gpu_pipeline", "true");

            OpenFile_btn_Click(null, null);
        }
예제 #6
0
        void TurnOnGPU_Pipeline()
        {
            if (!gpu_p)
            {
                m_objMFFactory = new MFFactoryClass();
                m_objMFFactory.PropsSet("gpu_pipeline", "true");

                gpu_p = true;
                GpuPipilineOn_btn.Text      = "GPU PIPELINE = ON";
                GpuPipilineOn_btn.BackColor = Color.Green;

                Reset_btn.Enabled            = true;
                PredifinedMatrix_txb.Enabled = true;
                ColorLevel_cmb.Enabled       = true;
                Red_trb.Enabled             = true;
                Green_trb.Enabled           = true;
                Blue_trb.Enabled            = true;
                Constant_trb.Enabled        = true;
                RedChannel_txb.Enabled      = true;
                GreenChannel_txb.Enabled    = true;
                BlueChannel_txb.Enabled     = true;
                ConstantChannel_txb.Enabled = true;

                //When we turn on the gpu_pipeline we need to recreate objects.
                //To continue playback from same position we take current and save it
                m_objMFile.FilePosGet(out double position);
                m_objMFile.FilePlayStop(0);

                Marshal.ReleaseComObject(m_objMFile);

                m_objMFile = new MFileClass();

                m_objMFile.PreviewWindowSet("", panelPreview.Handle.ToInt32());
                m_objMFile.PreviewEnable("", 1, 1);

                if (filePath.Length > 1)
                {
                    m_objMFile.FileNameSet(filePath, "loop=true");
                    m_objMFile.FilePosSet(position, 0);
                    m_objMFile.FilePlayStart();
                }
                PredifinedMatrix_txb.SelectedIndex = 0;
            }
        }
예제 #7
0
        private void thread_DoWork(CancellationToken token)
        {
            MFFactoryClass _factory = new MFFactoryClass();

            while (!token.IsCancellationRequested)
            {
                if (decode)
                {
                    MFFrame frame = null;

                    string path = String.Format(@"\\MLDiskStation\MLFiles\Trash\Roman\NetTestFiles\LG_jazz\LG_jazz\LG_jazz{0:d7}.jpg", index);

                    Debug.WriteLine("Picture:" + index.ToString());
                    index = ++index == 291 ? 0 : index; //291 is count of pictures in image sequences

                    {
                        Bitmap bmp = (Bitmap)System.Drawing.Image.FromFile(path);

                        Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
                        System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);

                        M_AV_PROPS avProps = new M_AV_PROPS();
                        avProps.vidProps.eVideoFormat = eMVideoFormat.eMVF_HD1080_30p;
                        avProps.vidProps.fccType      = eMFCC.eMFCC_RGB32;
                        avProps.vidProps.nWidth       = bmp.Width;
                        avProps.vidProps.nHeight      = -1 * bmp.Height; // Negative height for top-bottom RGB images (if positive->bottom-top)
                        avProps.vidProps.nRowBytes    = bmpData.Stride;  // distance between lines

                        _factory.MFFrameCreateFromMem(ref avProps, bmpData.Scan0.ToInt64(), 0, 0, out frame, "");

                        bmp.UnlockBits(bmpData);

                        bmp.Dispose();
                    }

                    M_AV_PROPS props;
                    int        samples;
                    frame.MFAVPropsGet(out props, out samples);
                    props.vidProps.eVideoFormat = eMVideoFormat.eMVF_HD1080_30p;
                    props.vidProps.dblRate      = 30.0;
                    props.vidProps.nAspectX     = 16;
                    props.vidProps.nAspectY     = 9;

                    MFFrame frameConvert;
                    int     nRest = 0;
                    frame.MFConvert(ref props, out frameConvert, out nRest, "", "");

                    m_objPreview.ReceiverFramePut(frameConvert, 0, "");
                    m_objWriter.ReceiverFramePut(frameConvert, -1, "");
                    if (stopWr)
                    {
                        m_objWriter.WriterClose(0);
                    }

                    Marshal.ReleaseComObject(frameConvert);
                    Marshal.ReleaseComObject(frame);

                    GC.Collect();
                }
            }
        }