免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 843 | 回复: 0
打印 上一主题 下一主题

测试JRTPLIB-LINUX报告 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-07 20:48 |只看该作者 |倒序浏览
安装JRTPLIB成功,需要JTHREAD库的支持(跨平台开源代码,只有三个类)。
测试其中的例子,能够按照RTP的协议进行采集!

Linux下安装Lame3成功,并用命令行的方式把×.wav格式的文件压缩成了MP3格式。然后调用FOBSFFMPEG可以正常播放,感觉太好了。

如此方案可以定为:

用Lame3对采集的声卡数据进行压缩成mp3格式的数据,然后用JRTPLIB打包进行传输,然后通过FOBSFFMPEG进行解包并播放。

还应考虑两边的交互性。

在lame的例子程序里,把缓冲区的数进行压缩的顺序如下:

/************************************************************************
*
* read_samples()
*
* PURPOSE:  reads the PCM samples from a file to the buffer
*
*  SEMANTICS:
* Reads #samples_read# number of shorts from #musicin# filepointer
* into #sample_buffer[]#.  Returns the number of samples read.
*
************************************************************************/
static int
read_samples_pcm(FILE * const musicin, int sample_buffer[2304],
                 int frame_size /* unused */ , int samples_to_read)
{
    int     i;
    int     samples_read;
    samples_read =
        sf_read_int((SNDFILE *) musicin, sample_buffer, samples_to_read);
    switch (pcmbitwidth) {
    case 8:
        for (i = 0; i
    return samples_read;
}



/************************************************************************
*
* read_samples()
*
* PURPOSE:  reads the PCM samples from a file to the buffer
*
*  SEMANTICS:
* Reads #samples_read# number of shorts from #musicin# filepointer
* into #sample_buffer[]#.  Returns the number of samples read.
*
************************************************************************/
int
read_samples_pcm(FILE * musicin, int sample_buffer[2304], int frame_size,
                 int samples_to_read)
{
    int     samples_read;
    int     iswav = (input_format == sf_wave);
    int     hi_lo_order; /* byte order of input stream */
    if( (32 == pcmbitwidth) || (24 == pcmbitwidth) || (16 == pcmbitwidth) ) {
    /* assume only recognized wav files are */
    /*  in little endian byte order */
hi_lo_order = (!iswav == !pcmswapbytes);
        samples_read = unpack_read_samples(samples_to_read, pcmbitwidth/8,
                                           hi_lo_order,sample_buffer, musicin );
      
    } else if( 8 == pcmbitwidth ) {
samples_read = unpack_read_samples( samples_to_read, 1, 0,
         sample_buffer, musicin );
    } else {
if( silent
    return samples_read;
}


lame_encode_finish(gf,mp3buffer,sizeof(mp3buffer));

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16942/showart_137782.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP