comparison vc1.c @ 3694:8765ee4eaa45 libavcodec

Drop unneeded checks before av_free() and change to av_freep() where it's more suitable.
author kostya
date Sat, 09 Sep 2006 11:40:41 +0000
parents e9be5d4bad80
children 653fc28f78b4
comparison
equal deleted inserted replaced
3693:e9be5d4bad80 3694:8765ee4eaa45
4163 } else 4163 } else
4164 init_get_bits(&s->gb, buf, buf_size*8); 4164 init_get_bits(&s->gb, buf, buf_size*8);
4165 // do parse frame header 4165 // do parse frame header
4166 if(v->profile < PROFILE_ADVANCED) { 4166 if(v->profile < PROFILE_ADVANCED) {
4167 if(vc1_parse_frame_header(v, &s->gb) == -1) { 4167 if(vc1_parse_frame_header(v, &s->gb) == -1) {
4168 if(buf2)av_free(buf2); 4168 av_free(buf2);
4169 return -1; 4169 return -1;
4170 } 4170 }
4171 } else { 4171 } else {
4172 if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { 4172 if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {
4173 if(buf2)av_free(buf2); 4173 av_free(buf2);
4174 return -1; 4174 return -1;
4175 } 4175 }
4176 } 4176 }
4177 4177
4178 if(s->pict_type != I_TYPE && !v->res_rtm_flag){ 4178 if(s->pict_type != I_TYPE && !v->res_rtm_flag){
4179 if(buf2)av_free(buf2); 4179 av_free(buf2);
4180 return -1; 4180 return -1;
4181 } 4181 }
4182 4182
4183 // for hurry_up==5 4183 // for hurry_up==5
4184 s->current_picture.pict_type= s->pict_type; 4184 s->current_picture.pict_type= s->pict_type;
4185 s->current_picture.key_frame= s->pict_type == I_TYPE; 4185 s->current_picture.key_frame= s->pict_type == I_TYPE;
4186 4186
4187 /* skip B-frames if we don't have reference frames */ 4187 /* skip B-frames if we don't have reference frames */
4188 if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)){ 4188 if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)){
4189 if(buf2)av_free(buf2); 4189 av_free(buf2);
4190 return -1;//buf_size; 4190 return -1;//buf_size;
4191 } 4191 }
4192 /* skip b frames if we are in a hurry */ 4192 /* skip b frames if we are in a hurry */
4193 if(avctx->hurry_up && s->pict_type==B_TYPE) return -1;//buf_size; 4193 if(avctx->hurry_up && s->pict_type==B_TYPE) return -1;//buf_size;
4194 if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE) 4194 if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
4195 || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE) 4195 || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
4196 || avctx->skip_frame >= AVDISCARD_ALL) { 4196 || avctx->skip_frame >= AVDISCARD_ALL) {
4197 if(buf2)av_free(buf2); 4197 av_free(buf2);
4198 return buf_size; 4198 return buf_size;
4199 } 4199 }
4200 /* skip everything if we are in a hurry>=5 */ 4200 /* skip everything if we are in a hurry>=5 */
4201 if(avctx->hurry_up>=5) { 4201 if(avctx->hurry_up>=5) {
4202 if(buf2)av_free(buf2); 4202 av_free(buf2);
4203 return -1;//buf_size; 4203 return -1;//buf_size;
4204 } 4204 }
4205 4205
4206 if(s->next_p_frame_damaged){ 4206 if(s->next_p_frame_damaged){
4207 if(s->pict_type==B_TYPE) 4207 if(s->pict_type==B_TYPE)
4209 else 4209 else
4210 s->next_p_frame_damaged=0; 4210 s->next_p_frame_damaged=0;
4211 } 4211 }
4212 4212
4213 if(MPV_frame_start(s, avctx) < 0) { 4213 if(MPV_frame_start(s, avctx) < 0) {
4214 if(buf2)av_free(buf2); 4214 av_free(buf2);
4215 return -1; 4215 return -1;
4216 } 4216 }
4217 4217
4218 ff_er_frame_start(s); 4218 ff_er_frame_start(s);
4219 4219
4241 4241
4242 /* Return the Picture timestamp as the frame number */ 4242 /* Return the Picture timestamp as the frame number */
4243 /* we substract 1 because it is added on utils.c */ 4243 /* we substract 1 because it is added on utils.c */
4244 avctx->frame_number = s->picture_number - 1; 4244 avctx->frame_number = s->picture_number - 1;
4245 4245
4246 if(buf2)av_free(buf2); 4246 av_free(buf2);
4247 return buf_size; 4247 return buf_size;
4248 } 4248 }
4249 4249
4250 4250
4251 /** Close a VC1/WMV3 decoder 4251 /** Close a VC1/WMV3 decoder