1
0

MP3Coder.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef NULLSOFT_MP3_CODER_H
  2. #define NULLSOFT_MP3_CODER_H
  3. #include <windows.h>
  4. #include "../nsv/enc_if.h"
  5. #include "BladeMP3EncDLL.h"
  6. #ifndef _BLADEDLL
  7. extern BEINITSTREAM beInitStream;
  8. extern BECLOSESTREAM beCloseStream;
  9. extern BEENCODECHUNK beEncodeChunk;
  10. extern BEDEINITSTREAM beDeinitStream;
  11. extern BEWRITEVBRHEADER beWriteVBRHeader;
  12. extern BEVERSION beVersion;
  13. extern BEENCODECHUNKFLOATS16NI beEncodeChunkFloatS16NI;
  14. #endif // !_BLADEDLL
  15. typedef struct
  16. {
  17. int bitrate;
  18. int vbr_max_bitrate;
  19. int abr_bitrate;
  20. int stereo_mode; //0=stereo,1=jstereo,2=mchannel,3=mono
  21. int quality; //0=normal,1=low,2=high,3=voice,4=r3mix,5=vh
  22. int vbr; // 0=high-9=low
  23. int vbr_method; // -1=none, 0=default, 1=old, 2=new, 3=mtrh, 4=abr
  24. }
  25. configtype;
  26. class AudioCoderMP3 : public AudioCoder
  27. {
  28. public:
  29. AudioCoderMP3(int nch, int srate, int bps, configtype *cfg);
  30. int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
  31. virtual ~AudioCoderMP3();
  32. int GetLastError();
  33. void setVbrFilename(char *filename);
  34. void PrepareToFinish();
  35. protected:
  36. int m_err;
  37. DWORD obuf_size;
  38. DWORD ibuf_size, ibuf_size_spls;
  39. HBE_STREAM hbeStream;
  40. BE_CONFIG beConfig;
  41. int bytesPerSample;
  42. int done;
  43. char *bs;
  44. int bs_size;
  45. int is_downmix;
  46. int mono_input;
  47. };
  48. class AudioCoderMP3_24 : public AudioCoderMP3
  49. {
  50. public:
  51. AudioCoderMP3_24(int nch, int srate, int bps, configtype *cfg) : AudioCoderMP3(nch, srate, bps, cfg) {}
  52. int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail);
  53. };
  54. #endif