1 /*
2 * Copyright (c) 2012 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
22
29
30 #if HAVE_PTHREADS
31 #include <pthread.h>
32 #elif HAVE_W32THREADS
34 #elif HAVE_OS2THREADS
36 #endif
37
38 #define MAX_THREADS 64
39 #define BUFFER_SIZE (2*MAX_THREADS)
40
47
51
55
59
62
66
71
76
78 if(!pkt) continue;
80
86 }
88 }
92
98 if(got_packet) {
100 } else {
103 }
109 }
116 return NULL;
117 }
118
120 int i=0;
122
123
126 return 0;
127
131 }
132
134 return 0;
135
138
141 if(!c)
143
145
148 goto fail;
149
155
158 void *tmpv;
160 if(!thread_avctx)
161 goto fail;
163 *thread_avctx = *avctx;
169
174 goto fail;
175 }
180 goto fail;
181 }
182 }
183
185
186 return 0;
187 fail:
191 return -1;
192 }
193
195 int i;
197
202
205 }
206
214 }
215
220
222
223 if(frame){
226 if(!new)
231 if(ret<0)
233 new->pts = frame->
pts;
238 frame = new;
239 }
240
242 task.
indata = (
void*)frame;
247
249
251 return 0;
252 }
253
255 return 0;
256
260 }
264 *got_packet_ptr = 1;
268
270 }