1 Star 1 Fork 1

柏松/DShowCaptureToLocal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
GetDeviceInfoDlg.h 3.25 KB
一键复制 编辑 原始数据 按行查看 历史
柏松 提交于 2017-08-10 09:28 . asdfa
// GetDeviceInfoDlg.h : header file
//
#pragma once
#include "afxwin.h"
#include "SampleGrabberCB.h"
#ifndef SAFE_RELEASE
#define SAFE_RELEASE( x ) \
if ( NULL != x ) \
{ \
x->Release(); \
x = NULL; \
}
#endif
//class CSampleGrabberCB;
struct ImgDeviceInfo
{
CString strDevicePidVid; //设备PIDVID
CString strDeviceName; //设备名称
int nDeviceIndex; //设备序号
ImgDeviceInfo()
{
strDevicePidVid = _T("");
strDeviceName = _T("");
nDeviceIndex = -1;
};
ImgDeviceInfo(const ImgDeviceInfo &other)
{
*this = other;
};
ImgDeviceInfo& operator = (const ImgDeviceInfo& other)
{
strDevicePidVid = other.strDevicePidVid;
strDeviceName = other.strDeviceName;
nDeviceIndex = other.nDeviceIndex;
return *this;
};
};
typedef CArray <ImgDeviceInfo, ImgDeviceInfo&> ASImgDeviceInfoArray;
struct CamResolutionInfo
{
int nWidth; //分辨率宽
int nHeight; //分辨率高
int nResolutionIndex; //分辨率序号
CamResolutionInfo()
{
nWidth = 640;
nHeight = 480;
nResolutionIndex = -1;
};
CamResolutionInfo(const CamResolutionInfo &other)
{
*this = other;
};
CamResolutionInfo& operator = (const CamResolutionInfo& other)
{
nWidth = other.nWidth;
nHeight = other.nHeight;
nResolutionIndex = other.nResolutionIndex;
return *this;
};
};
typedef CArray <CamResolutionInfo, CamResolutionInfo&> ASCamResolutionInfoArray;
// CGetDeviceInfoDlg dialog
class CGetDeviceInfoDlg : public CDialogEx
{
// Construction
public:
CGetDeviceInfoDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_GETDEVICEINFO_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedBtnGetdevice();
afx_msg void OnBnClickedBtnInit();
afx_msg void OnBnClickedBtnPreview();
afx_msg void OnBnClickedBtnStop();
afx_msg void OnBnClickedBtnTakepic();
afx_msg void OnDestroy();
BOOL ListVideoCaptureDevices();
BOOL ListAudioCaptureDevices();
BOOL ListVideoCompressDevices();
BOOL ListAudioCompressDevices();
HRESULT InitCaptureGraphBuilder(IGraphBuilder **ppGraph, ICaptureGraphBuilder2 **ppBuild);
void CreateVideoFilter(CString strSelectedDevice, IBaseFilter **pBaseFilter);
void CreateAudioFilter(CString strSelectedDevice, IBaseFilter **pBaseFilter);
void GetVideoResolution();
void FreeMediaType(AM_MEDIA_TYPE *pmt);
public:
CComboBox m_cbxCtrl;
CComboBox m_cbxAudioCtrl;
CComboBox m_cbxCompressCtrl;
CComboBox m_cbxAudioCompressor;
CComboBox m_cbxResolutionCtrl;
ASImgDeviceInfoArray m_asVideoDeviceInfo;
ASImgDeviceInfoArray m_asAudioDeviceInfo;
ASImgDeviceInfoArray m_asCompressDeviceInfo;
ASImgDeviceInfoArray m_asAudioCompressorInfo;
ASCamResolutionInfoArray m_arrCamResolutionArr;
IGraphBuilder *m_pGraphBuilder;
ICaptureGraphBuilder2* m_pCapture;
IMediaControl *m_pMediaControl;
IVideoWindow* m_pVW;
IBaseFilter* m_pVideoFilter;
IBaseFilter* m_pGrabberFilter;
IBaseFilter* m_pAudioFilter;
HWND m_hShowWnd;
BOOL m_bIsVideoOpen;
BOOL m_bRendered;
ISampleGrabber* m_pGrabber;
CSampleGrabberCB mCB;
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/poisson/DShowCaptureToLocal.git
git@gitee.com:poisson/DShowCaptureToLocal.git
poisson
DShowCaptureToLocal
DShowCaptureToLocal
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385