Originally committed as revision 18480 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Baptiste Coudurier 16 years ago
parent 8fa0ae060b
commit e472ea34c4
  1. 52
      libavformat/utils.c

@ -1848,34 +1848,34 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt)
int got_picture, data_size, ret=0; int got_picture, data_size, ret=0;
AVFrame picture; AVFrame picture;
if(!st->codec->codec){ if(!st->codec->codec){
codec = avcodec_find_decoder(st->codec->codec_id); codec = avcodec_find_decoder(st->codec->codec_id);
if (!codec) if (!codec)
return -1; return -1;
ret = avcodec_open(st->codec, codec); ret = avcodec_open(st->codec, codec);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if(!has_codec_parameters(st->codec)){ if(!has_codec_parameters(st->codec)){
switch(st->codec->codec_type) { switch(st->codec->codec_type) {
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
ret = avcodec_decode_video2(st->codec, &picture, ret = avcodec_decode_video2(st->codec, &picture,
&got_picture, avpkt); &got_picture, avpkt);
break; break;
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE); data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
samples = av_malloc(data_size); samples = av_malloc(data_size);
if (!samples) if (!samples)
goto fail; goto fail;
ret = avcodec_decode_audio3(st->codec, samples, ret = avcodec_decode_audio3(st->codec, samples,
&data_size, avpkt); &data_size, avpkt);
av_free(samples); av_free(samples);
break; break;
default: default:
break; break;
}
} }
}
fail: fail:
return ret; return ret;
} }

Loading…
Cancel
Save