diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-07-29 22:19:35 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-07-31 20:54:17 +0200 |
commit | 263dbe9d953bfa717cd46698511cdcdc3d5d74b1 (patch) | |
tree | 1474b0f18050dd8f78843b3a57521c3e41d5185a /libavformat/mpc.c | |
parent | 782e64fbe1daa84c38594db037d0edfac7193c37 (diff) | |
download | ffmpeg-263dbe9d953bfa717cd46698511cdcdc3d5d74b1.tar.gz |
mpc: return more meaningful error codes.
Diffstat (limited to 'libavformat/mpc.c')
-rw-r--r-- | libavformat/mpc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 03d362998f..404950b836 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -59,17 +59,17 @@ static int mpc_read_header(AVFormatContext *s) if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){ av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); - return -1; + return AVERROR_INVALIDDATA; } c->ver = avio_r8(s->pb); if(c->ver != 0x07 && c->ver != 0x17){ av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); - return -1; + return AVERROR_INVALIDDATA; } c->fcount = avio_rl32(s->pb); if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){ av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); - return -1; + return AVERROR_INVALIDDATA; } if(c->fcount){ c->frames = av_malloc(c->fcount * sizeof(MPCFrame)); @@ -122,7 +122,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t pos; if (c->curframe >= c->fcount && c->fcount) - return -1; + return AVERROR_EOF; if(c->curframe != c->lastframe + 1){ avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET); @@ -151,8 +151,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) } c->curbits = (curbits + size2) & 0x1F; - if (av_new_packet(pkt, size) < 0) - return AVERROR(EIO); + if ((ret = av_new_packet(pkt, size)) < 0) + return ret; pkt->data[0] = curbits; pkt->data[1] = (c->curframe > c->fcount) && c->fcount; @@ -166,7 +166,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_seek(s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); - return AVERROR(EIO); + return ret < 0 ? ret : AVERROR(EIO); } pkt->size = ret + 4; @@ -214,7 +214,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp ret = av_read_frame(s, pkt); if (ret < 0){ c->curframe = lastframe; - return -1; + return ret; } av_free_packet(pkt); } |