OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> | 2 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> |
3 * | 3 * |
4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
5 * | 5 * |
6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 c[i].ret= ret; | 109 c[i].ret= ret; |
110 c[i].jobnr = &jobnr; | 110 c[i].jobnr = &jobnr; |
111 } | 111 } |
112 ReleaseSemaphore(c[0].work_sem, count, 0); | 112 ReleaseSemaphore(c[0].work_sem, count, 0); |
113 for(i=0; i<count; i++) | 113 for(i=0; i<count; i++) |
114 WaitForSingleObject(c[0].done_sem, INFINITE); | 114 WaitForSingleObject(c[0].done_sem, INFINITE); |
115 | 115 |
116 return 0; | 116 return 0; |
117 } | 117 } |
118 | 118 |
119 int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext *c2, v
oid *arg2, int, int),void *arg, int *ret, int count){ | 119 static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext
*c2, void *arg2, int, int),void *arg, int *ret, int count){ |
120 ThreadContext *c= s->thread_opaque; | 120 ThreadContext *c= s->thread_opaque; |
121 int i; | 121 int i; |
122 for(i=0; i<s->thread_count; i++) | 122 for(i=0; i<s->thread_count; i++) |
123 c[i].func2 = func; | 123 c[i].func2 = func; |
124 avcodec_thread_execute(s, NULL, arg, ret, count, 0); | 124 avcodec_thread_execute(s, NULL, arg, ret, count, 0); |
125 } | 125 } |
126 | 126 |
127 int avcodec_thread_init(AVCodecContext *s, int thread_count){ | 127 int avcodec_thread_init(AVCodecContext *s, int thread_count){ |
128 int i; | 128 int i; |
129 ThreadContext *c; | 129 ThreadContext *c; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 //printf("init done\n"); fflush(stdout); | 165 //printf("init done\n"); fflush(stdout); |
166 | 166 |
167 s->execute= avcodec_thread_execute; | 167 s->execute= avcodec_thread_execute; |
168 s->execute2= avcodec_thread_execute2; | 168 s->execute2= avcodec_thread_execute2; |
169 | 169 |
170 return 0; | 170 return 0; |
171 fail: | 171 fail: |
172 avcodec_thread_free(s); | 172 avcodec_thread_free(s); |
173 return -1; | 173 return -1; |
174 } | 174 } |
OLD | NEW |