Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- namespace TH.Parking.Wrapper.HBCamera
- {
- public class T1800
- {
- public const int T18_ERR_SUCCESS = 0;//succeed
- public const int T18_ERR_WAIT_TIMEOUT = 1;//sdk time out
- public const int T18_ERR_DSP_ERROR = 2;//dsp error
- public const int T18_ERR_INVALID_HANDLE = 3;//invaild channel handle
- public const int T18_ERR_INVALID_ARGUMENT = 4;//invaild parameter
- public const int T18_ERR_DDRAW_CREATE_FAILED = 5;//fail to create ddraw surface
- public const int T18_ERR_DSP_CANNOT_BE_FOUND = 6;//dsp can't be found
- public const int T18_ERR_DSP_IS_RUNNING = 7;//dsp is open
- public const int T18_ERR_CANNOT_FIND_IMGFILE = 8;//can't found img file
- public const int T18_ERR_NOT_SUPPORT = 9;//sdk no support
- public const int T18_ERR_RECEIVE_MSG = 10;//receive msg error
- public const int T18_ERR_GET_CHANNELS = 11;//get total channel
- //public const ulong COLORREF;
- public enum FrameType
- {
- PktError = 0,
- PktIFrames = 0x0001,
- PktPFrames = 0x0002,
- PktBBPFrames = 0x0004,
- PktAudioFrames = 0x0008,
- PktMotionDetection = 0x00010,
- PktDspStatus = 0x00020,
- PktOrigImage = 0x00040,
- PktSysHeader = 0x00080,
- PktBPFrames = 0x00100,
- PktSFrames = 0x00200
- }
- public struct PREVIEWRECTREGION
- {
- public RECT previewRect;
- public bool bFullScreen;
- public bool bSingle;
- public int nPreviewNum;//1 4 9 16 25 36
- public int nStartChannel;
- public int nCurChannel;
- public ulong nSizeFlag;//0-ORIGINAL 1-QCIF 2-CIF 3-FULLWINDOW
- }
- //Video Encode Size
- public enum PictureFormat
- {
- ENC_CIF_FORMAT = 0,
- ENC_QCIF_FORMAT = 1,
- ENC_2CIF_FORMAT = 2,
- ENC_4CIF_FORMAT = 3,
- ENC_SQD1_FORMAT = 4,
- ENC_CIFQCIF_FORMAT = 5,
- ENC_CIFQQCIF_FORMAT = 6,
- ENC_CIFCIF_FORMAT = 7,
- ENC_4CIFCIF_FORMAT = 8,
- ENC_4CIFQCIF_FORMAT = 9,
- ENC_DCIF_FORMAT = 10
- }
- public enum VideoStandard
- {
- StandardNone = unchecked((int)0x80000000),
- StandardNTSC = 0x00000001,
- StandardPAL = 0x00000002,
- StandardSECAM = 0x00000004,
- }
- public enum BitrateControlType
- {
- brCBR = 0,
- brVBR = 1
- }
- public struct FRAMES_STATISTICS
- {
- ulong VideoFrames;
- ulong AudioFrames;
- ulong FramesLost;
- ulong QueueOverflow;
- ulong CurBps;
- }
- public struct VERSION_INFO
- {
- ulong DspVersion, DspBuildNum;
- ulong DriverVersion, DriverBuildNum;
- ulong SDKVersion, SDKBuildNum;
- }
- public struct RECT
- {
- public long left;
- public long top;
- public long right;
- public long bottom;
- }
- [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall, SetLastError = true, CharSet = CharSet.Unicode)]
- public delegate int STREAM_READ_CALLBACK(ulong channelNumber, IntPtr context);
- public delegate int IMAGE_STREAM_CALLBACK(int channelNumber, ref IntPtr context);
- #region Initialize & Close
- #region DLLImport
- [DllImport("T1800.dll", EntryPoint = "T18_InitDSPs", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_InitDSPs();
- [DllImport("T1800.dll", EntryPoint = "T18_DeInitDSPs", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_DeInitDSPs();
- [DllImport("T1800.dll", EntryPoint = "T18_ChannelOpen", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern IntPtr dll_T18_ChannelOpen(int channelNum);
- [DllImport("T1800.dll", EntryPoint = "T18_ChannelClose", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_ChannelClose(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_ResetDSP", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_ResetDSP(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_GetTotalChannels", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetTotalChannels();
- [DllImport("T1800.dll", EntryPoint = "T18_GetTotalDSPs", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetTotalDSPs();
- [DllImport("T1800.dll", EntryPoint = "T18_GetLastErrorNum", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetLastErrorNum(IntPtr hChannelHandle, ref ulong dspError, ref ulong sdkError);
- [DllImport("T1800.dll", EntryPoint = "T18_GetSDKVersion", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetSDKVersion(VERSION_INFO VersionInfo);
- [DllImport("T1800.dll", EntryPoint = "T18_GetFramesStatistics", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetFramesStatistics(IntPtr hChannelHandle, ref FRAMES_STATISTICS frameStatistics);
- [DllImport("T1800.dll", EntryPoint = "T18_RegisterMessageNotifyHandle", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_RegisterMessageNotifyHandle(IntPtr hChannelHandle, uint messageId);
- [DllImport("T1800.dll", EntryPoint = "T18_GetBoardInfo", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetBoardInfo(IntPtr hChannelHandle, ref ulong boardType, ref string serialNo);
- //[DllImport("T1800.dll", EntryPoint = "T18_RegisterStreamReadCallback", CallingConvention = CallingConvention.Cdecl)]
- [DllImport("T1800.dll", EntryPoint = "T18_RegisterStreamReadCallback", CallingConvention = CallingConvention.Cdecl, SetLastError = true, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_RegisterStreamReadCallback(STREAM_READ_CALLBACK STREAM_READ_CALLBACK, ref IntPtr context);
- [DllImport("T1800.dll", EntryPoint = "T18_StartVideoPreviewEx", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_StartVideoPreviewEx(IntPtr hChannelHandle, IntPtr wndHandle, ref System.Drawing.Rectangle rect, bool bOverlay, int videoFormat, int frameRate);
- [DllImport("T1800.dll", EntryPoint = "T18_StopVideoPreview", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_StopVideoPreview(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_SetOverlayColorKey", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetOverlayColorKey(ulong destColorKey);
- [DllImport("T1800.dll", EntryPoint = "T18_SetOverlayColorKey", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetLogoDisplayMode(IntPtr hChannelHandle, ulong ColorKey, bool bTranslucent, int nReserve);
- [DllImport("T1800.dll", EntryPoint = "T18_UpdateOverlay", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_UpdateOverlay();
- [DllImport("T1800.dll", EntryPoint = "T18_ReleaseOverlay", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_ReleaseOverlay();
- [DllImport("T1800.dll", EntryPoint = "T18_RestoreOverlay", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_RestoreOverlay();
- [DllImport("T1800.dll", EntryPoint = "T18_SetAudioPreview", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetAudioPreview(IntPtr hChannelHandle, bool bEnable);
- [DllImport("T1800.dll", EntryPoint = "T18_SetAudioPreviewVolume", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetAudioPreviewVolume(IntPtr hChannelHandle, ulong nVolume);
- [DllImport("T1800.dll", EntryPoint = "T18_GetSoundLevel", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetSoundLevel(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoStandard", CallingConvention = CallingConvention.Cdecl)]
- private static extern int dll_T18_SetVideoStandard(IntPtr hChannelHandle, VideoStandard videoStandard);
- [DllImport("T1800.dll", EntryPoint = "T18_GetVideoSignal", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetVideoSignal(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoPara", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetVideoPara(IntPtr hChannelHandle, int nBrightness, int nContrast, int nSaturation, int nHue);
- [DllImport("T1800.dll", EntryPoint = "T18_GetVideoPara", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetVideoPara(IntPtr hChannelHandle, ref VideoStandard videoStandard, ref int brightness, ref int contrast, ref int saturation, ref int hue);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoLostMode", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetVideoLostMode(int mode);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoClip", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetVideoClip(IntPtr hChannelHandle, int x, int y);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoNightFilter", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetVideoNightFilter(IntPtr hChannelHandle, int nVideoNightFilter);
- [DllImport("T1800.dll", EntryPoint = "T18_SetDefaultVideoStandard", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetDefaultVideoStandard(VideoStandard videoStandard);
- [DllImport("T1800.dll", EntryPoint = "T18_SetVideoSharp", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetVideoSharp(IntPtr hChannelHandle, int nLevel);
- [DllImport("T1800.dll", EntryPoint = "T18_GetRawAudioVolume", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetRawAudioVolume(IntPtr hChannelHandle, out ulong nVolume);
- [DllImport("T1800.dll", EntryPoint = "T18_StartVideoCapture", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_StartVideoCapture(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_StopVideoCapture", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_StopVideoCapture(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_SetStreamType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetStreamType(IntPtr hChannelHandle, ushort type);
- [DllImport("T1800.dll", EntryPoint = "T18_GetStreamType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetStreamType(IntPtr hChannelHandle, ref ushort streamType);
- [DllImport("T1800.dll", EntryPoint = "T18_SetEncoderPictureFormat", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetEncoderPictureFormat(IntPtr hChannelHandle, PictureFormat pictureFormat);
- [DllImport("T1800.dll", EntryPoint = "T18_SetAllEncoderPictureFormat", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetAllEncoderPictureFormat(ref PictureFormat pPictureFormat);
- [DllImport("T1800.dll", EntryPoint = "T15_SetIBPMode", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T15_SetIBPMode(IntPtr hChannelHandle, int keyFrameIntervals, int bFrames, int pFrames, int frameRate);
- [DllImport("T1800.dll", EntryPoint = "T18_SetDefaultQuant", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetDefaultQuant(IntPtr hChannelHandle, int iQuantVal, int pQuantVal, int bQuantVal);
- [DllImport("T1800.dll", EntryPoint = "T18_SetBitrateControlMode", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetBitrateControlMode(IntPtr hChannelHandle, BitrateControlType brc);
- [DllImport("T1800.dll", EntryPoint = "T18_SetupBitrateControl", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetupBitrateControl(IntPtr hChannelHandle, ulong maxBps);
- [DllImport("T1800.dll", EntryPoint = "T18_SetEncodeAudioType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetEncodeAudioType(IntPtr hChannelHandle, int nType);
- [DllImport("T1800.dll", EntryPoint = "T18_GetOriginalImage", CallingConvention = CallingConvention.Cdecl, BestFitMapping = true)]
- private static extern int dll_T18_GetOriginalImage(IntPtr hChannelHandle, IntPtr imageBuf, ref ulong size, ulong nPictureType);
- [DllImport("T1800.dll", EntryPoint = "T18_CaptureIFrame", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_CaptureIFrame(IntPtr hChannelHandle);
- [DllImport("T1800.dll", EntryPoint = "T18_GetSystemHeader", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetSystemHeader(IntPtr hChannelHandle, [Out] byte[] pSystemHeader, ref ulong length);
- [DllImport("T1800.dll", EntryPoint = "T18_SetupNotifyThreshold", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetupNotifyThreshold(IntPtr hChannelHandle, int iFramesThreshold);
- [DllImport("T1800.dll", EntryPoint = "T18_ReadStreamData", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_ReadStreamData(IntPtr hChannelHandle, [Out] byte[] DataBuf, ref ulong length, ref int frameType);
- [DllImport("T1800.dll", EntryPoint = "T18_SetupSubChannel", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetupSubChannel(IntPtr hChannelHandle, int iSubChannel);
- [DllImport("T1800.dll", EntryPoint = "T18_GetSubChannelStreamType", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetSubChannelStreamType(ref IntPtr dataBuf, int frameType);
- [DllImport("T1800.dll", EntryPoint = "T18_SetImageStream", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetImageStream(IntPtr hChannelHandle, bool bStart, int fps, int width, int height, ref IntPtr imageBuffer);
- [DllImport("T1800.dll", EntryPoint = "T18_RegisterImageStreamCallback", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_RegisterImageStreamCallback(MulticastDelegate ImageStreamCallback, ref IntPtr context);
- [DllImport("T1800.dll", EntryPoint = "T18_SetEncoderFormat", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_SetEncoderFormat(IntPtr hChannelHandle, PictureFormat pictureFormat);
- [DllImport("T1800.dll", EntryPoint = "T18_GetOriginalImageEx", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
- private static extern int dll_T18_GetOriginalImageEx(IntPtr hChannelHandle, ref IntPtr imageBuf, ref ulong Size, ulong nPictureType);
- [DllImport("T1800.dll", EntryPoint = "T18_SaveYUVToBmpFile", CallingConvention = CallingConvention.Cdecl)]
- private static extern int dll_T18_SaveYUVToBmpFile(string FileName, IntPtr yuv, int Width, int Height, ulong nYUVType);
- [DllImport("T1800.dll", EntryPoint = "T18_LoadYUV444FromBmpFile", CallingConvention = CallingConvention.Cdecl)]
- private static extern int dll_T18_LoadYUV444FromBmpFile(string FileName, ref IntPtr yuv, ref int BufLen, ref int Width, ref int Height);
- [DllImport("T1800.dll", EntryPoint = "T18_SetLogo", CallingConvention = CallingConvention.Cdecl)]
- private static extern int dll_T18_SetLogo(IntPtr hChannelHandle, int x, int y, int w, int h, IntPtr yuv);
- #endregion
- #region Functions
- /// <summary>
- /// T18_s the init DS ps.
- /// Parameters: None
- /// Description: To initialize every card in system. It must be called in application
- /// Startup.
- /// Return: Number of DSPs in system, 0 means initializing failed.
- /// </summary>
- /// <returns></returns>
- public static int T18_InitDSPs()
- {
- return dll_T18_InitDSPs();
- }
- /// <summary>
- /// T18_s the de init DS ps.
- ///1.02 Close DSP :T18_DeInitDSPs()
- ///Parameters: None
- ///Description: To close all cards in system and release resources. It must be called
- ///before application exit.
- ///Return: Number of DSPs closed
- /// </summary>
- /// <returns></returns>
- public static int T18_DeInitDSPs()
- {
- return dll_T18_DeInitDSPs();
- }
- /// <summary>
- /// T18_s the channel open.
- /// Parameters:int ChannelNum Channel number(0 is first channel)
- ///Description: Open a channel and get handle for channel operations.
- ///Return: Valid handle when success or return 0xFFFFFFFF if failed
- /// </summary>
- /// <param name="channelNum">The channel num.</param>
- /// <returns></returns>
- public static IntPtr T18_ChannelOpen(int channelNum)
- {
- return dll_T18_ChannelOpen(channelNum);
- }
- /// <summary>
- /// T18_s the channel close.
- /// Parameters: HANDLE hChannelHandle Channel number(0 is first channel)
- ///Description: Close a channel and release its resources. It must be called before call
- ///T18_DeInitDSPs().
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <returns></returns>
- public static int T18_ChannelClose(IntPtr hChannelHandle)
- {
- return dll_T18_ChannelClose(hChannelHandle);
- }
- /// <summary>
- /// T18_s the reset DSP.
- /// Parameters: HANDLE hChannelHandle
- ///Description Reset DSP system;
- ///Return 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <returns></returns>
- public static int T18_ResetDSP(IntPtr hChannelHandle)
- {
- return dll_T18_ResetDSP(hChannelHandle);
- }
- /// <summary>
- /// T18_s the get total channels.
- /// Parameters: None
- /// Description: To get total number of channels in system
- /// Return: Number of channels in system
- /// </summary>
- /// <returns></returns>
- public static int T18_GetTotalChannels()
- {
- return dll_T18_GetTotalChannels();
- }
- /// <summary>
- /// T18_s the get total DS ps.
- /// Parameters: None
- /// Description: To get total number of DSPs in system
- /// Return: Number of channels in system
- /// </summary>
- /// <returns></returns>
- public static int T18_GetTotalDSPs()
- {
- return dll_T18_GetTotalDSPs();
- }
- /// <summary>
- /// T18_s the get last error num.
- /// Parameters: HANDLE hChannelHandle (Channel Handle)
- ///ULONG *DspError, DSP error number
- ///ULONG *SdkError SDK error number
- ///Description: To get SDK and DSP errors number, you can get detailed information
- ///about error. You can call it to get error code(detailed in T1800.h) when functions
- ///return fail.
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <param name="dspError">The DSP error.</param>
- /// <param name="sdkError">The SDK error.</param>
- /// <returns></returns>
- public static int T18_GetLastErrorNum(IntPtr hChannelHandle, ref ulong dspError, ref ulong sdkError)
- {
- return dll_T18_GetLastErrorNum(hChannelHandle, ref dspError, ref sdkError);
- }
- /// <summary>
- /// T18_s the get SDK version.
- /// Parameters: None
- ///Description: Get the version of SDK currently used.
- ///Return: first 16 bits is BCD code in which high 8 bits is main version number, low 8
- ///bits is sub-version number, then 32 bits is BUILD number.
- /// </summary>
- /// <param name="versionInfo">The version info.</param>
- /// <returns></returns>
- public static int T18_GetSDKVersion(VERSION_INFO versionInfo)
- {
- return dll_T18_GetSDKVersion(versionInfo);
- }
- /// <summary>
- /// T18_s the get frames statistics.
- ///Parameters: HANDLE hChannelHandle, handle of channel
- ///PFRAMES_STATISTICS ,framesStatistics frames statistics information
- ///Description: Get frames statistics of video encoding
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <param name="framesStatistics">The frames statistics.</param>
- /// <returns></returns>
- public static int T18_GetFramesStatistics(IntPtr hChannelHandle, ref FRAMES_STATISTICS framesStatistics)
- {
- return dll_T18_GetFramesStatistics(hChannelHandle, ref framesStatistics);
- }
- /// <summary>
- /// T18_s the register message notify handle.
- /// Parameters: HWND hWnd handle of window
- ///UINT MessageId message ID
- ///Description: When encoding data is ready, SDK will send message MessageId to
- ///window hWnd, after window hWnd receive message, call
- ///ReadStreamData read encoding data of a frame.
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <param name="messageId">The message id.</param>
- /// <returns></returns>
- public static int T18_RegisterMessageNotifyHandle(IntPtr hChannelHandle, uint messageId)
- {
- return dll_T18_RegisterMessageNotifyHandle(hChannelHandle, messageId);
- }
- /// <summary>
- /// T18_s the get board info.
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// ULONG *BoardType, card type (0x18004:HB18004, 0x18008:HB18008,
- /// 0x18016:HB18016)
- /// UCHAR *SerialNo serial number of card, SerialNo[0] is the highest
- /// number, for example serial number “04040025” is array of integer
- /// (0,4,0,4,0,0,2,5)
- /// Description: Get hardware information of card
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle">The h channel handle.</param>
- /// <param name="boardType">Type of the board.</param>
- /// <param name="serialNo">The serial no.</param>
- /// <returns></returns>
- public static int T18_GetBoardInfo(IntPtr hChannelHandle, ref ulong boardType, ref string serialNo)
- {
- return dll_T18_GetBoardInfo(hChannelHandle, ref boardType, ref serialNo);
- }
- /// <summary>
- /// Parameters: STREAM_READ_CALLBACK StreamReadCallback
- /// Void *Context transfer the context of the Callback function
- /// Description: when transferring the function,it will support the channel no and pointer
- /// of context
- /// Return: 0 when success
- /// </summary>
- /// <param name="stream_Read_CallBack"></param>
- /// <param name="context"></param>
- /// <returns></returns>
- public static int T18_RegisterStreamReadCallback(STREAM_READ_CALLBACK stream_Read_CallBack, ref IntPtr context)
- {
- return dll_T18_RegisterStreamReadCallback(stream_Read_CallBack, ref context);
- }
- /// <summary>
- ///Parameters: HANDLE hChannelHandle handle of channel
- ///HWND WndHandle handle of window
- ///RECT *rect rectangle area
- ///BOOLEAN bOverlay open or close the Overlay mode
- ///int VideoFormat video format,only support YUV422
- ///int FrameRate Frame Rate,(PAL:25,NTSC:30)
- ///Description: Set video preview parameters. It must use one window to preview video
- ///of all channels. This function must be called with new handle of window
- ///when you switch display window, then restart video preview. Start video
- ///preview
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="wndHandle"></param>
- /// <param name="rect"></param>
- /// <param name="bOverlay"></param>
- /// <param name="videoFormat"></param>
- /// <param name="frameRate"></param>
- /// <returns></returns>
- public static int T18_StartVideoPreviewEx(IntPtr hChannelHandle, IntPtr wndHandle, ref System.Drawing.Rectangle rect, bool bOverlay, int videoFormat, int frameRate)
- {
- return dll_T18_StartVideoPreviewEx(hChannelHandle, wndHandle, ref rect, bOverlay, videoFormat, frameRate);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle ,handle of channel
- ///Description: Stop video preview
- ///Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_StopVideoPreview(IntPtr hChannelHandle)
- {
- return dll_T18_StopVideoPreview(hChannelHandle);
- }
- /// <summary>
- /// Parameters: COLORREF DestColorKey Overlay Key Color
- /// Description: Set overlay key color
- /// Return: 0 when success
- /// </summary>
- /// <param name="destColorKey"></param>
- /// <returns></returns>
- public static int T18_SetOverlayColorKey(ulong destColorKey)
- {
- return dll_T18_SetOverlayColorKey(destColorKey);
- }
- public static int T18_SetLogoDisplayMode(IntPtr hChannelHandle, ulong ColorKey, bool bTranslucent, int nReserve)
- {
- return dll_T18_SetLogoDisplayMode(hChannelHandle, ColorKey, bTranslucent, nReserve);
- }
- /// <summary>
- /// Parameters: None
- /// Description: Update overlay display area, work in with T18_ StartVideoPreviewEx
- /// when all the video preview is starting ,transfer this function.
- /// Return: 0 when success
- /// </summary>
- /// <returns></returns>
- public static int T18_UpdateOverlay()
- {
- return dll_T18_UpdateOverlay();
- }
- /// <summary>
- /// Parameters: None
- ///Description: Release Overlay resource,when transfering the function, all the video
- ///preview must be enabled. Work in with T18_RestoreOverlay;
- ///Return: 0 when success
- /// </summary>
- /// <returns></returns>
- public static int T18_ReleaseOverlay()
- {
- return dll_T18_ReleaseOverlay();
- }
- /// <summary>
- /// Parameters: None
- /// Description: Restore Overlay resource,,when transfering the function, all the video
- /// preview must be enabled. Work in with T18_ReleaseOverlay;
- /// </summary>
- /// <returns></returns>
- public static int T18_RestoreOverlay()
- {
- return dll_T18_RestoreOverlay();
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// BOOL bEnable enable
- /// Description: Enable or disable audio preview, audio preview means you can choose
- /// one channel live audio played by PC.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="bEnable"></param>
- /// <returns></returns>
- public static int T18_SetAudioPreview(IntPtr hChannelHandle, bool bEnable)
- {
- return dll_T18_SetAudioPreview(hChannelHandle, bEnable);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// DWORD nVolume audio volume (0-100)
- /// Description: set audio preview volume
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nVolume"></param>
- /// <returns></returns>
- public static int T18_SetAudioPreviewVolume(IntPtr hChannelHandle, ulong nVolume)
- {
- return dll_T18_SetAudioPreviewVolume(hChannelHandle, nVolume);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// Description: get audio preview volume
- /// Return: audio volume (0-100)
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_GetSoundLevel(IntPtr hChannelHandle)
- {
- return dll_T18_GetSoundLevel(hChannelHandle);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// VideoStandard_t VideoStandard Video Standard
- /// Description: Set video standard PAL or NTSC, it must be called before calling
- /// T18_InitDSPs. It will set all channels to same video standard.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="videoStandard"></param>
- /// <returns></returns>
- public static int T18_SetVideoStandard(IntPtr hChannelHandle, VideoStandard videoStandard)
- {
- return dll_T18_SetVideoStandard(hChannelHandle, videoStandard);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// Description: get video input status, we can know if video input signal is OK
- /// Return: 0 means video input OK, otherwise means no video input or video input lost
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_GetVideoSignal(IntPtr hChannelHandle)
- {
- return dll_T18_GetVideoSignal(hChannelHandle);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// int nBrightness Brightness(0-255)
- /// int nContrast Contrast(0-255)
- /// int nSaturation Saturation(0-255)
- /// int nHue Hue(0-255)
- /// Description: Set video color parameters
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nBrightness"></param>
- /// <param name="nContrast"></param>
- /// <param name="nSaturation"></param>
- /// <param name="nHue"></param>
- /// <returns></returns>
- public static int T18_SetVideoPara(IntPtr hChannelHandle, int nBrightness, int nContrast, int nSaturation, int nHue)
- {
- return dll_T18_SetVideoPara(hChannelHandle, nBrightness, nContrast, nSaturation, nHue);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// VideoStandard_t *VideoStandard Video Standard
- /// int *Brightness, pointer of Brightness(0-255)
- /// int *Contrast, pointer of Contrast(0-255)
- /// int *Saturation, pointer of Saturation(0-255)
- /// int *Hue pointer of Hue(0-255)
- /// Description: Get video color parameters
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="videoStandard"></param>
- /// <param name="brightness"></param>
- /// <param name="contrast"></param>
- /// <param name="saturation"></param>
- /// <param name="hue"></param>
- /// <returns></returns>
- public static int T18_GetVideoPara(IntPtr hChannelHandle, ref VideoStandard videoStandard, ref int brightness, ref int contrast, ref int saturation, ref int hue)
- {
- return dll_T18_GetVideoPara(hChannelHandle, ref videoStandard, ref brightness, ref contrast, ref saturation, ref hue);
- }
- /// <summary>
- /// Parameters: :int nMode Video Lost Mode(0-2),Default value is 0
- ///Description: Set video lost mode, when the signal is lost , the video add information,
- ///0 not add;1 add Chinese“无视频信号“; 2 add English“No Signal”;
- ///Return: 0 when success
- /// </summary>
- /// <param name="mode"></param>
- /// <returns></returns>
- public static int T18_SetVideoLostMode(int mode)
- {
- return dll_T18_SetVideoLostMode(mode);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int X center position horizontally
- /// int Y center position vertically
- /// Description: Set the video clip position,could solve the black border problem.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="x"></param>
- /// <param name="y"></param>
- /// <returns></returns>
- public static int T18_SetVideoClip(IntPtr hChannelHandle, int x, int y)
- {
- return dll_T18_SetVideoClip(hChannelHandle, x, y);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int nVideoNightFilter night video filter switch 0-off 1-on
- /// Description: Set night video filter, if set on it will reduce data rate.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nVideoNightFilter"></param>
- /// <returns></returns>
- public static int T18_SetVideoNightFilter(IntPtr hChannelHandle, int nVideoNightFilter)
- {
- return dll_T18_SetVideoNightFilter(hChannelHandle, nVideoNightFilter);
- }
- /// <summary>
- /// Parameters: VideoStandard_t VideoStandard video standard
- /// Description: Set default video standard, default is PAL;it must be called before calling
- /// T18_InitDSPs.
- /// </summary>
- /// <param name="videoStandard"></param>
- /// <returns></returns>
- public static int T18_SetDefaultVideoStandard(VideoStandard videoStandard)
- {
- return dll_T18_SetDefaultVideoStandard(videoStandard);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int nLevel video sharp level (0-1)
- /// 0 : close,1: open
- /// Default is 0
- /// Description:Set video sharp
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nLevel"></param>
- /// <returns></returns>
- public static int T18_SetVideoSharp(IntPtr hChannelHandle, int nLevel)
- {
- return dll_T18_SetVideoSharp(hChannelHandle, nLevel);
- }
- /// <summary>
- /// Parameter: HANDLE hChannelHandle handle of channel
- /// DWORD &nVolume audio volume (0-32768)
- /// Description: Get original audio volume;
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nVolume"></param>
- /// <returns></returns>
- public static int T18_GetRawAudioVolume(IntPtr hChannelHandle, out ulong nVolume)
- {
- return dll_T18_GetRawAudioVolume(hChannelHandle, out nVolume);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// Description: Start video encoder and send messages registered in
- /// T18_RegisterMessageNotifyHandle to application, application can call
- /// function T18_ReadStreamData to get data.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_StartVideoCapture(IntPtr hChannelHandle)
- {
- return dll_T18_StartVideoCapture(hChannelHandle);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// Description: Stop video capture
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_StopVideoCapture(IntPtr hChannelHandle)
- {
- return dll_T18_StopVideoCapture(hChannelHandle);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// USHORT Type Stream type:
- /// #define STREAM_TYPE_VIDEO 1 //video only
- /// #define STREAM_TYPE_AUDIO 2 //audio only
- /// #define STREAM_TYPE_AVSYNC 3 //video and audio
- /// Description: Set data stream type
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- public static int T18_SetStreamType(IntPtr hChannelHandle, ushort type)
- {
- return dll_T18_SetStreamType(hChannelHandle, type);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// USHORT *StreamType Pointer to stream type
- /// Description: Get data stream type
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="streamType"></param>
- /// <returns></returns>
- public static int T18_GetStreamType(IntPtr hChannelHandle, ref ushort streamType)
- {
- return dll_T18_GetStreamType(hChannelHandle, ref streamType);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// PictureForamt_t PictureFormat image format (CIF, Half D1, D1)
- /// Description: Set image format for encoding. It is called after T18_InitDSPs() and
- /// before other functions. It is more efficiency to call
- /// T18_SetAllEncoderPictureFormat to set image format for all channels at
- /// same time.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="pictureFormat"></param>
- /// <returns></returns>
- public static int T18_SetEncoderPictureFormat(IntPtr hChannelHandle, PictureFormat pictureFormat)
- {
- return dll_T18_SetEncoderPictureFormat(hChannelHandle, pictureFormat);
- }
- /// <summary>
- /// Parameters: PictureForamt_t *pPictureFormat the pointer of the encode image size
- /// array
- /// Description: Set all encoder picture format,after initialization is done, transfer it
- /// immediately;
- /// Return: 0 when success
- /// </summary>
- /// <param name="pPictureFormat"></param>
- /// <returns></returns>
- public static int T18_SetAllEncoderPictureFormat(ref PictureFormat pPictureFormat)
- {
- return dll_T18_SetAllEncoderPictureFormat(ref pPictureFormat);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// int KeyFrameIntervals, Key frame intervals(default 64)
- /// int BFrames, reserved
- /// int PFrames, reserved
- /// int FrameRate Frame rate(default 25)
- /// Description: Set encoding parameters. Key frame intervals must not be less than 12,
- /// frame rate is 1-25(PAL) or 1-30(NTSC) which can be set while encoding.
- /// Key frame is I frame in compressed video data and it is decoded by itself.
- /// P frames is compressed referring I frame and need I frame to decode. I
- /// frame data rate is much more than P frame. Less key frame interval
- /// means larger data rate and better video quality.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="keyFrameIntervals"></param>
- /// <param name="bFrames"></param>
- /// <param name="pFrames"></param>
- /// <param name="frameRate"></param>
- /// <returns></returns>
- public static int T15_SetIBPMode(IntPtr hChannelHandle, int keyFrameIntervals, int bFrames, int pFrames, int frameRate)
- {
- return dll_T15_SetIBPMode(hChannelHandle, keyFrameIntervals, bFrames, pFrames, frameRate);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// int IQuantVal, I frame Q factor
- /// int PQuantVal, reserved
- /// int BQuantVal reserved
- /// Description: Set video encoder Q factor. Lower value means better video quality and
- /// higher data rate. Valid value is 1-31. 5 or 6 is better value and can set
- /// while encoding.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="iQuantVal"></param>
- /// <param name="pQuantVal"></param>
- /// <param name="bQuantVal"></param>
- /// <returns></returns>
- public static int T18_SetDefaultQuant(IntPtr hChannelHandle, int iQuantVal, int pQuantVal, int bQuantVal)
- {
- return dll_T18_SetDefaultQuant(hChannelHandle, iQuantVal, pQuantVal, bQuantVal);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// BitrateControlType_t brc encoder mode, brCBR Constant bit rate,
- /// brVBR Variable bit rate
- /// Description: Set encoder mode
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="brc"></param>
- /// <returns></returns>
- public static int T18_SetBitrateControlMode(IntPtr hChannelHandle, BitrateControlType brc)
- {
- return dll_T18_SetBitrateControlMode(hChannelHandle, brc);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// ULONG MaxBps maximum level of bit rate in Bit
- /// Description: Set video data rate control after calling T18_SetBitrateControlMode.In
- /// mode brVBR, MaxBps means maximum level of bit rate. The video
- /// data rate is decided by IQuantVal and KeyFrameIntervals. In mode
- /// brCBR, MaxBps means actual data bit rate.
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="maxBps"></param>
- /// <returns></returns>
- public static int T18_SetupBitrateControl(IntPtr hChannelHandle, ulong maxBps)
- {
- return dll_T18_SetupBitrateControl(hChannelHandle, maxBps);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int nType audio encoder type(Random value) A-law 8k*8
- /// Description: Set audio encoder type. Do not call it in default. A-law is 64Kbit/s
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="nType"></param>
- /// <returns></returns>
- public static int T18_SetEncodeAudioType(IntPtr hChannelHandle, int nType)
- {
- return dll_T18_SetEncodeAudioType(hChannelHandle, nType);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// UCHAR *ImageBuf pointer to original image
- /// ULONG *Size size of original image, it is size of imagebuf before
- /// calling, It is number of actual image in Byte.
- /// DWORD nPictureType image type: 0-non standard yuv,1-standard
- /// yuv422
- /// Description: Get original image data. It is used to capture still image from live video.
- /// Call T18_SaveYUVToBmpFile to save bmp file. nPictureType must be
- /// same to nYUVType in T18_SaveYUVToBmpFile.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="imageBuf"></param>
- /// <param name="size"></param>
- /// <param name="nPictureType"></param>
- /// <returns></returns>
- public static int T18_GetOriginalImage(IntPtr hChannelHandle, IntPtr imageBuf, ref ulong size, ulong nPictureType)
- {
- try
- {
- return dll_T18_GetOriginalImage(hChannelHandle, imageBuf, ref size, nPictureType);
- }
- catch
- {
- return 0;
- }
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// Description: Set frame type of next frame is I frame. It is used when you start to save
- /// file or send data to network.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <returns></returns>
- public static int T18_CaptureIFrame(IntPtr hChannelHandle)
- {
- return dll_T18_CaptureIFrame(hChannelHandle);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// UCHAR **pSystemHeader pointer to head buffer
- /// DWORD *Length length of head buffer
- /// Description: Get head of file, must get for each file
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="pSystemHeader"></param>
- /// <param name="length"></param>
- /// <returns></returns>
- public static int T18_GetSystemHeader(IntPtr hChannelHandle, byte[] pSystemHeader, ref ulong length)
- {
- return dll_T18_GetSystemHeader(hChannelHandle, pSystemHeader, ref length);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int iFramesThreshold read notify threshold, Valid value is 1-10, default is 3
- /// Description: User setup notify threshold ,when the quantity of data frames in the
- /// buffer area exceed the threshold,System will send message to notify user.
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="iFramesThreshold"></param>
- /// <returns></returns>
- public static int T18_SetupNotifyThreshold(IntPtr hChannelHandle, int iFramesThreshold)
- {
- return dll_T18_SetupNotifyThreshold(hChannelHandle, iFramesThreshold);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle, handle of channel
- /// void *DataBuf, user buffer to store data of a frame
- /// DWORD *Length input: size of buffer output: length of frame
- /// Int *FrameType frame type
- /// Description: Read stream data, after call StartVideoCapture or StartMotionDetection
- /// system will send message with channel number to application’s window
- /// message process function. When application receive message
- /// T18_ReadStreamData must be called to get data. T18_ReadStreamData
- /// will return length of frame if size of buffer is larger than size of frame,
- /// or return error. T18_ReadStreamData must be called sequentially until
- /// length is 0 or data maybe lost.
- /// Return: length of frame
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="DataBuf"></param>
- /// <param name="length"></param>
- /// <param name="frameType"></param>
- /// <returns></returns>
- public static int T18_ReadStreamData(IntPtr hChannelHandle, byte[] DataBuf, ref ulong length, ref int frameType)
- {
- return dll_T18_ReadStreamData(hChannelHandle, DataBuf, ref length, ref frameType);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// int iSubChannel sub channel no
- /// Description: There are two different conditions,For CIF card
- /// (18004,18008,18016,18016E),main channel resolution is CIF,Sub
- /// channel is CIF;For D1 card(18204),main channel resolution is D1
- /// (4CIF),sub channel is CIF. User can setup some parameters on sub
- /// channel 0,1 separately. The parameters ,such as stream
- /// type,OSD,LOGO,MOSAIC in sub channel 0 are the same as the
- /// parameters in sub channel 1.User should setup the parameters, such as
- /// frame rate, I frame interval, quantity modulus, VBR/CBR, bit rate in sub
- /// channel 0,1 separately, the default value is sub channel 0.
- /// The functions are as follows:
- /// T18_StartVideoCapture
- /// T18_StopVideoCapture
- /// T18_SetEncodeSettings
- /// T18_SetIBPMode
- /// T18_SetDefaultQuant
- /// T18_SetBitrateControlMode
- /// T18_SetupBitrateControl
- /// T18_GetSystemHeader
- /// T18_CaptureIFrame
- /// The data stream of the sub channel 1 need to transfer functions
- /// T18_StartVideoCapture(it required that the encoding of the sub-channel 0
- /// must be started up firstly)and T18_StopVideoCapture to start or stop the
- /// encoding of sub channel 1.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="iSubChannel"></param>
- /// <returns></returns>
- public static int T18_SetupSubChannel(IntPtr hChannelHandle, int iSubChannel)
- {
- return dll_T18_SetupSubChannel(hChannelHandle, iSubChannel);
- }
- /// <summary>
- /// Parameters: void *DataBuf input data buffer
- /// Int FrameType input frame type
- /// Description: There are two different conditions , For CIF card
- /// (18004,18008,18016,18016E),main channel resolution is CIF,Sub
- /// channel is CIF;For D1 card(18204),main channel resolution is D1
- ///(4CIF),sub channel is CIF. After start recording ,DSP will send two
- /// different kinds of data stream upwards for each channel. The application
- /// software can get the type of the sub channel stream by transferring the
- /// function.
- /// Return: 0 when success
- /// </summary>
- /// <param name="dataBuf"></param>
- /// <param name="frameType"></param>
- /// <returns></returns>
- public static int T18_GetSubChannelStreamType(ref IntPtr dataBuf, int frameType)
- {
- return dll_T18_GetSubChannelStreamType(ref dataBuf, frameType);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// BOOL bStart TRUE/start capturing,FALSE/stop capturing
- /// int fps framerate
- /// int width width of the picture
- /// int height height of the picture
- /// unsigned char *imageBuffer The address where the image saved.
- /// Description: There are two different conditions , For CIF card
- /// (18004,18008,18016,18016E),main channel resolution is CIF,Sub channel is CIF;
- /// For D1 card (18204) ,main channel resolution is D1 (4CIF) ,sub channel is CIF. User
- /// could start or stop capturing the original image data stream.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="bStart"></param>
- /// <param name="fps"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <param name="imageBuffer"></param>
- /// <returns></returns>
- public static int T18_SetImageStream(IntPtr hChannelHandle, bool bStart, int fps, int width, int height, ref IntPtr imageBuffer)
- {
- return dll_T18_SetImageStream(hChannelHandle, bStart, fps, width, height, ref imageBuffer);
- }
- /// <summary>
- /// Parameters: IMAGE_STREAM_CALLBACK ImageStreamCallback Callback
- /// function
- /// (*IMAGE_STREAM_CALLBACK)(int channelNumber,void *context);
- /// int channnelNumber; channel No
- /// void *context; transfer the context of the callback function
- /// Description: Registered user use the function to capture the original image data
- /// stream,User could capture the real-time preview data which format is
- /// planar422
- /// Return: 0 when success
- /// </summary>
- /// <param name="imageStreamCallBack"></param>
- /// <param name="context"></param>
- /// <returns></returns>
- public static int T18_RegisterImageStreamCallback(MulticastDelegate imageStreamCallBack, ref IntPtr context)
- {
- return dll_T18_RegisterImageStreamCallback(imageStreamCallBack, ref context);
- }
- /// <summary>
- /// Description:Set current channel encoder format,example:ENC_2CIF_FORMAT is
- /// HALF D1 format,ENC_4CIF_FORMAT is D1 format;
- /// Note:Only support D1 card.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="pictureFormat"></param>
- /// <returns></returns>
- public static int T18_SetEncoderFormat(IntPtr hChannelHandle, PictureFormat pictureFormat)
- {
- return dll_T18_SetEncoderFormat(hChannelHandle, pictureFormat);
- }
- /// <summary>
- /// Parameters: HANDLE hChannelHandle handle of channel
- /// UCHAR *ImageBuf pointer to original image
- /// ULONG *Size size of original image, it is size of imagebuf before
- /// calling, It is number of actual image in Byte.
- /// DWORD nPictureType image type: 0-non standard yuv,1-standard
- /// yuv422
- /// Description: Get original image data. It is used to capture still image from live video.
- /// Call T18_SaveYUVToBmpFile to save bmp file. nPictureType must be
- /// same to nYUVType in T18_SaveYUVToBmpFile.
- /// Return: 0 when success
- /// </summary>
- /// <param name="hChannelHandle"></param>
- /// <param name="imageBuf"></param>
- /// <param name="size"></param>
- /// <param name="nPictureType"></param>
- /// <returns></returns>000
- public static int T18_GetOriginalImageEx(IntPtr hChannelHandle, ref IntPtr imageBuf, ref ulong size, ulong nPictureType)
- {
- return dll_T18_GetOriginalImageEx(hChannelHandle, ref imageBuf, ref size, nPictureType);
- }
- public static int T18_SaveYUVToBmpFile(string FileName, IntPtr yuv, int Width, int Height, ulong nYUVType)
- {
- return dll_T18_SaveYUVToBmpFile(FileName, yuv, Width, Height, nYUVType);
- }
- public static int T18_SetLogo(IntPtr hChannelHandle, int x, int y, int w, int h, IntPtr yuv)
- {
- return dll_T18_SetLogo(hChannelHandle, x, y, w, h, yuv);
- }
- public static int T18_LoadYUV444FromBmpFile(string FileName, ref IntPtr yuv, ref int BufLen, ref int Width, ref int Height)
- {
- return dll_T18_LoadYUV444FromBmpFile(FileName, ref yuv, ref BufLen, ref Width, ref Height);
- }
- public static ulong ToUlong(int red, int green, int blue)
- {
- long i;
- i = red;
- i = i + 256 * green;
- i = i + 256 * 256 * blue;
- return Convert.ToUInt32(i);
- }
- #endregion
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment