ImplAAFMultipleDescriptor::~ImplAAFMultipleDescriptor () { // Release all of the Descriptor pointers. aafUInt32 count = _Descriptors.count(); for (aafUInt32 i = 0; i < count; i++) { ImplAAFFileDescriptor *pDescriptor = _Descriptors.clearValueAt(i); if (pDescriptor) { pDescriptor->ReleaseReference(); pDescriptor = 0; } } }
AAFRESULT STDMETHODCALLTYPE ImplAAFMultipleDescriptor::RemoveFileDescriptorAt (aafUInt32 index) { if (index >= _Descriptors.count()) return AAFRESULT_BADINDEX; ImplAAFFileDescriptor *pDescriptor = _Descriptors.removeAt(index); if (pDescriptor) { // We have removed an element from a "stong reference container" so we must // decrement the objects reference count. This will not delete the object // since the caller must have alread acquired a reference. (transdel 2000-MAR-10) pDescriptor->ReleaseReference (); } return AAFRESULT_SUCCESS; }
HRESULT STDMETHODCALLTYPE CEnumAAFFileDescriptors::NextOne (IAAFFileDescriptor ** ppFileDescriptors) { HRESULT hr; ImplEnumAAFFileDescriptors * ptr; ImplAAFRoot * pO; pO = GetRepObject (); assert (pO); ptr = static_cast<ImplEnumAAFFileDescriptors*> (pO); assert (ptr); // // set up for ppFileDescriptors // ImplAAFFileDescriptor * internalppFileDescriptors = NULL; ImplAAFFileDescriptor ** pinternalppFileDescriptors = NULL; if (ppFileDescriptors) { pinternalppFileDescriptors = &internalppFileDescriptors; } try { hr = ptr->NextOne (pinternalppFileDescriptors); } 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; } // // cleanup for ppFileDescriptors // if (SUCCEEDED(hr)) { IUnknown *pUnknown; HRESULT hStat; if (internalppFileDescriptors) { pUnknown = static_cast<IUnknown *> (internalppFileDescriptors->GetContainer()); hStat = pUnknown->QueryInterface(IID_IAAFFileDescriptor, (void **)ppFileDescriptors); assert (SUCCEEDED (hStat)); //pUnknown->Release(); internalppFileDescriptors->ReleaseReference(); // We are through with this pointer. } } return hr; }
/************************ * Function: omfsReconcileMobLength (INTERNAL) * * Given a master mob or file mob, make sure that all fields * which contain the length of the mob are in agreement. Currently * only makes sure that mob length references are >= each of * the track lengths. * * Argument Notes: * <none>. * * ReturnValue: * Error code (see below). * * Possible Errors: * Standard errors (see top of file). */ AAFRESULT ImplAAFSourceMob::ReconcileMobLength(void) { aafNumSlots_t numSlots; aafUInt32 loop; aafLength_t len; ImplAAFMobSlot *slot = NULL; ImplAAFTimelineMobSlot *timelineSlot = NULL; ImplAAFSegment *seg = NULL; ImplEnumAAFMobSlots *slotIter = NULL; aafRational_t srcRate, destRate; ImplAAFEssenceDescriptor *edesc = NULL; ImplAAFFileDescriptor *physMedia = NULL; XPROTECT() { CHECK(GetEssenceDescriptor(&edesc)); physMedia = dynamic_cast<ImplAAFFileDescriptor*>(edesc); if(physMedia != NULL) { CHECK(GetSlots (&slotIter)); CHECK(CountSlots(&numSlots)); for (loop = 1; loop <= numSlots; loop++) { CHECK(slotIter->NextOne((ImplAAFMobSlot **)&slot)); timelineSlot = dynamic_cast<ImplAAFTimelineMobSlot*>(slot); if(timelineSlot != NULL) { CHECK(timelineSlot->GetSegment(&seg)); CHECK(timelineSlot->GetEditRate(&destRate)); timelineSlot->ReleaseReference(); timelineSlot = NULL; CHECK(physMedia->GetLength(&len)); CHECK(physMedia->GetSampleRate(&srcRate)); if((srcRate.numerator != destRate.numerator) || (srcRate.denominator != destRate.denominator)) { CHECK(AAFConvertEditRate( srcRate, len, destRate, kRoundFloor, &len)); } CHECK(seg->SetLength(len)); seg->ReleaseReference(); seg = NULL; } else { slot->ReleaseReference(); slot = NULL; } } physMedia->ReleaseReference(); physMedia = NULL; slotIter->ReleaseReference(); slotIter = NULL; } } XEXCEPT { if (slot) slot->ReleaseReference(); slot = 0; if (timelineSlot) timelineSlot->ReleaseReference(); timelineSlot = 0; if (physMedia) physMedia->ReleaseReference(); physMedia = 0; if (seg) seg->ReleaseReference(); seg = 0; if (slotIter) slotIter->ReleaseReference(); slotIter = 0; } XEND return (AAFRESULT_SUCCESS); }