1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <ctype.h>
5 
6 #include <termios.h>
7 #include <signal.h>
8 #include <unistd.h>
9 #include <getopt.h>
10 #include <sys/time.h>
11 #include <sys/types.h>
12 
13 #include <readline/readline.h>
14 #include <readline/history.h>
15 
16 #include "mpglib.h"
17 
18 #define EOF (-1)
19 
20 void usage(char *text);
21 void help(void);
22 
23 int mpeg(unsigned char secondbyte);
24 int layer(unsigned char secondbyte);
25 int sampfreq(unsigned char secondbyte, unsigned char thirdbyte);
26 int channelmode(unsigned char fourthbyte);
27 int channels(unsigned char fourthbyte);
28 int bitrate(unsigned char secondbyte,unsigned char thirdbyte,unsigned char fourthbyte);
29 int paddingbit(unsigned char thirdbyte);
30 int framesize(unsigned char secondbyte,unsigned char thirdbyte,unsigned char fourthbyte);
31 int is_header(int secondbyte, int thirdbyte, int fourthbyte);
32 
33 long nextframe(long seekpos);
34 long prevframe(long seekpos);
35 
36 int showmins (long bytes);
37 double showsecs (long bytes);
38 
39 long fforward (long seekpos,long skiptime);
40 long frewind (long seekpos,long skiptime);
41 
42 double avbitrate(void);
43 long get_total_frames(void);
44 unsigned int volume(long playpos);
45 
46 long seeksilence(long seekpos);
47 long seeksilstart(long seekpos);
48 
49 /* This function prints the reached ID3 V1 TAG,
50    argument is next byte after tag */
51 void showtag(long seekpos);
52 
53 /* This function prints the reached ID3 V1 TAG */
54 void print_id3v1(long seekpos);
55 
56 /* This function prints the reached ID3 V2 TAG */
57 void print_id3v2(long showpos);
58 
59 /* This function rewinds to before ID3V1 tag, if any.
60    Returns position of last byte before tag. */
61 long rewind3v1(long seekpos);
62 
63 /* This function rewinds max 100kB to before ID3V2 tag, if any.
64    Returns position of first byte of tag. */
65 long rewind3v2(long seekpos);
66 
67 /* This function gets data from ID3 V1 and returns its length,
68    argument is end of tag */
69 int importid3v1(long seekpos);
70 
71 /* This function gets data from ID3 V2 and returns its length,
72    argument is start of tag */
73 long importid3v2(long seekpos);
74 
75 /* This function skips ID3 V1 tag, if any.
76    Returns position of next byte after tag. */
77 long skipid3v1(long seekpos);
78 
79 /* This function skips ID3 V2 tag, if any.
80    Useful also for getting the length of the ID3 V2 tag.
81    Returns position of next byte after tag. */
82 long skipid3v2(long seekpos);
83 
84 /* This function returns the position of the next ID3 TAG,
85    next byte after V1 and first byte of prepended V2 */
86 long seektag(long seekpos);
87 
88 
89 void infotag(long seekpos);
90 
91 void zaptitle (void);
92 
93 void writeconf(void);
94 void readconf(void);
95 
96 void playsel(long int playpos);
97 void playfirst(long int playpos);
98 
99 //void savesel(void);
100 void savewithtag(void);
101 
102 //void cutexact(void);
103 
104 //void writetable(void);
105 //void cutfromtable(void);
106 
107 void showfileinfo(int rawmode, int fix_channels);
108