91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15.55MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-10
  • 語言: 其他
  • 標簽: G711??PCM??

資源簡介

將G711轉化為PCM,然后再采用CDL2播放,在VS2010下測試通過,并附帶G711音頻測試文件

資源截圖

代碼片段和文件信息

/**
?*?最簡單的SDL2播放音頻的例子(SDL2播放PCM)
?*?Simplest?Audio?Play?SDL2?(SDL2?play?PCM)?
?*
?*?雷霄驊?Lei?Xiaohua
?*?leixiaohua1020@126.com
?*?中國傳媒大學/數字電視技術
?*?Communication?University?of?China?/?Digital?TV?Technology
?*?http://blog.csdn.net/leixiaohua1020
?*
?*?本程序使用SDL2播放PCM音頻采樣數據。SDL實際上是對底層繪圖
?*?API(Direct3D,OpenGL)的封裝,使用起來明顯簡單于直接調用底層
?*?API。
?*
?*?函數調用步驟如下:
?*
?*?[初始化]
?*?SDL_Init():初始化SDL。
?*?SDL_OpenAudio():根據參數(存儲于SDL_AudioSpec)打開音頻設備。
?*
?*?[循環播放數據]
?*?SDL_PauseAudio():播放音頻數據。
?*?SDL_Delay():延時等待播放完成。
?*
?*?This?software?plays?PCM?raw?audio?data?using?SDL2.
?*?SDL?is?a?wrapper?of?low-level?API?(DirectSound).
?*?Use?SDL?is?much?easier?than?directly?call?these?low-level?API.
?*
?*?The?process?is?shown?as?follows:
?*
?*?[Init]
?*?SDL_Init():?Init?SDL.
?*?SDL_OpenAudio():?Opens?the?audio?device?with?the?desired?
?* parameters?(In?SDL_AudioSpec).
?*
?*?[Loop?to?play?data]
?*?SDL_PauseAudio():?Play?Audio.
?*?SDL_Delay():?Wait?for?completetion?of?playback.
?*/

#include?
#include?
#include?
#include?

extern?“C“
{
#include?“sdl/SDL.h“
#include?
#include?
#include?
};

#define SIGN_BIT (0x80) /*?Sign?bit?for?a?A-law?byte.?*/
#define QUANT_MASK (0xf) /*?Quantization?field?mask.?*/
#define NSEGS (8) /*?Number?of?A-law?segments.?*/
#define SEG_SHIFT (4) /*?Left?shift?for?segment?number.?*/
#define SEG_MASK (0x70) /*?Segment?field?mask.?*/
#define BIAS (0x84) /*?Bias?for?linear?code.?*/

//Buffer:
//|-----------|-------------|
//chunk-------pos---len-----|
static??Uint8??*audio_chunk;?
static??Uint32??audio_len;?
static??Uint8??*audio_pos;?


int?ulaw2linear(?unsigned?char u_val)
{
int t;

/*?Complement?to?obtain?normal?u-law?value.?*/
u_val?=?~u_val;

/*
?*?Extract?and?bias?the?quantization?bits.?Then
?*?shift?up?by?the?segment?number?and?subtract?out?the?bias.
?*/
t?=?((u_val?&?QUANT_MASK)?< t?<<=?((unsigned)u_val?&?SEG_MASK)?>>?SEG_SHIFT;

return?((u_val?&?SIGN_BIT)???(BIAS?-?t)?:?(t?-?BIAS));
}

int?g711utoPCM(const?char*?g711file?const?char*?pcmfile){
FILE?*?inpf;
FILE?*?outf;
inpf?=?fopen(g711file?“rb“);
if(?inpf?==?NULL?)
{
printf(“G.711?file?cant?open\n“);
return?1?;
}
outf?=?fopen(pcmfile?“wb“);
unsigned?char*?Buf;
Buf?=?(unsigned?char*)calloc(1024?sizeof(char));
int?nalLen?=?0;
while(!feof(inpf))
{
nalLen?=fread(Buf11inpf);
int?iLinear?=?ulaw2linear(Buf[0]);
fwrite(&iLinear12outf);//寫到文件
}
if(inpf)
fclose(inpf);

if(outf)
fclose(outf);
printf(“The?pcm?audio?file?is?end?!?\n“);
return?0;
}


/*?Audio?Callback
?*?The?audio?function?callback?takes?the?following?parameters:?
?*?stream:?A?pointer?to?the?audio?buffer?to?be?filled?
?*?len:?The?length?(in?bytes)?of?the?audio?buffer?
?*?
*/?
void??fill_audio(void?*udataUint8?*streamint?len){?
//SDL?2.0
SDL_mem

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????????25??2014-06-05?19:35??AudioDecode&play—G711播放DEMO_20150806\.gitignore

?????文件???22247936??2015-07-09?16:34??AudioDecode&play—G711播放DEMO_20150806\avcodec-56.dll

?????文件????1380352??2015-06-19?12:41??AudioDecode&play—G711播放DEMO_20150806\avdevice-56.dll

?????文件????2386432??2015-06-19?12:41??AudioDecode&play—G711播放DEMO_20150806\avfilter-5.dll

?????文件????6021632??2015-06-19?12:41??AudioDecode&play—G711播放DEMO_20150806\avformat-56.dll

?????文件?????495104??2015-07-09?16:34??AudioDecode&play—G711播放DEMO_20150806\avutil-54.dll

?????文件???????1698??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\cl.command.1.tlog

?????文件??????30292??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\CL.read.1.tlog

?????文件???????1130??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\CL.write.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.6016-cvtres.read.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.6016-cvtres.write.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.6016.read.1.tlog

?????文件??????????2??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.6016.write.1.tlog

?????文件???????4140??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.command.1.tlog

?????文件???????8032??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.read.1.tlog

?????文件???????2464??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\link.write.1.tlog

?????文件???????1070??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\mt.command.1.tlog

?????文件????????970??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\mt.read.1.tlog

?????文件????????776??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\mt.write.1.tlog

?????文件???????1594??2015-08-06?09:25??AudioDecode&play—G711播放DEMO_20150806\Debug\rc.command.1.tlog

?????文件????????914??2015-08-06?09:25??AudioDecode&play—G711播放DEMO_20150806\Debug\rc.read.1.tlog

?????文件????????930??2015-08-06?09:25??AudioDecode&play—G711播放DEMO_20150806\Debug\rc.write.1.tlog

?????文件??????31232??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.exe

?????文件????????658??2015-08-06?08:54??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.exe.embed.manifest

?????文件????????724??2015-08-06?09:25??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.exe.embed.manifest.res

?????文件????????616??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.exe.intermediate.manifest

?????文件?????385072??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.ilk

?????文件?????????73??2015-08-06?09:36??AudioDecode&play—G711播放DEMO_20150806\Debug\simplest_audio_play_sdl2.lastbuildstate

............此處省略205個文件信息

評論

共有 條評論