DD::Image::Read Class Reference

Inherits DD::Image::PlanarIop, DD::Image::FileOp, DD::Image::FileRead, and DD::Image::ReadFileKnobOwner.

Inherited by DD::Image::TimelineRead.

List of all members.

Public Member Functions

virtual FileHandler * handler () const
void close ()
const char * getFilename () const
ReadergetReader ()
virtual
DD::Image::DopeItemFlags::Mask 
getDopeItemFlags () const
virtual bool shouldHideInDopeSheet (Knob *knob) const
void set_file_type (const char *fileType)
virtual const char * file_type () const
void setReadFormat (const Format *fmt)
void setFullSizeFormat (const Format *fmt)
void setFormat (const Format *fmt)
void setUpdateFileTypeKnobFlag (const bool updateFileTypeKnobFlag)
FormatPair & getFormats ()
const FormatPair & getFormats () const
const DD::Image::FormatgetReadFormat () const
const Formatexpected_full_size_format () const
const Formatexpected_format () const
const Formatexpected_read_format () const
const Formatread_format () const
bool videosequence () const
 Read (Node *node=0)
void append (Hash &)
void retrieveInfo ()
void setIgnoreCachedErrors (bool ignoreCachedErrors)
void frame_for_reader (int n)
int frame_for_reader () const
void filename (const char *f)
const char * filename () const
void view_for_reader (int view)
int view_for_reader () const
virtual ViewSet splitForViews () const
int current_view (const DD::Image::OutputContext *oc) const
void expectedFrameRange (int first, int last)
int expected_first_frame () const
int expected_last_frame () const
int first_frame () const
int last_frame () const
int colorspace () const
void colorspace (int v)
bool raw () const
void raw (bool v)
bool premult () const
void premult (bool v)
bool autoAlpha () const
void autoAlpha (bool v)
void knobs (Knob_Callback)
int knob_changed (Knob *)
int knob_change_finished (Knob *knob, bool changeByUser)
bool invalidate (Hash hash)
bool invalidate ()
int output_type () const
bool ignore_missing_clip () const
void output_type (int v)
void force_near_frame (bool b)
void force_format (bool b)
const char * Class () const
const char * node_help () const

Static Public Attributes

static const Description d

Protected Member Functions

virtual Opop ()
Readercreate_reader (const char *fname) const
void make_format (const char *fileName)
void make_format ()
void make_reader ()
ReadfirstRead ()
const ReadfirstRead () const
const Reader::Descriptionformat_for_name (const char *)
void asengine (int y, int x, int r, ChannelMask channels, Row &row)
const MetaData::Bundle_fetchMetaData (const char *key)
void _validate (bool)
void _open ()
void engine (int y, int x, int r, ChannelMask, Row &)
void _request (int x, int y, int r, int t, ChannelMask chans, int count)
virtual bool useStripes () const
virtual size_t stripeHeight () const
virtual PackedPreference packedPreference () const
virtual void renderStripe (ImagePlane &imagePlane)
virtual void doFetchPlane (ImagePlane &imagePlane)
virtual PlanarIgetPlanarI ()
virtual PlanarI::PlaneID getPlaneFromChannel (Channel chan)
void _close ()

Protected Attributes

Reader_reader
ReaderFormat * _fileformat
const Reader::Description_reader_type
const DD::Image::Description_readerdesc
Iop::Info _readerInfo
bool _errorOnConstructor
bool _readerInfoOk
bool videosequence_
bool force_near_frame_
bool force_format_
Hash _filehash
bool _ignoreCachedErrors
int frame_for_reader_
bool frame_for_reader_valid_
int view_for_reader_
const char * filename_
const char * file_type_
int colorspace_
bool raw_
bool premult_
bool autoAlpha_
int _outputType
int _frameRange [2]
bool _proxyscale
float _sx
float _sy
float _tx
float _ty
Format _localFormat
MetaData::Bundle _meta
FormatPair _formats
const Format_readFormat
DD::Image::RecursiveLock _makeReaderLock

Detailed Description

Return an image from the outside world. The image is identified by the filename (which may just be a string interpreted by one of the reader implementations and not an actual file on the disk), and by the frame() if it is a movie file.

