transcoder.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _TRANSCODER_H_
  2. #define _TRANSCODER_H_
  3. class Transcoder {
  4. protected:
  5. Transcoder(){}
  6. virtual ~Transcoder(){}
  7. public:
  8. // done at init()
  9. virtual void LoadConfigProfile(wchar_t *profile)=0; // deprecated, do not call
  10. virtual void AddAcceptableFormat(wchar_t *format)=0; // eg, L"mp3" or L"wma"
  11. virtual void AddAcceptableFormat(unsigned int format)=0; // eg, mmioFOURCC('M','4','A',' ')
  12. // done when file is added to transfer queue
  13. // returns:
  14. // -1 for can't transcode
  15. // output file size estimate if can transcode
  16. // if ext is supplied, it should be a buffer with space for 5 characters, and will be filled with
  17. // the output file type file extention, eg, L".mp3"
  18. virtual int CanTranscode(wchar_t *file, wchar_t *ext = NULL, int length = -1)=0;
  19. // false if no transcoding needed
  20. virtual bool ShouldTranscode(wchar_t *file)=0;
  21. // done just before transfer OR in background after file is added to queue
  22. // extention is added to outputFile, allow 5 extra chars
  23. // callback, callbackcontext and killswitch should be similar to those passed by ml_pmp
  24. // return 0 for success, -1 for failed or cancelled
  25. virtual int TranscodeFile(wchar_t *inputFile, wchar_t *outputFile, int *killswitch, void (*callback)(void * callbackContext, wchar_t * status), void* callbackContext, wchar_t * caption=L"Transcoding %d%%")=0;
  26. // get a filename which can be used as a staging area.
  27. // ext should be for example L".mp3"
  28. // make sure filename is a buffer at least MAX_PATH characters long.
  29. virtual void GetTempFilePath(const wchar_t *ext, wchar_t *filename)=0;
  30. };
  31. #endif //_TRANSCODER_H_