Blame IlmImf/ImfMultiPartOutputFile.h

Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
//
Packit 0d464f
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
Packit 0d464f
// Digital Ltd. LLC
Packit 0d464f
//
Packit 0d464f
// Portions (c) 2012 Weta Digital Ltd
Packit 0d464f
//
Packit 0d464f
// All rights reserved.
Packit 0d464f
//
Packit 0d464f
// Redistribution and use in source and binary forms, with or without
Packit 0d464f
// modification, are permitted provided that the following conditions are
Packit 0d464f
// met:
Packit 0d464f
// *       Redistributions of source code must retain the above copyright
Packit 0d464f
// notice, this list of conditions and the following disclaimer.
Packit 0d464f
// *       Redistributions in binary form must reproduce the above
Packit 0d464f
// copyright notice, this list of conditions and the following disclaimer
Packit 0d464f
// in the documentation and/or other materials provided with the
Packit 0d464f
// distribution.
Packit 0d464f
// *       Neither the name of Industrial Light & Magic nor the names of
Packit 0d464f
// its contributors may be used to endorse or promote products derived
Packit 0d464f
// from this software without specific prior written permission.
Packit 0d464f
//
Packit 0d464f
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 0d464f
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 0d464f
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 0d464f
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 0d464f
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 0d464f
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 0d464f
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 0d464f
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 0d464f
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 0d464f
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 0d464f
//
Packit 0d464f
///////////////////////////////////////////////////////////////////////////
Packit 0d464f
Packit 0d464f
#ifndef MULTIPARTOUTPUTFILE_H_
Packit 0d464f
#define MULTIPARTOUTPUTFILE_H_
Packit 0d464f
Packit 0d464f
#include "ImfHeader.h"
Packit 0d464f
#include "ImfGenericOutputFile.h"
Packit 0d464f
#include "ImfForward.h"
Packit 0d464f
#include "ImfThreading.h"
Packit 0d464f
#include "ImfNamespace.h"
Packit 0d464f
#include "ImfExport.h"
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Packit 0d464f
Packit 0d464f
Packit 0d464f
//
Packit 0d464f
// Class responsible for handling the writing of multipart images.
Packit 0d464f
//
Packit 0d464f
// Note: Certain attributes are 'common' to all parts. Notably:
Packit 0d464f
// * Display Window
Packit 0d464f
// * Pixel Aspect Ratio
Packit 0d464f
// * Time Code
Packit 0d464f
// * Chromaticities
Packit 0d464f
// The first header forms the basis for the set of attributes that are shared 
Packit 0d464f
// across the constituent parts.
Packit 0d464f
//
Packit 0d464f
// Parameters
Packit 0d464f
//  headers - pointer to array of headers; one for each part of the image file
Packit 0d464f
//  parts - count of number of parts
Packit 0d464f
//  overrideSharedAttributes - toggle for the handling of shared attributes.
Packit 0d464f
//                             set false to check for inconsistencies, true
Packit 0d464f
//                             to copy the values over from the first header.
Packit 0d464f
//  numThreads - number of threads that should be used in encoding the data.
Packit 0d464f
//
Packit 0d464f
    
Packit 0d464f
class IMF_EXPORT MultiPartOutputFile : public GenericOutputFile
Packit 0d464f
{
Packit 0d464f
    public:
Packit 0d464f
        MultiPartOutputFile(const char fileName[],
Packit 0d464f
                            const Header * headers,
Packit 0d464f
                            int parts,
Packit 0d464f
                            bool overrideSharedAttributes = false,
Packit 0d464f
                            int numThreads = globalThreadCount());
Packit 0d464f
                            
Packit 0d464f
        MultiPartOutputFile(OStream & os,
Packit 0d464f
                            const Header * headers,
Packit 0d464f
                            int parts,
Packit 0d464f
                            bool overrideSharedAttributes = false,
Packit 0d464f
                            int numThreads = globalThreadCount());                            
Packit 0d464f
Packit 0d464f
        //
Packit 0d464f
        // return number of parts in file
Packit 0d464f
        //
Packit 0d464f
        int parts() const ;
Packit 0d464f
        
Packit 0d464f
        
Packit 0d464f
        //
Packit 0d464f
        // return header for part n
Packit 0d464f
        // (note: may have additional attributes compared to that passed to constructor)
Packit 0d464f
        //
Packit 0d464f
        const Header & header(int n) const;
Packit 0d464f
                            
Packit 0d464f
        ~MultiPartOutputFile();
Packit 0d464f
Packit 0d464f
        struct Data;
Packit 0d464f
Packit 0d464f
    private:
Packit 0d464f
        Data*                           _data;
Packit 0d464f
Packit 0d464f
        MultiPartOutputFile(const MultiPartOutputFile &); // not implemented
Packit 0d464f
        
Packit 0d464f
        template<class T>         T*  getOutputPart(int partNumber);
Packit 0d464f
Packit 0d464f
    
Packit 0d464f
    friend class OutputPart;
Packit 0d464f
    friend class TiledOutputPart;
Packit 0d464f
    friend class DeepScanLineOutputPart;
Packit 0d464f
    friend class DeepTiledOutputPart;
Packit 0d464f
};
Packit 0d464f
Packit 0d464f
Packit 0d464f
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Packit 0d464f
Packit 0d464f
#endif /* MULTIPARTOUTPUTFILE_H_ */