Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Reimar Döffinger authored on 2012/01/22 07:53:57... | ... |
@@ -157,6 +157,13 @@ static int decode_frame(AVCodecContext *avctx, |
157 | 157 |
if (header_size == 8) |
158 | 158 |
buf+=4; |
159 | 159 |
|
160 |
+ f->pict_type = AV_PICTURE_TYPE_I; |
|
161 |
+ f->key_frame = 1; |
|
162 |
+ f->reference = 3; |
|
163 |
+ f->buffer_hints = FF_BUFFER_HINTS_VALID | |
|
164 |
+ FF_BUFFER_HINTS_PRESERVE | |
|
165 |
+ FF_BUFFER_HINTS_REUSABLE; |
|
166 |
+ |
|
160 | 167 |
switch(version) { |
161 | 168 |
case 0: |
162 | 169 |
default: |
... | ... |
@@ -177,19 +184,15 @@ static int decode_frame(AVCodecContext *avctx, |
177 | 177 |
return -1; |
178 | 178 |
} |
179 | 179 |
|
180 |
- f->reference = 3; |
|
181 |
- f->buffer_hints = FF_BUFFER_HINTS_VALID | |
|
182 |
- FF_BUFFER_HINTS_PRESERVE | |
|
183 |
- FF_BUFFER_HINTS_REUSABLE; |
|
184 | 180 |
if (avctx->reget_buffer(avctx, f)) { |
185 | 181 |
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
186 | 182 |
return -1; |
187 | 183 |
} |
188 | 184 |
/* bit 31 means same as previous pic */ |
189 |
- f->pict_type = (header & (1U<<31))? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; |
|
190 |
- f->key_frame = f->pict_type == AV_PICTURE_TYPE_I; |
|
191 |
- |
|
192 |
- if (f->pict_type == AV_PICTURE_TYPE_I) { |
|
185 |
+ if (header & (1U<<31)) { |
|
186 |
+ f->pict_type = AV_PICTURE_TYPE_P; |
|
187 |
+ f->key_frame = 0; |
|
188 |
+ } else { |
|
193 | 189 |
buf32=(const uint32_t*)buf; |
194 | 190 |
for(y=0; y<avctx->height/2; y++){ |
195 | 191 |
luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ]; |
... | ... |
@@ -220,19 +223,15 @@ static int decode_frame(AVCodecContext *avctx, |
220 | 220 |
return -1; |
221 | 221 |
} |
222 | 222 |
|
223 |
- f->reference = 3; |
|
224 |
- f->buffer_hints = FF_BUFFER_HINTS_VALID | |
|
225 |
- FF_BUFFER_HINTS_PRESERVE | |
|
226 |
- FF_BUFFER_HINTS_REUSABLE; |
|
227 | 223 |
if (avctx->reget_buffer(avctx, f)) { |
228 | 224 |
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
229 | 225 |
return -1; |
230 | 226 |
} |
231 | 227 |
/* bit 31 means same as previous pic */ |
232 |
- f->pict_type = (header & (1U<<31))? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; |
|
233 |
- f->key_frame = f->pict_type == AV_PICTURE_TYPE_I; |
|
234 |
- |
|
235 |
- if (f->pict_type == AV_PICTURE_TYPE_I) { |
|
228 |
+ if (header & (1U<<31)) { |
|
229 |
+ f->pict_type = AV_PICTURE_TYPE_P; |
|
230 |
+ f->key_frame = 0; |
|
231 |
+ } else { |
|
236 | 232 |
for(y=0; y<avctx->height; y++) |
237 | 233 |
memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ], |
238 | 234 |
&buf[y*avctx->width*3], |
... | ... |
@@ -247,10 +246,6 @@ static int decode_frame(AVCodecContext *avctx, |
247 | 247 |
* Fraps v4 is virtually the same |
248 | 248 |
*/ |
249 | 249 |
avctx->pix_fmt = PIX_FMT_YUVJ420P; |
250 |
- f->reference = 3; |
|
251 |
- f->buffer_hints = FF_BUFFER_HINTS_VALID | |
|
252 |
- FF_BUFFER_HINTS_PRESERVE | |
|
253 |
- FF_BUFFER_HINTS_REUSABLE; |
|
254 | 250 |
if (avctx->reget_buffer(avctx, f)) { |
255 | 251 |
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
256 | 252 |
return -1; |
... | ... |
@@ -261,8 +256,6 @@ static int decode_frame(AVCodecContext *avctx, |
261 | 261 |
f->key_frame = 0; |
262 | 262 |
break; |
263 | 263 |
} |
264 |
- f->pict_type = AV_PICTURE_TYPE_I; |
|
265 |
- f->key_frame = 1; |
|
266 | 264 |
if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { |
267 | 265 |
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); |
268 | 266 |
return -1; |
... | ... |
@@ -291,10 +284,6 @@ static int decode_frame(AVCodecContext *avctx, |
291 | 291 |
case 5: |
292 | 292 |
/* Virtually the same as version 4, but is for RGB24 */ |
293 | 293 |
avctx->pix_fmt = PIX_FMT_BGR24; |
294 |
- f->reference = 3; |
|
295 |
- f->buffer_hints = FF_BUFFER_HINTS_VALID | |
|
296 |
- FF_BUFFER_HINTS_PRESERVE | |
|
297 |
- FF_BUFFER_HINTS_REUSABLE; |
|
298 | 294 |
if (avctx->reget_buffer(avctx, f)) { |
299 | 295 |
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
300 | 296 |
return -1; |
... | ... |
@@ -305,8 +294,6 @@ static int decode_frame(AVCodecContext *avctx, |
305 | 305 |
f->key_frame = 0; |
306 | 306 |
break; |
307 | 307 |
} |
308 |
- f->pict_type = AV_PICTURE_TYPE_I; |
|
309 |
- f->key_frame = 1; |
|
310 | 308 |
if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) { |
311 | 309 |
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n"); |
312 | 310 |
return -1; |