revplaymdichildwnd.h
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:5k
源码类别:
VC书籍
开发平台:
Visual C++
- #if !defined(AFX_REVPLAYMDICHILDWND_H__32C9A3E1_3AC9_11D4_883E_0000210A0111__INCLUDED_)
- #define AFX_REVPLAYMDICHILDWND_H__32C9A3E1_3AC9_11D4_883E_0000210A0111__INCLUDED_
- // Added by ClassView
- #include "WaitDlg.h" // Added by ClassView
- #include "winsock2.h"
- #include "Mmsystem.h"
- //#include "streams.h"
- #include "mpegdef.h"
- #include "mpgutil.h"
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // RevPlayMDIChildWnd.h : header file
- //
- class CMemStream;
- class CMemReader;
- #define MPEGWIDTH 352
- #define MPEGHEIGHT 288
- #define HELPER_RELEASE(x) {if(x) x -> Release(); x = NULL;} // 控件释放
- #define CHECK_ERROR(x, idFailMsg) if (FAILED(hr = (x))) { if (idFailMsg) MessageBox(idFailMsg); return -1;}
- /////////////////////////////////////////////////////////////////////////////
- // CRevPlayMDIChildWnd frame
- struct COnCmdMsg
- {
- int m_nID;
- int m_nCode;
- void* m_pExtra;
- AFX_CMDHANDLERINFO* m_pHandlerInfo;
- };
- #define WM_USER_ONCMDMSG (WM_USER + 0x1000)
- #define WM_USER_PREPARE_TO_CLOSE (WM_USER + 0x1001)
- class CRevPlayMDIChildWnd : public CMDIChildWnd
- {
- DECLARE_DYNCREATE(CRevPlayMDIChildWnd)
- protected:
- // protected constructor used by dynamic creation
- static CMenu NEAR menu;
- // Attributes
- public:
- // Operations
- public:
- CRevPlayMDIChildWnd();
- BOOL Create(LPCTSTR szTitle,const RECT&rect,CMDIFrameWnd* parent);
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CRevPlayMDIChildWnd)
- public:
- virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
- virtual BOOL DestroyWindow();
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- virtual ~CRevPlayMDIChildWnd();
- // Generated message map functions
- //{{AFX_MSG(CRevPlayMDIChildWnd)
- afx_msg void OnSize(UINT nType, int cx, int cy);
- //}}AFX_MSG
- afx_msg LRESULT OnPrepareToClose(WPARAM wParam=0, LPARAM lParam=0);
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////
- // CRevPlayWnd window
- class CRevPlayWnd : public CWnd
- {
- // Construction
- public:
- CRevPlayWnd();
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CRevPlayWnd)
- //}}AFX_VIRTUAL
- // Implementation
- public:
- BOOL m_Receive; //表示是否按了Receive菜单
- void StopReceive();
- PBYTE pRevMem[100]; //存放接收的数据,以供DirectShow读取
- PBYTE achInBuf;
- BOOL m_FirstRead; //是否是第一次接收数据
- BOOL m_Save; //是否保存接收数据
- BOOL m_Stop; //停止接收菜单标志
- BOOL m_RenderOk; //是否Render成功
- int RevLen; //实际接收数据的长度
- int g_rwIndex; //DirectShow读取数据数组的标志
- int Block;
- int rIndex;
- int m_LostBlock;
- HMMIO hmmioSave; //保存数据文件句柄
- WSABUF stWSABuf; //接收缓冲区
- SOCKET MultiSock;
- char strDestAddr[20]; //组播地址
- int DestPort; //组播端口
- CWaitDlg WaitDlg;
- CMediaType mt;
- CMemStream *m_pStream;
- CMemReader *m_rdr;
- IVideoWindow *m_pivw; // 视频窗口
- IFilterGraph *m_pifg; // 图像过滤
- IGraphBuilder *m_pigb; // 图像建立
- IMediaControl *m_pimc; // 媒体控制
- IMediaPosition *m_ppos;
- MPEG_PACKET_DATA PacketData;
- SEQHDR_INFO SeqInfo;
- DWORD Parse(PBYTE Ptr,DWORD dwSize,LONGLONG* llTime);
- void RenderFrom(PBYTE Buf,LPCTSTR File);
- int InitGraph();
- int ReceiveData();
- void InitMultiSock();
- int Connect(HWND hwnd,const char* Addr,short Port,int& sock);
- BOOL Create(LPCTSTR szTitle,long stytle,const RECT&rect, CWnd* parent);
- virtual ~CRevPlayWnd();
- // Generated message map functions
- protected:
- //{{AFX_MSG(CRevPlayWnd)
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnSave();
- afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
- afx_msg void OnStopReceive();
- afx_msg void OnRevPlay();
- afx_msg void OnUpdateSave(CCmdUI* pCmdUI);
- afx_msg void OnUpdateStopReceive(CCmdUI* pCmdUI);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- //}}AFX_MSG
- afx_msg LRESULT OnDelegatedCmdMsg(WPARAM, LPARAM);
- afx_msg LRESULT OnPrepareToClose(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnConnect(WPARAM wParam,LPARAM lParam);
- afx_msg LRESULT OnRead(WPARAM wParam,LPARAM lParam);
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_REVPLAYMDICHILDWND_H__32C9A3E1_3AC9_11D4_883E_0000210A0111__INCLUDED_)