void EXRReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); if( getExplicitChannelConversion() == eParamReaderChannelAuto ) { switch( _channelNames.size() ) { case 1: { if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentAlpha ) ) clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentAlpha ); break; } case 2: case 3: { if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentRGB ) ) clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGB ); break; } default: //case 4: { if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentRGBA ) ) clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } } } clipPreferences.setPixelAspectRatio( *this->_clipDst, _par ); }
void PngReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); const std::string filename( getAbsoluteFirstFilename() ); if( getExplicitBitDepthConversion() == eParamReaderBitDepthAuto ) { OFX::EBitDepth bd = OFX::eBitDepthNone; if( ! boost::filesystem::exists( filename ) ) { BOOST_THROW_EXCEPTION( exception::FileNotExist() << exception::user( "PNG: Unable to open file" ) << exception::filename( filename ) ); } int bitDepth; bitDepth = png_read_precision( filename ); switch( bitDepth ) { case 8: bd = OFX::eBitDepthUByte; break; case 16: bd = OFX::eBitDepthUShort; break; default: BOOST_THROW_EXCEPTION( exception::ImageFormat() ); } clipPreferences.setClipBitDepth( *this->_clipDst, bd ); } if( getExplicitChannelConversion() == eParamReaderChannelAuto ) { switch( png_read_color_type( filename ) ) { case 0 : clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentAlpha ); break; case 2 : if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentRGB ) ) clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGB ); else clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; case 6 : clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; default: clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } } clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); }
void ReaderPlugin::getClipPreferences(OFX::ClipPreferencesSetter& clipPreferences) { // If pattern detected (frame varying on time) clipPreferences.setOutputFrameVarying(varyOnTime()); switch(getExplicitBitDepthConversion()) { case eParamReaderBitDepthByte: { clipPreferences.setClipBitDepth(*this->_clipDst, OFX::eBitDepthUByte); break; } case eParamReaderBitDepthShort: { clipPreferences.setClipBitDepth(*this->_clipDst, OFX::eBitDepthUShort); break; } case eParamReaderBitDepthAuto: case eParamReaderBitDepthFloat: { clipPreferences.setClipBitDepth(*this->_clipDst, OFX::eBitDepthFloat); break; } } switch(getExplicitChannelConversion()) { case eParamReaderChannelGray: { clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentAlpha); break; } case eParamReaderChannelRGB: { if(OFX::getImageEffectHostDescription()->supportsPixelComponent(OFX::ePixelComponentRGB)) clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGB); else clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGBA); break; } case eParamReaderChannelAuto: case eParamReaderChannelRGBA: { clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGBA); break; } } clipPreferences.setPixelAspectRatio(*this->_clipDst, 1.0); }
void ComponentPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { switch( _paramToComponent->getValue() ) { case eConvertToGray: clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentAlpha ); break; case eConvertToRGB: clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGB ); break; case eConvertToRGBA: clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } }
void Jpeg2000ReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { // TUTTLE_LOG_VAR( TUTTLE_INFO, _paramFilepath->getValue() ); // TUTTLE_LOG_VAR( TUTTLE_INFO, getAbsoluteFirstFilename() ); // TUTTLE_LOG_VAR( TUTTLE_INFO, getFirstTime() ); // TUTTLE_LOG_VAR( TUTTLE_INFO, getAbsoluteFilenameAt(getFirstTime()) ); ReaderPlugin::getClipPreferences( clipPreferences ); FileInfo fileInfo = retrieveFileInfo( getFirstTime() ); if ( fileInfo._failed ) { BOOST_THROW_EXCEPTION( exception::Failed() << exception::user( "Jpeg2000: Unable to read file infos." ) ); } if( getExplicitBitDepthConversion() == eParamReaderBitDepthAuto ) { clipPreferences.setClipBitDepth( *_clipDst, fileInfo._precisionType ); } else // if we explicitly specify which conversion we want { clipPreferences.setClipBitDepth( *_clipDst, getOfxExplicitConversion() ); } if( getExplicitChannelConversion() == eParamReaderChannelAuto ) { switch( fileInfo._components ) { case 1: clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentAlpha ); break; case 3: clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentRGB ); break; case 4: clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentRGBA ); break; default: { BOOST_THROW_EXCEPTION( exception::ImageFormat() << exception::user() + "Jpeg2000: Unexpected number of channels (" + fileInfo._components + ")" ); } } } clipPreferences.setPixelAspectRatio( *_clipDst, 1.0 ); }
void ReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { const std::string filename( getAbsoluteFirstFilename() ); if( !bfs::exists( filename ) ) { BOOST_THROW_EXCEPTION( exception::File() << exception::user( "Unable to open file." ) << exception::filename( filename ) ); BOOST_THROW_EXCEPTION( exception::FileNotExist( filename ) ); } // If pattern detected (frame varying on time) clipPreferences.setOutputFrameVarying( varyOnTime() ); switch( getExplicitConversion() ) { case eParamReaderExplicitConversionByte: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUByte ); break; } case eParamReaderExplicitConversionShort: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUShort ); break; } case eParamReaderExplicitConversionAuto: case eParamReaderExplicitConversionFloat: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthFloat ); break; } } clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); }
void RawReaderPlugin::getClipPreferences(OFX::ClipPreferencesSetter& clipPreferences) { ReaderPlugin::getClipPreferences(clipPreferences); // const std::string filename( getAbsoluteFirstFilename() ); if(getExplicitBitDepthConversion() == eParamReaderBitDepthAuto) { OFX::EBitDepth bd = OFX::eBitDepthNone; int bitDepth = 32; // raw_read_precision( filename ); switch(bitDepth) { case 8: bd = OFX::eBitDepthUByte; break; case 16: bd = OFX::eBitDepthUShort; break; case 32: bd = OFX::eBitDepthFloat; break; default: BOOST_THROW_EXCEPTION(exception::ImageFormat()); } clipPreferences.setClipBitDepth(*this->_clipDst, bd); } clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGBA); clipPreferences.setPixelAspectRatio(*this->_clipDst, 1.0); }
void TestOpenGLPlugin::getClipPreferences(OFX::ClipPreferencesSetter &clipPreferences) { // We have to do this because the processing code does not support varying components for srcClip and dstClip // (The OFX spec doesn't state a default value for this) clipPreferences.setClipComponents(*_dstClip, _srcClip->getPixelComponents()); }
void FFMpegReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { clipPreferences.setOutputFrameVarying( true ); clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setClipBitDepth( *_clipDst, OFX::eBitDepthUByte ); /// @todo tuttle: some video format may need other bit depth (how we can detect this ?) if( !ensureVideoIsOpen() ) return; // options depending on input file clipPreferences.setPixelAspectRatio( *_clipDst, _reader.aspectRatio() ); clipPreferences.setOutputFrameRate( _reader.fps() ); // Setup fielding switch( _reader.interlacment() ) { case eInterlacmentNone: { clipPreferences.setOutputFielding( OFX::eFieldNone ); break; } case eInterlacmentUpper: { clipPreferences.setOutputFielding( OFX::eFieldUpper ); break; } case eInterlacmentLower: { clipPreferences.setOutputFielding( OFX::eFieldLower ); break; } } }
void GeneratorPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { clipPreferences.setOutputFrameVarying( true ); switch( getExplicitConversion() ) { case eParamGeneratorExplicitConversionByte: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUByte ); break; } case eParamGeneratorExplicitConversionShort: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUShort ); break; } case eParamGeneratorExplicitConversionAuto: case eParamGeneratorExplicitConversionFloat: { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthFloat ); break; } } clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); }
void SobelPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { EParamOutputComponent comp = static_cast<EParamOutputComponent>(_paramOutputComponent->getValue()); switch( comp ) { case eParamOutputComponentRGBA: { clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentRGBA ); break; } case eParamOutputComponentRGB: { clipPreferences.setClipComponents( *_clipDst, OFX::ePixelComponentRGB ); break; } } }
void ColorGradientPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { GeneratorPlugin::getClipPreferences( clipPreferences ); if( getExplicitConversion() == eParamGeneratorExplicitConversionAuto ) { clipPreferences.setClipBitDepth( *_clipDst, OFX::eBitDepthFloat ); } clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); }
void EXRReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); if( getExplicitChannelConversion() == eParamReaderChannelAuto ) { switch( _channels ) { case 1: { clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentAlpha ); break; } case 3: { if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentRGB ) ) clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGB ); else clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } case 4: { clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } default: { std::string msg = "EXR: not support "; msg += _channels; msg += " channels."; BOOST_THROW_EXCEPTION( exception::FileNotExist() << exception::user( msg ) ); break; } } } clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); /// @todo tuttle: retrieve info from exr }
void InputBufferPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { OfxRangeD range; _paramTimeDomain->getValue( range.min, range.max ); InputBufferProcessParams params = getProcessParams( range.min ); clipPreferences.setOutputFrameVarying( params._mode == eParamInputModeCallbackPointer ); clipPreferences.setClipComponents( *_clipDst, params._pixelComponents ); clipPreferences.setClipBitDepth( *_clipDst, params._bitDepth ); clipPreferences.setPixelAspectRatio( *_clipDst, params._pixelAspectRatio ); clipPreferences.setOutputFrameRate( params._framerate ); clipPreferences.setOutputFielding( params._field ); }
void TurboJpegReaderPlugin::getClipPreferences(OFX::ClipPreferencesSetter& clipPreferences) { ReaderPlugin::getClipPreferences(clipPreferences); if(getExplicitBitDepthConversion() == eParamReaderBitDepthAuto) { clipPreferences.setClipBitDepth(*this->_clipDst, OFX::eBitDepthUByte); } if(getExplicitChannelConversion() == eParamReaderChannelAuto) { if(OFX::getImageEffectHostDescription()->supportsPixelComponent(OFX::ePixelComponentRGB)) { clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGB); } else { clipPreferences.setClipComponents(*this->_clipDst, OFX::ePixelComponentRGBA); } } clipPreferences.setPixelAspectRatio(*this->_clipDst, 1.0); }
void DPXReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); const std::string filename( getAbsoluteFirstFilename() ); if( getExplicitConversion() == eParamReaderExplicitConversionAuto ) { DpxImage dpxImg; dpxImg.readHeader( filename ); OFX::EBitDepth bd = OFX::eBitDepthNone; switch( dpxImg.componentsType() ) { case DpxImage::eCompTypeR8G8B8: case DpxImage::eCompTypeR8G8B8A8: case DpxImage::eCompTypeA8B8G8R8: { bd = OFX::eBitDepthUByte; break; } case DpxImage::eCompTypeR10G10B10: case DpxImage::eCompTypeR10G10B10A10: case DpxImage::eCompTypeA10B10G10R10: case DpxImage::eCompTypeR12G12B12: case DpxImage::eCompTypeR12G12B12A12: case DpxImage::eCompTypeA12B12G12R12: case DpxImage::eCompTypeR16G16B16: case DpxImage::eCompTypeR16G16B16A16: case DpxImage::eCompTypeA16B16G16R16: { bd = OFX::eBitDepthUShort; break; } default: bd = OFX::eBitDepthFloat; } clipPreferences.setClipBitDepth( *_clipDst, bd ); } clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); }
void ImageMagickReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); const std::string filename = getAbsoluteFirstFilename(); ImageInfo* imageInfo = AcquireImageInfo(); GetImageInfo( imageInfo ); strcpy( imageInfo->filename, filename.c_str() ); ExceptionInfo* exceptionsInfo = AcquireExceptionInfo(); GetExceptionInfo( exceptionsInfo ); Image* image = PingImage( imageInfo, exceptionsInfo ); if( getExplicitConversion() == eParamReaderExplicitConversionAuto ) { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthFloat ); // by default if( image ) { unsigned long bitDepth = GetImageDepth( image, exceptionsInfo ); // if image information use it if( bitDepth <= 8 ) { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUByte ); } else if( bitDepth <= 16 ) { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthUShort ); } } } clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); /// @todo tuttle: retrieve info, gray / RGB / RGBA... clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); /// @todo tuttle: retrieve info if( image ) image = DestroyImage( image ); imageInfo = DestroyImageInfo( imageInfo ); exceptionsInfo = DestroyExceptionInfo( exceptionsInfo ); }
void OpenImageIOReaderPlugin::getClipPreferences( OFX::ClipPreferencesSetter& clipPreferences ) { ReaderPlugin::getClipPreferences( clipPreferences ); const std::string filename( getAbsoluteFirstFilename() ); // if no filename if( filename.size() == 0 ) { clipPreferences.setClipBitDepth( *this->_clipDst, OFX::eBitDepthFloat ); clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); return; } OpenImageIO::ImageInput *in = OpenImageIO::ImageInput::create( filename ); if( !in ) { BOOST_THROW_EXCEPTION( exception::Unknown() << exception::user( "OIIO Reader: " + in->geterror () ) << exception::filename( filename ) ); } OpenImageIO::ImageSpec spec; if( ! in->open( filename, spec ) ) { BOOST_THROW_EXCEPTION( exception::Unknown() << exception::user( "OIIO Reader: " + in->geterror () ) << exception::filename( filename ) ); } if( getExplicitBitDepthConversion() == eParamReaderBitDepthAuto ) { OFX::EBitDepth bd = OFX::eBitDepthNone; switch( spec.format.basetype ) { // case TypeDesc::UCHAR: case OpenImageIO::TypeDesc::UINT8: // case TypeDesc::CHAR: case OpenImageIO::TypeDesc::INT8: bd = OFX::eBitDepthUByte; break; case OpenImageIO::TypeDesc::HALF: // case TypeDesc::USHORT: case OpenImageIO::TypeDesc::UINT16: // case TypeDesc::SHORT: case OpenImageIO::TypeDesc::INT16: bd = OFX::eBitDepthUShort; break; // case TypeDesc::UINT: case OpenImageIO::TypeDesc::UINT32: // case TypeDesc::INT: case OpenImageIO::TypeDesc::INT32: // case TypeDesc::ULONGLONG: case OpenImageIO::TypeDesc::UINT64: // case TypeDesc::LONGLONG: case OpenImageIO::TypeDesc::INT64: case OpenImageIO::TypeDesc::FLOAT: case OpenImageIO::TypeDesc::DOUBLE: bd = OFX::eBitDepthFloat; break; case OpenImageIO::TypeDesc::STRING: case OpenImageIO::TypeDesc::PTR: case OpenImageIO::TypeDesc::LASTBASE: case OpenImageIO::TypeDesc::UNKNOWN: case OpenImageIO::TypeDesc::NONE: default: { in->close(); BOOST_THROW_EXCEPTION( exception::ImageFormat() << exception::user("bad input format") ); } } clipPreferences.setClipBitDepth( *this->_clipDst, bd ); } if( getExplicitChannelConversion() == eParamReaderChannelAuto ) { switch( spec.nchannels ) { case 1 : clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentAlpha ); break; case 3 : if( OFX::getImageEffectHostDescription()->supportsPixelComponent( OFX::ePixelComponentRGB ) ) { clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGB ); } else { clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); } break; case 4 : clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; default: clipPreferences.setClipComponents( *this->_clipDst, OFX::ePixelComponentRGBA ); break; } } clipPreferences.setPixelAspectRatio( *this->_clipDst, 1.0 ); in->close(); }