Recognizes if input is ogg or not.
[xiph.git] / vorbis-tools / oggenc / encode.h
blob9710a77f2afba233d26b8bc54e8e057164617992
1 #ifndef __ENCODE_H
2 #define __ENCODE_H
4 #include <stdio.h>
5 #include <vorbis/codec.h>
7 typedef void TIMER;
8 typedef long (*audio_read_func)(void *src, float **buffer, int samples);
9 typedef void (*progress_func)(char *fn, long totalsamples,
10 long samples, double time);
11 typedef void (*enc_end_func)(char *fn, double time, int rate,
12 long samples, long bytes);
13 typedef void (*enc_start_func)(char *fn, char *outfn, int bitrate,
14 float quality, int qset, int managed, int min_br, int max_br);
15 typedef void (*error_func)(char *errormessage);
18 void *timer_start(void);
19 double timer_time(void *);
20 void timer_clear(void *);
21 int create_directories(char *);
23 void update_statistics_full(char *fn, long total, long done, double time);
24 void update_statistics_notime(char *fn, long total, long done, double time);
25 void update_statistics_null(char *fn, long total, long done, double time);
26 void start_encode_full(char *fn, char *outfn, int bitrate, float quality, int qset,
27 int managed, int min, int max);
28 void start_encode_null(char *fn, char *outfn, int bitrate, float quality, int qset,
29 int managed, int min, int max);
30 void final_statistics(char *fn, double time, int rate, long total_samples,
31 long bytes);
32 void final_statistics_null(char *fn, double time, int rate, long total_samples,
33 long bytes);
34 void encode_error(char *errmsg);
36 typedef struct {
37 char *arg;
38 char *val;
39 } adv_opt;
41 typedef struct
43 char **title;
44 int title_count;
45 char **artist;
46 int artist_count;
47 char **album;
48 int album_count;
49 char **comments;
50 int comment_count;
51 char **tracknum;
52 int track_count;
53 char **dates;
54 int date_count;
55 char **genre;
56 int genre_count;
57 adv_opt *advopt;
58 int advopt_count;
59 int copy_comments;
60 int with_skeleton;
62 int quiet;
64 int rawmode;
65 int raw_samplesize;
66 int raw_samplerate;
67 int raw_channels;
68 int raw_endianness;
70 char *namefmt;
71 char *namefmt_remove;
72 char *namefmt_replace;
73 char *outfile;
75 /* All 3 in kbps */
76 int managed;
77 int min_bitrate;
78 int nominal_bitrate;
79 int max_bitrate;
81 /* Float from 0 to 1 (low->high) */
82 float quality;
83 int quality_set;
85 int resamplefreq;
86 int downmix;
87 float scale;
89 unsigned int serial;
90 unsigned int skeleton_serial;
91 int fixedserial;
92 int ignorelength;
93 } oe_options;
95 typedef struct
97 vorbis_comment *comments;
98 unsigned int serialno;
99 unsigned int skeleton_serialno;
101 audio_read_func read_samples;
102 progress_func progress_update;
103 enc_end_func end_encode;
104 enc_start_func start_encode;
105 error_func error;
107 void *readdata;
109 long total_samples_per_channel;
110 int channels;
111 long rate;
112 int samplesize;
113 int endianness;
114 int resamplefreq;
115 int copy_comments;
116 int with_skeleton;
118 /* Various bitrate/quality options */
119 int managed;
120 int bitrate;
121 int min_bitrate;
122 int max_bitrate;
123 float quality;
124 int quality_set;
125 adv_opt *advopt;
126 int advopt_count;
128 FILE *out;
129 char *filename;
130 char *infilename;
131 int ignorelength;
132 } oe_enc_opt;
135 int oe_encode(oe_enc_opt *opt);
137 #endif /* __ENCODE_H */