Creating an AVI in memory with C++
Creating an AVI in memory with C++
The following example demonstrates how an avi file is completely created in memory.
/*
MakeAviInMemory.cpp
An example on how to use Avi.cpp
Copyright (c) 2004, 2005 René Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include <windows.h>
#include "avi.h"
#include <iostream>
#include <sstream>
#include "MemoryDC.h"
#include "DibSection.h"
#include "Color.h"
#include "Font.h"
int main() {
const float frames_per_second = 24.0;
Avi a("InMemory.avi",static_cast<int>(1000.0/frames_per_second),0);
MemoryDC memory_dc;
for (int i=0; i<5*frames_per_second; i++) {
DibSection dib_section(200, 200);
memory_dc.Select(dib_section);
// Set up compression just before the first frame
if (i==0) {
//AVICOMPRESSOPTIONS opts;
//ZeroMemory(&opts,sizeof(opts));
//opts.fccHandler=mmioFOURCC('d','i','v','x');
//SetAviVideoCompression(hbm,0/*&opts*/,true,0);
HRESULT r = a.compression(dib_section, 0 /*&opts*/, true, 0);
char buf [200];
if (r != S_OK) {
FormatAviMessage(r, buf, 200);
std::cout << "compression: " << buf << std::endl;
return -1;
}
}
memory_dc.DrawOpaque(false);
memory_dc.TextColor(Color(0,0,255));
memory_dc.Select(Font("Arial", 100));
STD_SSTR s;
s<<i;
memory_dc.Text(50,50,s.str().c_str());
HRESULT r =a.add_frame(dib_section);
char buf [200];
if (r != S_OK) {
FormatAviMessage(r, buf, 200);
std::cout << buf << std::endl;
}
}
}
Creating an AVI in memory with C++的更多相关文章
- WCF Windows Service Using TopShelf and ServiceModelEx z
http://lourenco.co.za/blog/2013/08/wcf-windows-service-using-topshelf-and-servicemodelex/ There are ...
- SPFILE 、PFILE 的全面解读
这里先阐述一下数据库的启动过程: 1. 启动实例/例程(nomount状态)时,读取参数文件(文本文件PFILE 或服务器参数文件SPFILE),分配SGA.启动后台进程.打开告警文件及后台 ...
- udp协议的数据接收与发送的代码
我想基于lwIP协议中的UDP协议,用单片机做一个服务器,接受电脑的指令然后返回数据.以下是我的代码 /************************************************ ...
- 利用ZYNQ SOC快速打开算法验证通路(6)——LWIP实现千兆TCP/IP网络传输
一.前言 之前ZYNQ与PC之间的网络连接依赖于外接硬件协议栈芯片,虽然C驱动非常简单,但网络带宽受限.现采用LWIP+PS端MAC控制器+PHY芯片的通用架构.关于LWIP库,已经有很多现成的资料和 ...
- C# to IL 6 Reference and Value Types(引用类型和值类型)
An interface is a reference type, in spite of the fact that it has no code at all. Thus, wecannot in ...
- centos7.5安装minikube kubernetes
前提:已安装centos7.5安装VirtualBox Minikube是什么?Minikube是一种方便在本地运行Kubernetes的工具. Minikube 是可以在VM中运行单节点的Kuber ...
- FPGA内部RAM的初始化
Altera的RAM初始化文件格式是mif和hex. QuartusII自带的RAM初始化工具很方便产生初始化文件. Xilinx的RAM初始化文件格式是coe, 在vivado中软件会将coe文件变 ...
- GPU Command Buffer
For Developers > Design Documents > GPU Command Buffer This are mostly just notes on the ...
- minikube国内在线部署体验
问题描述: 快速学习k8s的各个组件的作用及yml的编写,minikube很适合. how to install Minikube, a tool that runs a single-node Ku ...
随机推荐
- 【UVa】And Then There Was One(dp)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- OSG 中 相交測试 模块 工作流程及原理
主要涉及三个类: 1. osgUtil::PolytopeIntersector // 详细不同算法实现类 2. osgUtil::IntersectionVisitor //用来遍历节点树的每一个节 ...
- TrustZone——开源库—Linaro—OP-TEE
想研究安全系统源代码的有福气了.曾经OVOS的代码缺少TA相关的实现. 这次的版本号,基本框架都有了.先看看架构图吧. 几家大公司做的,可能是ST牵头.页面有ST的LOGO. 代码质量较高. 未来也会 ...
- 怎么用MathType解决Word公式排版很乱的问题
现在办公室起草文件,期刊论文投稿.学校试着编辑都要先在Word中编辑好后再打印出来.在Word中编辑这些文本内容时,如果遇到公式就要使用专门的MathType公式编辑器.而有很多人在用MathType ...
- Maven项目POM.xml详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 关于PostgreSQL的SQL注入必知必会
一.postgresql简介 postgresql是一款关系型数据库,广泛应用在web编程当中,由于其语法与MySQL不尽相同,所以其SQL注入又自成一派. 二.postgresql的SQL注入:(注 ...
- Struts2漏洞利用原理及OGNL机制
Struts2漏洞利用原理及OGNL机制研究 概述 在MVC开发框架中,数据会在MVC各个模块中进行流转.而这种流转,也就会面临一些困境,就是由于数据在不同MVC层次中表现出不同的形式和状态而造成 ...
- js 中导出excel 较长数字串会变成科学计数法(转载)
在做项目中,碰到如题的问题.比如要将居民的信息导出到excel中,居民的身份证号码因为长度过长(大于10位),excel会自动的将过长的数字串转换成 科学计数法.现在网上找到解决方案之一: (在数字串 ...
- CH5E01 乌龟棋【线性DP】
5E01 乌龟棋 0x5E「动态规划」练习 描述 小明过生日的时候,爸爸送给他一副乌龟棋当作礼物.乌龟棋的棋盘是一行N 个格子,每个格子上一个分数(非负整数).棋盘第1 格是唯一的起点,第N 格是终点 ...
- Pycharm取消默认的右击运行unittest方法
Pycharm取消默认的右击运行unittest方法:File-> Settings -> Tools -> Python Integrated Tools -> Defaul ...