// bywyh264encoderDemoDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "bywyh264encoderDemo.h"
#include "bywyh264encoderDemoDlg.h"
#include "afxdialogex.h"
#include "bywyh264encoder.h"
#ifdef WIN64
#pragma comment(lib,"bywyh264encoderX64.lib")
#else
#pragma comment(lib,"bywyh264encoder.lib")
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Cbywyh264encoderDemoDlg 对话框
Cbywyh264encoderDemoDlg::Cbywyh264encoderDemoDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(Cbywyh264encoderDemoDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void Cbywyh264encoderDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_BUTTON1, m_ctrlRun);
DDX_Control(pDX, IDC_EDIT1, m_ctrlPath);
DDX_Control(pDX, IDC_EDIT2, m_ctrlExname);
DDX_Control(pDX, IDC_EDIT3, m_ctrlOutfn);
DDX_Control(pDX, IDC_EDIT4, m_ctrlH264fn);
DDX_Control(pDX, IDC_EDIT5, m_ctrlOutpath);
DDX_Control(pDX, IDC_BUTTON4, m_ctrlRunJpg);
DDX_Control(pDX, IDC_BUTTON5, m_ctrlRunBmp);
DDX_Control(pDX, IDC_EDIT6, m_ctrlAac);
DDX_Control(pDX, IDC_EDIT7, m_ctrlOutaac);
}
BEGIN_MESSAGE_MAP(Cbywyh264encoderDemoDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDOK, &Cbywyh264encoderDemoDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &Cbywyh264encoderDemoDlg::OnBnClickedCancel)
// ON_BN_CLICKED(IDOK2, &Cbywyh264encoderDemoDlg::OnBnClickedOk2)
ON_BN_CLICKED(IDC_BUTTON1, &Cbywyh264encoderDemoDlg::OnBnClickedButton1)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_BUTTON2, &Cbywyh264encoderDemoDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &Cbywyh264encoderDemoDlg::OnBnClickedButton3)
ON_BN_CLICKED(IDC_BUTTON4, &Cbywyh264encoderDemoDlg::OnBnClickedButton4)
ON_BN_CLICKED(IDC_BUTTON5, &Cbywyh264encoderDemoDlg::OnBnClickedButton5)
END_MESSAGE_MAP()
// Cbywyh264encoderDemoDlg 消息处理程序
void Cbywyh264encoderDemoDlg::setFormTitle()
{
if(1)
{
wchar_t strverW[1024];
wchar_t strdllverW[1024];
wchar_t strW[1024];
bywyGetAppVersionH264W(strverW);
bywyGetDllVersionH264W(strdllverW);
swprintf(strW,L"bywyh264编解码Demo ver:%s dllver:%s",strverW,strdllverW);
SetWindowText(strW);
}
if(0)
{
char strver[1024];
char strdllver[1024];
char str1[1024];
bywyGetAppVersionH264(strver);
bywyGetDllVersionH264(strdllver);
sprintf(str1,"bywyh264编解码Demo ver:%s dllver:%s",strver,strdllver);
::SetWindowTextA(m_hWnd,str1);
}
}
BOOL Cbywyh264encoderDemoDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
setFormTitle();
//编码
//m_ctrlPath.SetWindowTextW(L"jpg");
//m_ctrlExname.SetWindowTextW(L".jpg");
m_ctrlPath.SetWindowTextW(L"png");
m_ctrlExname.SetWindowTextW(L".png");
m_ctrlAac.SetWindowTextW(L"1.aac");
//m_ctrlOutfn.SetWindowTextW(L"t.264");
m_ctrlOutfn.SetWindowTextW(L"t.mp4");
//解码
//m_ctrlH264fn.SetWindowTextW(L"in.264");
m_ctrlH264fn.SetWindowTextW(L"in.mp4");
m_ctrlOutaac.SetWindowTextW(L"out.aac");
m_ctrlOutpath.SetWindowTextW(L"out");
endflag=1;
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void Cbywyh264encoderDemoDlg::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 Cbywyh264encoderDemoDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void Cbywyh264encoderDemoDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
}
void Cbywyh264encoderDemoDlg::OnBnClickedCancel()
{
// TODO: 在此添加控件通知处理程序代码
}
UINT buildThreadProc(LPVOID pParam)
{
Cbywyh264encoderDemoDlg* pDlg = (Cbywyh264encoderDemoDlg*)pParam;
int retCode = -1;
retCode = pDlg->run();
return 0;
}
UINT decoderThreadProc(LPVOID pParam)
{
Cbywyh264encoderDemoDlg* pDlg = (Cbywyh264encoderDemoDlg*)pParam;
int retCode = -1;
retCode = pDlg->rundec();
return 0;
}
void Cbywyh264encoderDemoDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
endflag=0;
::GetWindowTextA(m_ctrlPath.m_hWnd,imgpath,1024);
::GetWindowTextA(m_ctrlExname.m_hWnd,imgexname,1024);
::GetWindowTextA(m_ctrlAac.m_hWnd,inaacfn,1024);
::GetWindowTextA(m_ctrlOutfn.m_hWnd,outfn,1024);
if(strlen(imgpath) <= 0)
{
AfxMessageBox(L"待处理图片路径不能为空");
return;
}
m_ctrlPath.EnableWindow(FALSE);
m_ctrlExname.EnableWindow(FALSE);
m_ctrlAac.EnableWindow(FALSE);
m_ctrlOutfn.EnableWindow(FALSE);
m_ctrlRun.EnableWindow(FALSE);
m_ctrlRunJpg.EnableWindow(FALSE);
m_ctrlRunBmp.EnableWindow(FALSE);
m_ctrlOutpath.EnableWindow(FALSE);
m_ctrlH264fn.EnableWindow(FALSE);
m_ctrlOutaac.EnableWindow(FALSE);
AfxBeginThread(buildThreadProc, this, THREAD_PRIORITY_NORMAL);
}
int Cbywyh264encoderDemoDlg::run()
{
// TODO: 在此添加控件通知处理程序代码
int dup = 1;
int fps = 25;
char fmt[1024];
CString str2;
int timeflag=0;//0,2以音频时长为准 1,3以视频时长为准
sprintf(fmt,"%s\\%%d%s",imgpath,imgexname);
str2=outfn;
str2.MakeLower();
if(str2.Right(4) ==".mp4")
bywyH264encoderImgfile2Mp4(outfn,fps,dup,1,120, -1, 0, &endflag, (unsigned char*)fmt, 0,inaacfn,timeflag,"编码中:%d", m_hWnd);
else
bywyH264encoderImgfile2(outfn,fps,dup,1,120, -1, 0, &endflag, (unsigned char*)fmt, 0,"编码中:%d", m_hWnd);
AfxMessageBox(L"编码 end.");
m_ctrlRun.EnableWindow(TRUE);
m_ctrlPath.EnableWindow(TRUE);
m_ctrlExname.EnableWindow(TRUE);
m_ctrlAac.EnableWindow(TRUE);
m_ctrlOutfn.EnableWindow(TRUE);
m_ctrlRunJpg.EnableWindow(TRUE);
m_ctrlRunBmp.EnableWindow(TRUE);
m_ctrlOutpath.EnableWindow(TRUE);
m_ctrlH264fn.EnableWindow(TRUE);
m_ctrlOutaac.EnableWindow(TRUE);
endflag=1;
setFormTitle();
return 0;
}
void Cbywyh264encoderDemoDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
OnBnClickedButton2();
CDialogEx::OnClose();
}
void Cbywyh264encoderDemoDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
if(endflag == 0)
{
AfxMessageBox(L"还未结束,请稍后...");
return;
}
CDialogEx::OnOK();
}
void Cbywyh264encoderDemoDlg::OnBnClickedButton3()
{
// TODO: 在此添加控件通知处理程序代码
bywyRewardH264(NULL);
}
void Cbywyh264encoderDemoDlg::OnBnClickedButton4()
{
// TODO: 在此添加控件通知处理程序代码
endflag=0;
::GetWindowTextA(m_ctrlOutpath.m_hWnd,outpath,1024);
::GetWindowTextA(m_ctrlH264fn.m_hWnd,infn,1024);
::GetWindowTextA(m_ctrlOutaac.m_hWnd,outaacfn,1024);
jpgQuality=60;
m_ctrlRunJpg.EnableWindow(FALSE);
m_ctrlRunBmp.EnableWindow(FALSE);
m_ctrlOutpath.EnableWindow(FALSE);
m_ctrlAac.EnableWindow(FALSE);
m_ctrlH264fn.EnableWindow(FALSE);
m_ctrlRun.EnableWindow(FALSE);
m_ctrlPath.EnableWindow(FALSE);
m_ctrlExname.EnableWindow(FALSE);
m_ctrlOutfn.EnableWindow(FALSE);
m_ctrlOutaac.EnableWindow(FALSE);
AfxBeginThread(decoderThreadProc, this, THREAD_PRIORITY_NORMAL);
}
int Cbywyh264encoderDemoDlg::rundec()
{
// TODO: 在此添加控件通知处理程序代码
CString str2;
str2=infn;
str2.MakeLower();
if(str2.Right(4) ==".mp4")
{
bywy_h264decoderFromMp4(infn,outpath,outaacfn,m_hWnd,"正在解码:%d
没有合适的资源?快使用搜索试试~ 我知道了~
bywyh264encoder编解码API 1.0.0.5使用Demo

共568个文件
jpg:242个
png:240个
tlog:30个

需积分: 1 0 下载量 35 浏览量
2023-11-21
10:05:04
上传
评论 1
收藏 116.03MB RAR 举报
温馨提示
bywyh264encoder编解码API 1.0.0.5使用Demo 增加了mp4解析出aac。亦是看运行界面即可明了了。 优化了编码,貌似上一版本就有,忘记了,反正跟之前录屏和一张图更新的编码优化一样。 至于mp3和wav的转换,以后再弄吧,看看是集成融合进原有函数里的好还是单独出函数自行调用的好... 继续不伦不类。 吐槽一下曝光能力值,字数越多越大?好吧,又被打败了,唐僧的最爱... 有些得失只是一种交换~ 随风带去一份祝愿,自我内心深处,只是,分不清真假... bywy
资源推荐
资源详情
资源评论


























收起资源包目录





































































































共 568 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论


血玥珏
- 粉丝: 101
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 数据库原理及应用第2章.ppt
- 基于聚类的二次异常入侵检测算法.docx
- 单片机人体脉搏检测系统设计.doc
- 电气基础知识讲座IT计算机专业资料.ppt
- 无线网络安全论文设计.docx
- 异步通信与同步通信.ppt
- 基于应用人才培养模式的计算机网络课程教改研究.docx
- DVBCQAM调制主要参数选择与测试.doc
- PLC的交流异步电机转速闭环控制系统设计.doc
- 计算机系统配套零、部件竞争策略分析报告.docx
- 《信息系统集成技术实践》课程大纲.doc
- 基于数据挖掘的针灸治疗重症肌无力的现代文献取穴规律分析.docx
- 电力信息网络安全存在问题及对策分析.docx
- 基于 Python 的自动驾驶规划与控制代码实现
- 下半年软考系统集成项目管理测验真题(上午).doc
- 自动化PLC课程设计实施方案指导书.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
