1 Star 1 Fork 0

maplerian / mp3_info

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Decode MP3 Info (MP3音频信息获取)

Id3v2.3.0 parsing, and audio duration and other information acquisition

ID3V2.3.0 解析, 以及 音频时长等信息获取

struct info(结构体信息)

#pragma pack(1)
struct mp3_info
{
    char *path;           /* 文件路径(mallo) */
    uint16_t time;        /* 音频时长(单位:S) */
    uint16_t bitRate;     /* 音频比特率 */
    uint16_t sampleRate;  /* 音频采样率 */
    uint8_t channel : 4;  /* 音频通道 */
    uint8_t img_type : 4; /* 歌曲图片类型(2 JPG,1 PNG,0 NULL) */
    uint32_t size;        /* 文件总大小Byte */
    uint8_t *title;       /* 歌曲名(mallo) */
    uint8_t *artist;      /* 歌手(mallo) */
    uint8_t *album;       /* 歌曲专辑名(mallo) */
    uint8_t *img_data;    /* 歌曲图片数据(mallo) */
    uint32_t img_size;    /* 歌曲图片大小 */
};
#pragma pack()
typedef struct mp3_info *mp3_info_t;

API Interface(API接口)


// typedef struct mp3_info mp3_info_s;
typedef struct mp3_info *mp3_info_t;
/* free mp3 info struct pointer 释放MP3信息结构体 */
void mp3_info_free(mp3_info_t info);
/* Get mp3 info , success : return mp3 info struct pointer 获取 MP3信息, 成功返回结构体指针 */
mp3_info_t mp3_get_info(char *path, uint8_t utf8_max_len);  
/**
 *  Performance tests, parses/prints the specified number of times
 *  性能测试,解析/打印指定次数
 */
void mp3_get_info_test(char *path, uint8_t max_txt_length, uint32_t print_info_number, uint32_t repeat_number);

lg(例子):

#include "mp3_info.h"

int main(int args, char **argv)
{
	printf("struct size : %ld\n", sizeof(struct mp3_info));
	mp3_get_info_test("./2.mp3", 15, 1, 0);
}

/* or see mp3_get_info_test function */

空文件

简介

获取MP3文件及音频信息 展开 收起
C
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/maplerian/mp3_info.git
git@gitee.com:maplerian/mp3_info.git
maplerian
mp3_info
mp3_info
main

搜索帮助

53164aa7 5694891 3bd8fe86 5694891