StackGeneric_c::~StackGeneric_c( void ) { OS_TerminateMutex( &Lock ); if( Storage != NULL ) delete Storage; }
OS_Status_t OS_TerminateEvent(OS_Event_t *Event) { OS_TerminateMutex(&((*Event)->Mutex)); OSDEV_DeInitializeWaitQueue((*Event)->Queue); OSDEV_Free(*Event); return OS_NO_ERROR; }
Player_Generic_c::~Player_Generic_c( void ) { ShutdownPlayer = true; OS_TerminateEvent( &InternalEventSignal ); OS_TerminateMutex( &Lock ); }
Manifestor_Audio_c::Manifestor_Audio_c(void) : DestroySyncrhonizationPrimatives(false) { MANIFESTOR_DEBUG(">><<\n"); Configuration.ManifestorName = "Audio"; Configuration.StreamType = StreamTypeAudio; Configuration.DecodeBufferDescriptor = &InitialDecodeBufferDescriptor; Configuration.PostProcessControlBufferCount = 16; if (InitializationStatus != ManifestorNoError) { MANIFESTOR_ERROR("Initialization status not valid - aborting init\n"); return; } if (OS_InitializeMutex(&BufferQueueLock) != OS_NO_ERROR) { MANIFESTOR_ERROR("Unable to create the buffer queue lock\n"); InitializationStatus = ManifestorError; return; } if (OS_InitializeEvent(&BufferQueueUpdated) != OS_NO_ERROR) { MANIFESTOR_ERROR("Unable to create the buffer queue update event\n"); OS_TerminateMutex(&BufferQueueLock); InitializationStatus = ManifestorError; return; } DestroySyncrhonizationPrimatives = true; RelayfsIndex = st_relayfs_getindex(ST_RELAY_SOURCE_AUDIO_MANIFESTOR); Manifestor_Audio_c::Reset(); }
//}}} //{{{ ~HavanaPlayback_c HavanaPlayback_c::~HavanaPlayback_c(void) { int i; PLAYBACK_DEBUG("\n"); for (i = 0; i < MAX_STREAMS_PER_PLAYBACK; i++) { if (Stream[i] != NULL) { delete Stream[i]; Stream[i] = NULL; } } for (i = 0; i < MAX_DEMUX_CONTEXTS; i++) { if (Demux[i] != NULL) { delete Demux[i]; Demux[i] = NULL; } } if (PlayerPlayback != NULL) { Player->TerminatePlayback(PlayerPlayback, true); PlayerPlayback = NULL; } if (OutputCoordinator != NULL) delete OutputCoordinator; if (LockInitialised) { OS_TerminateMutex(&Lock); LockInitialised = false; } }
DemultiplexorStatus_t Demultiplexor_Base_c::DestroyContext(DemultiplexorContext_t Context) { DemultiplexorBaseContext_t BaseContext = (DemultiplexorBaseContext_t)Context; OS_LockMutex(&BaseContext->Lock); OS_TerminateMutex(&BaseContext->Lock); delete(unsigned char *)Context; return DemultiplexorNoError; }
AllocatorSimple_c::~AllocatorSimple_c(void) { BeingDeleted = true; OS_SetEvent(&EntryFreed); while (InAllocate) OS_SleepMilliSeconds(1); OS_TerminateEvent(&EntryFreed); OS_TerminateMutex(&Lock); }
//}}} //{{{ ~HavanaDemux_c HavanaDemux_c::~HavanaDemux_c (void) { DEMUX_DEBUG("\n"); Player = NULL; PlayerPlayback = NULL; DemuxContext = NULL; OS_TerminateMutex (&InputLock); }
Buffer_Generic_c::~Buffer_Generic_c( void ) { if (BufferBlock != NULL) { delete BufferBlock; BufferBlock = NULL; } else report(severity_error,"Maybe not such a bug!\n"); OS_TerminateMutex( &Lock ); }
Manifestor_Audio_c::~Manifestor_Audio_c(void) { MANIFESTOR_DEBUG(">><<\n"); Manifestor_Audio_c::Halt(); st_relayfs_freeindex(ST_RELAY_SOURCE_AUDIO_MANIFESTOR, RelayfsIndex); if (DestroySyncrhonizationPrimatives) { OS_TerminateMutex(&BufferQueueLock); OS_TerminateEvent(&BufferQueueUpdated); } }
RingGeneric_c::~RingGeneric_c( void ) { OS_SetEvent( &Signal ); OS_SleepMilliSeconds( 1 ); OS_TerminateMutex( &Lock ); OS_TerminateEvent( &Signal ); if( Storage != NULL ) delete Storage; }
void BufferPool_Generic_c::TidyUp( void ) { Buffer_Generic_t Buffer; // // // Ensure no-one is waiting on anything. // if( BufferReleaseSignalWaitedOn ) AbortBlockingGetBuffer(); // // detach any globally attached meta data // while( ListOfMetaData != NULL ) DetachMetaData( ListOfMetaData->Descriptor->Type ); // // Clean up the buffers // if( NumberOfBuffers != NOT_SPECIFIED ) { for( Buffer = ListOfBuffers; Buffer != NULL; Buffer = Buffer->Next ) if( Buffer->ReferenceCount != 0 ) FreeUpABuffer( Buffer ); } else { while( ListOfBuffers != NULL ) FreeUpABuffer( ListOfBuffers ); } while( ListOfBuffers != NULL ) { Buffer = ListOfBuffers; ListOfBuffers = Buffer->Next; delete Buffer; } // // delete the ring holding free buffers // if( FreeBuffer != NULL ) { delete FreeBuffer; FreeBuffer = NULL; } // // Delete any created allocator for the memory pool // if( MemoryPoolAllocator != NULL ) { delete MemoryPoolAllocator; MemoryPoolAllocator = NULL; } // // Delete any global memory allocation for the buffers // if( BufferBlock != NULL ) { DeAllocateMemoryBlock( BufferBlock ); delete BufferBlock; BufferBlock = NULL; } // // Free up the OS entities // OS_TerminateEvent( &BufferReleaseSignal ); OS_TerminateMutex( &Lock ); }
FrameParser_Base_c::~FrameParser_Base_c(void) { OS_TerminateMutex(&Lock); }
BufferManager_Generic_c::~BufferManager_Generic_c(void) { while (ListOfBufferPools != NULL) DestroyPool(ListOfBufferPools); OS_TerminateMutex(&Lock); }
//}}} //{{{ ~HavanaPlayer_c HavanaPlayer_c::~HavanaPlayer_c (void) { int i; class HavanaFactory_c* Factory; HAVANA_DEBUG("\n"); // remove event signal Player->SetEventSignal (PlayerAllPlaybacks, PlayerAllStreams, EventAllEvents, NULL); // Shut down event signal thread first if (EventSignalThreadId != OS_INVALID_THREAD) { EventSignalThreadRunning = false; EventSignalCallback = NULL; OS_SetEvent (&EventSignal); OS_WaitForEvent (&EventSignalThreadTerminated, OS_INFINITE); // Wait for display signal to exit EventSignalThreadId = OS_INVALID_THREAD; OS_TerminateEvent (&EventSignalThreadTerminated); OS_TerminateEvent (&EventSignal); OS_TerminateMutex (&Lock); } for (i = 0; i < MAX_PLAYBACKS; i++) { if (Playback[i] != NULL) delete Playback[i]; } for (i = 0; i < MAX_DEMUX_CONTEXTS; i++) { if (DemuxContext[i] != NULL) delete DemuxContext[i]; } for (i = 0; i < MAX_DISPLAYS; i++) { if (AudioDisplays[i] != NULL) delete AudioDisplays[i]; if (VideoDisplays[i] != NULL) delete VideoDisplays[i]; if (OtherDisplays[i] != NULL) delete OtherDisplays[i]; } if (BufferManager != NULL) delete BufferManager; if (Demultiplexor != NULL) delete Demultiplexor; while (FactoryList != NULL) { Factory = FactoryList; FactoryList = Factory->Next (); delete Factory; } DisplayDevice = NULL; EventSignalCallback = NULL; }
//}}} //{{{ Init HavanaStatus_t HavanaPlayer_c::Init (void) { HAVANA_DEBUG("\n"); if (Player == NULL) Player = new Player_Generic_c(); if (Player == NULL) { HAVANA_ERROR("Unable to create player - insufficient memory\n"); return HavanaNoMemory; } //{{{ Event management // Create event signal thread and input mutexes if (EventSignalThreadId == OS_INVALID_THREAD) { if (OS_InitializeMutex (&Lock) != OS_NO_ERROR) { HAVANA_ERROR ("Failed to initialize Lock mutex\n"); return HavanaNoMemory; } if (OS_InitializeEvent (&EventSignal) != OS_NO_ERROR) { HAVANA_ERROR ("Failed to initialize EventSignal\n"); OS_TerminateMutex (&Lock); return HavanaError; } if (OS_InitializeEvent (&EventSignalThreadTerminated) != OS_NO_ERROR) { HAVANA_ERROR ("Failed to initialize EventSignalThreadTerminated event\n"); OS_TerminateEvent (&EventSignal); OS_TerminateMutex (&Lock); return HavanaError; } EventSignalThreadRunning = true; if (OS_CreateThread (&EventSignalThreadId, EventSignalThreadStub, this, "Havana player Event Signal Thread", OS_MID_PRIORITY) != OS_NO_ERROR) { HAVANA_ERROR("Unable to create Display Signal thread\n"); EventSignalThreadRunning = false; EventSignalThreadId = OS_INVALID_THREAD; OS_TerminateEvent (&EventSignalThreadTerminated); OS_TerminateEvent (&EventSignal); OS_TerminateMutex (&Lock); return HavanaError; } } //}}} if (BufferManager == NULL) BufferManager = new BufferManager_Generic_c(); if (BufferManager == NULL) { HAVANA_ERROR("Unable to create buffer manager - insufficient memory\n"); return HavanaNoMemory; } Player->RegisterBufferManager (BufferManager); if (Demultiplexor == NULL) Demultiplexor = new Demultiplexor_Ts_c (); if (Demultiplexor == NULL) { HAVANA_ERROR("Unable to create transport stream demultiplexor\n"); return HavanaNoMemory; } Player->RegisterDemultiplexor (Demultiplexor); DisplayDevice = NULL; if (Player->SetEventSignal (PlayerAllPlaybacks, PlayerAllStreams, EventAllEvents, &EventSignal) != PlayerNoError) { HAVANA_ERROR("Failed to set up player event signal\n"); return HavanaError; } //Player->SpecifySignalledEvents (PlayerAllPlaybacks, PlayerAllStreams, EventAllEvents); // Must be done by every stream return HavanaNoError; }