From: Stuart C. <stu...@us...> - 2009-08-24 13:32:25
|
Update of /cvsroot/aaf/AAF/ref-impl/src/com-api In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24514/ref-impl/src/com-api Modified Files: CAAFMasterMob.cpp CAAFMasterMob.h Log Message: Extend AAFMasterMob interface to add new function AddMasterSlotWithSequence(). This function is similar to AddMasterSlot but instead adds a Sequence and then adds the SourceClip into the sequence, achieving better MXF interoperability. Index: CAAFMasterMob.cpp =================================================================== RCS file: /cvsroot/aaf/AAF/ref-impl/src/com-api/CAAFMasterMob.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CAAFMasterMob.cpp 1 Jun 2009 11:47:02 -0000 1.14 --- CAAFMasterMob.cpp 24 Aug 2009 13:32:16 -0000 1.15 *************** *** 1874,1877 **** --- 1874,1987 ---- + HRESULT STDMETHODCALLTYPE + CAAFMasterMob::AddMasterSlotWithSequence (IAAFDataDef * pDataDef, + aafSlotID_t sourceSlotID, + IAAFSourceMob * pSourceMob, + aafSlotID_t masterSlotID, + aafCharacter_constptr pSlotName) + { + HRESULT hr; + + ImplAAFMasterMob * ptr; + ImplAAFRoot * pO; + pO = GetRepObject (); + assert (pO); + ptr = static_cast<ImplAAFMasterMob*> (pO); + assert (ptr); + + // + // set up for pDataDef + // + ImplAAFDataDef * internalpDataDef = NULL; + if (pDataDef) + { + HRESULT hStat; + IAAFRoot * iObj; + ImplAAFRoot *arg; + hStat = pDataDef->QueryInterface (IID_IAAFRoot, (void **)&iObj); + assert (SUCCEEDED (hStat)); + assert (iObj); + hStat = iObj->GetImplRep((void **)&arg); + assert (SUCCEEDED (hStat)); + iObj->Release(); // we are through with this interface pointer. + internalpDataDef = static_cast<ImplAAFDataDef*>(arg); + assert (internalpDataDef); + } + + + // + // set up for pSourceMob + // + ImplAAFSourceMob * internalpSourceMob = NULL; + if (pSourceMob) + { + HRESULT hStat; + IAAFRoot * iObj; + ImplAAFRoot *arg; + hStat = pSourceMob->QueryInterface (IID_IAAFRoot, (void **)&iObj); + assert (SUCCEEDED (hStat)); + assert (iObj); + hStat = iObj->GetImplRep((void **)&arg); + assert (SUCCEEDED (hStat)); + iObj->Release(); // we are through with this interface pointer. + internalpSourceMob = static_cast<ImplAAFSourceMob*>(arg); + assert (internalpSourceMob); + } + + + + try + { + hr = ptr->AddMasterSlotWithSequence (internalpDataDef, + sourceSlotID, + internalpSourceMob, + masterSlotID, + pSlotName); + } + catch (OMException& e) + { + // OMExceptions should be handled by the impl code. However, if an + // unhandled OMException occurs, control reaches here. We must not + // allow the unhandled exception to reach the client code, so we + // turn it into a failure status code. + // + // If the OMException contains an HRESULT, it is returned to the + // client, if not, AAFRESULT_UHANDLED_EXCEPTION is returned. + // + hr = OMExceptionToResult(e, AAFRESULT_UNHANDLED_EXCEPTION); + } + catch (OMAssertionViolation &) + { + // Control reaches here if there is a programming error in the + // impl code that was detected by an assertion violation. + // We must not allow the assertion to reach the client code so + // here we turn it into a failure status code. + // + hr = AAFRESULT_ASSERTION_VIOLATION; + } + catch (...) + { + // We CANNOT throw an exception out of a COM interface method! + // Return a reasonable exception code. + // + hr = AAFRESULT_UNEXPECTED_EXCEPTION; + } + + // + // no cleanup necessary for pDataDef + // + + + // + // no cleanup necessary for pSourceMob + // + + + + return hr; + } + + + // *************** *** 1916,1919 **** --- 2026,2035 ---- return S_OK; } + if (EQUAL_UID(riid,IID_IAAFMasterMob3)) + { + *ppvObj = (IAAFMasterMob3 *)this; + ((IUnknown *)*ppvObj)->AddRef(); + return S_OK; + } // Always delegate back to base implementation. Index: CAAFMasterMob.h =================================================================== RCS file: /cvsroot/aaf/AAF/ref-impl/src/com-api/CAAFMasterMob.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CAAFMasterMob.h 1 Jun 2009 11:47:02 -0000 1.10 --- CAAFMasterMob.h 24 Aug 2009 13:32:16 -0000 1.11 *************** *** 71,74 **** --- 71,75 ---- public IAAFMasterMobEx, public IAAFMasterMob2, + public IAAFMasterMob3, public CAAFMob { *************** *** 930,933 **** --- 931,1004 ---- + //*********************************************************** + // METHOD NAME: AddMasterSlotWithSequence() + // + // DESCRIPTION: + // @mfunc AAFRESULT | AAFMasterMob3 | AddMasterSlotWithSequence | + // This function is similar to AddMasterSlot but creates the structure + /// MobSlot - Sequence - SourceClip instead of MobSlot - SourceClip. + /// This arrangement is required for MXF compliance. + /// + /// This function adds a slot to the specified Master Mob that + /// references the specified a slot in the specified Source Mob. The + /// new slot in the Master Mob has a Sequence containing the Source Clip + /// that specifies the Source Mob in its source reference properties. + /// + /// Note: If pSlotName is passed in with zero length, then the + /// slot is not assigned a name. Slot names are not used by the + /// SDK, and exist only so the user can name slots. + /// + /// Succeeds if all of the following are true: + /// (more conditions here) + /// + /// If this method fails no state is changed. + /// + /// This method will return the following codes. If more than one of + /// the listed errors is in effect, it will return the first one + /// encountered in the order given below: + /// + /// AAFRESULT_SUCCESS + /// - succeeded. (This is the only code indicating success.) + /// + /// AAFRESULT_NOT_INITIALIZED + /// - This object has not yet had Initialize() called on it. + /// + /// AAFRESULT_NULL_PARAM + /// - One or more of the following parameters are NULL pSourceMob, + /// pSlotName, and pDataDef. + /// + /// AAFRESULT_INVALID_DATADEF + /// - The data kind of the source MOB slot to be added to the Master + /// Mob does not match what is specfied in pDataDef. + /// + /// AAFRESULT_SLOT_NOTFOUND + /// - The specified Source Mob slot was not found. + /// + /// AAFRESULT_SLOT_EXISTS + /// - The specified Master slot ID already exists. + // @end + // + STDMETHOD (AddMasterSlotWithSequence) + ( + // @parm [in] AAFDataDef | pDataDef | Data kind of new slot. Requires a data kind valid for a media + /// stream. Valid data kinds are: + /// - Picture + /// - Sound + IAAFDataDef * pDataDef, + + // @parm [in] aafSlotID_t | sourceSlotID | Slot ID of the Source Mob slot to be added to the Master Mob + aafSlotID_t sourceSlotID, + + // @parm [in] AAFSourceMob | pSourceMob | Source Mob containing the slot to be added to the Master Mob + IAAFSourceMob * pSourceMob, + + // @parm [in] aafSlotID_t | masterSlotID | SlotID assigned to the new Master Mob slot + aafSlotID_t masterSlotID, + + // @parm [in, string] aafCharacter_constptr | pSlotName | Name to assign to new slot in Master Mob + aafCharacter_constptr pSlotName + ); + + protected: |