首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    libmad学习进阶2----利用libmad将mp3转码成pcm

    # include <stdio.h> # include <unistd.h> # include <sys/stat.h> # include <sys/mman.h> # include "mad.h" #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<stdlib.h> /* * This is perhaps the simplest example use of the MAD high-level API. * Standard input is mapped into memory via mmap(), then the high-level API * is invoked with three callbacks: input, output, and error. The output * callback converts MAD's high-resolution PCM samples to 16 bits, then * writes them to standard output in little-endian, stereo-interleaved * format. */ #define printf static Get_file_length(char *PATH); static int decode(unsigned char const *, unsigned long); int main(int argc, char *argv[]) { printf("The main is start!\n"); struct stat stat; void *fdm; int fd; //char buffer1[80000]; printf("###The input file is %s ! the arc=%d###\n",argv[1],argc); if (argc == 1) { printf("The argc is wrong!\n"); return 1; } #if 0 if (fstat(STDIN_FILENO, &stat) == -1 || stat.st_size == 0) return 2; #endif fd =open(argv[1],O_RDWR); if(-1==fd) { printf("sorry,The file open is faild!\n"); } else { printf("The file open is sucessed!\n"); } //read(fd,buffer1,sizeof(buffer1)); //printf("%s", buffer1); stat.st_size = Get_file_length(argv[1]); printf("The file size is %d\n",stat.st_size ); printf("The Map is begin!\n"); fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, fd, 0); if (fdm == MAP_FAILED) { printf("mmap is failed\n"); return 3; } decode(fdm, stat.st_size); if (munmap(fdm, stat.st_size) == -1) return 4; return 0; } /* * This is a private message structure. A generic pointer to this structure * is passed to each of the callback functions. Put here any data you need * to access from within the callbacks. */ struct buffer { unsigned char const *start; unsigned long length; }; /* * This is the input callback. The purpose of this callback is to

    05

    Svelte框架结合SpreadJS实现表格协同文档

    SpreadJS是葡萄城结合 40 余年专业控件技术和在电子表格应用领域的经验而推出的纯前端表格控件。作为一个类Excel控件,SpreadJS如何实现当前比较流行的表格协同呢?本篇文章将简单介绍一下。 首先,从框架搭建上,本篇示例采用当下流行的前后端分离的开发方式,前端使用npm作为脚手架搭建Svelte框架。 后端使用Java的SpringBoot作为后端框架。前端使用SpreadJS V15.2.5以及SpreadJS在线表格编辑器Designer为前端操作的平台后端使用GCExcel作为文档的终端处理,随时提供备份与恢复。 首先,介绍下在前端Svelte框架下搭建SpreadJS在线表格编辑器。 1、在pageage.json文件中引入相关SpreadJS资源

    03

    Swift多线程之Operation:按优先级加载图片1. 进程和线程2. Operation3. Basic Demo4. 案例实现

    乖乖的,俺又来了。上一个系列写传感器,特别庆幸自己在开篇的时候就立下了一个Flag,不然那个系列估计到现在就不知道被自己偏到什么地方去了。众所周知的iOS有好多传感器,配合各种传感器可以做出来各种好玩的东东。 宅胖也见过很多超牛的作品用传感器和动画相结合,那简直了。 所以,这个系列,叫做多线程。在写之前还是稍稍做了一下功课,大概看了看一些前辈们的分享帖。于是果断的决定这个系列不出意外,基本上就用Swift来写了。如果有特别强烈要求的同学,打算重金打赏宅胖两块钱要求提供OC源代码的,我也会毫无底线的答应这个无

    03
    领券