海康 通过回调函数获取了 数据 数据是h.264格式的 将数据解码
问个问题哦!
/// <summary>
/// 3.5.3.1.1.1注册编码图像数据流直接读取回调函数
/// 说 明: DS4000HC系列板卡新增的一种数据流读取方式,当启动数据捕获后,
/// StreamDirectReadCallback会提供数据流的地址、长度、帧类型等,供用户程序直接处理。
///
/// 函 数: int __stdcall RegisterStreamDirectReadCallback (STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context)
/// </summary>
/// <param name="StreamDirectReadCallback">编码数据流直接读取回调函数</param>
/// <param name="context">设备上下文</param>
/// <returns>成功返回0;失败返回错误号</returns>
[DllImport("DS40xxSDK.dll")]
Public static extern int RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback, IntPtr context);
/// <summary>
/// 编码数据流直接读取回调函数
///
/// typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context);
/// </summary>
/// <param name="channelNumber">通道号</param>
/// <param name="DataBuf">缓冲区地址</param>
/// <param name="Length">缓冲区长度</param>
/// <param name="FrameType">缓冲区数据帧类型</param>
/// <param name="context">设备上下文</param>
/// <returns></returns>
//public delegate int STREAM_DIRECT_READ_CALLBACK(uint channelNumber, byte[] DataBuf, uint Length, FrameType_t FrameType, IntPtr context);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int STREAM_DIRECT_READ_CALLBACK(int channelNumber, IntPtr DataBuf, int Length, FrameType_t FrameType, IntPtr context);
public int F_STREAM_DIRECT_READ_CALLBACK(int channelNumber, IntPtr DataBuf, int Length, FrameType_t FrameType, IntPtr context)
{
byte[] imagebuffer = new byte[Length];
//将数据存放到字节数组imgaebuffer中
Marshal.Copy(DataBuf, imagebuffer, 0, Length);
怎么将数据字节数据中的数据解码。
return 0;
}
我得到的数据流是h.264格式的。我怎么解码。 在线等