If the filename is null a black frame of the expected_format() (or video if no format is given) is produced. This is done so that a new Read in Nuke will not produce an error.

All the work is done by the various subclasses of Reader. Read just chooses what subclass to instantiate and returns the output from it, and correctly destroys and instantiates new ones as needed.


Member Function Documentation

void Read::make_format ( const char *  fileName) [protected]
const MetaData::Bundle & Read::_fetchMetaData ( const char *  key) [protected, virtual]

We can't return this directly, because the Reader might get deleted (thus invalidating the reference) when the Read is closed.

So, let us make a local copy to store it in, which is guaranteed to be around for as long as we need it. We can put some non-reader specific things in this, also.

Reimplemented from DD::Image::Op.

References DD::Image::Reader::frame(), DD::Image::Reader::height(), DD::Image::Reader::prefetchMetaData(), DD::Image::MetaData::Bundle::setData(), and DD::Image::Reader::width().

void Read::_validate ( bool  for_real) [protected, virtual]

validate() will destroy any previous Reader and open a new one if the filename has changed or the version number has changed (the version number is incremented by the reload button).

After opening the file, it copies the info_ from the Reader object. This will have been initialized with expected_first_frame(), expected_last_frame(), expected_format(), and expected_full_size_format(), but the Reader subclass may have changed this information.

For Nuke, this may be called with for_real set to false. In this case it does not try to open the file. Instead it assumes everything is at the expected settings. Anything that actually needs the data will open the file.

Reimplemented from DD::Image::Iop.

References _close(), DD::Image::FileOp::_readerError, DD::Image::IopInfo::black_outside(), DD::Image::Iop::default_input(), expected_format(), expected_full_size_format(), expected_read_format(), DD::Image::GeneralInfo::first_frame(), DD::Image::IopInfoOwner::full_size_format(), DD::Image::Info2D::full_size_format(), DD::Image::Enumeration_KnobI::getError(), DD::Image::Box::h(), DD::Image::Format::height(), DD::Image::IopInfoOwner::info_, DD::Image::FileOp::internalError(), DD::Image::Op::knob(), DD::Image::GeneralInfo::last_frame(), DD::Image::Reader::lut(), DD::Image::Op::outputContext(), DD::Image::Box::r(), DD::Image::Box::set(), DD::Image::Box::t(), DD::Image::LUT::test(), DD::Image::ProxyContext::to_proxy(), DD::Image::InternalOCIOOp::validate(), DD::Image::Box::w(), DD::Image::Format::width(), DD::Image::Box::x(), DD::Image::Box::y(), and DD::Image::IopInfo::ydirection().

void Read::_open ( ) [protected, virtual]

Calls open() on the reader object.

Reimplemented from DD::Image::PlanarIop.

References DD::Image::FileOp::_readerError, getPlanarI(), and DD::Image::Reader::open().

bool Read::useStripes ( ) const [protected, virtual]

implementation of PlanarIop::useStripes()

Reimplemented from DD::Image::PlanarIop.

References DD::Image::Reader::useStripes().

size_t Read::stripeHeight ( ) const [protected, virtual]

implementation of PlanarIop::stripeHeight()

Reimplemented from DD::Image::PlanarIop.

References DD::Image::Reader::stripeHeight().

PlanarI::PackedPreference Read::packedPreference ( ) const [protected, virtual]

implementation of PlanarIop::packedPreference()

Reimplemented from DD::Image::PlanarIop.

void Read::doFetchPlane ( ImagePlane imagePlane) [protected, virtual]

implementation of Iop::packedPreference(). Calls Iop::doFetchPlane() or PlanarIop::doFetchPlane() depending on whether the reader supports planar.

Reimplemented from DD::Image::PlanarIop.

References getPlanarI().

PlanarI * Read::getPlanarI ( ) [protected, virtual]

implementation of PlanarIop::getPlanarI

Reimplemented from DD::Image::PlanarIop.

References DD::Image::Reader::planarPreference().

Referenced by _open(), and doFetchPlane().

PlanarI::PlaneID Read::getPlaneFromChannel ( Channel  chan) [protected, virtual]

