| 5282 | } |
| 5283 | |
| 5284 | StatusEnum |
| 5285 | EffectInstance::getDefaultMetadata(NodeMetadata &metadata) |
| 5286 | { |
| 5287 | NodePtr node = getNode(); |
| 5288 | |
| 5289 | if (!node) { |
| 5290 | return eStatusFailed; |
| 5291 | } |
| 5292 | |
| 5293 | const bool multiBitDepth = supportsMultipleClipDepths(); |
| 5294 | int nInputs = getMaxInputCount(); |
| 5295 | metadata.clearAndResize(nInputs); |
| 5296 | |
| 5297 | // OK find the deepest chromatic component on our input clips and the one with the |
| 5298 | // most components |
| 5299 | bool hasSetCompsAndDepth = false; |
| 5300 | ImageBitDepthEnum deepestBitDepth = eImageBitDepthNone; |
| 5301 | int mostComponents = 0; |
| 5302 | |
| 5303 | //Default to the project frame rate |
| 5304 | double frameRate = getApp()->getProjectFrameRate(); |
| 5305 | std::vector<EffectInstPtr> inputs(nInputs); |
| 5306 | |
| 5307 | // Find the components of the first non optional connected input |
| 5308 | // They will be used for disconnected input |
| 5309 | int firstNonOptionalConnectedInputComps = 0; |
| 5310 | for (std::size_t i = 0; i < inputs.size(); ++i) { |
| 5311 | inputs[i] = getInput(i); |
| 5312 | if ( !firstNonOptionalConnectedInputComps && inputs[i] && !isInputOptional(i) ) { |
| 5313 | firstNonOptionalConnectedInputComps = inputs[i]->getMetadataNComps(-1); |
| 5314 | } |
| 5315 | } |
| 5316 | |
| 5317 | double inputPar = 1.; |
| 5318 | bool inputParSet = false; |
| 5319 | ImagePremultiplicationEnum premult = eImagePremultiplicationOpaque; |
| 5320 | bool premultSet = false; |
| 5321 | for (int i = 0; i < nInputs; ++i) { |
| 5322 | const EffectInstPtr& input = inputs[i]; |
| 5323 | if (input) { |
| 5324 | frameRate = std::max( frameRate, input->getFrameRate() ); |
| 5325 | } |
| 5326 | |
| 5327 | |
| 5328 | if (input) { |
| 5329 | if (!inputParSet) { |
| 5330 | inputPar = input->getAspectRatio(-1); |
| 5331 | inputParSet = true; |
| 5332 | } |
| 5333 | } |
| 5334 | |
| 5335 | int rawComp = getUnmappedComponentsForInput(this, i, inputs, firstNonOptionalConnectedInputComps); |
| 5336 | ImageBitDepthEnum rawDepth = input ? input->getBitDepth(-1) : eImageBitDepthFloat; |
| 5337 | ImagePremultiplicationEnum rawPreMult = input ? input->getPremult() : eImagePremultiplicationPremultiplied; |
| 5338 | |
| 5339 | // Note: first chromatic input gives the default output premult too, even if not connected |
| 5340 | // (else the output of generators may be opaque even if the host default is premultiplied) |
| 5341 | if ( ( rawComp == 4 ) && (input || !premultSet) ) { |
nothing calls this directly
no test coverage detected