Ejemplo n.º 1
0
        private IntPtr GetHBitmapCore(double position)
        {
            MFrame mFrame = null;

            _mfileObj.FileFrameGet(position, 0.0, out mFrame);
            M_AV_PROPS m_AV_PROPS = default(M_AV_PROPS);

            mFrame.FrameAVPropsGet(out m_AV_PROPS);

            m_AV_PROPS.vidProps.nWidth    = m_AV_PROPS.vidProps.nWidth / 5;
            m_AV_PROPS.vidProps.nHeight   = m_AV_PROPS.vidProps.nHeight / 5;
            m_AV_PROPS.vidProps.nRowBytes = m_AV_PROPS.vidProps.nRowBytes / 5;
            MFrame mFrame2 = null;

            mFrame.FrameConvert(ref m_AV_PROPS.vidProps, out mFrame2, string.Empty);
            long value = 0L;

            mFrame2.FrameVideoGetHbitmap(out value);

            Marshal.ReleaseComObject(mFrame);
            Marshal.ReleaseComObject(mFrame2);
            mFrame2 = null;
            mFrame  = null;

            return(new System.IntPtr(value));
        }
Ejemplo n.º 2
0
        private IntPtr GetMediaFileInfoInternal(string filePath, out double dblDuration)
        {
            IntPtr hBitmap = IntPtr.Zero;

            dblDuration = 0;
            if (_mfileObj != null)
            {
                try
                {
                    _mfileObj.FileNameSet(filePath, string.Empty);
                    _mfileObj.ObjectStart(null);
                    double dblIn, dblOut;

                    try
                    {
                        _mfileObj.FileInOutGet(out dblIn, out dblOut, out dblDuration);

                        if (dblDuration > 0)
                        {
                            MFrame mFrame = null;
                            _mfileObj.FileFrameGet(dblDuration / 2.0, 0.0, out mFrame);
                            long value = 0L;
                            mFrame.FrameVideoGetHbitmap(out value);

                            Marshal.ReleaseComObject(mFrame);
                            mFrame  = null;
                            hBitmap = new System.IntPtr(value);
                        }
                    }
                    finally
                    {
                        _mfileObj.ObjectClose();
                    }
                }
                catch
                {
                    hBitmap = IntPtr.Zero;
                }
            }
            return(hBitmap);
        }