1 /* 2 * This file is part of Checkmate, a program to check MP3 files for errors 3 * 4 * Copyright (C) 2006 Sjoerd Langkemper 5 * 6 * Checkmate is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 ***************************************************************************** 21 * 22 * file.h - keeps file stats 23 * 24 */ 25 26 #ifndef __FILE_H__ 27 #define __FILE_H__ 28 29 #include "frame.h" 30 #include "bufio.h" 31 32 /* structure which holds information for all files */ 33 typedef struct _file_info file_info; 34 35 struct _file_info { 36 CFILE * fp; /* filepointer to this file */ 37 char * filename; /* filename of this file */ 38 int length; /* length of this file (in bytes) */ 39 int lengthcount; /* length of all frames */ 40 int time; /* length of this file (in seconds) */ 41 int msec; /* milliseconds left (see time) */ 42 int frames; /* number of valid frames */ 43 int alien_total; /* total number of unidentifiable bytes */ 44 int alien_before; /* junk before all frames */ 45 int alien_between; /* junk between first and last frame */ 46 int alien_after; /* junk after all frames */ 47 int id3; /* bitwise OR of 0, ID3V1, ID3V2. */ 48 size_t id3v2_size; /* total number of bytes in ID3v2 tag */ 49 int ape; /* bitwise OR of 0, APEV1, APEV2. */ 50 size_t apev1_size; /* total number of bytes in APEv1 tag */ 51 size_t apev2_size; /* total number of bytes in APEv2 tag */ 52 int version; /* MPEG version */ 53 int layer; /* layer */ 54 int bitrate; /* bitrate in bps */ 55 int bitratecount; /* add bitrates to calculate an average */ 56 int stereo; /* boolean */ 57 int samplerate; /* samplerate in Hertz */ 58 int samples; /* samples per frame */ 59 int vbr; /* variable bit rate (boolean) */ 60 int errors; /* is TRUE or >1 if errors are found */ 61 int lastframe_offset; /* offset of last frame */ 62 int lastframe_length; /* length of last frame */ 63 int ismp3file; /* TRUE if this file is an mp3 file */ 64 }; 65 66 /* prototypes */ 67 file_info *file_create(void); 68 void file_destroy(file_info *file); 69 int file_update(file_info *file, const frame_info *frame); 70 void file_final(file_info *file); 71 void file_clear(file_info *file); 72 void file_print(const file_info *file); 73 const char * file_strversion(const file_info * file); 74 75 #endif 76 77