diff options
author | wm4 <nfxjfg@googlemail.com> | 2016-10-01 17:22:02 +0200 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2016-10-01 17:22:02 +0200 |
commit | b2fea2fdee464edd736fc903ec3a4dc1e3a06e56 (patch) | |
tree | 54b7197f5fd4a8781c4568704bba135884291bb4 /libavcodec | |
parent | 3c18188f9f3e5d7980c7998416a39f7efba307bf (diff) | |
download | ffmpeg-b2fea2fdee464edd736fc903ec3a4dc1e3a06e56.tar.gz |
ffmpeg: move subframe warning to libavcodec
With the new decode API, doing this in ffmpeg.c is impractical. There
was resistance against removing the warning, so put it into libavcodec.
Not bothering with reducing the warning to verbose log level for
subsequent wanrings. The warning should be rare, and only happen when
developing new codecs for the old API.
Includes a change suggested by Michael Niedermayer.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/internal.h | 1 | ||||
-rw-r--r-- | libavcodec/utils.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 000fe263cc..35b9630b52 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -173,6 +173,7 @@ typedef struct AVCodecInternal { int buffer_pkt_valid; // encoding: packet without data can be valid AVFrame *buffer_frame; int draining_done; + int showed_multi_packet_warning; } AVCodecInternal; struct AVCodecDefault { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cf85300605..ef3da65144 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2461,6 +2461,12 @@ fail: av_assert0(ret <= avpkt->size); + if (!avci->showed_multi_packet_warning && + ret >= 0 && ret != avpkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) { + av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n"); + avci->showed_multi_packet_warning = 1; + } + return ret; } |