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; } } }