html读写excle文档
2024-10-01 03:24:49
1、faac
example
./configure --prefix=$(pwd)/_install
make
make install
/* aac_encode.c */
#include <stdio.h>
#include <faac.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h> int main (int argc, char **argv)
{
unsigned long sampleRate = 8000;
unsigned int numChannels = 1;
unsigned long inputSample = 0;
unsigned long maxOutputBytes = 0;
faacEncHandle encoder;
faacEncConfigurationPtr config;
FILE *rfile = NULL;
FILE *wfile = NULL;
int16_t *pcm_input = NULL;
uint8_t *aac_output = NULL;
int readcount = 0;
int writecount = 0; encoder = faacEncOpen(sampleRate, numChannels, &inputSample, &maxOutputBytes);
config = faacEncGetCurrentConfiguration(encoder);
config->aacObjectType = MAIN;
config->mpegVersion = MPEG4;
config->useLfe = 0;
config->useTns = 1;
config->allowMidside = 1;
/*RAW_STREAM=0, ADTS_STREAM=1*/
config->outputFormat = 1;
config->bitRate = sampleRate;
config->inputFormat = FAAC_INPUT_16BIT;
faacEncSetConfiguration(encoder, config); printf("sampleRate:%ld, numChannels:%d, inputSample:%ld, maxOutputBytes:%ld\n",
sampleRate, numChannels, inputSample, maxOutputBytes); if (argv[1]) {
rfile = fopen(argv[1], "rb");
} else {
printf("try to open input.pcm\n");
rfile = fopen("input.pcm", "rb");
} if (!rfile) {
printf("open error\n");
goto end;
} if (argv[2]) {
wfile = fopen(argv[2], "wb");
} else {
printf("try to open output.aac\n");
wfile = fopen("output.aac", "wb");
} if (!wfile) {
printf("open error\n");
goto end;
} pcm_input = (int16_t *)malloc(inputSample * sizeof(int16_t));
aac_output = (uint8_t *)malloc(maxOutputBytes * sizeof(uint8_t)); /* encode */
while (1) {
int readlen = 0;
int ret = 0; readlen = fread(pcm_input, sizeof(int16_t), inputSample, rfile); ret = faacEncEncode(encoder, (int32_t *)pcm_input, readlen, aac_output, maxOutputBytes); if (ret > 0) {
fwrite(aac_output, sizeof(uint8_t), ret, wfile);
} else if (ret < 0) {
printf("encode error\n");
break;
} readcount += readlen * 2;
writecount += ret; if (!readlen && !ret) {
printf("encode complete, from %d bytes to %d bytes\n", readcount, writecount);
break;
}
} free(pcm_input);
free(aac_output); end:
if (wfile) fclose(wfile);
if (rfile) fclose(rfile);
faacEncClose(encoder);
return 0;
}
Makefile
APP = main
INCLUDE = \
-I ./faac/include
LIB = \
-L ./faac/lib/
SRC = main.c
CFLAGS =
LDFLAGS = -lfaac
out:
gcc $(SRC) -o $(APP) $(LIB) $(INCLUDE) $(CFLAGS) $(LDFLAGS)
clean:
rm -rf *o *.out $(APP)
2、faac/faad <--- > pcm
https://www.audiocoding.com/downloads.html
3、g711 <---> pcm
https://github.com/phoenixZZZ/G711_EncodecAndDecodec
https://github.com/Wenstery/G711AudioStream
https://github.com/escrichov/G711
codec-for-audio-in-G72X-G711-G723-G726-G729
非常好的实例,已经用在产品里了,感谢作者!
An ANSI C library for encoding/decoding using the A-law and u-Law.
https://github.com/dystopiancode/pcm-g711
https://blog.csdn.net/szfhy/article/details/52448906
最新文章
- input range样式更改,模拟滑块
- 经典DOS游戏皇帝攻略(曾经的回忆)
- 笔记6:winfrom连接sql server 进行数据交换
- JPA学习---第八节:使用JPQL语句进行查询
- hadoop2.2编程:mapreduce编程之二次排序
- mybatis-generator 代码自动生成工具(maven方式)
- 在VS中生成后拷贝文件
- 2.如何实现使用VBS脚本程序对直播间自动评论
- nicEditors使用方法
- .NET之微信消息模板推送
- 【Springboot】Springboot整合Thymeleaf模板引擎
- nginx日志切割(logrotate或shell脚本)
- MySQL-基本命令
- i2c初步理解
- Mac 下netstat和linux下不一样
- 初识Java作业
- discuz完善用户资料任务不能完成的解决方法
- dongle0
- Python类中self的作用
- apache服务器设置
热门文章
- Memcached 1.4.20 发布,集中式缓存系统
- Ajax的两个用法
- div允许用户输入
- 离线 + 位优化 - SGU 108 Self-numbers 2
- JavaScript语言精粹读书笔记- JavaScript对象
- 【BZOJ】1030: [JSOI2007]文本生成器(递推+ac自动机)
- 【BZOJ】1644: [Usaco2007 Oct]Obstacle Course 障碍训练课(bfs)
- linux grub启动密码验证设置
- mysql_ado的demo
- 还是PHPExcel问题