抓图函数:
[DllImport("playm4.dll")]
public static extern bool PlayM4_ConvertToBmpFile([MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nType, string sFileName);
回调函数:
[DllImport("playm4.dll")]
public static extern bool PlayM4_SetDisplayCallBack(int nPort, DisplayCBFun df);
委托:
public delegate void DisplayCBFun(int nPort, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nStamp, int nType, int nReserved);播放过程中点击抓图按钮执行的函数:
private void DisplayCBFun(int nPort, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nStamp, int nType, int nReserved)
{
if (!g_bCapPic)
{
return;
}
if (PlayMp4.PlayM4_ConvertToBmpFile(pBuf, nSize, nWidth, nHeight, nType, "abc.bmp")) {
MessageBox.Show("抓图成功");
}
g_bCapPic = false;
}
[DllImport("playm4.dll")]
public static extern bool PlayM4_ConvertToBmpFile([MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nType, string sFileName);
回调函数:
[DllImport("playm4.dll")]
public static extern bool PlayM4_SetDisplayCallBack(int nPort, DisplayCBFun df);
委托:
public delegate void DisplayCBFun(int nPort, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nStamp, int nType, int nReserved);播放过程中点击抓图按钮执行的函数:
private void DisplayCBFun(int nPort, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuf, int nSize, int nWidth, int nHeight, int nStamp, int nType, int nReserved)
{
if (!g_bCapPic)
{
return;
}
if (PlayMp4.PlayM4_ConvertToBmpFile(pBuf, nSize, nWidth, nHeight, nType, "abc.bmp")) {
MessageBox.Show("抓图成功");
}
g_bCapPic = false;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货