⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.h

📁 可以播放MP3,wma等文件格式的播放器
💻 H
字号:
/* util.h * * $Id: util.h,v 1.4 2002/03/16 19:53:19 kyllingstad Exp $ * * Apollo sound player: http://www.apolloplayer.org * Copyright(C) 2000-2002 Apollo Team.  See CREDITS file. * * 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. * * The GNU General Public License is also available online at: * * http://www.gnu.org/copyleft/gpl.html *//*! some utility functions */class QString;void secondsToTimeString(long seconds, QString &time);/*!  `fullScanVbr' means reading through the whole file iff it's  encoded with variable bitrate.  Slow and unnecessary.*/int getMp3LengthInSeconds(const QString &path, bool fullScanVbr=false);////////////////////////////////////////////////////////////////////////////// functions from mp3info - http://www.ibiblio.org/mp3info ///////////////////////////////////////////////////////////////////////////////////////////*     Copyright (C) 2000-2001  Cedric Tefft <cedric@earthling.net>     */#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/stat.h>#include <ctype.h>#include <string.h>/* MIN_CONSEC_GOOD_FRAMES defines how many consecutive valid MP3 frames   we need to see before we decide we are looking at a real MP3 file */#define MIN_CONSEC_GOOD_FRAMES 4#define FRAME_HEADER_SIZE 4#define MIN_FRAME_SIZE 21#define NUM_SAMPLES 4enum VBR_REPORT { VBR_VARIABLE, VBR_AVERAGE, VBR_MEDIAN };enum SCANTYPE { SCAN_NONE, SCAN_QUICK, SCAN_FULL };typedef struct {	unsigned long	sync;	unsigned int	version;	unsigned int	layer;	unsigned int	crc;	unsigned int	bitrate;	unsigned int	freq;	unsigned int	padding;	unsigned int	extension;	unsigned int	mode;	unsigned int	mode_extension;	unsigned int	copyright;	unsigned int	original;	unsigned int	emphasis;} mp3header;typedef struct {	char title[31];	char artist[31];	char album[31];	char year[5];	char comment[31];	unsigned char track[1];	unsigned char genre[1];} id3tag;typedef struct {	char *filename;	FILE *file;	off_t datasize;	int header_isvalid;	mp3header header;	int id3_isvalid;	id3tag id3;	int vbr;	float vbr_average;	int seconds;	int frames;	int badframes;} mp3info;int get_header(FILE *file,mp3header *header);int frame_length(mp3header *header);int header_layer(mp3header *h);int header_bitrate(mp3header *h);int sameConstant(mp3header *h1, mp3header *h2);int get_mp3_info(mp3info *mp3,int scantype, int fullscan_vbr);int get_id3(mp3info *mp3);char *unpad(char *string);int header_frequency(mp3header *h);char *header_emphasis(mp3header *h);char *header_mode(mp3header *h);int get_first_header(mp3info *mp3,long startpos);int get_next_header(mp3info *mp3);////////////////////////////////////////////////////////////////////////////// end of functions from mp3info - http://www.ibiblio.org/mp3info ///////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -