c_encoder_mp3dll.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __C_ENCODER_MP3DLL_H__
  2. #define __C_ENCODER_MP3DLL_H__
  3. #include "c_encoder.h"
  4. #include "../lame/include/lame.h"
  5. #include "../lame/libmp3lame/lame_global_flags.h"
  6. #include <windows.h>
  7. // Defaults for this encoder
  8. #define MP3_DEFAULT_INPUTSAMPLERATE 44100
  9. #define MP3_DEFAULT_INPUTNUMCHANNELS 2
  10. #define MP3_DEFAULT_OUTPUTSAMPLERATE 44100
  11. #define MP3_DEFAULT_OUTPUTNUMCHANNELS 2
  12. #define MP3_DEFAULT_OUTPUTBITRATE 96
  13. #define MP3_DEFAULT_ATTRIBNUM 22
  14. struct T_ENCODER_MP3_INFO {
  15. int output_bitRate;
  16. int output_sampleRate;
  17. int output_numChannels;
  18. int input_sampleRate;
  19. int input_numChannels;
  20. int QualityMode;
  21. };
  22. #define HBE_STREAM lame_global_flags *
  23. class C_ENCODER_MP3 : public C_ENCODER {
  24. private:
  25. HANDLE hMutex;
  26. lame_t Handle;
  27. int has_encoded;
  28. protected:
  29. lame_t (*lame_init)(void);
  30. int (*lame_init_params)(lame_global_flags *);
  31. int (*lame_encode_buffer_interleaved)(lame_global_flags *, short int pcm[], int num_samples, char *mp3buffer, int mp3buffer_size);
  32. int (*lame_encode_flush)(lame_global_flags *, char *mp3buffer, int size);
  33. public:
  34. C_ENCODER_MP3(void *init, void *params, void *encode, void *finish);
  35. virtual ~C_ENCODER_MP3();
  36. virtual void Close();
  37. virtual void Reset();
  38. virtual int Encode(const void *inputbuf, const unsigned int inputbufsize, void *outputbuf, const unsigned int outputbufsize, int *inputamtused); /* all values are in BYTES! */
  39. };
  40. #endif /* !__C_ENCODER_MP3_H__ */