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形式的地图展示,可以自行绘制图形,高亮区 ...
随机推荐
- UI基础_transform
#import "ViewController.h" typedef enum { ButtonTypeLeft = 1, ButtonTypeRight, ButtonTypeU ...
- Grafana连接Prometheus监控Docker平台
Grafana是一款开源的分析平台. Grafana allows you to query, visualize, alert on and understand your metrics no m ...
- ASP.NET MVC 5 访问在views文件夹中的JS文件。 ASP.NET MVC html与JS分离
修改VIEWS文件夹下的web.config文件, 加入下面红色字标识的内容: <system.webServer> <handlers> <r ...
- lockingModel in log4net 日志文件不能被其他进程写入
http://logging.apache.org/log4net/release/faq.html#single-file How do I get multiple process to log ...
- UVA 11186 Circum Triangle (枚举三角形优化)(转)
题意:圆上有n个点,求出这n个点组成的所有三角形的面积之和 题解: 当我们要求出S(i,j,k)时,我们需要假设k在j的左侧,k在i与j之间,k在i的右侧. 如果k在 j的左侧 那么 S(i,j,k ...
- skynet中的各种锁
最近读skynet c语言部分的源码,发现有好多锁的使用和gcc提供的一些原子操作.看到这些东西,对于我这个newbee来说实在有些hold不住.但为了了解并进一步掌握,还是决定好好分析一下.不足之处 ...
- 智课雅思词汇---十八、前缀peri是什么意思
智课雅思词汇---十八.前缀peri是什么意思 一.总结 一句话总结:前缀:peri- 表示“周围, 靠近” 词根:-peri- [词根含义]:试验,尝试 [词根来源]:英语experience, e ...
- 搜索5--noi1700:八皇后问题
搜索5--noi1700:八皇后问题 一.心得 二.题目 1700:八皇后问题 查看 提交 统计 提问 总时间限制: 10000ms 内存限制: 65536kB 描述 在国际象棋棋盘上放置八个皇后 ...
- R语言基础入门之二:数据导入和描述统计
by 写长城的诗 • October 30, 2011 • Comments Off This post was kindly contributed by 数据科学与R语言 - go there t ...
- iOS开发中的系统版本比较
由于系统平台和SDK更新迭代,一部分过时的成员.方法会被彻底从SDK中移除,为了兼容旧的设备,这时就需要区分系统平台版本调用正确的API. 另一种情况是iOS设备的屏幕和设备参数不同,虽然UI上的Au ...