1
0

AudioCoderWMA.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef AUDIOCODERWMA_H
  2. #define AUDIOCODERWMA_H
  3. #include "../nsv/enc_if.h"
  4. #include "main.h"
  5. class CustomWMWriterSink;
  6. class AudioCoderWMA : public AudioCoder
  7. {
  8. public:
  9. AudioCoderWMA(int nch, int srate, int bps, configtype *cfg, char *configfile);
  10. virtual int Encode(int framepos, void *in, int in_avail, int *in_used, void *out, int out_avail); //returns bytes in out
  11. virtual ~AudioCoderWMA();
  12. int GetLastError();
  13. void PrepareToFinish();
  14. void OnFinished(const wchar_t *filename);
  15. HRESULT SelectAndLoadResampler(int numchannels, int samplerate, int bitpersamp);
  16. HRESULT CreateAndConfigureWriter(WORD nch, WORD srate, WORD bps, char *configfile);
  17. HRESULT CreateAndConfigureProfile(WAVEFORMATEX* pWaveLimits, IWMProfile** ppProfile, char *configfile);
  18. private:
  19. bool begin_writing;
  20. int error;
  21. IWMWriterFileSink *sink;
  22. IWMWriter *writer;
  23. IWMWriterAdvanced *writerAdvanced;
  24. double timeunits_per_byte; // "100 nanosecond units" -- ie: ( ( (10000000.0) / (double)samplerate ) / (double)numchannels ) / ( (double)bitspersamp/ 8.0 )
  25. int input_bytecount;
  26. QWORD lastByteCount;
  27. wchar_t tempFilename[MAX_PATH];
  28. };
  29. enum AudioCoderWMAErrors
  30. {
  31. WMA_NO_ERROR = 0,
  32. WMA_CANT_FIND_WMSDK = -1,
  33. WMA_CANT_LOAD_CREATOR = -2,
  34. WMA_CANT_CREATE_WRITER = -3,
  35. WMA_CANT_SET_INPUT_FORMAT = -4,
  36. WMA_CANT_SET_OUTPUT_FORMAT = -5,
  37. WMA_CANT_MAKE_CUSTOM_SINK = -6,
  38. WMA_CANT_QUERY_WRITER_INTERFACE = -7,
  39. WMA_CANT_QUERY_SINK_INTERFACE = -8,
  40. WMA_CANT_ADD_SINK = -9,
  41. };
  42. #endif//AUDIOCODERWMA_H