void bg_avdec_destroy(void * priv) { avdec_priv * avdec = priv; bg_avdec_close(priv); if(avdec->dec) { bgav_close(avdec->dec); } if(avdec->opt) { bgav_options_destroy(avdec->opt); } free(avdec); }
ReadMedia::~ReadMedia() { printf("killing the media..\n"); setCommand( CMD_QUIT ); signalDispatcher(); // signal dispatcher joins the opener and AV threads pthread_join( m_thread_dispatch, NULL); //printf("joined dispatcher\n"); if (m_audio_frame != NULL) { gavl_audio_frame_destroy(m_audio_frame); } if (m_video_frame != NULL) { gavl_video_frame_destroy(m_video_frame); } if (m_file != NULL) { bgav_close(m_file); } //printf("now, on to deleting fifo...\n"); if( m_fifoaudio != NULL) delete m_fifoaudio; if( m_fifovideo != NULL) delete m_fifovideo; // these are created only once bgav_options_destroy(m_opt); pthread_cond_destroy(&m_cond_dispatch); pthread_mutex_destroy(&m_condmut_dispatch); pthread_cond_destroy(&m_cond_a); pthread_cond_destroy(&m_cond_v); pthread_mutex_destroy(&m_condmut_a); pthread_mutex_destroy(&m_condmut_v); pthread_mutex_destroy(&m_av_mut); pthread_mutex_destroy(&m_state_mut); printf("killed the media..\n"); }