前言
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,如需轉載請自行聯系原作者