* @brief The purpose of this function is to check that the meta data returned by the plug-ins are valid and to * check for warnings **/
| 5768 | * check for warnings |
| 5769 | **/ |
| 5770 | void |
| 5771 | EffectInstance::Implementation::checkMetadata(NodeMetadata &md) |
| 5772 | { |
| 5773 | NodePtr node = _publicInterface->getNode(); |
| 5774 | |
| 5775 | if (!node) { |
| 5776 | return; |
| 5777 | } |
| 5778 | //Make sure it is valid |
| 5779 | int nInputs = node->getNInputs(); |
| 5780 | |
| 5781 | for (int i = -1; i < nInputs; ++i) { |
| 5782 | md.setBitDepth( i, node->getClosestSupportedBitDepth( md.getBitDepth(i) ) ); |
| 5783 | int nComps = md.getNComps(i); |
| 5784 | bool isAlpha = false; |
| 5785 | bool isRGB = false; |
| 5786 | if (i == -1) { |
| 5787 | if ( nComps == 3) { |
| 5788 | isRGB = true; |
| 5789 | } else if (nComps == 1) { |
| 5790 | isAlpha = true; |
| 5791 | } |
| 5792 | } |
| 5793 | |
| 5794 | if ( md.getComponentsType(i) == kNatronColorPlaneID ) { |
| 5795 | md.setNComps(i, node->findClosestSupportedComponents(i, ImagePlaneDesc::mapNCompsToColorPlane(nComps)).getNumComponents()); |
| 5796 | } |
| 5797 | |
| 5798 | if (i == -1) { |
| 5799 | //Force opaque for RGB and premult for alpha |
| 5800 | if (isRGB) { |
| 5801 | md.setOutputPremult(eImagePremultiplicationOpaque); |
| 5802 | } else if (isAlpha) { |
| 5803 | md.setOutputPremult(eImagePremultiplicationPremultiplied); |
| 5804 | } |
| 5805 | } |
| 5806 | } |
| 5807 | |
| 5808 | |
| 5809 | ///Set a warning on the node if the bitdepth conversion from one of the input clip to the output clip is lossy |
| 5810 | QString bitDepthWarning = tr("This nodes converts higher bit depths images from its inputs to work. As " |
| 5811 | "a result of this process, the quality of the images is degraded. The following conversions are done:"); |
| 5812 | bitDepthWarning.append( QChar::fromLatin1('\n') ); |
| 5813 | bool setBitDepthWarning = false; |
| 5814 | const bool supportsMultipleClipDepths = _publicInterface->supportsMultipleClipDepths(); |
| 5815 | const bool supportsMultipleClipPARs = _publicInterface->supportsMultipleClipPARs(); |
| 5816 | const bool supportsMultipleClipFPSs = _publicInterface->supportsMultipleClipFPSs(); |
| 5817 | std::vector<EffectInstancePtr> inputs(nInputs); |
| 5818 | for (int i = 0; i < nInputs; ++i) { |
| 5819 | inputs[i] = _publicInterface->getInput(i); |
| 5820 | } |
| 5821 | |
| 5822 | |
| 5823 | ImageBitDepthEnum outputDepth = md.getBitDepth(-1); |
| 5824 | double outputPAR = md.getPixelAspectRatio(-1); |
| 5825 | bool outputFrameRateSet = false; |
| 5826 | double outputFrameRate = md.getOutputFrameRate(); |
| 5827 | bool mustWarnFPS = false; |
no test coverage detected