mp3x.c 1.4 KB

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