资源简介
mp3 播放器的linux c代码

代码片段和文件信息
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2004 Underbit Technologies Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*
* $Id: minimad.cv 1.4 2004/01/23 09:41:32 rob Exp $
*/
# include
# include
# include
# include
# include “mad.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.
*/
static int decode(unsigned char const * unsigned long);
int main(int argc char *argv[])
{
struct stat stat;
void *fdm;
if (argc != 1)
return 1;
if (fstat(STDIN_FILENO &stat) == -1 ||
stat.st_size == 0)
return 2;
fdm = mmap(0 stat.st_size PROT_READ MAP_SHARED STDIN_FILENO 0);
if (fdm == MAP_FAILED)
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 (re)fill
* the stream buffer which is to be decoded. In this example an entire file
* has been mapped into memory so we just call mad_stream_buffer() with the
* address and length of the mapping. When this callback is called a second
* time we are finished decoding.
*/
static
enum mad_flow input(void *data
struct mad_stream *stream)
{
struct buffer *buffer = data;
if (!buffer->length)
return MAD_FLOW_STOP;
mad_stream_buffer(stream buffer->start buffer->length);
buffer->length = 0;
return MAD_FLOW_CONTINUE;
}
/*
* The following utility routine performs simple rounding clipping and
* scaling of MAD‘s high-resolution samples down to 16 bits. It does not
* perform any dithering or noise shaping which would be recommended to
* obtain any exceptional audio quality. It is therefore not recommend
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 139 2012-07-01 00:41 mp3_test\Makefile
文件 61 2012-07-01 00:41 mp3_test\env.sh
文件 27125 2012-07-01 00:41 mp3_test\mad.h
文件 5935 2012-07-01 00:41 mp3_test\minimad.c
文件 1577 2012-07-01 00:41 mp3_test\pcm_play.c
目录 0 2005-05-20 16:20 mp3_test\
- 上一篇:简易电子琴
- 下一篇:2012年数学建模全国一等奖论文
相关资源
- mp3解析文档及其分析工具
- MP3文件ID3v2ID3v2APEv2标签读取
- 易语言搜搜mp3源码
-
MP3Pla
yer播放器 - 音频测试文件pcmmp3aacamrg711ag711u等多种
- 一种基于DAB接收机的MP3播放器设计方
- QT编的MP3播放器
- 取硬件信息可用VMP3.X过机器码
- mp3文件转成pcm格式
- 输出6V,0.5A的手机MP3开关电源充电器
- Node.js-微信amr音频转mp3模块
- amr音频文件转换成mp3文件
- Angular-alltomp3-app.zip
- 基于正点原子的STM32mini版代码
- VMP3.12过虚拟机、调试器检测
- qmc3转换mp3格式工具
- libmp3lame.a(3.100)静态库for iOS支持真
- 提取获取网页中的视频和MP3
- MP3程序 原理图 VS1003模块资料
- 语音芯片实现MP3播放
- stm32F103RVT6与vs1003/1053/SD卡做成的MP3
- hi3516a音频解码音频编解码库
- 1068515楼月免费MP3录音软件v3.0.zip
- stm32F103与PCM5102A与Helix软解播放MP3
- 基于QT的嵌入式MP3播放器设计代码
- 基于FPGA的MP3音乐播放器设计
- 基于MSP430单片机的MP3
- [嵌入式Linux项目实战开发]基于QT4.7.
- 基于定点DSP的MP3解码系统设计与实现
- Easy RM to MP3 Converter 2.7.3.700
评论
共有 条评论