当前位置:编程学习 > C#/ASP.NET >>

大华监控视频dav转换avi的问题,提供dhplay.dll及sdk说明文档,能实现播放但未能实现转换AVI

大华监控视频dav转换avi的问题,提供dhplay.dll及sdk说明文档,能实现播放但未能实现转换AVI,我这里有个vc++的demo,有个C#的demo,但是C#demo没有转换功能,我自己写了转换的代码不行,有做过类似的问题的么?求赐教。  --------------------编程问答-------------------- 部分代码:
 private void button3_Click(object sender, EventArgs e)
        {
            if (ofdMain.FileName == "") return;

            bool b1 = DHPlay.PLAY_SetStreamOpenMode_p(0,1);

            bool b2 = DHPlay.PLAY_OpenStream_p(0, IntPtr.Zero, 0, (UInt32)900 * 1024);

            bool b3=DHPlay.PLAY_StartAVIConvert_p(0, ofdMain.FileName.Replace(".dav", ".avi"), AVIConvertCallback2, 0);

            FileStream SourceFile = File.OpenRead(ofdMain.FileName);
            //if (!SourceFile.Open(m_csSourceFile, CFile.modeRead | CFile.shareDenyNone))
            //{
            //    //PLAY_StopAVIConvert(DefineConstantsAVIConvertDlg.AVICONV_PORT);
            //    //PLAY_Stop(DefineConstantsAVIConvertDlg.AVICONV_PORT);
            //    //PLAY_CloseStream(DefineConstantsAVIConvertDlg.AVICONV_PORT);
            //}
            uint dwFileLen = (uint) SourceFile.Length;
            const int BUFLEN = 8 * 1024;
            byte[] InfoBuf = new byte[BUFLEN];
            uint nRead;
            uint dwCurPos = 0;
           bool m_bAVIConvEnable =true;
            while (m_bAVIConvEnable)
            {
                //memset(InfoBuf, 0, InfoBuf.Length);
                //nRead = SourceFile.Read(InfoBuf, BUFLEN);
                nRead = (uint)SourceFile.Read(InfoBuf,0 ,BUFLEN);
                if (nRead <= 0)
                {
                    break;
                }

                dwCurPos += nRead;

                //////////////////
                //byte[] test = new byte[5];
                GCHandle hObject = GCHandle.Alloc(InfoBuf, GCHandleType.Pinned);
                IntPtr pObject = hObject.AddrOfPinnedObject();

                if (hObject.IsAllocated)
                    hObject.Free();
 
                /////////////////
                while (m_bAVIConvEnable && !DHPlay.PLAY_InputData_p(0, InfoBuf, nRead))//阻塞为false
                {
                    Thread.Sleep(5);
                }

                double fpress = (double)dwCurPos / (double)dwFileLen;

                int iProgressPos = (int)(fpress * 1000.0);
                //if (m_bAVIConvEnable)
                //    pProgCtrl->SetPos(iProgressPos);
            }

        }
--------------------编程问答-------------------- --------------------编程问答-------------------- lz问题解决了吗?我也遇到这个问题了 --------------------编程问答-------------------- 楼主,请问你这个问题解决了吗?我现在也是的,求指教!求讨论!
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,