comparison h263dec.c @ 526:cd170daf9e4c libavcodec

return the number of consumed bytes instead of 0 or buf_size
author michaelni
date Wed, 10 Jul 2002 10:25:11 +0000
parents 0b4450c15067
children d2147d9704ce
comparison
equal deleted inserted replaced
525:985187bc2fa3 526:cd170daf9e4c
170 MPV_common_end(s); 170 MPV_common_end(s);
171 if (MPV_common_init(s) < 0) 171 if (MPV_common_init(s) < 0)
172 return -1; 172 return -1;
173 } 173 }
174 174
175 if(ret==FRAME_SKIPED) return 0; 175 if(ret==FRAME_SKIPED) return (get_bits_count(&s->gb)+7)>>3;
176 /* skip if the header was thrashed */ 176 /* skip if the header was thrashed */
177 if (ret < 0){ 177 if (ret < 0){
178 fprintf(stderr, "header damaged\n"); 178 fprintf(stderr, "header damaged\n");
179 return -1; 179 return -1;
180 } 180 }
181 /* skip b frames if we dont have reference frames */ 181 /* skip b frames if we dont have reference frames */
182 if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return 0; 182 if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return buf_size;
183 /* skip b frames if we are in a hurry */ 183 /* skip b frames if we are in a hurry */
184 if(s->hurry_up && s->pict_type==B_TYPE) return 0; 184 if(s->hurry_up && s->pict_type==B_TYPE) return buf_size;
185 185
186 if(s->next_p_frame_damaged){ 186 if(s->next_p_frame_damaged){
187 if(s->pict_type==B_TYPE) 187 if(s->pict_type==B_TYPE)
188 return 0; 188 return buf_size;
189 else 189 else
190 s->next_p_frame_damaged=0; 190 s->next_p_frame_damaged=0;
191 } 191 }
192 192
193 MPV_frame_start(s); 193 MPV_frame_start(s);
445 if(s->num_available_buffers>=2 || (!s->has_b_frames)) 445 if(s->num_available_buffers>=2 || (!s->has_b_frames))
446 *data_size = sizeof(AVPicture); 446 *data_size = sizeof(AVPicture);
447 #ifdef PRINT_FRAME_TIME 447 #ifdef PRINT_FRAME_TIME
448 printf("%Ld\n", rdtsc()-time); 448 printf("%Ld\n", rdtsc()-time);
449 #endif 449 #endif
450 return buf_size; 450 return (get_bits_count(&s->gb)+7)>>3;
451 } 451 }
452 452
453 AVCodec mpeg4_decoder = { 453 AVCodec mpeg4_decoder = {
454 "mpeg4", 454 "mpeg4",
455 CODEC_TYPE_VIDEO, 455 CODEC_TYPE_VIDEO,