| 1 |
/* $Id$ */ |
| 2 |
|
| 3 |
#ifdef HAVE_CONFIG_H |
| 4 |
# include <config.h> |
| 5 |
#endif |
| 6 |
|
| 7 |
#include <stdio.h> |
| 8 |
|
| 9 |
#include "lame.h" |
| 10 |
#include "machine.h" |
| 11 |
#include "encoder.h" |
| 12 |
#include "lame-analysis.h" |
| 13 |
#include <gtk/gtk.h> |
| 14 |
#include "parse.h" |
| 15 |
#include "get_audio.h" |
| 16 |
#include "gtkanal.h" |
| 17 |
#include "lametime.h" |
| 18 |
|
| 19 |
#include "main.h" |
| 20 |
#include "console.h" |
| 21 |
|
| 22 |
|
| 23 |
/************************************************************************ |
| 24 |
* |
| 25 |
* main |
| 26 |
* |
| 27 |
* PURPOSE: MPEG-1,2 Layer III encoder with GPSYCHO |
| 28 |
* psychoacoustic model. |
| 29 |
* |
| 30 |
************************************************************************/ |
| 31 |
int |
| 32 |
lame_main(lame_t gf, int argc, char **argv) |
| 33 |
{ |
| 34 |
unsigned char mp3buffer[LAME_MAXMP3BUFFER]; |
| 35 |
char outPath[PATH_MAX + 1]; |
| 36 |
char inPath[PATH_MAX + 1]; |
| 37 |
int ret; |
| 38 |
|
| 39 |
lame_set_errorf(gf, &frontend_errorf); |
| 40 |
lame_set_debugf(gf, &frontend_debugf); |
| 41 |
lame_set_msgf(gf, &frontend_msgf); |
| 42 |
if (argc <= 1) { |
| 43 |
usage(stderr, argv[0]); /* no command-line args */ |
| 44 |
return -1; |
| 45 |
} |
| 46 |
ret = parse_args(gf, argc, argv, inPath, outPath, NULL, NULL); |
| 47 |
if (ret < 0) { |
| 48 |
return ret == -2 ? 0 : 1; |
| 49 |
} |
| 50 |
(void) lame_set_analysis(gf, 1); |
| 51 |
|
| 52 |
if (init_infile(gf, inPath) < 0) { |
| 53 |
error_printf("Can't init infile '%s'\n", inPath); |
| 54 |
return 1; |
| 55 |
} |
| 56 |
lame_init_params(gf); |
| 57 |
lame_print_config(gf); |
| 58 |
|
| 59 |
gtk_init(&argc, &argv); |
| 60 |
gtkcontrol(gf, inPath); |
| 61 |
|
| 62 |
lame_encode_flush(gf, mp3buffer, sizeof(mp3buffer)); |
| 63 |
close_infile(); |
| 64 |
return 0; |
| 65 |
} |