|
|
#pragma once
|
|
|
#include "resource.h"
|
|
|
#include "afxcmn.h"
|
|
|
#include "ExtendSliderCtrl.h"
|
|
|
#include "BtnST.h"
|
|
|
#include "BitmapSlider.h"
|
|
|
#include "tlhelp32.h"
|
|
|
//读文件结构体
|
|
|
// 为保证初始读数速度为25fps,此处计算得出速度为8533
|
|
|
static const int g_DefaultReadLen = 6000; // 8k
|
|
|
static const int g_MaxReadLen = 20480; // 20k
|
|
|
static const int g_MinReadLen = 1024; // 1k
|
|
|
struct struFileStru
|
|
|
{
|
|
|
ULONGLONG FileTotalLen; // 文件 长度
|
|
|
ULONGLONG curFilePos; // 当前读取文件当前内容位置
|
|
|
UINT FrameLen; // 每帧字节大小
|
|
|
BYTE Buffer[g_MaxReadLen]; // 从文件读取的数据每帧数据存放位置
|
|
|
|
|
|
struFileStru()
|
|
|
{
|
|
|
FileTotalLen = 0;
|
|
|
curFilePos = 0;
|
|
|
FrameLen = g_DefaultReadLen;
|
|
|
};
|
|
|
|
|
|
void ClearStru()
|
|
|
{
|
|
|
FileTotalLen = 0;
|
|
|
curFilePos = 0;
|
|
|
FrameLen = 8533;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
// CShowReplayDlg 对话框
|
|
|
class CShowReplayDlg : public CDialogEx
|
|
|
{
|
|
|
DECLARE_DYNAMIC(CShowReplayDlg)
|
|
|
|
|
|
public:
|
|
|
CShowReplayDlg(CWnd* pParent = NULL); // 标准构造函数
|
|
|
virtual ~CShowReplayDlg();
|
|
|
|
|
|
// 对话框数据
|
|
|
enum { IDD = IDD_DLG_REPLAY };
|
|
|
|
|
|
protected:
|
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
|
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
|
|
private:
|
|
|
CString m_HFfilePath; //打开回放文件路径
|
|
|
CFile m_ReplayFile; //回放文件对象
|
|
|
BOOL m_bFileOpen; //文件是否打开成功
|
|
|
struFileStru m_FileInfo; // 回放文件信息
|
|
|
UINT m_TimerID; // 定时器编号
|
|
|
UINT m_TimerPeriod; // 定时器周期
|
|
|
BOOL m_bIsPlay; // 正在播放或者已经暂停
|
|
|
BOOL m_bPauseSliderReflect; // 暂停滑动条响应
|
|
|
BOOL m_bService; // 判断后台服务程序是否打开
|
|
|
|
|
|
// 美化视频回放界面按钮
|
|
|
CButtonST m_Btn_OpenFile; // 打开文件
|
|
|
CButtonST m_Btn_PlayPause; // 播放暂停
|
|
|
CButtonST m_Btn_Stop; // 停止播放
|
|
|
CButtonST m_Btn_SpeedUp; // 加速播放
|
|
|
CButtonST m_Btn_SpeedDown; // 减速播放
|
|
|
|
|
|
// 对话框半透明设置变量
|
|
|
BOOL m_bTransParent; // TRUE为半透明,初始设置为FALSE
|
|
|
|
|
|
|
|
|
public:
|
|
|
//CExtendSliderCtrl m_SliderReplayRatio; // 滑动条关联变量
|
|
|
CBitmapSlider m_SliderReplayRatio; // 滑动条关联变量——加载bitmap
|
|
|
|
|
|
virtual BOOL OnInitDialog();
|
|
|
|
|
|
void StartTimer(); // 启动定时器
|
|
|
void StopTimer(); // 关闭定时器
|
|
|
|
|
|
void ReadAndPlay(); // 读取文件,并播放
|
|
|
|
|
|
void SetFileReplayRatio(double ratio); // 设置回放进度
|
|
|
|
|
|
afx_msg void OnBnClickedBtnOpenfile(); // 打开文件
|
|
|
// 播放及暂停视频
|
|
|
afx_msg void OnBnClickedBtnFileplaypause();
|
|
|
// 停止播放
|
|
|
afx_msg void OnBnClickedBtnFilestop();
|
|
|
// 播放进度变慢
|
|
|
afx_msg void OnBnClickedBtnFileslow();
|
|
|
// 播放进度变快
|
|
|
afx_msg void OnBnClickedBtnFilefast();
|
|
|
// 选择模式——实时/回放(默认实时)
|
|
|
afx_msg void OnCbnSelchangeComboxPlaytype();
|
|
|
// 关闭窗口时销毁
|
|
|
afx_msg void OnDestroy();
|
|
|
// afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
|
|
// 滑动条响应函数
|
|
|
afx_msg LRESULT OnBitmapSliderMoving(WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
// 判断进程是否正在运行函数 返回0说明没有运行
|
|
|
DWORD GetProcessIdFromName(LPCTSTR name);
|
|
|
|
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
|
|
|
|
|
// CH92中修改DC为EO/IR
|
|
|
LRESULT ReturnPayloadTypeWarning(WPARAM wParam, LPARAM lParam);
|
|
|
}; |