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形式的地图展示,可以自行绘制图形,高亮区 ...
随机推荐
- MySQL数据库基本操作(四)
在进行查询之前,我们要先建好关系表,并往数据表中插入些数据.为查询操作做好准备. 五张关系表的创建: #创建并进入数据库: mysql> CREATE DATABASE `info`; Quer ...
- (十三)linux文件系统详解(基于ext2文件系统)【转】
本文转载自:https://blog.csdn.net/FadeFarAway/article/details/53959639 我们知道,一个磁盘可以划分成多个分区,每个分区必须先用格式化工具(例如 ...
- Spring MVC 接收多个实体参数
在SpringMVC 的接收参数中,如果接收一个实体对象,只需要在方法参数中这样做:@RequestBody User user //单个的时候这样接收 @RequestMapping(value = ...
- Yii框架和Vue的完美结合完成前后端分离项目
背景说明 本文假设你对Yii和Vue都比较熟悉,至少都在项目里用过,另外笔者新人,以后不定时放一些干货,欢迎程序媛关注 Yii是一个PHP全端框架,典型的mvc的项目结构,后端接口都是一个控制器里放了 ...
- alibaba的JSON.toString会把值为null的字段去掉,谨记
alibaba的JSON.toString会把值为null的字段去掉,谨记 Map<String,Object> map = new HashMap<>(); map.put( ...
- IDEA字体设置
最近编码总是把","和"."搞错,字体实在是太小了,看不清,而且g的显示各个字体显示也是不一样,看的十分难受,果断换字体.分享一下在IDEA2017.2.5中如 ...
- python 2 到 3 的新手坑
print 和 input print 我们在课程最开始的时候就讲过 print,在版本2的使用方法是: print 'this is version 2' 也可以是 print('this is v ...
- ASP.NET上传文件,已经上传的大小保存在session中,在另一个页面中读取session的值不行
想自己做个ASP.NET上传文件时显示进度条的, 按照自己的想法,其实也就是显示每次已经上传的字节,从网上找到一个方法是能够把文件变成流以后再慢慢写入的,我在那个循环写入的时候每循环一次都把已经上传的 ...
- WPF利用通过父控件属性来获得绑定数据源RelativeSource
WPF利用通过父控件属性来获得绑定数据源RelativeSource 有时候我们不确定作为数据源的对象叫什么名字,但知道作为绑定源与UI布局有相对的关系,如下是一段XAML代码,说明多层布局控件中 ...
- json与NSString转换
json to string NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json options:NSJSONWriting ...