lavf/dxa: return meaningful error codes

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2012-12-05 20:18:04 +00:00
parent c5008135c2
commit 0aabd35b62
1 changed files with 6 additions and 6 deletions

View File

@ -65,12 +65,12 @@ static int dxa_read_header(AVFormatContext *s)
tag = avio_rl32(pb); tag = avio_rl32(pb);
if (tag != MKTAG('D', 'E', 'X', 'A')) if (tag != MKTAG('D', 'E', 'X', 'A'))
return -1; return AVERROR_INVALIDDATA;
flags = avio_r8(pb); flags = avio_r8(pb);
c->frames = avio_rb16(pb); c->frames = avio_rb16(pb);
if(!c->frames){ if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
return -1; return AVERROR_INVALIDDATA;
} }
fps = avio_rb32(pb); fps = avio_rb32(pb);
@ -90,7 +90,7 @@ static int dxa_read_header(AVFormatContext *s)
st = avformat_new_stream(s, NULL); st = avformat_new_stream(s, NULL);
if (!st) if (!st)
return -1; return AVERROR(ENOMEM);
// Parse WAV data header // Parse WAV data header
if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){ if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){
@ -103,7 +103,7 @@ static int dxa_read_header(AVFormatContext *s)
ast = avformat_new_stream(s, NULL); ast = avformat_new_stream(s, NULL);
if (!ast) if (!ast)
return -1; return AVERROR(ENOMEM);
ret = ff_get_wav_header(pb, ast->codec, fsize); ret = ff_get_wav_header(pb, ast->codec, fsize);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -191,7 +191,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
size = AV_RB32(buf + 5); size = AV_RB32(buf + 5);
if(size > 0xFFFFFF){ if(size > 0xFFFFFF){
av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size); av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
return -1; return AVERROR_INVALIDDATA;
} }
if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0) if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -209,7 +209,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
default: default:
av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]); av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]);
return -1; return AVERROR_INVALIDDATA;
} }
} }
return AVERROR_EOF; return AVERROR_EOF;