/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.  */
void avcodec_thread_free(AVCodecContext *s)
/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.  */
void avcodec_thread_free(AVCodecContext *s)
{
        c[i].func= NULL;
        release_sem(c[i].work_sem);
        wait_for_thread(c[i].thread, &ret);
        if(c[i].work_sem > B_OK) delete_sem(c[i].work_sem);
        if(c[i].done_sem > B_OK) delete_sem(c[i].done_sem);
    }
    av_freep(&s->thread_opaque);
}