天天看点

视频监控 封装[PlayCtrl.dll]的API (1)

前言

  PlayCtrl.dll都忘记到底是朋友翻的还是自己翻的了,有朋友需要,我就贴上来吧。

正文

  一、文件下载

    注意:文件可能随时更新,欢迎使用中遇到问题及时反馈给我。下载后把后缀改成.cs就行了。

  二、部分API

    /// <summary>

    /// 播放器

    /// </summary>

    public sealed class HikPlayer

    {

        #region Const Member Variables

        // #define WINVER 

        // 0x0700 Windows 7

        // 0x0600 Windows Vista

        // 0x0502 Windows 2003 Server

        // 0x0410 Windows XP

        //<0x0400 Windows 98/Windows 2000

        public static readonly int WINVER = 0x0502;

        public static readonly uint WM_USER = 0x0400;

        public static readonly uint WM_FILE_END = WM_USER + 33;

        public static readonly uint WM_ENC_CHANGE = WM_USER + 100;

        public static readonly int COLOR_DEFAULT = 64;

        public static readonly int PLAYER_SLIDER_MAX = 200;

        public static readonly int MAX_DISPLAY_DEVICE = 4;

        public static readonly int WIDTH_PAL = 352;

        public static readonly int HEIGHT_PAL = 288;

        #region Source buffer

        //#define SOURCE_BUF_MAX

        public static readonly uint SOURCE_BUF_MAX = 1024 * 100000;

        //#define SOURCE_BUF_MIN    1024*50

        public static readonly uint SOURCE_BUF_MIN = 1024 * 50;

        #endregion

        #region Frame type

        /// <summary>

        /// 音频数据;采样率16khz,单声道,每个采样点16位表示。

        /// </summary>

        public static readonly int T_AUDIO16 = 101;

        public static readonly int T_AUDIO8 = 100;

        /// 视频数据,uyvy格式。“U0-Y0-V0-Y1-U2-Y2-V2-Y3….”,第一个像素位于图像左上角。 

        public static readonly int T_UYVY = 1;

        /// 视频数据,yv12格式。排列顺序“Y0-Y1-……”,“V0-V1….”,“U0-U1-…..”。 

        public static readonly int T_YV12 = 3;

        /// 视频数据。每个像素4个字节,排列方式与位图相似,“B-G-R-0 ……”,第一个像素位于图像左下角。 

        public static readonly int T_RGB32 = 7;

        #region Stream type

        /// 实时模式,适合播放网络实时数据,解码器会立刻解码。

        public static readonly int STREAME_REALTIME = 0;

        /// 文件模式,适合用户把文件数据用流方式输入。

        /// 注意:当PlayM4_InputData()返回FALSE时,用户要等一下重新输入。

        public static readonly int STREAME_FILE = 1;

        #region Error code

        /// 没有错误

        /// no error

        public static readonly int PlayM4_NOERROR = 0;

        /// 输入参数非法

        /// input parameter is invalid;

        public static readonly int PlayM4_PARA_OVER = 1;

        /// 调用顺序不对

        /// The order of the function to be called is error.

        public static readonly int PlayM4_ORDER_ERROR = 2;

        /// 多媒体时钟设置失败

        /// Create multimedia clock failed;

        public static readonly int PlayM4_TIMER_ERROR = 3;

        /// 视频解码失败

        /// Decode video data failed.

        public static readonly int PlayM4_DEC_VIDEO_ERROR = 4;

        /// 音频解码失败

        /// Decode audio data failed.

        public static readonly int PlayM4_DEC_AUDIO_ERROR = 5;

        /// 分配内存失败

        /// Allocate memory failed.

        public static readonly int PlayM4_ALLOC_MEMORY_ERROR = 6;

        /// 文件操作失败

        /// Open the file failed.

        public static readonly int PlayM4_OPEN_FILE_ERROR = 7;

        /// 创建线程事件等失败

        /// Create thread or event failed.

        public static readonly int PlayM4_CREATE_OBJ_ERROR = 8;

        /// 创建DirectDraw失败

        /// Create DirectDraw object failed.

        public static readonly int PlayM4_CREATE_DDRAW_ERROR = 9;

        /// 创建后端缓存失败

        /// Failed when creating off-screen surface.

        public static readonly int PlayM4_CREATE_OFFSCREEN_ERROR = 10;

        /// 缓冲区满,输入流失败

        /// Buffer is overflow.

        public static readonly int PlayM4_BUF_OVER = 11;

        /// 创建音频设备失败

        /// Failed when creating audio device.

        public static readonly int PlayM4_CREATE_SOUND_ERROR = 12;

        /// 设置音量失败

        /// Set volume failed.

        public static readonly int PlayM4_SET_VOLUME_ERROR = 13;

        /// 只能在播放文件时才能使用此接口

        /// The function only support play file.

        public static readonly int PlayM4_SUPPORT_FILE_ONLY = 14;

        /// 只能在播放流时才能使用此接口

        /// The function only support play stream.

        public static readonly int PlayM4_SUPPORT_STREAM_ONLY = 15;

        /// 系统不支持,解码器只能工作在Pentium 3以上

        /// System not support.

        public static readonly int PlayM4_SYS_NOT_SUPPORT = 16;

        /// 没有文件头

        /// No file header.

        public static readonly int PlayM4_FILEHEADER_UNKNOWN = 17;

        /// 解码器和编码器版本不对应

        /// The version of decoder and encoder is not adapted.  

        public static readonly int PlayM4_VERSION_INCORRECT = 18;

        /// 初始化解码器失败

        /// Initialize decoder failed.

        public static readonly int HIK_PALYM4_INIT_DECODER_ERROR = 19;

        /// 文件太短或码流无法识别

        /// The file data is unknown.

        public static readonly int PlayM4_CHECK_FILE_ERROR = 20;

        /// 初始化多媒体时钟失败

        /// Initialize multimedia clock failed.

        public static readonly int PlayM4_INIT_TIMER_ERROR = 21;

        /// 位拷贝失败

        /// Blt failed.

        public static readonly int PlayM4_BLT_ERROR = 22;

        /// 显示Overlay失败

        /// Update failed.

        public static readonly int PlayM4_UPDATE_ERROR = 23;

        /// 打开文件错误

        /// Open file error, stream type is multi.

        public static readonly int PlayM4_OPEN_FILE_ERROR_MULTI = 24;

        /// Open file error, stream type is video.

        public static readonly int PlayM4_OPEN_FILE_ERROR_VIDEO = 25;

        /// JPEG格式压缩错误

        /// JPEG compress error.

        public static readonly int PlayM4_JPEG_COMPRESS_ERROR = 26;

        /// 不支持此文件的版本

        /// Don't support the version of this file.

        public static readonly int PlayM4_EXTRACT_NOT_SUPPORT = 27;

        /// 提取视频数据失败

        /// Extract video data failed.

        public static readonly int PlayM4_EXTRACT_DATA_ERROR = 28;

        #region Display buffers

        /// 播放缓冲最大值

        public static readonly int MAX_DIS_FRAMES = 50;

        /// 播放缓冲最小值

        public static readonly int MIN_DIS_FRAMES = 6;

        #region Locate by

        /// 帧号

本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/586610,如需转载请自行联系原作者

继续阅读