libcfe  0.12.1
some useful C-functions
mp3tech.h
Go to the documentation of this file.
1 /*
2  mp3tech.h - Headers for mp3tech.c
3 
4  Copyright (C) 2000-2006 Cedric Tefft <cedric@phreaker.net>
5 
6  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 
20  ***************************************************************************
21 
22  This file is based in part on:
23 
24  * MP3Info 0.5 by Ricardo Cerqueira <rmc@rccn.net>
25  * MP3Stat 0.9 by Ed Sweetman <safemode@voicenet.com> and
26  Johannes Overmann <overmann@iname.com>
27 
28 */
29 
30 /* MIN_CONSEC_GOOD_FRAMES defines how many consecutive valid MP3 frames
31  we need to see before we decide we are looking at a real MP3 file */
32 #define MIN_CONSEC_GOOD_FRAMES 4
33 #define FRAME_HEADER_SIZE 4
34 #define MIN_FRAME_SIZE 21
35 #define NUM_SAMPLES 4
36 
39 
40 typedef struct {
41  unsigned long sync;
42  unsigned int version;
43  unsigned int layer;
44  unsigned int crc;
45  unsigned int bitrate;
46  unsigned int freq;
47  unsigned int padding;
48  unsigned int extension;
49  unsigned int mode;
50  unsigned int mode_extension;
51  unsigned int copyright;
52  unsigned int original;
53  unsigned int emphasis;
54 } mp3header;
55 
56 typedef struct {
57  char title[31];
58  char artist[31];
59  char album[31];
60  char year[5];
61  char comment[31];
62  unsigned char track[1];
63  unsigned char genre[1];
64 } id3tag;
65 
66 typedef struct {
67  char *filename;
68  FILE *file;
69  off_t datasize;
74  int vbr;
75  float vbr_average;
76  int seconds;
77  int frames;
78  int badframes;
79 } mp3info;
80 
81 
82 int get_header(FILE *file,mp3header *header);
83 int frame_length(mp3header *header);
84 int header_layer(mp3header *h);
86 int sameConstant(mp3header *h1, mp3header *h2);
87 int get_mp3_info(mp3info *mp3,int scantype, int fullscan_vbr);
88 int get_id3(mp3info *mp3);
89 char *pad(char *string, int length);
90 char *unpad(char *string);
91 int write_tag(mp3info *mp3);
93 char *header_emphasis(mp3header *h);
94 char *header_mode(mp3header *h);
95 int get_first_header(mp3info *mp3,long startpos);
96 int get_next_header(mp3info *mp3);
char * header_emphasis(mp3header *h)
Definition: mp3tech.c:276
unsigned int copyright
Definition: mp3tech.h:51
int get_id3(mp3info *mp3)
Definition: mp3tech.c:300
int get_next_header(mp3info *mp3)
Definition: mp3tech.c:192
off_t datasize
Definition: mp3tech.h:69
unsigned int padding
Definition: mp3tech.h:47
unsigned int mode
Definition: mp3tech.h:49
unsigned int original
Definition: mp3tech.h:52
Definition: mp3tech.h:56
VBR_REPORT
Definition: mp3tech.h:37
unsigned int freq
Definition: mp3tech.h:46
unsigned int mode_extension
Definition: mp3tech.h:50
int get_header(FILE *file, mp3header *header)
Definition: mp3tech.c:223
unsigned int extension
Definition: mp3tech.h:48
int header_layer(mp3header *h)
Definition: mp3tech.c:266
int write_tag(mp3info *mp3)
Definition: mp3tech.c:366
id3tag id3
Definition: mp3tech.h:73
int seconds
Definition: mp3tech.h:76
unsigned int bitrate
Definition: mp3tech.h:45
unsigned long sync
Definition: mp3tech.h:41
unsigned int version
Definition: mp3tech.h:42
char * filename
Definition: mp3tech.h:67
SCANTYPE
Definition: mp3tech.h:38
unsigned int crc
Definition: mp3tech.h:44
int badframes
Definition: mp3tech.h:78
char * unpad(char *string)
Definition: mp3tech.c:355
int id3_isvalid
Definition: mp3tech.h:72
int header_isvalid
Definition: mp3tech.h:70
int frames
Definition: mp3tech.h:77
int get_first_header(mp3info *mp3, long startpos)
Definition: mp3tech.c:155
int frame_length(mp3header *header)
Definition: mp3tech.c:259
mp3header header
Definition: mp3tech.h:71
int header_frequency(mp3header *h)
Definition: mp3tech.c:272
FILE * file
Definition: mp3tech.h:68
int get_mp3_info(mp3info *mp3, int scantype, int fullscan_vbr)
Definition: mp3tech.c:69
unsigned int emphasis
Definition: mp3tech.h:53
char * pad(char *string, int length)
Definition: mp3tech.c:340
int sameConstant(mp3header *h1, mp3header *h2)
Definition: mp3tech.c:284
int header_bitrate(mp3header *h)
Definition: mp3tech.c:268
unsigned int layer
Definition: mp3tech.h:43
float vbr_average
Definition: mp3tech.h:75
int vbr
Definition: mp3tech.h:74
char * header_mode(mp3header *h)
Definition: mp3tech.c:280