diff options
author | wm4 <nfxjfg@googlemail.com> | 2016-03-22 19:09:57 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-03-23 19:31:36 +0100 |
commit | 8bc4accc37ab047d2fd85d672c577b39dfc918e1 (patch) | |
tree | 2a1f0b6e9bf177f1bf9e8f278d7c99d077237267 /libavformat | |
parent | 35846d93e023c28c70948dc4a8e9888a6efd6b8c (diff) | |
download | ffmpeg-streaming-8bc4accc37ab047d2fd85d672c577b39dfc918e1.zip ffmpeg-streaming-8bc4accc37ab047d2fd85d672c577b39dfc918e1.tar.gz |
lavf: use new decode API
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 31faa95..6df1a32 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1945,22 +1945,22 @@ FF_ENABLE_DEPRECATION_WARNINGS (!st->codec_info_nb_frames && (avctx->codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)))) { got_picture = 0; - switch (avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - ret = avcodec_decode_video2(avctx, frame, - &got_picture, &pkt); - break; - case AVMEDIA_TYPE_AUDIO: - ret = avcodec_decode_audio4(avctx, frame, &got_picture, &pkt); - break; - default: - break; + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || + avctx->codec_type == AVMEDIA_TYPE_AUDIO) { + ret = avcodec_send_packet(avctx, &pkt); + if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) + break; + if (ret >= 0) + pkt.size = 0; + ret = avcodec_receive_frame(avctx, frame); + if (ret >= 0) + got_picture = 1; + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + ret = 0; } if (ret >= 0) { if (got_picture) st->info->nb_decoded_frames++; - pkt.data += ret; - pkt.size -= ret; ret = got_picture; } } |