You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3KB

  1. /*
  2. Copyright (C) 2006-2011 Nasca Octavian Paul
  3. Author: Nasca Octavian Paul
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of version 2 of the GNU General Public License
  6. as published by the Free Software Foundation.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License (version 2) for more details.
  11. You should have received a copy of the GNU General Public License (version 2)
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef MP3_INPUT_H
  16. #define MP3_INPUT_H
  17. #include <string>
  18. #include <stdio.h>
  19. #include <mad.h>
  20. #include "InputS.h"
  21. class MP3InputS:public InputS{
  22. public:
  23. MP3InputS();
  24. ~MP3InputS();
  25. bool open(std::string filename);
  26. void close();
  27. int read(int nsmps,short int *smps);
  28. void seek(double pos);//0=start,1.0=end
  29. private:
  30. void convertsmps(int nsmps, short int *smps,int pcmstart);
  31. short int madpcm2short(mad_fixed_t x);
  32. int pcm_remained;
  33. bool MP3_opened;
  34. struct mad_stream stream;
  35. struct mad_frame frame;
  36. struct mad_synth synth;
  37. FILE *f;
  38. unsigned char *buf;
  39. };
  40. #endif