2024年1月3日发(作者:)
public int GetNextVideoFrame_Rgb(byte[] buffer, Int32 bufferLen) { int result = tVideoFrame_Rgb(_handleDecode, buffer, bufferLen); return result; } public int GetVideoFrameSize_Rgb2(Int32 width, Int32 height) { int result = eoFrameSize_Rgb2(_handleDecode, width, height); return result; } public int GetNextVideoFrame_Rgb2(byte[] buffer, Int32 bufferLen, Int32 width, Int32 height) { int result = tVideoFrame_Rgb2(_handleDecode, buffer, bufferLen, width, height); return result; } } public enum EN_H264Algorithm { SWS_FAST_BILINEAR = 1, SWS_BILINEAR = 2, SWS_BICUBIC = 4, SWS_X = 8, SWS_POINT = 0x10, SWS_AREA = 0x20, SWS_BICUBLIN = 0x40, SWS_GAUSS = 0x80, SWS_SINC = 0x100, SWS_LANCZOS = 0x200, SWS_SPLINE = 0x400, } public class H264DecodeWrapper { private const string DLLName = ""; [DllImport(DLLName, EntryPoint = "H264_CreateHandle", CallingConvention = )] private static extern long H264_CreateHandle(); [DllImport(DLLName, EntryPoint = "H264_CloseHandle", CallingConvention = )] private static extern Int32 H264_CloseHandle(long handle); [DllImport(DLLName, EntryPoint = "H264_PutVideoStream", CallingConvention = )] private static extern Int32 H264_PutVideoStream(long handle, IntPtr buffer, Int32 bufferLen); [DllImport(DLLName, EntryPoint = "H264_GetVideoParam", CallingConvention = )] private static extern Int32 H264_GetVideoParam(long handle, IntPtr width, IntPtr height); [DllImport(DLLName, EntryPoint = "H264_GetVideoFrameSize", CallingConvention = )] private static extern Int32 H264_GetVideoFrameSize(long handle); [DllImport(DLLName, EntryPoint = "H264_GetVideoFrameFormate", CallingConvention = )] private static extern Int32 H264_GetVideoFrameFormate(long handle); [DllImport(DLLName, EntryPoint = "H264_GetNextVideoFrame", CallingConvention = )] private static extern Int32 H264_GetNextVideoFrame(long handle, IntPtr buffer, Int32 bufferLen, Int32 yuFormate); [DllImport(DLLName, EntryPoint = "H264_GetVideoFrameSize_Rgb", CallingConvention = )] private static extern Int32 H264_GetVideoFrameSize_Rgb(long handle); [DllImport(DLLName, EntryPoint = "H264_GetNextVideoFrame_Rgb", CallingConvention = )] private static extern Int32 H264_GetNextVideoFrame_Rgb(long handle, IntPtr buffer, Int32 bufferLen); [DllImport(DLLName, EntryPoint = "H264_GetVideoFrameSize_Rgb2", CallingConvention = )] private static extern Int32 H264_GetVideoFrameSize_Rgb2(long handle, Int32 width, Int32 height); [DllImport(DLLName, EntryPoint = "H264_GetNextVideoFrame_Rgb2", CallingConvention = )] private static extern Int32 H264_GetNextVideoFrame_Rgb2(long handle, IntPtr buffer, Int32 bufferLen, Int32 width, Int32 height); [DllImport(DLLName, EntryPoint = "H264_SetDefaultAlgorithm", CallingConvention = )] private static extern Int32 H264_SetDefaultAlgorithm(Int32 flag); [DllImport(DLLName, EntryPoint = "H264_SetAlgorithm", CallingConvention = )] private static extern Int32 H264_SetAlgorithm(long handle,Int32 flag); public static long CreateHandle() {
return H264_CreateHandle(); } public static long CloseHandle(long handle) { return H264_CloseHandle(handle); } public static int PutVideoStream(long handle, byte[] buffer, Int32 bufferLen) { GCHandle hin = (buffer, ); int result = H264_PutVideoStream(handle, PinnedObject(), bufferLen); (); return result; } public static int GetVideoParam(long handle, out int width, out int height) { width = 0; height = 0; byte[] width2 = new byte[4]; byte[] height2 = new byte[4]; GCHandle hin_width = (width2, ); GCHandle hin_height = (height2, ); int result = H264_GetVideoParam(handle, hin_PinnedObject(), hin_PinnedObject()); hin_(); hin_(); if (result != 0) { return result; } width = 32(width2, 0); height = 32(height2, 0); return result; } public static int GetVideoFrameSize(long handle) { int result = H264_GetVideoFrameSize(handle); return result; } public static int GetVideoFrameFormate(long handle) { int result = H264_GetVideoFrameFormate(handle); return result; } public static int GetNextVideoFrame(long handle, byte[] buffer, Int32 bufferLen, EN_H264_YU_Formate formate) { GCHandle hin = (buffer, ); int result = H264_GetNextVideoFrame(handle, PinnedObject(), bufferLen, (int)formate); (); return result; } public static int GetVideoFrameSize_Rgb(long handle) { int result = H264_GetVideoFrameSize_Rgb(handle); return result; } public static int GetNextVideoFrame_Rgb(long handle, byte[] buffer, Int32 bufferLen) { GCHandle hin = (buffer, ); int result = H264_GetNextVideoFrame_Rgb(handle, PinnedObject(), bufferLen); (); return result; } public static int GetVideoFrameSize_Rgb2(long handle, Int32 width, Int32 height) { int result = H264_GetVideoFrameSize_Rgb2(handle, width, height); return result; } public static Int32 SetDefaultAlgorithm(Int32 flag) { return H264_SetDefaultAlgorithm(flag); } public static Int32 SetAlgorithm(long handle, Int32 flag)
{ return H264_SetAlgorithm(handle,flag); } public static int GetNextVideoFrame_Rgb2(long handle, byte[] buffer, Int32 bufferLen, Int32 width, Int32 height) { GCHandle hin = (buffer, ); int result = H264_GetNextVideoFrame_Rgb2(handle, PinnedObject(), bufferLen, width, height); (); return result; } public enum EN_H264_YU_Formate { Y_U_V = 1, Y_V_U = 2, } }


发布评论