Part of the code:
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))//Blocking false
{
Thread.Sleep(5);
}
double fpress = (double)dwCurPos / (double)dwFileLen;
int iProgressPos = (int)(fpress * 1000.0);
//if (m_bAVIConvEnable)
// pProgCtrl->SetPos(iProgressPos);
}
}
Posted by Silvia at April 26, 2016 - 6:07 AM
The reply to 2012-03-09 16:31:53 was a moderator to delete
Posted by Stella at May 03, 2016 - 7:02 AM
The LZ problem is solved? I also have this problem
Posted by Tyler at May 18, 2016 - 7:20 AM
LZ, do you solve the problem? Me too, seeking advice! For discussion!
Posted by Christine at May 31, 2016 - 7:54 AM
LZ, do you solve the problem? Me too, seeking advice! For discussion!
Posted by Thomas at June 07, 2016 - 8:45 AM
If you solve, can you give me the way, please add my QQ:381893887, thank you
Posted by Thomas at June 10, 2016 - 9:25 AM
Started by Silvia at April 15, 2016 - 5:21 AM