Hey Vilius,
I have found few errors in ur code. Changes marked with red bolded font. Let me know if it worked and if not I will paste my code snippets.
NET_DVR_RealPlay_V40 import (class SDKMethods):
[DllImport("HCNetSDK.dll")]
public static extern int NET_DVR_RealPlay_V40(int lUserID, ref Structs.LPNET_DVR_PREVIEWINFO lpPreviewInfo, Structs.REALDATACALLBACK fRealDataCallBack_V30, IntPtr pUser);
here my structures (class Structs):
public delegate void REALDATACALLBACK(int lPlayHandle, uint dwDataType, byte[] pBuffer, uint dwBufSize, IntPtr pUser);
public struct LPNET_DVR_PREVIEWINFO
{
public int lChannel; / Channel no.
public uint dwStreamType; / Stream type 0-main stream,1-sub stream,2-third stream,3-forth stream,4-fifth stream,5-sixth stream,7-seventh stream,8-eighth stream,9-ninth stream,10-tenth stream
public uint dwLinkMode; / Protocol type: 0-TCP, 1-UDP, 2-Muticast, 3-RTP,4-RTP/RTSP, 5-RSTP/HTTP
public IntPtr hPlayWnd; / Play window's handle; set NULL to disable preview
public uint bBlocked; /If data stream requesting process is blocked or not: 0-no, 1-yes
/if true, the SDK Connect failure return until 5s timeout , not suitable for polling to preview.
public uint bPassbackRecord; /0- not enable ,1 enable
public byte byPreviewMode; / Preview mode 0-normal preview,2-delay preview
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = Defines.STREAM_ID_LEN, ArraySubType = UnmanagedType.I1)]
public byte[] byStreamID;/Stream ID
public byte byProtoType; /0-private,1-RTSP
public byte byRes1;
public byte byVideoCodingType;
public uint dwDisplayBufNum; /soft player display buffer size(number of frames), range:1-50, default:1
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 216, ArraySubType = UnmanagedType.I1)]
public byte[] byRes;
}
and there is my calling function:
Structs.LPNET_DVR_PREVIEWINFO PrevInfo = new Structs.LPNET_DVR_PREVIEWINFO();
PrevInfo.hPlayWnd = this.host1.Handle;
PrevInfo.lChannel = 33; /check your digital channels for DVR, number 1 which you assigned is probably analog one. For example my digital channels starts with 33
PrevInfo.dwStreamType = 0;
PrevInfo.dwLinkMode = 1;
PrevInfo.bBlocked = 0;
PrevInfo.byPreviewMode = 0;
int player = SDKMethods.NET_DVR_RealPlay_V40(UserID, ref PrevInfo, null, IntPtr.Zero);
Console.WriteLine(player);
Best regards