DD::Image::Read Class Reference

Inherits DD::Image::FileIop, DD::Image::FileRead, and DD::Image::ReadFileKnobOwner.

List of all members.

Public Member Functions

FileHandler * handler () const
void close ()
const char * getFilename () const
void setReadFormat (const Format *fmt)
void setFullSizeFormat (const Format *fmt)
void setFormat (const Format *fmt)
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 retriveInfo ()
void setIgnoreCachedErrors (bool ignoreCachedErrors)
void frame_for_reader (int n)
int frame_for_reader () const
void filename (const char *f)
const char * filename () const
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 *)
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)
void setEdgeCode (const std::string &edgeCode)
void setTimeCode (const std::string &edgeCode)
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 ()
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)
virtual const char * file_type () const
bool set_file_type (const char *)
bool set_file_type_from_filename (Knob *knob=0)
void _validate (bool)
void _open ()
void engine (int y, int x, int r, ChannelMask, Row &)
void _close ()

Protected Attributes

Readerreader
ReaderFormat * fileformat
const Reader::Descriptionreader_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_
int view_for_reader_
const char * filename_
const char * file_type_
int colorspace_
bool raw_
bool premult_
bool autoAlpha_
int _outputType
int frame_range [2]
bool proxyscale
float sx
float sy
float tx
float ty
Format localFormat
MetaData::Bundle _meta
FormatPair formats
const FormatreadFormat


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 (  )  [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::fetchMetaData(), 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 DD::Image::Iop::default_input(), DD::Image::OutputContext::from_proxy_wh(), DD::Image::OutputContext::from_proxy_xy(), DD::Image::Op::outputContext(), DD::Image::OutputContext::setProxyscale(), DD::Image::OutputContext::to_proxy(), DD::Image::OutputContext::to_proxy_wh(), and DD::Image::OutputContext::to_proxy_xy().

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

Calls open() on the reader object.

Reimplemented from DD::Image::Iop.

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

void Read::engine ( int  y,
int  x,
int  r,
ChannelMask  channels,
Row row 
) [protected, virtual]

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.

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::Hash::append(), DD::Image::OutputContext::from_proxy_wh(), DD::Image::OutputContext::from_proxy_xy(), DD::Image::Op::outputContext(), and DD::Image::OutputContext::view().

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.

void 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 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 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 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 !



©2009 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk