DiscFormatData.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef __DISC_FORMATDATA_20151220__
  2. #define __DISC_FORMATDATA_20151220__
  3. ///////////////////////////////////////////////////////////////////////
  4. // DiscFormatData.h
  5. //
  6. // Wrapper for IDiscFormat2Data Interface
  7. //
  8. // 包装IDiscFormat2Data接口用于写入数据媒体。
  9. //
  10. #pragma once
  11. #define WM_IMAPI_UPDATE WM_APP+842
  12. typedef struct _IMAPI_STATUS {
  13. // IDiscFormat2DataEventArgs Interface
  14. LONG elapsedTime; // Elapsed time in seconds
  15. LONG remainingTime; // Remaining time in seconds
  16. LONG totalTime; // total estimated time in seconds
  17. // IWriteEngine2EventArgs Interface
  18. LONG startLba; // the starting lba of the current operation
  19. LONG sectorCount; // the total sectors to write in the current operation
  20. LONG lastReadLba; // the last read lba address
  21. LONG lastWrittenLba; // the last written lba address
  22. LONG totalSystemBuffer; // total size of the system buffer
  23. LONG usedSystemBuffer; // size of used system buffer
  24. LONG freeSystemBuffer; // size of the free system buffer
  25. } IMAPI_STATUS, *PIMAPI_STATUS;
  26. /*
  27. typedef enum {
  28. IMAPI_BURN_VERIFICATION_NONE = 0,
  29. IMAPI_BURN_VERIFICATION_QUICK = 1,
  30. IMAPI_BURN_VERIFICATION_FULL = 2
  31. } IMAPI_BURN_VERIFICATION_LEVEL;
  32. */
  33. #define RETURN_CANCEL_WRITE 0
  34. #define RETURN_CONTINUE 1
  35. class CDiscRecorder;
  36. class CDiscFormatData
  37. {
  38. private:
  39. IDiscFormat2Data* m_discFormatData;
  40. SAFEARRAY* m_mediaTypesArray;
  41. SAFEARRAY* m_supportedSpeeds;
  42. HRESULT m_hResult;
  43. CString m_errorMessage;
  44. HWND m_hNotificationWnd;
  45. bool m_closeMedia;
  46. public:
  47. CDiscFormatData(void);
  48. ~CDiscFormatData(void);
  49. inline HRESULT GetHresult() {return m_hResult;}
  50. inline CString GetErrorMessage() {return m_errorMessage;}
  51. inline IDiscFormat2Data* GetInterface() {return m_discFormatData;}
  52. bool Initialize(CDiscRecorder* pDiscRecorder, const CString& clientName);
  53. bool Burn(HWND hWnd, IStream* data);
  54. ULONG GetTotalSupportedMediaTypes();
  55. int GetSupportedMediaType(ULONG index);
  56. ULONG GetTotalSupportedWriteSpeeds();
  57. int GetSupportedWriteSpeed(ULONG index);
  58. bool SetWriteSpeed(ULONG index);
  59. inline void SetCloseMedia(bool closeMedia){m_closeMedia = closeMedia;}
  60. //bool SetBurnVerification(IMAPI_BURN_VERIFICATION_LEVEL VerificationLevel);
  61. // 获取光盘的可用大小;
  62. bool GetFreeSectorsOnMedia(LONG& lFreeSectorOnMedia);
  63. protected:
  64. IStream* m_streamData;
  65. };
  66. #endif