예제 #1
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.OpenFile:打开文件;
 /// 2.PLAY_COMMAND.CatchPic:抓图;</param>
 /// <param name="nPort">播放通道号</param>
 /// <param name="sFileName">打开/保存文件名</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, string sFileName)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.OpenFile:
             returnValue = PLAY_OpenFile(nPort, sFileName);
             break;
         case PLAY_COMMAND.CatchPic:
             returnValue = PLAY_CatchPic(nPort, sFileName);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #2
0
        /// <summary>
        /// 播放控制
        /// </summary>
        /// <param name="pPlayCom">
        /// 播放命令:
        /// 1.PLAY_COMMAND.Stop:停止;
        /// 2.PLAY_COMMAND.CloseFile:关闭文件;
        /// 3.PLAY_COMMAND.Pause:暂停播放;
        /// 4.PLAY_COMMAND.ReSume:继续播放;
        /// 5.PLAY_COMMAND.Fast:快放;
        /// 6.PLAY_COMMAND.Slow:慢放;
        /// 7.PLAY_COMMAND.OneByOne:单帧播放;
        /// 8.PLAY_COMMAND.PlaySound:播放声音;
        /// 9.PLAY_COMMAND.PlaySoundShare:共享播放声音;
        /// 10.PLAY_COMMAND.StopSoundShare:停止共享播放声音;
        /// 11.PLAY_COMMAND.OneByOneBack:单帧回放
        /// 12.PLAY_COMMAND.CloseStream:关闭数据流
        /// 13.PLAY_COMMAND.CloseStreamEx:关闭数据流(音视频分开方式打开流)
        /// </param>
        /// <param name="nPort">播放通道号</param>
        /// <returns>true:成功;false:失败</returns>
        public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort)
        {
            bool returnValue = false;

            switch (pPlayCom)
            {
                case PLAY_COMMAND.Stop://停止
                    returnValue = PLAY_Stop(nPort);
                    break;
                case PLAY_COMMAND.CloseFile://关闭文件
                    returnValue = PLAY_CloseFile(nPort);
                    break;
                case PLAY_COMMAND.Pause://暂停播放
                    returnValue = PLAY_Pause(nPort, 1);
                    break;
                case PLAY_COMMAND.ReSume://继续播放
                    returnValue = PLAY_Pause(nPort, 0);
                    break;
                case PLAY_COMMAND.Fast://快放
                    returnValue = PLAY_Fast(nPort);
                    break;
                case PLAY_COMMAND.Slow://慢放
                    returnValue = PLAY_Slow(nPort);
                    break;
                case PLAY_COMMAND.OneByOne://单帧播放
                    returnValue = PLAY_OneByOne(nPort);
                    break;
                case PLAY_COMMAND.OneByOneBack://单帧回放
                    returnValue = PLAY_OneByOneBack(nPort);
                    break;
                case PLAY_COMMAND.PlaySound://播放声音
                    returnValue = PLAY_PlaySound(nPort);
                    break;
                case PLAY_COMMAND.PlaySoundShare://共享播放声音
                    returnValue = PLAY_PlaySoundShare(nPort);
                    break;
                case PLAY_COMMAND.StopSoundShare://停止共享播放声音
                    returnValue = PLAY_StopSoundShare(nPort);
                    break;
                case PLAY_COMMAND.ToBegin:
                    if (!DHPlayControl(PLAY_COMMAND.SetCurrentFrameNum, nPort, 0))
                    {
                        if (!DHPlayControl(PLAY_COMMAND.SetPlayedTimeEx, nPort, 0))
                        {
                            float playBegionPos = 0.00F;
                            if (!DHPlayControl(PLAY_COMMAND.SetPlayPos, nPort, ref playBegionPos))
                            {
                                returnValue = false;
                                break;
                            }
                        }
                    }
                    returnValue = true;
                    break;
                case PLAY_COMMAND.ToEnd:
                    if (!DHPlayControl(PLAY_COMMAND.SetCurrentFrameNum, nPort,DHPlayControl(PLAY_COMMAND.GetFileTotalFrames,nPort,true)-1))
                    {
                        if (!DHPlayControl(PLAY_COMMAND.SetPlayedTimeEx, nPort, DHPlayControl(PLAY_COMMAND.GetFileTotalTime, nPort, true)))
                        {
                            float playEndPos = 0.99F;
                            if (!DHPlayControl(PLAY_COMMAND.SetPlayPos, nPort, ref playEndPos))
                            {
                                returnValue = false;
                                break;
                            }
                        }
                    }
                    returnValue = true;
                    break;
                case PLAY_COMMAND.CloseStream:
                    returnValue = PLAY_CloseStream(nPort);
                    break;
                case PLAY_COMMAND.CloseStreamEx:
                    returnValue = PLAY_CloseStreamEx(nPort);
                    break;
                default:
                    return false;
            }

            DHThrowLastError(nPort);
            return returnValue;
        }
