void video_output_close(video_t *video) { if (!video) return; video_output_stop(video); for (size_t i = 0; i < video->inputs.num; i++) video_input_free(&video->inputs.array[i]); da_free(video->inputs); for (size_t i = 0; i < video->info.cache_size; i++) video_frame_free((struct video_frame*)&video->cache[i]); os_sem_destroy(video->update_semaphore); pthread_mutex_destroy(&video->data_mutex); pthread_mutex_destroy(&video->input_mutex); bfree(video); }
static inline void video_input_free(struct video_input *input) { for (size_t i = 0; i < MAX_CONVERT_BUFFERS; i++) video_frame_free(&input->frame[i]); video_scaler_destroy(input->scaler); }