예제 #1
0
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 );

}
예제 #2
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);
}
예제 #3
0
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);
}