From d859bb1db0b082644881058a12653e3207855678 Mon Sep 17 00:00:00 2001 From: Sascha Sommer Date: Wed, 16 Sep 2009 15:08:26 +0000 Subject: [PATCH] Add CODEC_CAP_SUBFRAMES for codecs that output multiple subframes per AVPacket No longer print "Multiple frames in a packet" error message when CODEC_CAP_SUBFRAMES is set (wmapro, wavpack) Originally committed as revision 19881 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 3 ++- libavcodec/avcodec.h | 4 ++++ libavcodec/wavpack.c | 1 + libavcodec/wmaprodec.c | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 944fec3..86ea70c 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1280,7 +1280,8 @@ static int output_packet(AVInputStream *ist, int ist_index, handle_eof: ist->pts= ist->next_pts; - if(avpkt.size && avpkt.size != pkt->size && verbose>0) + if(avpkt.size && avpkt.size != pkt->size && + !(ist->st->codec->codec->capabilities & CODEC_CAP_SUBFRAMES) && verbose>0) fprintf(stderr, "Multiple frames in a packet from stream %d\n", pkt->stream_index); /* decode the packet if needed */ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fe1e060..3909b66 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -605,6 +605,10 @@ typedef struct RcOverride{ * Codec can export data for HW decoding (VDPAU). */ #define CODEC_CAP_HWACCEL_VDPAU 0x0080 +/** + * Codec can output multiple frames per AVPacket + */ +#define CODEC_CAP_SUBFRAMES 0x0100 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 10254f0..95f1d71 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -964,5 +964,6 @@ AVCodec wavpack_decoder = { NULL, NULL, wavpack_decode_frame, + .capabilities = CODEC_CAP_SUBFRAMES, .long_name = NULL_IF_CONFIG_SMALL("WavPack"), }; diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 2a45312..7e7d233 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1557,6 +1557,7 @@ AVCodec wmapro_decoder = { NULL, decode_end, decode_packet, + .capabilities = CODEC_CAP_SUBFRAMES, .flush= flush, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"), }; -- 2.7.4