comparison h263dec.c @ 341:bf26081c373c libavcodec

avcodec_flush_buffers()
author michaelni
date Wed, 24 Apr 2002 01:24:06 +0000
parents c56b45669214
children 9f6071a87e17
comparison
equal deleted inserted replaced
340:f24c77638413 341:bf26081c373c
133 } else if (s->h263_intel) { 133 } else if (s->h263_intel) {
134 ret = intel_h263_decode_picture_header(s); 134 ret = intel_h263_decode_picture_header(s);
135 } else { 135 } else {
136 ret = h263_decode_picture_header(s); 136 ret = h263_decode_picture_header(s);
137 } 137 }
138 if(ret==FRAME_SKIPED) return 0;
139 138
140 /* After H263 & mpeg4 header decode we have the height, width,*/ 139 /* After H263 & mpeg4 header decode we have the height, width,*/
141 /* and other parameters. So then we could init the picture */ 140 /* and other parameters. So then we could init the picture */
142 /* FIXME: By the way H263 decoder is evolving it should have */ 141 /* FIXME: By the way H263 decoder is evolving it should have */
143 /* an H263EncContext */ 142 /* an H263EncContext */
152 MPV_common_end(s); 151 MPV_common_end(s);
153 if (MPV_common_init(s) < 0) 152 if (MPV_common_init(s) < 0)
154 return -1; 153 return -1;
155 } 154 }
156 155
156 if(ret==FRAME_SKIPED) return 0;
157 if (ret < 0) 157 if (ret < 0)
158 return -1; 158 return -1;
159 159 /* skip b frames if we dont have reference frames */
160 if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return 0;
161
160 MPV_frame_start(s); 162 MPV_frame_start(s);
161 163
162 #ifdef DEBUG 164 #ifdef DEBUG
163 printf("qscale=%d\n", s->qscale); 165 printf("qscale=%d\n", s->qscale);
164 #endif 166 #endif
220 return -1; 222 return -1;
221 } 223 }
222 } 224 }
223 MPV_decode_mb(s, s->block); 225 MPV_decode_mb(s, s->block);
224 } 226 }
225 if (avctx->draw_horiz_band) { 227 if ( avctx->draw_horiz_band
228 && (s->num_available_buffers>=1 || (!s->has_b_frames)) ) {
226 UINT8 *src_ptr[3]; 229 UINT8 *src_ptr[3];
227 int y, h, offset; 230 int y, h, offset;
228 y = s->mb_y * 16; 231 y = s->mb_y * 16;
229 h = s->height - y; 232 h = s->height - y;
230 if (h > 16) 233 if (h > 16)
277 280
278 /* Return the Picture timestamp as the frame number */ 281 /* Return the Picture timestamp as the frame number */
279 /* we substract 1 because it is added on utils.c */ 282 /* we substract 1 because it is added on utils.c */
280 avctx->frame_number = s->picture_number - 1; 283 avctx->frame_number = s->picture_number - 1;
281 284
282 *data_size = sizeof(AVPicture); 285 /* dont output the last pic after seeking
286 note we allready added +1 for the current pix in MPV_frame_end(s) */
287 if(s->num_available_buffers>=2 || (!s->has_b_frames))
288 *data_size = sizeof(AVPicture);
289
283 return buf_size; 290 return buf_size;
284 } 291 }
285 292
286 AVCodec mpeg4_decoder = { 293 AVCodec mpeg4_decoder = {
287 "mpeg4", 294 "mpeg4",