"Fossies" - the Fresh Open Source Software Archive 
Member "mp3info-0.8.5a/mp3tech.h" (6 Nov 2006, 2733 Bytes) of package /linux/misc/old/mp3info-0.8.5a.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "mp3tech.h" see the
Fossies "Dox" file reference documentation.
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
37 enum VBR_REPORT { VBR_VARIABLE, VBR_AVERAGE, VBR_MEDIAN };
38 enum SCANTYPE { SCAN_NONE, SCAN_QUICK, SCAN_FULL };
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;
70 int header_isvalid;
71 mp3header header;
72 int id3_isvalid;
73 id3tag id3;
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);
85 int header_bitrate(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);
92 int header_frequency(mp3header *h);
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);