예제 #3
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.SetPlayPos:设置文件播放的相对位置(百分比)
 /// </param>
 /// <param name="nPort">播放通道</param>
 /// <param name="nValue">参数值</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, ref float nValue)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.SetPlayPos:
             returnValue = PLAY_SetPlayPos(nPort, nValue);
             break;
         case PLAY_COMMAND.GetPlayPos:
             nValue = PLAY_GetPlayPos(nPort);
             returnValue = true;
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #4
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.Start:开始播放
 /// </param>
 /// <param name="nPort">播放通道号</param>
 /// <param name="hWnd">播放容器句柄</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, IntPtr hWnd)
 {
     bool returnValue = false;
     if (pPlayCom == PLAY_COMMAND.Start)
     {
         returnValue = PLAY_Play(nPort, hWnd);
         DHThrowLastError(nPort);
     }
     return returnValue;
 }
예제 #5
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.StopSound:停止声音
 /// </param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom)
 {
     bool returnValue = false;
     if (pPlayCom == PLAY_COMMAND.StopSound)
     {
         returnValue = PLAY_StopSound();
         DHThrowLastError(0);
     }
     return returnValue;
 }
예제 #6
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.SetVolume:设置音量
 /// 2.PLAY_COMMAND.SetCurrentFrameNum:设置当前播放位置到指定帧号
 /// </param>
 /// <param name="nPort">播放通道</param>
 /// <param name="nValue">命令参数值</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, UInt32 nValue)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.SetVolume:
             returnValue = PLAY_SetVolume(nPort, nValue);
             break;
         case PLAY_COMMAND.SetCurrentFrameNum:
             returnValue = PLAY_SetCurrentFrameNum(nPort, nValue);
             break;
         case PLAY_COMMAND.SetPlayedTimeEx:
             returnValue = PLAY_SetPlayedTimeEx(nPort, nValue);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #7
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.OpenStream:输入从卡上得到的流数据;打开流并调用PLAY_Play之后才能输入数据。
 /// 2.PLAY_COMMAND.InputVideoData:输入从卡上得到的视频流 (可以是复合流,但音频数据会被忽略);打开流之后才能输入数据
 /// 3.PLAY_COMMAND.InputAudioData:输入从卡上得到的音频流;打开声音之后才能输入数据
 /// </param>
 /// <param name="nPort">通道号</param>
 /// <param name="pBuf">缓冲区地址</param>
 /// <param name="nSize">缓冲区大小</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, IntPtr pBuf, UInt32 nSize)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.InputData:
             returnValue = PLAY_InputData(nPort, pBuf, nSize);
             break;
         case PLAY_COMMAND.InputVideoData:
             returnValue = PLAY_InputVideoData(nPort, pBuf, nSize);
             break;
         case PLAY_COMMAND.InputAudioData:
             returnValue = PLAY_InputAudioData(nPort, pBuf, nSize);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #8
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.OpenStream:打开流接口
 /// 2.PLAY_COMMAND.OpenStreamEx:以音视频分开输入的方式打开流
 /// </param>
 /// <param name="nPort">通道号</param>
 /// <param name="pFileHeadBuff">目前不使用,填NULL</param>
 /// <param name="nSize">目前不使用,填0</param>
 /// <param name="nBufPoolSize">
 /// 设置播放器中存放数据流的缓冲区大小。
 /// 范围是SOURCE_BUF_MIN~ SOURCE_BUF_MAX。
 /// 一般设为900*1024,如果数据送过来相对均匀,可调小该值,如果数据传输不均匀,可增大该值</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, IntPtr pFileHeadBuff, UInt32 nSize, UInt32 nBufPoolSize)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.OpenStream:
             returnValue = PLAY_OpenStream(nPort, pFileHeadBuff, nSize, nBufPoolSize);
             break;
         case PLAY_COMMAND.OpenStreamEx:
             returnValue = PLAY_OpenStreamEx(nPort, pFileHeadBuff, nSize, nBufPoolSize);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #9
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.GetPictureSize:获得帧原始图像大小
 /// </param>
 /// <param name="nPort">播放通道</param>
 /// <param name="frameInfo">帧信息</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, ref FRAME_INFO frameInfo)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.GetPictureSize:
             returnValue = PLAY_GetPictureSize(nPort, ref frameInfo.nWidth, ref frameInfo.nHeight);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #10
