diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-14 02:22:48 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-14 02:24:10 +0200 |
commit | 80e4fe4063001d0cf468d5f4c7c02ba5b04484b7 (patch) | |
tree | ab237b4967339905110c59f6a118bfda9a5a5433 /libavformat/mpc.c | |
parent | 6b61920ab76dc6d85ef462909951923935dd643f (diff) | |
parent | b5849f77095439e994b11c25e6063d443b36c228 (diff) | |
download | ffmpeg-80e4fe4063001d0cf468d5f4c7c02ba5b04484b7.tar.gz |
Merge commit 'b5849f77095439e994b11c25e6063d443b36c228'
* commit 'b5849f77095439e994b11c25e6063d443b36c228': (21 commits)
ac3enc: merge AC3MDCTContext with AC3EncodeContext.
ac3enc: prefer passing AC3EncodeContext rather than AVCodecContext
ac3enc: fix memleak
mpeg1video: add CODEC_CAP_SLICE_THREADS.
lavf: fix segfault in av_open_input_stream()
mpegtsenc: set Random Access indicator on keyframe start packets
lavf: Cleanup try_decode_frame() logic.
Replace some gotos that lead to single return statements by direct return.
build: move tests/seek_test.c to libavformat and reuse generic build rules
mxfenc: include needed header for ff_iso8601_to_unix_time() prototype
Add a check for strptime().
lavf: factor out conversion of ISO8601 string to unix time
wav: parse 'bext' metadata
wav: keep parsing until EOF if the input is seekable and we know the size of the data tag
wav: Refactor the tag checking into a switch statement
wav: make sure neither data_size nor sample_count is negative.
wav: refactor the 'fmt ' tag search and parsing.
wav: add an option for writing BEXT chunk
ffmpeg: get rid of a pointless limit on number of streams.
ffmpeg: remove an unused define.
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpc.c')
-rw-r--r-- | libavformat/mpc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 4d6854f13f..aba73a7d6d 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -70,7 +70,15 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); return -1; } - c->frames = av_malloc(c->fcount * sizeof(MPCFrame)); + if(c->fcount){ + c->frames = av_malloc(c->fcount * sizeof(MPCFrame)); + if(!c->frames){ + av_log(s, AV_LOG_ERROR, "Cannot allocate seektable\n"); + return AVERROR(ENOMEM); + } + }else{ + av_log(s, AV_LOG_WARNING, "Container reports no frames\n"); + } c->curframe = 0; c->lastframe = -1; c->curbits = 8; @@ -111,7 +119,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) int ret, size, size2, curbits, cur = c->curframe; int64_t tmp, pos; - if (c->curframe >= c->fcount) + if (c->curframe >= c->fcount && c->fcount) return -1; if(c->curframe != c->lastframe + 1){ @@ -133,7 +141,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_seek(s->pb, pos, SEEK_SET); size = ((size2 + curbits + 31) & ~31) >> 3; - if(cur == c->frames_noted){ + if(cur == c->frames_noted && c->fcount){ c->frames[cur].pos = pos; c->frames[cur].size = size; c->frames[cur].skip = curbits - 20; @@ -146,7 +154,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); pkt->data[0] = curbits; - pkt->data[1] = (c->curframe > c->fcount); + pkt->data[1] = (c->curframe > c->fcount) && c->fcount; pkt->data[2] = 0; pkt->data[3] = 0; |