aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-27 01:42:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-27 02:09:58 +0100
commit01fcbdf9cedcf14418b5886205261e532167f949 (patch)
tree8022d29d337142d81b3a05a0927a5ec90a67b25f /libavformat/utils.c
parenta8ae00b68cb9895f4a819950dbc740bc8fc7c1e1 (diff)
parent9adf25c1cf78dbf1d71bf386c49dc74cb8a60df0 (diff)
downloadffmpeg-01fcbdf9cedcf14418b5886205261e532167f949.tar.gz
Merge remote-tracking branch 'qatar/master'n0.11-dev
* qatar/master: smacker: Sanity check huffman tables found in the headers. smacker: remove dead store qdm2: Check data block size for bytes to bits overflow. mxfdec: Fix files with essence containers larger than 2 GiB. mxfdec: Employ correct printf conversion specifiers for POSIX int types. vc1: always read the bfraction element for interlaced fields fate: add XWD image regression test lavf: prevent infinite loops while flushing in avformat_find_stream_info matroskadec: Pad AAC extradata. ismindex: Fix build on mingw Conflicts: libavformat/mxfdec.c libavformat/utils.c tests/lavf-regression.sh Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 005704c7f0..c1de71d29e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2236,6 +2236,7 @@ static int has_decode_delay_been_guessed(AVStream *st)
st->info->nb_decoded_frames >= 6;
}
+/* returns 1 or 0 if or if not decoded data was returned, or a negative error */
static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options)
{
AVCodec *codec;
@@ -2283,6 +2284,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
st->info->nb_decoded_frames++;
pkt.data += ret;
pkt.size -= ret;
+ ret = got_picture;
}
}
if(!pkt.data && !got_picture)
@@ -2589,16 +2591,21 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st = ic->streams[i];
/* flush the decoders */
- while ((err = try_decode_frame(st, &empty_pkt,
+ do {
+ err = try_decode_frame(st, &empty_pkt,
(options && i < orig_nb_streams) ?
- &options[i] : NULL)) >= 0)
- if (has_codec_parameters(st->codec))
- break;
+ &options[i] : NULL);
+ } while (err > 0 && !has_codec_parameters(st->codec));
+ if (err < 0) {
+ av_log(ic, AV_LOG_INFO,
+ "decoding for stream %d failed\n", st->index);
+ }
if (!has_codec_parameters(st->codec)){
char buf[256];
avcodec_string(buf, sizeof(buf), st->codec, 0);
- av_log(ic, AV_LOG_WARNING, "Could not find codec parameters (%s)\n", buf);
+ av_log(ic, AV_LOG_WARNING,
+ "Could not find codec parameters (%s)\n", buf);
} else {
ret = 0;
}