implementation of PlanarI::getPlaneFromChannel

this is only defined for channels that the reader actually supports, otherwise return plane consisting of individual layer.

Reimplemented from DD::Image::PlanarI.

References DD::Image::ChannelSet::contains(), and DD::Image::Reader::getPlaneFromChannel().

void Read::_close ( ) [protected, virtual]

Call this to close any current file. This will free up resources. Nuke calls this automatically after a timeout.

open() will reopen the file, but it assumes the file is the same one. You must call invalidate() if there is a possibility the existence, readability, or dimensions of the file has changed.

Reimplemented from DD::Image::Iop.

Referenced by _validate().

const Format * DD::Image::Read::expected_full_size_format ( ) const [inline]

This is the Format the Read will output as full_size_format(). If it is NULL or is equal to expected_read_format() then the format() is returned.

Referenced by _validate().

const Format * DD::Image::Read::expected_format ( ) const [inline]

If not NULL then this is the proxyfied version of the expected_full_size_format and will be used as the output format(). If this is NULL then the read format is used and you better not try to set any proxy scaling.

Referenced by _validate().

const Format * DD::Image::Read::expected_read_format ( ) const [inline]

This is the format to assume file is in if it has the correct dimensions. If the dimensions are wrong then Format::find() is used to locate or create a correct format, but the pixel_aspect from this format is used as a hint.

If this is NULL (the default value) then Format::find() is always called with a pixel aspect of 1.

Referenced by _validate(), and DD::Image::Reader::set_info().

void Read::append ( Hash hash) [virtual]

Indicate that the frame number, view, autoAlpha, and LUT may affect the output.

Reimplemented from DD::Image::Op.

References DD::Image::ValueStuffI::get_value(), DD::Image::Op::knob(), DD::Image::Op::outputContext(), DD::Image::root_real_fps, and DD::Image::Op::rootOp().

void Read::setIgnoreCachedErrors ( bool  ignoreCachedErrors)

Setter for ignoreCachedErrors flag which is used by the renderFrames() function to force-invalidate read ops which depend on previous writes in the op tree.

void Read::expectedFrameRange ( int  first,
int  last 
) [virtual]

Set the frame range returned if the image file itself does not contain a frame range.

Implements DD::Image::ReadFileKnobOwner.

References DD::Image::GeneralInfo::first_frame(), DD::Image::IopInfoOwner::info_, and DD::Image::GeneralInfo::last_frame().

void DD::Image::Read::colorspace ( int  v) [inline]

Make the Reader use LUT::builtin(v) to convert the data, unless v is zero in which case the Reader chooses the LUT itself (for most Readers the default LUT is sRGB). Zero is the default value.

void DD::Image::Read::raw ( bool  v) [inline]

Sets the LUT to LUT::LINEAR (overriding the colorspace() setting). Some Reader types may examine this setting and use it to turn off other processing, such as conversion from YUV space.

void DD::Image::Read::premult ( bool  v) [inline]

Indicates that data should be divided by the alpha channel before being run through the LUT, and then multiplied again afterwards. This will convert data that was premultiplied in the file's colorspace into data that is premultiplied in linear colorspace.

This makes a difference if the LUT is anything other than LUT::LINEAR for any pixels where the alpha is greater than zero and less than one.

void DD::Image::Read::output_type ( int  v) [inline, virtual]

Sets exactly what is in the pixels that the Read produces. This is used by Nuke to produce results with the correct size and channels for missing frames, such as out-of-range frame numbers, or missing files in the middle of the range. This is done by setting the filename to an actual existing file, but using this to make the read produce black or a checkerboard.

  • IMAGE returns the data from the file.
  • BLACK returns zero in all channels and sets the bounding box to 1x1.
  • CHECKERBOARD produces a box pattern for all channels and sets the bounding box to the format.

Implements DD::Image::ReadFileKnobOwner.

void DD::Image::Read::force_near_frame ( bool  b) [inline, virtual]

Force the read node to use near frame in case of error !

Implements DD::Image::ReadFileKnobOwner.

void DD::Image::Read::force_format ( bool  b) [inline]

Force the read node to output at the expected format !