ImfMultiPartOutputFile.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
  4. // Digital Ltd. LLC
  5. //
  6. // Portions (c) 2012 Weta Digital Ltd
  7. //
  8. // All rights reserved.
  9. //
  10. // Redistribution and use in source and binary forms, with or without
  11. // modification, are permitted provided that the following conditions are
  12. // met:
  13. // * Redistributions of source code must retain the above copyright
  14. // notice, this list of conditions and the following disclaimer.
  15. // * Redistributions in binary form must reproduce the above
  16. // copyright notice, this list of conditions and the following disclaimer
  17. // in the documentation and/or other materials provided with the
  18. // distribution.
  19. // * Neither the name of Industrial Light & Magic nor the names of
  20. // its contributors may be used to endorse or promote products derived
  21. // from this software without specific prior written permission.
  22. //
  23. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  27. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  28. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  29. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  30. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  31. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  32. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. //
  35. ///////////////////////////////////////////////////////////////////////////
  36. #ifndef MULTIPARTOUTPUTFILE_H_
  37. #define MULTIPARTOUTPUTFILE_H_
  38. #include "ImfHeader.h"
  39. #include "ImfGenericOutputFile.h"
  40. #include "ImfForward.h"
  41. #include "ImfThreading.h"
  42. #include "ImfNamespace.h"
  43. #include "ImfExport.h"
  44. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  45. //
  46. // Class responsible for handling the writing of multipart images.
  47. //
  48. // Note: Certain attributes are 'common' to all parts. Notably:
  49. // * Display Window
  50. // * Pixel Aspect Ratio
  51. // * Time Code
  52. // * Chromaticities
  53. // The first header forms the basis for the set of attributes that are shared
  54. // across the constituent parts.
  55. //
  56. // Parameters
  57. // headers - pointer to array of headers; one for each part of the image file
  58. // parts - count of number of parts
  59. // overrideSharedAttributes - toggle for the handling of shared attributes.
  60. // set false to check for inconsistencies, true
  61. // to copy the values over from the first header.
  62. // numThreads - number of threads that should be used in encoding the data.
  63. //
  64. class MultiPartOutputFile : public GenericOutputFile
  65. {
  66. public:
  67. IMF_EXPORT
  68. MultiPartOutputFile(const char fileName[],
  69. const Header * headers,
  70. int parts,
  71. bool overrideSharedAttributes = false,
  72. int numThreads = globalThreadCount());
  73. IMF_EXPORT
  74. MultiPartOutputFile(OStream & os,
  75. const Header * headers,
  76. int parts,
  77. bool overrideSharedAttributes = false,
  78. int numThreads = globalThreadCount());
  79. //
  80. // return number of parts in file
  81. //
  82. IMF_EXPORT
  83. int parts() const;
  84. //
  85. // return header for part n
  86. // (note: may have additional attributes compared to that passed to constructor)
  87. //
  88. IMF_EXPORT
  89. const Header & header(int n) const;
  90. IMF_EXPORT
  91. ~MultiPartOutputFile();
  92. struct Data;
  93. private:
  94. Data* _data;
  95. MultiPartOutputFile(const MultiPartOutputFile &); // not implemented
  96. template<class T> T* getOutputPart(int partNumber);
  97. friend class OutputPart;
  98. friend class TiledOutputPart;
  99. friend class DeepScanLineOutputPart;
  100. friend class DeepTiledOutputPart;
  101. };
  102. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  103. #endif /* MULTIPARTOUTPUTFILE_H_ */