* 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. */
| 73 | * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. |
| 74 | */ |
| 75 | void avcodec_thread_free(AVCodecContext *s){ |
| 76 | ThreadContext *c= s->thread_opaque; |
| 77 | int i; |
| 78 | |
| 79 | for(i=0; i<s->thread_count; i++){ |
| 80 | |
| 81 | c[i].func= NULL; |
| 82 | c[i].func2= NULL; |
| 83 | } |
| 84 | ReleaseSemaphore(c[0].work_sem, s->thread_count, 0); |
| 85 | for(i=0; i<s->thread_count; i++){ |
| 86 | WaitForSingleObject(c[i].thread, INFINITE); |
| 87 | if(c[i].thread) CloseHandle(c[i].thread); |
| 88 | } |
| 89 | if(c[0].work_sem) CloseHandle(c[0].work_sem); |
| 90 | if(c[0].job_sem) CloseHandle(c[0].job_sem); |
| 91 | if(c[0].done_sem) CloseHandle(c[0].done_sem); |
| 92 | |
| 93 | av_freep(&s->thread_opaque); |
| 94 | } |
| 95 | |
| 96 | static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ |
| 97 | ThreadContext *c= s->thread_opaque; |
no test coverage detected