// ECX_TesterRtmpLiveDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "ECX_TesterRtmpLive.h"
#include "ECX_TesterRtmpLiveDlg.h"
#include "afxdialogex.h"
#include "ECX_RtmpLiveSDK.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CECX_TesterRtmpLiveDlg 对话框
CECX_TesterRtmpLiveDlg::CECX_TesterRtmpLiveDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CECX_TesterRtmpLiveDlg::IDD, pParent),
m_pRtmpLive(NULL)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
}
CECX_TesterRtmpLiveDlg::~CECX_TesterRtmpLiveDlg()
{
if ( this->m_pRtmpLive != NULL )
{
ECX_RtmpLiveSDK::RtmpLiveFree( this->m_pRtmpLive );
this->m_pRtmpLive = NULL;
}
}
void CECX_TesterRtmpLiveDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CECX_TesterRtmpLiveDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_Btn_Start, &CECX_TesterRtmpLiveDlg::OnBnClickedBtnStart)
ON_BN_CLICKED(IDC_Btn_Stop, &CECX_TesterRtmpLiveDlg::OnBnClickedBtnStop)
END_MESSAGE_MAP()
// CECX_TesterRtmpLiveDlg 消息处理程序
BOOL CECX_TesterRtmpLiveDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
this->SetWindowText(_T("ECX_TesterRtmpLive v1.0 - PinFuTech (QQ: 2570246528)"));
CButton* pCheckBoxShowPreview =
(CButton*)( this->GetDlgItem(IDC_CheckBox_ShowPreview) );
pCheckBoxShowPreview->SetCheck(BST_CHECKED);
this->SetDlgItemText(IDC_Edit_RtmpUrl, _T("rtmp://127.0.0.1/live/PinFuTech"));
this->GetDlgItem(IDC_Btn_Start)->EnableWindow(TRUE);
this->GetDlgItem(IDC_Btn_Stop)->EnableWindow(FALSE);
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
void CECX_TesterRtmpLiveDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
CDialogEx::OnSysCommand(nID, lParam);
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CECX_TesterRtmpLiveDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CECX_TesterRtmpLiveDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CECX_TesterRtmpLiveDlg::OnBnClickedBtnStart()
{
// TODO: Add your control notification handler code here
ECX_VecAVDevs vecVideoDevs;
ECX_VecAVDevs vecAudioDevs;
ECX_RtmpLiveSDK::ListVideoDevices(vecVideoDevs);
ECX_RtmpLiveSDK::ListAudioDevices(vecAudioDevs);
if ( vecVideoDevs.empty() )
{
this->MessageBox(_T("未找到视频输入设备!!!"));
return;
}
if ( vecAudioDevs.empty() )
{
this->MessageBox(_T("未找到音频输入设备!!!"));
return;
}
CWnd *pWndVideoPreview = this->GetDlgItem(IDC_VideoPreview);
CRect rc;
pWndVideoPreview->GetClientRect(&rc);
CButton* pCheckBoxShowPreview =
(CButton*)( this->GetDlgItem(IDC_CheckBox_ShowPreview) );
CString cstrRtmpUrl;
this->GetDlgItemText(IDC_Edit_RtmpUrl, cstrRtmpUrl);
this->m_pRtmpLive =
ECX_RtmpLiveSDK::RtmpLiveAlloc(
(const wchar_t*)(cstrRtmpUrl),
vecVideoDevs.begin()->wstrDevId,
vecAudioDevs.begin()->wstrDevId,
320, 240, 250, 25,
(pCheckBoxShowPreview->GetCheck() == BST_CHECKED) ? pWndVideoPreview->GetSafeHwnd() : NULL,
rc.right-rc.left, rc.bottom-rc.top
);
if ( this->m_pRtmpLive == NULL )
{
return;
}
ECX_RtmpLiveSDK::RtmpLiveStart( this->m_pRtmpLive );
this->GetDlgItem(IDC_CheckBox_ShowPreview)->EnableWindow(FALSE);
this->GetDlgItem(IDC_Btn_Start)->EnableWindow(FALSE);
this->GetDlgItem(IDC_Btn_Stop)->EnableWindow(TRUE);
}
void CECX_TesterRtmpLiveDlg::OnBnClickedBtnStop()
{
// TODO: Add your control notification handler code here
if ( this->m_pRtmpLive != NULL )
{
ECX_RtmpLiveSDK::RtmpLiveFree( this->m_pRtmpLive );
this->m_pRtmpLive = NULL;
}
this->GetDlgItem(IDC_CheckBox_ShowPreview)->EnableWindow(TRUE);
this->GetDlgItem(IDC_Btn_Start)->EnableWindow(TRUE);
this->GetDlgItem(IDC_Btn_Stop)->EnableWindow(FALSE);
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
H264 FAAC音视频采集编码,并经由Rtmp发布测试代码 1. 采用DirectShow实现摄像头视频数据和音频数据的采集 2. 采用x264/faac实现音视频的编码 3. 采用librtmp实现编码后音视频数据到Rtmp流媒体服务器的发布 4. 实际上经由本机Rtmp流媒体服务器转发的延迟大概在0.5~2秒左右 可采用Adobe简单Flash播放器进行测试 http://download.csdn.net/detail/zjzfb/5839719
资源推荐
资源详情
资源评论
收起资源包目录
ECX_TesterRtmpLive.rar (30个子文件)
ECX_TesterRtmpLive
ECX_TesterRtmpLive.cpp 2KB
ECX_TesterRtmpLive.sln 902B
ECX_TesterRtmpLive.h 514B
resource.h 2KB
ECX_RtmpLiveSDK
libeay32.lib 779KB
strmbasd.lib 4.53MB
ECX_RtmpLiveSDKd.lib 2.26MB
libx264d.lib 1.52MB
zlibd.lib 888KB
ssleay32.lib 66KB
libfaacd.lib 277KB
librtmpd.lib 514KB
ECX_RtmpLiveSDK.h 1KB
stdafx.h 2KB
ECX_TesterRtmpLive.vcxproj.filters 2KB
ECX_TesterRtmpLive.vcxproj 7KB
res
ECX_TesterRtmpLive.ico 66KB
ECX_TesterRtmpLive.rc2 692B
ECX_TesterRtmpLiveDlg.h 789B
ECX_TesterRtmpLive.rc 9KB
stdafx.cpp 151B
ECX_TesterRtmpLive.vcxproj.user 143B
预览图
无预览.jpg 52KB
延迟比较.jpg 79KB
Adobe示例播放器.jpg 59KB
Thumbs.db 10KB
ECX_TesterRtmpLiveDlg.cpp 5KB
bin
libeay32.dll 1.13MB
ssleay32.dll 263KB
targetver.h 234B
共 30 条
- 1
zjzfb
- 粉丝: 14
- 资源: 55
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页