NeroIsoTrack.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /******************************************************************************
  2. |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. |* PARTICULAR PURPOSE.
  6. |*
  7. |* Copyright 1995-2005 Nero AG. All Rights Reserved.
  8. |*-----------------------------------------------------------------------------
  9. |* NeroSDK / NeroAPI
  10. |*
  11. |* PROGRAM: NeroIsoTrack.h
  12. |*
  13. |* PURPOSE: Classes for writing ISO 9660/Joliet track
  14. |*
  15. |* NOTE: In contrast to NeroAPI.h, this code is not pure C, but rather C++
  16. ******************************************************************************/
  17. #ifndef _NEROISOTRACK_
  18. #define _NEROISOTRACK_
  19. #include "NeroAPI.h"
  20. #ifndef __cplusplus
  21. #error The Nero ISO Track feature can only be used by C++ code.
  22. #else /* __cplusplus */
  23. #include <windows.h> // the data types used below are those of windows
  24. //
  25. // The application has to specify the complete layout of the
  26. // ISO track. The NeroAPI does not care at all where the
  27. // data for the files comes from. This also means that the
  28. // application has to provide access to the filename or the
  29. // data itself when the API needs it.
  30. //
  31. //
  32. // Data can be fed into the API directly (i.e. without intermediate
  33. // files) with CNeroDataCallback:
  34. //
  35. class CNeroDataCallback
  36. {
  37. public:
  38. virtual ~CNeroDataCallback () {}
  39. virtual DWORD IOCallback(BYTE *pBuffer, DWORD dwLen) = 0; // same semantic as NERO_IO_CALLBACK in "NeroAPI.h"
  40. virtual BOOL EOFCallback () = 0; // " " NERO_IO.nioEOFCallback
  41. virtual BOOL ErrorCallback () = 0; // " " NERO_IO.nioErrorCallback
  42. };
  43. //
  44. // The API builds an internal representation of the complete
  45. // ISO tree and uses a CNeroIsoHandle acquired from the
  46. // application for each file to access the data later.
  47. // Usually only one file at once will be left open.
  48. //
  49. class CNeroIsoHandle
  50. {
  51. public:
  52. virtual ~CNeroIsoHandle () {}
  53. virtual CNeroIsoHandle * Clone () = 0; // make a copy of yourself
  54. virtual int GetFileName (char *strBuffer, UINT nBufferSize) = 0; // If the application wants the API to read files, it has to fill
  55. // the buffer of size nBufferSize with a null-terminated string and return
  56. // the length of the full name, even if the given buffer was to small.
  57. // The API will try again with a larger buffer then.
  58. // return 0 in GetFileName() if you want to provide the data via a CNeroDataCallback:
  59. virtual CNeroDataCallback * Open () = 0; // return instance ready to read the data associated with this handle or NULL for error;
  60. // this instance will be deleted by NeroAPI;
  61. // usually only one file at once will be left open
  62. };
  63. //
  64. // Iterators are used to walk through directories while the API builds
  65. // its internal copy of the tree. Iterators point to an entry or to NULL,
  66. // if the last entry was passed, and can only be incremented.
  67. //
  68. class CNeroIsoEntry;
  69. class CNeroIsoIterator
  70. {
  71. public:
  72. virtual ~CNeroIsoIterator () {}
  73. virtual CNeroIsoEntry * GetCurrentEntry () = 0; // get pointer to current entry or NULL if last one passed;
  74. // entry not deleted by API, so the iterator may point to itself
  75. // and implement the required interface (as in the NeroAPI demo),
  76. // or to some permanent entry
  77. virtual void Next () = 0; // go to next entry
  78. };
  79. //
  80. // An entry (directory or file) is described like this:
  81. //
  82. struct CImportInfo;
  83. class CNeroIsoEntry
  84. {
  85. public:
  86. virtual ~CNeroIsoEntry () {}
  87. virtual CNeroIsoIterator * CreateDirectoryIterator() = 0; // NULL if no directory, otherwise an iterator to step through all child entries;
  88. // iterator will be deleted by NeroAPI
  89. virtual const char * GetName () = 0; // the name for this entry; will be copied by API
  90. virtual __int64 GetLength () = 0; // the size of this entry in bytes, or -1 if a directory
  91. virtual CNeroIsoHandle * CreateHandle () = 0; // creates a handle stored by the API to open a file later, NULL for directory;
  92. // handle will be deleted by NeroAPI when deleting the internal ISO tree
  93. // The following entries are only needed when e.g. creating your
  94. // own Video CD ISO track and not implemented yet.
  95. #if 0
  96. virtual BOOL IsMode2 () { return FALSE; } // TRUE if the application delivers mode 2 data (2336 bytes/block);
  97. // NOTE: the size above are the number of bytes delivered by the application
  98. // NOTE to ahead implementor: in contrast, the ISO entry length always assumes a
  99. // lock size of 2048 and thus GetSize() has to be multiplied by 2048/2336 before using it as CIsoListEntry::size
  100. virtual int GetBlockOffset () { return -1; } // file data is to be written in this block (relative to beginning of ISO track),
  101. // or in a block chosen by NeroAPI if -1
  102. #endif
  103. // Can be used to reference files from previous session
  104. virtual DWORD GetDataStartSec() { return 0;}
  105. virtual BOOL IsDataFixed() { return FALSE;}
  106. virtual BOOL GetEntryTime(struct tm *tm)
  107. {
  108. return FALSE; // Unspecified time
  109. }
  110. // This method was formerly known as GetRockRidgeInfo.
  111. // The object returned is a bit different internally now.
  112. // Since it is a private structure of NeroAPI this change doesn't matter.
  113. virtual CImportInfo *GetImportInfo() const
  114. {
  115. // no ImportInfo by default
  116. return NULL;
  117. };
  118. virtual void GetPriorities(int &iPriority,int &iDirPriority)
  119. {
  120. iPriority=0;
  121. iDirPriority=0;
  122. };
  123. // Up from NeroAPI 5.5.9.0
  124. virtual CNeroIsoIterator * CreateDirectoryIteratorWrapper() { return NULL; }
  125. // See CreateHandle(). Creates rsc fork handle for HFS filesystems
  126. // Will be preferred to reading the resource fork from the file specified by GetName() if !=NULL
  127. virtual CNeroIsoHandle * CreateResourceHandle () { return NULL; };
  128. virtual const WCHAR* GetUnicodeName() { return 0; } // the name for this entry in unicode format; will be copied by API
  129. // NeroAPI>=6.0.0.14: Not necessary to implement this. Only used for internal purposes.
  130. virtual void *GetInterface(const char *name) { return NULL; }
  131. private:
  132. // Reserved for future use
  133. virtual int reserved1() { return 0;}
  134. virtual int reserved2() { return 0;}
  135. virtual int reserved3() { return 0;}
  136. virtual int reserved4() { return 0;}
  137. virtual int reserved5() { return 0;}
  138. virtual int reserved6() { return 0;}
  139. virtual int reserved7() { return 0;}
  140. };
  141. //
  142. // An ISO track is a special directory entry:
  143. //
  144. struct CNeroIsoTrack : public CNeroIsoEntry
  145. {
  146. friend class CNeroIsoTrackProxy5039; // Internal compatibility stuff;
  147. friend class CNeroIsoTrackProxy55915; // Internal compatibility stuff;
  148. public:
  149. ~CNeroIsoTrack () {}
  150. // essential functions:
  151. virtual const char * GetName () = 0; // ISO volume name, copied by API
  152. virtual CNeroIsoIterator * CreateDirectoryIterator () = 0; // iterator for root directory; will be deleted by API
  153. // these new functions have reasonable defaults:
  154. virtual BOOL UseJoliet () { return TRUE; } // TRUE if track shall contain Joliet names in addition to ISO
  155. virtual BOOL UseMode2 () { return FALSE; } // TRUE if track shall be written as mode 2/XA
  156. // The following 3 functions exist from NeroAPI version 5.5.0.0
  157. virtual BOOL UseRockRidge () { return FALSE; } // RockRidge requires additional informations, so it is off by default
  158. virtual BOOL BurnISO() { return TRUE; } // TRUE if ISO should be created
  159. virtual BOOL BurnUDF() { return FALSE; } // TRUE if UDF should be created
  160. protected:
  161. virtual __int64 GetLength () { return -1; } // we are a directory, ...
  162. virtual CNeroIsoHandle * CreateHandle () { return NULL; } // ... so we cannot be read
  163. virtual CNeroIsoHandle * CreateResourceHandle () { return NULL; } // ... so we cannot be read
  164. public:
  165. // From NeroAPI version 5.5.1.2
  166. // You can set your burn options simply be redefining this function instead of
  167. // UseJoliet, UseMode2, UseRockRidge, BurnISO and BurnUDF
  168. // See NeroAPI.h for the signification of the NCITEF flags
  169. virtual DWORD BurnOptions()
  170. {
  171. return (UseJoliet() ? NCITEF_USE_JOLIET : 0)
  172. |(UseMode2() ? NCITEF_USE_MODE2 : 0)
  173. |(UseRockRidge() ? NCITEF_USE_ROCKRIDGE : 0)
  174. |(BurnISO() ? NCITEF_CREATE_ISO_FS : 0)
  175. |(BurnUDF() ? NCITEF_CREATE_UDF_FS : 0);
  176. };
  177. // Up from NeroAPI 5.5.9.0
  178. virtual CNeroIsoIterator *CreateDirectoryIteratorWrapper()
  179. {
  180. return NULL;
  181. }
  182. virtual BOOL HasWrapper(void)
  183. {
  184. return FALSE;
  185. }
  186. // for internal use only. Do not reimplement this method!
  187. virtual const void *dummy() const { return NULL; };
  188. virtual void GetVolumeDescriptor(const char **systemIdentifier, const char **volumeSet
  189. , const char **publisher, const char **dataPreparer, const char **application
  190. , const char **copyright, const char **abstract, const char **bibliographic)
  191. {
  192. *systemIdentifier = 0;
  193. *volumeSet = 0;
  194. *publisher = 0;
  195. *dataPreparer = 0;
  196. *application = 0;
  197. *copyright = 0;
  198. *abstract = 0;
  199. *bibliographic = 0;
  200. }
  201. // Reserved for future use
  202. virtual int reserved1() { return 0;}
  203. virtual int reserved2() { return 0;}
  204. virtual int reserved3() { return 0;}
  205. virtual int reserved4() { return 0;}
  206. virtual int reserved5() { return 0;}
  207. virtual int reserved6() { return 0;}
  208. virtual int reserved7() { return 0;}
  209. };
  210. #endif /* __cplusplus */
  211. #endif /* _NEROISOTRACK_ */