KVIrc 5.2.4
Developer APIs
MpMp3.h
Go to the documentation of this file.
1//=============================================================================
2//
3// File : MpMp3.h
4// Creation date : Fri Mar 25 20:01:25 2005 GMT by Szymon Stefanek
5//
6// This file is part of the KVIrc IRC client distribution
7// Copyright (C) 2005-2010 Szymon Stefanek (pragma at kvirc dot net)
8//
9// This file is based on the mp3tech.h. It is released under the original
10// license and the original copyright notice follows.
11//
12// mp3tech.hCO
13//
14// Copyright (C) 2000 Cedric Tefft <cedric@earthling.net>
15//
16// This program is free software; you can redistribute it and/or modify
17// it under the terms of the GNU General Public License as published by
18// the Free Software Foundation; either version 2 of the License, or
19// (at your option) any later version.
20//
21// This program is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU General Public License for more details.
25//
26// You should have received a copy of the GNU General Public License
27// along with this program; if not, write to the Free Software Foundation
28// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29//
30// This file is based in part on:
31//
32// * MP3Info 0.5 by Ricardo Cerqueira <rmc@rccn.net>
33// * MP3Stat 0.9 by Ed Sweetman <safemode@voicenet.com> and
34// Johannes Overmann <overmann@iname.com>
35//
36// There has been also a remarkable work by Cristopher Tieckle (Crissi)
37//
38//=============================================================================
39
40// MIN_CONSEC_GOOD_FRAMES defines how many consecutive valid MP3 frames
41// we need to see before we decide we are looking at a real MP3 file
42#define MIN_CONSEC_GOOD_FRAMES 4
43#define FRAME_HEADER_SIZE 4
44#define MIN_FRAME_SIZE 21
45#define NUM_SAMPLES 4
46#define TEXT_FIELD_LEN 30
47#define INT_FIELD_LEN 4
48
49#include "kvi_settings.h"
50
51#include <stdio.h>
52#include <stdlib.h>
53#include <QString>
54
55#if !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW)
56#include <unistd.h>
57#include <sys/stat.h>
58#include <ctype.h>
59#include <string.h>
60#endif
61
68
70{
71 unsigned int sync;
72 unsigned int version;
73 unsigned int layer;
74 unsigned int crc;
75 unsigned int bitrate;
76 unsigned int freq;
77 unsigned int padding;
78 unsigned int extension;
79 unsigned int mode;
80 unsigned int mode_extension;
81 unsigned int copyright;
82 unsigned int original;
83 unsigned int emphasis;
84};
85
86struct id3tag
87{
88 char title[31];
89 char artist[31];
90 char album[31];
91 char year[5];
92 char comment[31];
93 unsigned char track[1];
94 unsigned char genre[1];
95};
96
112
113// mode field:
114// 00 - Stereo
115// 01 - Joint stereo (Stereo)
116// 10 - Dual channel (2 mono channels)
117// 11 - Single channel (Mono)
118
119bool scan_mp3_file(QString & szFileName, mp3info * i);
120
122
125const char * header_emphasis(mp3header * h);
126const char * header_mode(mp3header * h);
130int header_crc(mp3header * h);
131int get_header(FILE * file, mp3header * header);
132int frame_length(mp3header * header);
133int sameConstant(mp3header * h1, mp3header * h2);
134int get_mp3_info(mp3info * mp3);
135int get_id3(mp3info * mp3);
136char * pad(char * string, int length);
137char * unpad(char * string);
138int get_first_header(mp3info * mp3, long startpos);
139//void tagedit_curs(char *filename, int filenum, int fileoutof, id3tag *tag);
140const char * get_typegenre(int idx);
char * pad(char *string, int length)
Definition MpMp3.cpp:422
double header_version(mp3header *h)
int header_layer(mp3header *h)
Definition MpMp3.cpp:324
int get_first_header(mp3info *mp3, long startpos)
Definition MpMp3.cpp:235
int frame_length(mp3header *header)
Definition MpMp3.cpp:319
int header_bitrate(mp3header *h)
Definition MpMp3.cpp:329
bool scan_mp3_file(QString &szFileName, mp3info *i)
Definition MpMp3.cpp:446
int get_mp3_info(mp3info *mp3)
Definition MpMp3.cpp:194
int sameConstant(mp3header *h1, mp3header *h2)
Definition MpMp3.cpp:362
int header_channels(mp3header *h)
Definition MpMp3.cpp:352
int header_frequency(mp3header *h)
Definition MpMp3.cpp:337
const char * header_emphasis(mp3header *h)
Definition MpMp3.cpp:342
int header_crc(mp3header *h)
Definition MpMp3.cpp:357
char * unpad(char *string)
Definition MpMp3.cpp:438
VBR_REPORT
Definition MpMp3.h:63
@ VBR_VARIABLE
Definition MpMp3.h:64
@ VBR_AVERAGE
Definition MpMp3.h:65
@ VBR_MEDIAN
Definition MpMp3.h:66
int get_header(FILE *file, mp3header *header)
Definition MpMp3.cpp:284
void resetmp3infoStruct(mp3info *i)
Definition MpMp3.cpp:179
const char * header_mode(mp3header *h)
Definition MpMp3.cpp:347
int get_id3(mp3info *mp3)
Definition MpMp3.cpp:373
const char * get_typegenre(int idx)
Definition MpMp3.cpp:121
#define i
Definition detector.cpp:74
#define h
Definition detector.cpp:73
This file contains compile time settings.
Definition MpMp3.h:87
char album[31]
Definition MpMp3.h:90
unsigned char genre[1]
Definition MpMp3.h:94
char title[31]
Definition MpMp3.h:88
char artist[31]
Definition MpMp3.h:89
unsigned char track[1]
Definition MpMp3.h:93
char year[5]
Definition MpMp3.h:91
char comment[31]
Definition MpMp3.h:92
Definition MpMp3.h:70
unsigned int sync
Definition MpMp3.h:71
unsigned int original
Definition MpMp3.h:82
unsigned int padding
Definition MpMp3.h:77
unsigned int crc
Definition MpMp3.h:74
unsigned int layer
Definition MpMp3.h:73
unsigned int bitrate
Definition MpMp3.h:75
unsigned int copyright
Definition MpMp3.h:81
unsigned int extension
Definition MpMp3.h:78
unsigned int emphasis
Definition MpMp3.h:83
unsigned int mode_extension
Definition MpMp3.h:80
unsigned int mode
Definition MpMp3.h:79
unsigned int freq
Definition MpMp3.h:76
unsigned int version
Definition MpMp3.h:72
Definition MpMp3.h:98
unsigned int datasize
Definition MpMp3.h:101
int id3_isvalid
Definition MpMp3.h:104
int seconds
Definition MpMp3.h:108
QString filename
Definition MpMp3.h:99
int header_isvalid
Definition MpMp3.h:102
FILE * file
Definition MpMp3.h:100
int vbr
Definition MpMp3.h:106
mp3header header
Definition MpMp3.h:103
float vbr_average
Definition MpMp3.h:107
id3tag id3
Definition MpMp3.h:105
int badframes
Definition MpMp3.h:110
int frames
Definition MpMp3.h:109