EMIPLIB简介
MIPAverageTimer timer(interval); //设定计时器
MIPWAVInput sndFileInput; //声音文件输入
MIPSamplingRateConverter sampConv, sampConv2; //采样转换
MIPSampleEncoder sampEnc, sampEnc2, sampEnc3; //采样编码
MIPULawEncoder uLawEnc; //uLaw编码
MIPRTPULawEncoder rtpEnc; //rtp编码
MIPRTPComponent rtpComp; //rtp组建
MIPRTPDecoder rtpDec; //rtp解码
MIPRTPULawDecoder rtpULawDec; //rtp ulaw解码
MIPULawDecoder uLawDec; //uLaw解码
MIPAudioMixer mixer; //混音
MIPWinMMOutput sndCardOutput; //声卡输出
MyChain chain("Sound file player"); //链:用来把上面组建串起来的对象。
RTPSession rtpSession; //RTP会话,来自jrtplib
bool returnValue; //返回值
int numChannels = 1; //声道设置默认为单声道
returnValue = sampEnc.init(MIPRAWAUDIOMESSAGE_TYPE_S16);
returnValue = uLawEnc.init();
RTPUDPv4TransmissionParams transmissionParams;
RTPSessionParams sessionParams;
int portBase = 60000;
int status;
sessionParams.SetOwnTimestampUnit(1.0/((double)samplingRate));
sessionParams.SetMaximumPacketSize(64000);
sessionParams.SetAcceptOwnPackets(true);
//建立一个RTPSession
status = rtpSession.Create(sessionParams,&transmissionParams);
status = rtpSession.AddDestination(RTPIPv4Address(ntohl(inet_addr("127.0.0.1")),portBase));
returnValue = rtpComp.init(&rtpSession);
//初始化RTP解码器
returnValue = rtpDec.init(true, 0, &rtpSession);
//设置RTP解码器使用ulaw规则
// 初始化ulaw解码,转换被U-law 解码的采样数据为线性解码采样
returnValue = uLawDec.init();
returnValue = sampConv2.init(samplingRate, numChannels);
//初始化混音
//初始化声卡输出
returnValue = sndCardOutput.open(samplingRate, numChannels, interval);
//声卡输出使用的数据形式
returnValue = chain.setChainStart(&timer);
returnValue = chain.addConnection(&uLawEnc, &rtpEnc);
returnValue = chain.addConnection(&rtpComp, &rtpDec);
returnValue = chain.addConnection(&sampEnc2, &sampConv2, true);
//启动这个链
int numChannels = 1;
returnValue=sndCardInput.open(samplingRate,numChannels,interval,buffertime,false);
{
IpAddrList *ipl=(IpAddrList*)lpParameter; //把目的列表传过来鸟
WSAStartup(MAKEWORD(2,2),&dat);
MIPTime buffertime(10);
MIPAverageTimer timer(interval);
MIPWAVInput sndFileInput;
MIPSamplingRateConverter sampConv;
MIPSampleEncoder sampEnc;
MIPULawEncoder uLawEnc;
MIPRTPULawEncoder rtpEnc;
MIPRTPComponent rtpComp;
MIPWinMMOutput sndCardOutput;
MyChain chain("MPVC");
RTPSession rtpSession;
bool returnValue;
int numChannels = 1;
returnValue=sndCardInput.open(samplingRate,numChannels,interval,buffertime,false);
returnValue = sampEnc.init(MIPRAWAUDIOMESSAGE_TYPE_S16);
returnValue = uLawEnc.init();
returnValue = rtpEnc.init();
RTPSessionParams sessionParams;
int portBase = BASEPORT_SEND;
int status;
transmissionParams.SetPortbase(portBase);
sessionParams.SetOwnTimestampUnit(1.0/((double)samplingRate));
sessionParams.SetMaximumPacketSize(64000);
{
status = rtpSession.AddDestination(RTPIPv4Address(ntohl(inet_addr(ipl->ipaddr[i])),BASEPORT_LISTEN));
}
returnValue = rtpComp.init(&rtpSession);
returnValue = chain.setChainStart(&sndCardInput);
returnValue = chain.addConnection(&sndCardInput, &sampEnc);
returnValue = chain.addConnection(&sampEnc, &uLawEnc);
returnValue = chain.addConnection(&uLawEnc, &rtpEnc);
returnValue = chain.addConnection(&rtpEnc, &rtpComp);
returnValue = chain.start();
{
Sleep(SLEEP_TIME);
}
returnValue = chain.stop();
rtpSession.Destroy();
return 0;
}
{
WSADATA dat;
WSAStartup(MAKEWORD(2,2),&dat);
MIPTime buffertime(10);
MIPAverageTimer timer(interval);
MIPWAVInput sndFileInput;
MIPSamplingRateConverter sampConv, sampConv2;
MIPSampleEncoder sampEnc, sampEnc2, sampEnc3;
MIPULawEncoder uLawEnc;
MIPRTPULawEncoder rtpEnc;
MIPRTPComponent rtpComp;
MIPRTPDecoder rtpDec;
MIPRTPULawDecoder rtpULawDec;
MIPULawDecoder uLawDec;
MIPAudioMixer mixer;
MIPWinMMOutput sndCardOutput;
MyChain chain("MPVClisten");
RTPSession rtpSession;
bool returnValue;
int numChannels = 1;
RTPSessionParams sessionParams;
int status;
sessionParams.SetOwnTimestampUnit(1.0/((double)samplingRate));
sessionParams.SetMaximumPacketSize(64000);
status = rtpSession.Create(sessionParams,&transmissionParams);
returnValue = rtpComp.init(&rtpSession);
returnValue = rtpDec.init(true, 0, &rtpSession);
returnValue = rtpDec.setPacketDecoder(0,&rtpULawDec);
returnValue = uLawDec.init();
returnValue = sampEnc2.init(MIPRAWAUDIOMESSAGE_TYPE_FLOAT);
returnValue = sampConv2.init(samplingRate, numChannels);
returnValue = mixer.init(samplingRate, numChannels, interval);
returnValue = sndCardOutput.open(samplingRate, numChannels, interval);
returnValue = sampEnc3.init(MIPRAWAUDIOMESSAGE_TYPE_S16LE);
returnValue = chain.setChainStart(&timer);
returnValue = chain.addConnection(&timer, &rtpComp);
returnValue = chain.addConnection(&rtpComp, &rtpDec);
returnValue = chain.addConnection(&rtpDec, &uLawDec, true);
returnValue = chain.addConnection(&uLawDec, &sampEnc2, true);
returnValue = chain.addConnection(&sampEnc2, &sampConv2, true);
returnValue = chain.addConnection(&sampConv2, &mixer, true);
returnValue = chain.addConnection(&mixer, &sampEnc3);
returnValue = chain.addConnection(&sampEnc3, &sndCardOutput);
returnValue = chain.start();
{
Sleep(SLEEP_TIME);
}
rtpSession.BYEDestroy(RTPTime(10,0),0,0);
returnValue = chain.stop();
rtpSession.Destroy();
return 0;
}
EMIPLIB简介的更多相关文章
- ASP.NET Core 1.1 简介
ASP.NET Core 1.1 于2016年11月16日发布.这个版本包括许多伟大的新功能以及许多错误修复和一般的增强.这个版本包含了多个新的中间件组件.针对Windows的WebListener服 ...
- MVVM模式和在WPF中的实现(一)MVVM模式简介
MVVM模式解析和在WPF中的实现(一) MVVM模式简介 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在 ...
- Cassandra简介
在前面的一篇文章<图形数据库Neo4J简介>中,我们介绍了一种非常流行的图形数据库Neo4J的使用方法.而在本文中,我们将对另外一种类型的NoSQL数据库——Cassandra进行简单地介 ...
- REST简介
一说到REST,我想大家的第一反应就是“啊,就是那种前后台通信方式.”但是在要求详细讲述它所提出的各个约束,以及如何开始搭建REST服务时,却很少有人能够清晰地说出它到底是什么,需要遵守什么样的准则. ...
- Microservice架构模式简介
在2014年,Sam Newman,Martin Fowler在ThoughtWorks的一位同事,出版了一本新书<Building Microservices>.该书描述了如何按照Mic ...
- const,static,extern 简介
const,static,extern 简介 一.const与宏的区别: const简介:之前常用的字符串常量,一般是抽成宏,但是苹果不推荐我们抽成宏,推荐我们使用const常量. 执行时刻:宏是预编 ...
- HTTPS简介
一.简单总结 1.HTTPS概念总结 HTTPS 就是对HTTP进行了TLS或SSL加密. 应用层的HTTP协议通过传输层的TCP协议来传输,HTTPS 在 HTTP和 TCP中间加了一层TLS/SS ...
- 【Machine Learning】机器学习及其基础概念简介
机器学习及其基础概念简介 作者:白宁超 2016年12月23日21:24:51 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本系列文章是作者结 ...
- Cesium简介以及离线部署运行
Cesium简介 cesium是国外一个基于JavaScript编写的使用WebGL的地图引擎,一款开源3DGIS的js库.cesium支持3D,2D,2.5D形式的地图展示,可以自行绘制图形,高亮区 ...
随机推荐
- QGIS 编译
QGIS 编译 在编译的过程中花费了很长时间,特别是编译Debug版本.release版本的编译可以从晚上找到很多的资料,但是Debug的编译相对较少.在Debug编译的过程中,需要单独build工程 ...
- MySQL/MariaDB数据库备份与恢复之mysqlpump入门操作
创建测试用表:MariaDB [music]> create table summary(id int,info char(128));Query OK, 0 rows affected (0 ...
- jprofile查看hprof文件[转]
用jprofile打开hprof文件,查看内存泄露情况,有几个常用的功能说明一下: 工具下载:到官网下载jprofile7.0.1 64位的.再申请一个注册号,注册号的申请好像是一个邮件只能用一次. ...
- linux下常用FTP命令 1. 连接ftp服务器[转]
1. 连接ftp服务器 格式:ftp [hostname| ip-address]a)在linux命令行下输入: ftp 192.168.1.1 b)服务器询问你用户名和密码,分别输入用户名和相应密码 ...
- centos下无法使用lsof命令"-bash: lsof: command not found"
1.问题描述 : 在CentOS下,使用lsof命令,报错如下: 2.解决方法: #yum install lsof 若输入y不能安装成功,通过yum install 包 -y 进行安装: # yum ...
- Spark Shuffle的技术演进
在Spark或Hadoop MapReduce的分布式计算框架中,数据被按照key分成一块一块的分区,打散分布在集群中各个节点的物理存储或内存空间中,每个计算任务一次处理一个分区,但map端和re ...
- DataWarehouse- 从面试定位自己的水平
1.讲一下什么是维度表和事实表.用户资料表算是什么类型表. 2. 维度建模属于第几范式,让你对维度建模改进,有什么思路吗. 3. 了解数据血缘分析吗,让你实现的话有什么技术方案,感觉难点在哪. 4. ...
- 智课雅思词汇---十九、前缀se是什么意思
智课雅思词汇---十九.前缀se是什么意思 一.总结 一句话总结:前缀:se- 表示“分开, 离开, 区别开” 前缀:se- [词根含义]:分离 [同源单词]:secede, secession, s ...
- 深入剖析Redis主从复制
[http://sofar.blog.51cto.com/353572/1413024/] [Redis 主从复制的内部协议和机制] 一.主从概述 Redis 支持 Master-Slave( ...
- 常用的CDN 链接 http://cdn.code.baidu.com/ http://www.bootcdn.cn/
http://cdn.code.baidu.com/ http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs ★新浪CDN,感觉 ...