0
 /// <summary>
 /// 播放控制
 /// </summary>
 /// <param name="pPlayCom">
 /// 播放命令:
 /// 1.PLAY_COMMAND.GetColor:获得颜色值
 /// </param>
 /// <param name="nPort">播放通道号</param>
 /// <param name="nRegionNum">显示区域</param>
 /// <param name="returnColor">颜色返回值</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHPlayControl(PLAY_COMMAND pPlayCom, int nPort, UInt32 nRegionNum,ref COLOR_STRUCT returnColor)
 {
     bool returnValue = false;
     switch (pPlayCom)
     {
         case PLAY_COMMAND.GetColor:
             returnValue = PLAY_GetColor(nPort, nRegionNum, ref returnColor.pBrightness, ref returnColor.pContrast, ref returnColor.pSaturation, ref returnColor.pHue);
             break;
         case PLAY_COMMAND.SetColor:
             returnValue = PLAY_SetColor(nPort, nRegionNum, returnColor.pBrightness, returnColor.pContrast, returnColor.pSaturation, returnColor.pHue);
             break;
     }
     DHThrowLastError(nPort);
     return returnValue;
 }
예제 #11
0
        /// <summary>
        /// 播放控制
        /// </summary>
        /// <param name="pPlayCom">
        /// 播放命令:
        /// 1.PLAY_COMMAND.GetCurrentFrameNum:获得当前帧序列号;
        /// 2.PLAY_COMMAND.GetCurrentFrameRate:获得当前帧率;
        /// 3.PLAY_COMMAND.GetFileTotalTime:获得文件总的时间长度,单位秒;
        /// 4.PLAY_COMMAND.GetFileTotalFrames:获得文件中的总帧数;
        /// 5.PLAY_COMMAND.GetPlayedTime:获得当前播放的时间,单位秒;
        /// 6.PLAY_COMMAND.GetPlayedTimeEx:获得当前播放的时间,单位毫秒;
        /// 7.PLAY_COMMAND.GetVolume:获得当前设置的音量;
        /// </param>
        /// <param name="nPort">播放通道号</param>
        /// <param name="blnReturnValue">该参数无效,只是用来区分重载的,必须输入一个bool值</param>
        /// <returns>对应命令的取值</returns>
        public static UInt32 DHPlayControl(PLAY_COMMAND pPlayCom, int nPort,bool blnReturnValue)
        {
            UInt32 returnValue = 0;

            switch (pPlayCom)
            {
                case PLAY_COMMAND.GetCurrentFrameNum:
                    returnValue = PLAY_GetCurrentFrameNum(nPort);
                    break;
                case PLAY_COMMAND.GetCurrentFrameRate:
                    returnValue = PLAY_GetCurrentFrameRate(nPort);
                    break;
                case PLAY_COMMAND.GetFileTotalTime:
                    returnValue = PLAY_GetFileTime(nPort);
                    break;
                case PLAY_COMMAND.GetFileTotalFrames:
                    returnValue = PLAY_GetFileTotalFrames(nPort);
                    break;
                case PLAY_COMMAND.GetPlayedTime:
                    returnValue = PLAY_GetPlayedTime(nPort);
                    break;
                case PLAY_COMMAND.GetPlayedTimeEx:
                    returnValue = PLAY_GetPlayedTimeEx(nPort);
                    break;
                case PLAY_COMMAND.GetVolume:
                    returnValue = PLAY_GetVolume(nPort);
                    break;
            }
            DHThrowLastError(nPort);
            return returnValue;
        }