boost::shared_ptr<EPVideoTrack> EPVideoTrack::CreateVideoTrack( AxMobSlot& axMobSlot ) { //1. Ensure the slot's data def is either picture or sound AxDataDef axDataDef( axMobSlot.GetDataDef() ); if ( axDataDef.IsPictureKind() ) { //2. Ensure the segment is a source clip. AxSegment axSegment( axMobSlot.GetSegment() ); IAAFSourceClipSP spSrcClip; if ( AxIsA( axSegment, spSrcClip ) ) { //3. Ensure the source clip contains a source mob. AxSourceClip axSrcClip( spSrcClip ); //4. Make sure that the referenced source mob is in this AAF file. if ( IsReferenceInFile( axSrcClip ) ) { AxMob axMob( axSrcClip.ResolveRef() ); IAAFSourceMobSP spSrcMob; if ( AxIsA( axMob, spSrcMob ) ) { //5. Ensure the source mob is a file source mob. AxSourceMob axSrcMob( spSrcMob ); AxEssenceDescriptor descriptor( axSrcMob.GetEssenceDescriptor() ); IAAFFileDescriptorSP spFileDes; if ( AxIsA( descriptor, spFileDes ) ) { boost::shared_ptr<EPVideoTrack> spTrack( new EPVideoTrack( axMobSlot, axSrcClip, axSrcMob ) ); return spTrack; } } } } } //Return a null shared pointer if the mob slot does not contain an essence //track. return boost::shared_ptr<EPVideoTrack>(); }
void Aif2XtlSourceClipVisitor::PreOrderVisit( Aif2XtlSourceClipNode& node ) { // If the source clip references a composition mob then we build the // sub tree for that mob. If the sub tree also contains further // sub compositions, these will be processed when IAAFSourceClipSP spSourceClip; spSourceClip = node.GetAif2XtlAAFObject(); AxSourceClip axSrcClip( spSourceClip ); AxMob axReferencedMob( axSrcClip.ResolveRef() ); IAAFCompositionMobSP spCompMob; if ( !AxIsA( axReferencedMob, spCompMob ) ) { return; } aafSourceRef_t srcRef = axSrcClip.GetSourceReference(); // Decorate this node so that we can easily distingquish it from // other source clips (i.e. master and chained source clips) // later on. std::auto_ptr<Aif2XtlUnMasteredSourceClipDecoration> pSrcClipDec ( new Aif2XtlUnMasteredSourceClipDecoration ); node.PushDecoration( pSrcClipDec ); // Build a sub tree that includes only the referenced slot. RejectUnreferencedSlots rejectAllSlotsButThisOne( srcRef.sourceSlotID ); std::auto_ptr<AifParseTreeNode> chainedSubTreeRoot = AifBuildParseTree( axReferencedMob, _nodeFactory, rejectAllSlotsButThisOne ); node.AddChild( chainedSubTreeRoot ); }
void Aif2XtlSourceClipVisitor::PostOrderVisit( Aif2XtlSourceClipNode& node ) { try { IAAFSourceClipSP spChainedSourceClip = node.GetAif2XtlAAFObject(); AxSourceClip axSrcClip( spChainedSourceClip ); AxMob axReferencedMob( axSrcClip.ResolveRef() ); IAAFMasterMobSP spMasterMob; if ( !AxIsA( axReferencedMob, spMasterMob ) ) { return; } // Decorate this node so that we can easily distingquish it from // other source clips (i.e. master and chained source clips) // later on. std::auto_ptr<Aif2XtlUnMasteredSourceClipDecoration> pSrcClipDec ( new Aif2XtlUnMasteredSourceClipDecoration ); node.PushDecoration( pSrcClipDec ); aafSourceRef_t srcRef = axSrcClip.GetSourceReference(); RejectUnreferencedSlots rejectAllSlotsButThisOne( srcRef.sourceSlotID ); std::auto_ptr<AifParseTreeNode> chainedSubTreeRoot = AifBuildParseTree( axReferencedMob, _nodeFactory, rejectAllSlotsButThisOne ); Aif2XtlSourceClipNode* pRootSrcClipNode = 0; bool notAtEndOfChain = GetChainedSourceClip( *chainedSubTreeRoot, GetLogStream(), &pRootSrcClipNode ); Aif2XtlSourceClipNode* pChainedSrcClipNode = pRootSrcClipNode; // This is a master mob. It should never be the end of the chain. assert(notAtEndOfChain); node.AddChild( chainedSubTreeRoot ); while ( notAtEndOfChain ) { spChainedSourceClip = pChainedSrcClipNode->GetAif2XtlAAFObject(); AxSourceClip axSrcClip( spChainedSourceClip ); AxMob axReferencedMob( axSrcClip.ResolveRef() ); aafSourceRef_t srcRef = axSrcClip.GetSourceReference(); RejectUnreferencedSlots rejectAllSlotsButThisOne( srcRef.sourceSlotID ); std::auto_ptr<AifParseTreeNode> chainedSubTreeRoot = AifBuildParseTree( axReferencedMob, _nodeFactory, rejectAllSlotsButThisOne ); notAtEndOfChain = GetChainedSourceClip( *chainedSubTreeRoot, GetLogStream(), &pChainedSrcClipNode ); pRootSrcClipNode->AddChild( chainedSubTreeRoot ); } } catch( const AxExHResult& ex ) { if ( ex.getHResult() != AAFRESULT_MOB_NOT_FOUND ) { throw; } } }
bool EPLocatorVisitor::PreOrderVisit( EPTypedObjNode<IAAFSourceMob, EPImportSource>& node ) { AxSourceMob axSrcMob( node.GetAAFObjectOfType() ); AxImportDescriptor axImpDes( AxQueryInterface<IAAFEssenceDescriptor, IAAFImportDescriptor>( axSrcMob.GetEssenceDescriptor() ) ); try { AxLocatorIter locIter( axImpDes.GetLocators() ); IAAFSmartPointer2<IAAFLocator> spLocator; //REQ_EP_075 bool locatorFound = false; while ( locIter.NextOne( spLocator ) ) { //If this is a Network Locator AxLocator axLocator( spLocator ); IAAFNetworkLocatorSP spNetLoc; if ( AxIsA( axLocator, spNetLoc ) ) { AxNetworkLocator axNetLoc( spNetLoc ); if ( CheckNetworkLocator( axNetLoc ) ) { locatorFound = true; break; } } } if ( !locatorFound ) { wstring explain = L"EssenceDescriptor::Locator property of " + this->GetMobName( axSrcMob, L"Import Source" ) + L" does not include any NetworkLocators that complies " L"with the constraints set out in Section 6.9 of the AAF Edit Protocol."; _spTestResult->AddSingleResult( L"REQ_EP_075", explain, TestResult::FAIL, node ); return false; } } catch ( const AxExHResult& ex ) { if ( ex.getHResult() != AAFRESULT_PROP_NOT_PRESENT ) { throw ex; } wstring explain = this->GetMobName( axSrcMob, EPImportSource::GetName() ) + L" does not have an EssenceDescriptor::Locator property."; _spTestResult->AddSingleResult( L"REQ_EP_075", explain, TestResult::FAIL, node ); return false; } return true; }
bool EPLocatorVisitor::PreOrderVisit( EPTypedObjNode<IAAFSourceMob, EPFileSource>& node ) { bool testPassed = true; AxSourceMob axSrcMob( node.GetAAFObjectOfType() ); AxString mobName = this->GetMobName( axSrcMob, EPFileSource::GetName() ); try { //REQ_EP_059 AxFileDescriptor axFileDes( AxQueryInterface<IAAFEssenceDescriptor, IAAFFileDescriptor>( axSrcMob.GetEssenceDescriptor() ) ); AxContainerDef axContDef( axFileDes.GetContainerFormat() ); aafUID_t containerFormat = axContDef.GetAUID(); try { AxLocatorIter locIter( axFileDes.GetLocators() ); IAAFSmartPointer2<IAAFLocator> spLocator; bool fileFound = false; if ( containerFormat == kAAFContainerDef_External ) { //REQ_EP_060 //Repeat until the iterator is out of mob slots. while ( locIter.NextOne( spLocator ) ) { AxLocator axLocator( spLocator ); AxString fileLocation = axLocator.GetPath(); //TODO: Determine if the file exists if ( false ) { fileFound = true; break; } } if ( !fileFound ) { _spTestResult->AddSingleResult( L"REQ_EP_060", L"EssenceDescriptor::Locator property of " + mobName + L" does not contain a locator pointing to any known file.", TestResult::WARN, node ); } locIter.Reset(); } else if ( containerFormat != kAAFContainerDef_AAF ) { _spTestResult->AddSingleResult( L"REQ_EP_059", L"Essence associated with " + mobName + L" is neither internal or external.", TestResult::FAIL, node ); testPassed = false; } //REQ_EP_061 bool locatorFound = false; while ( locIter.NextOne( spLocator ) ) { //If this is a Network Locator AxLocator axLocator( spLocator ); IAAFNetworkLocatorSP spNetLoc; if ( AxIsA( axLocator, spNetLoc ) ) { AxNetworkLocator axNetLoc( spNetLoc ); if ( CheckNetworkLocator( axNetLoc ) ) { locatorFound = true; break; } } } if ( !locatorFound ) { wstring explain = L"EssenceDescriptor::Locator property of " + mobName + L" does not include any NetworkLocators that complies with" L" the constrains set out in Section 6.9 of the AAF Edit Protocol."; _spTestResult->AddSingleResult( L"REQ_EP_061", explain, TestResult::WARN, node ); } } catch ( const AxExHResult& ex ) { if ( ex.getHResult() != AAFRESULT_PROP_NOT_PRESENT ) { throw ex; } wstring explain = mobName + L" does not have an EssenceDescriptor::Locator property."; _spTestResult->AddSingleResult( L"REQ_EP_060", explain, TestResult::WARN, node ); _spTestResult->AddSingleResult( L"REQ_EP_061", explain, TestResult::WARN, node ); } } catch ( const AxExHResult& ex ) { if ( ex.getHResult() != AAFRESULT_PROP_NOT_PRESENT ) { throw ex; } _spTestResult->AddSingleResult( L"REQ_EP_059", mobName + L" does not have a FileDescriptor::ContainerDefinition property.", TestResult::FAIL, node ); testPassed = false; } return testPassed; }