Mercurial > libavcodec.hg
annotate w32thread.c @ 12092:de9e45d04063 libavcodec
DCA: Occasionally a false XCH sync word can turn up after the core DTS data,
to verify the sync word the extension fsize field should be compared to
the core data length field.
Patch by nick.nbrereton@net
author | banan |
---|---|
date | Mon, 05 Jul 2010 08:16:43 +0000 |
parents | 7bfe7456e372 |
children |
rev | line source |
---|---|
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
1 /* |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
2 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
3 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
4 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
5 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
10 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
15 * |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
19 */ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
20 //#define DEBUG |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
21 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
22 #include "avcodec.h" |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
23 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
24 #define WIN32_LEAN_AND_MEAN |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
25 #include <windows.h> |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
26 #include <process.h> |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
27 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
28 typedef struct ThreadContext{ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
29 AVCodecContext *avctx; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
30 HANDLE thread; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
31 HANDLE work_sem; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
32 HANDLE job_sem; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
33 HANDLE done_sem; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
34 int (*func)(AVCodecContext *c, void *arg); |
10393 | 35 int (*func2)(AVCodecContext *c, void *arg, int, int); |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
36 void *arg; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
37 int argsize; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
38 int *jobnr; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
39 int *ret; |
10393 | 40 int threadnr; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
41 }ThreadContext; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
42 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
43 |
6469 | 44 static unsigned WINAPI attribute_align_arg thread_func(void *v){ |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
45 ThreadContext *c= v; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
46 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
47 for(;;){ |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
48 int ret, jobnr; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
49 //printf("thread_func %X enter wait\n", (int)v); fflush(stdout); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
50 WaitForSingleObject(c->work_sem, INFINITE); |
10548
e68792a12c31
In win32 thread implementation do not access jobnr if the thread is asked
reimar
parents:
10393
diff
changeset
|
51 // avoid trying to access jobnr if we should quit |
e68792a12c31
In win32 thread implementation do not access jobnr if the thread is asked
reimar
parents:
10393
diff
changeset
|
52 if (!c->func && !c->func2) |
e68792a12c31
In win32 thread implementation do not access jobnr if the thread is asked
reimar
parents:
10393
diff
changeset
|
53 break; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
54 WaitForSingleObject(c->job_sem, INFINITE); |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
55 jobnr = (*c->jobnr)++; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
56 ReleaseSemaphore(c->job_sem, 1, 0); |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
57 //printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
58 if(c->func) |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
59 ret= c->func(c->avctx, (uint8_t *)c->arg + jobnr*c->argsize); |
10548
e68792a12c31
In win32 thread implementation do not access jobnr if the thread is asked
reimar
parents:
10393
diff
changeset
|
60 else |
10393 | 61 ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr); |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
62 if (c->ret) |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
63 c->ret[jobnr] = ret; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
64 //printf("thread_func %X signal complete\n", (int)v); fflush(stdout); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
65 ReleaseSemaphore(c->done_sem, 1, 0); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
66 } |
2967 | 67 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
68 return 0; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
69 } |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
70 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
71 /** |
5127 | 72 * Free what has been allocated by avcodec_thread_init(). |
73 * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. | |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
74 */ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
75 void avcodec_thread_free(AVCodecContext *s){ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
76 ThreadContext *c= s->thread_opaque; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
77 int i; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
78 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
79 for(i=0; i<s->thread_count; i++){ |
2967 | 80 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
81 c[i].func= NULL; |
10393 | 82 c[i].func2= NULL; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
83 } |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
84 ReleaseSemaphore(c[0].work_sem, s->thread_count, 0); |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
85 for(i=0; i<s->thread_count; i++){ |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
86 WaitForSingleObject(c[i].thread, INFINITE); |
10044
560708e850a4
Fix a memleak with win32 threads: the handle returned by _beginthreadex
reimar
parents:
8129
diff
changeset
|
87 if(c[i].thread) CloseHandle(c[i].thread); |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
88 } |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
89 if(c[0].work_sem) CloseHandle(c[0].work_sem); |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
90 if(c[0].job_sem) CloseHandle(c[0].job_sem); |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
91 if(c[0].done_sem) CloseHandle(c[0].done_sem); |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
92 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
93 av_freep(&s->thread_opaque); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
94 } |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
95 |
11492
7bfe7456e372
Remove avcodec_thread_execute from avcodec.h, and make static functions that
benoit
parents:
11406
diff
changeset
|
96 static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
97 ThreadContext *c= s->thread_opaque; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
98 int i; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
99 int jobnr = 0; |
2967 | 100 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
101 assert(s == c->avctx); |
2967 | 102 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
103 /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
104 |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
105 for(i=0; i<s->thread_count; i++){ |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
106 c[i].arg= arg; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
107 c[i].argsize= size; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
108 c[i].func= func; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
109 c[i].ret= ret; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
110 c[i].jobnr = &jobnr; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
111 } |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
112 ReleaseSemaphore(c[0].work_sem, count, 0); |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
113 for(i=0; i<count; i++) |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
114 WaitForSingleObject(c[0].done_sem, INFINITE); |
2967 | 115 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
116 return 0; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
117 } |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
118 |
11406
fe7a77f77927
w32thread: Make avcodec_thread_execute2() static here as well
andoma
parents:
10954
diff
changeset
|
119 static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count){ |
10393 | 120 ThreadContext *c= s->thread_opaque; |
121 int i; | |
122 for(i=0; i<s->thread_count; i++) | |
123 c[i].func2 = func; | |
124 avcodec_thread_execute(s, NULL, arg, ret, count, 0); | |
125 } | |
126 | |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
127 int avcodec_thread_init(AVCodecContext *s, int thread_count){ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
128 int i; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
129 ThreadContext *c; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
130 uint32_t threadid; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
131 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
132 s->thread_count= thread_count; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
133 |
10954 | 134 if (thread_count <= 1) |
135 return 0; | |
136 | |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
137 assert(!s->thread_opaque); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
138 c= av_mallocz(sizeof(ThreadContext)*thread_count); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
139 s->thread_opaque= c; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
140 if(!(c[0].work_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL))) |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
141 goto fail; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
142 if(!(c[0].job_sem = CreateSemaphore(NULL, 1, 1, NULL))) |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
143 goto fail; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
144 if(!(c[0].done_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL))) |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
145 goto fail; |
2967 | 146 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
147 for(i=0; i<thread_count; i++){ |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
148 //printf("init semaphors %d\n", i); fflush(stdout); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
149 c[i].avctx= s; |
10392
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
150 c[i].work_sem = c[0].work_sem; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
151 c[i].job_sem = c[0].job_sem; |
32ee88f14239
Fix w32thread implementation to handle job count > thread_count.
reimar
parents:
10044
diff
changeset
|
152 c[i].done_sem = c[0].done_sem; |
10393 | 153 c[i].threadnr = i; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
154 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
155 //printf("create thread %d\n", i); fflush(stdout); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
156 c[i].thread = (HANDLE)_beginthreadex(NULL, 0, thread_func, &c[i], 0, &threadid ); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
157 if( !c[i].thread ) goto fail; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
158 } |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
159 //printf("init done\n"); fflush(stdout); |
2967 | 160 |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
161 s->execute= avcodec_thread_execute; |
10393 | 162 s->execute2= avcodec_thread_execute2; |
1822
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
163 |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
164 return 0; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
165 fail: |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
166 avcodec_thread_free(s); |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
167 return -1; |
7366bb5c363f
w32threads by (Gildas Bazin <gbazin at altern dot org>)
michael
parents:
diff
changeset
|
168 } |