Home > Software engineering >  On access to through the socket hai kang device camera data stream is sent to the client how to acqu
On access to through the socket hai kang device camera data stream is sent to the client how to acqu

Time:09-17

Hello everyone, I by socket telecommunication using mina framework to write a remote access to the sea, streaming real-time view, the current network communication has already passed, but on the server how to obtain video stream data sent to the client here is in trouble, don't know how to pick up the sea kang equipment data stream is sent to the client, client implementation preview
Hai kang SDK provides the callback source: now I add it to my source, how can I do to get to ask everybody to help
 public class FRealDataCallBack implements HCNetSDK. FRealDataCallBack_V30 {
@ Override
Public void invoke (NativeLong lRealHandle, int dwDataType, ByteByReference pBuffer, int dwBufSize,
Pointer pUser) {
//TODO Auto - generated method stub
HWND HWND=new HWND (Native getComponentPointer (top));
The switch (dwDataType) {
Case HCNetSDK.NET _DVR_SYSHEAD:
System. The out. Println (" System data ");
if (! PlayControl. PlayM4_GetPort (m_lPort)) {
System. The out. Println (" broadcast port number "+ playControl. PlayM4_GetPort (m_lPort));
break;
}
If (dwBufSize> 0 {
if (! PlayControl. PlayM4_SetStreamOpenMode (m_lPort. GetValue (), PlayCtrl. STREAME_REALTIME)) {
System. The out. Println (" set up a real-time streaming mode ");
break;
}
if (! PlayControl. PlayM4_OpenStream (m_lPort. GetValue (), pBuffer, dwBufSize, 1024 * 1024))//open flow interface
{
System. The out. Println (" open flow interface ");
break;
}

If (! PlayControl. PlayM4_Play (m_lPort. GetValue (), the HWND))//play begin
{
System. The out. Println (" played ");
break;
}

}

break;
Case HCNetSDK.NET _DVR_STREAMDATA:
If ((dwBufSize & gt; 0) & amp; & (m_lPort. GetValue (). IntValue ()! {
=1))if (! PlayControl. PlayM4_InputData (m_lPort. GetValue (), pBuffer, dwBufSize))//input stream data {
break;
}
}

CodePudding user response:

Hai kang not provide a demo

CodePudding user response:

reference 1st floor shiyanzi response:
hai kang is not provide any demo
but how doesn't know how to remove this flow data

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

The stream data is pBuffer the inside, can try to save read, etc

CodePudding user response:

Have you done?? O share the

CodePudding user response:

Do your own service transit? Hai kang have DEMO; In fact you with hai kang, certainly have a DEMO,

CodePudding user response:

The original poster can give hair related aspects of the code, in this, recently is really haven't a clue

CodePudding user response:

Webcams are actually provide RTSP this, can play any support this agreement,

CodePudding user response:

Hai kang play library has a set decoding PlayM4_SetDecCallBackEx callback function (int nPort, DECCBFUN DECCBFUN, IntPtr pDest, int nDestSize);
The second parameter is the callback function, decoding the YUV data will be spread to the callback function in the buff parameter
Take the YUV data processed is ok, don't know if I understand right

CodePudding user response:

Hai kang preview in the callback function will flow information; But exists in the pointer type IntPtr pBuffer, you will need to transfer the pointer byte [], then can be sent through the Tcp Socket, direct look at code:
 
Private void RealDataCallBack (Int32 lRealHandle, UInt32 dwDataType, IntPtr pBuffer, UInt32 dwBufSize, IntPtr pUser)
{
.//playing library code slightly, in the dome has
Byte [] write=new byte [dwBufSize];
Marshal. Copy (pBuffer, write, 0, the write. Length);
ThreadPool. QueueUserWorkItem (new WaitCallback sendSocket. SendMsg (), write);//sendSocket is a Socket client class before sent to instantiate the connection;
}
  • Related