mp3x.c

Go to the documentation of this file.
00001 /* $Id: mp3x.c,v 1.23 2006/06/15 23:51:48 robert Exp $ */
00002 
00003 #ifdef HAVE_CONFIG_H
00004 # include <config.h>
00005 #endif
00006 
00007 #include "lame.h"
00008 #include "machine.h"
00009 #include "encoder.h"
00010 #include "lame-analysis.h"
00011 #include <gtk/gtk.h>
00012 #include "parse.h"
00013 #include "get_audio.h"
00014 #include "gtkanal.h"
00015 #include "lametime.h"
00016 
00017 #include "main.h"
00018 #include "console.h"
00019 
00020 
00021 
00022 
00023 
00024 /************************************************************************
00025 *
00026 * main
00027 *
00028 * PURPOSE:  MPEG-1,2 Layer III encoder with GPSYCHO
00029 * psychoacoustic model.
00030 *
00031 ************************************************************************/
00032 int
00033 main(int argc, char **argv)
00034 {
00035     char    mp3buffer[LAME_MAXMP3BUFFER];
00036     lame_global_flags *gf;
00037     char    outPath[PATH_MAX + 1];
00038     char    inPath[PATH_MAX + 1];
00039     int     ret;
00040     int     enc_delay = -1;
00041     int     enc_padding = -1;
00042 
00043     frontend_open_console();
00044     gf = lame_init();
00045     if (NULL == gf) {
00046         error_printf("fatal error during initialization\n");
00047         frontend_close_console();
00048         return 1;
00049     }
00050     lame_set_errorf(gf, &frontend_errorf);
00051     lame_set_debugf(gf, &frontend_debugf);
00052     lame_set_msgf(gf, &frontend_msgf);
00053     if (argc <= 1) {
00054         usage(stderr, argv[0]); /* no command-line args  */
00055         frontend_close_console();
00056         return -1;
00057     }
00058     ret = parse_args(gf, argc, argv, inPath, outPath, NULL, NULL);
00059     if (ret < 0) {
00060         frontend_close_console();
00061         return ret == -2 ? 0 : 1;
00062     }
00063     (void) lame_set_analysis(gf, 1);
00064 
00065     init_infile(gf, inPath, &enc_delay, &enc_padding);
00066     lame_init_params(gf);
00067     lame_print_config(gf);
00068 
00069 
00070     gtk_init(&argc, &argv);
00071     gtkcontrol(gf, inPath);
00072 
00073     lame_encode_finish(gf, mp3buffer, sizeof(mp3buffer));
00074     close_infile();
00075     frontend_close_console();
00076     return 0;
00077 }

Generated on Sun Dec 2 11:34:18 2007 for LAME by  doxygen 1.5.2