Commit 0e84ba74 authored by Paul B Mahol's avatar Paul B Mahol

tta: return meaningful error codrs

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent b4d4ef55
...@@ -64,7 +64,7 @@ static int tta_read_header(AVFormatContext *s) ...@@ -64,7 +64,7 @@ static int tta_read_header(AVFormatContext *s)
start_offset = avio_tell(s->pb); start_offset = avio_tell(s->pb);
ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX);
if (avio_rl32(s->pb) != AV_RL32("TTA1")) if (avio_rl32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file return AVERROR_INVALIDDATA;
avio_skip(s->pb, 2); // FIXME: flags avio_skip(s->pb, 2); // FIXME: flags
channels = avio_rl16(s->pb); channels = avio_rl16(s->pb);
...@@ -72,7 +72,7 @@ static int tta_read_header(AVFormatContext *s) ...@@ -72,7 +72,7 @@ static int tta_read_header(AVFormatContext *s)
samplerate = avio_rl32(s->pb); samplerate = avio_rl32(s->pb);
if(samplerate <= 0 || samplerate > 1000000){ if(samplerate <= 0 || samplerate > 1000000){
av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
return -1; return AVERROR_INVALIDDATA;
} }
datalen = avio_rl32(s->pb); datalen = avio_rl32(s->pb);
...@@ -96,7 +96,7 @@ static int tta_read_header(AVFormatContext *s) ...@@ -96,7 +96,7 @@ static int tta_read_header(AVFormatContext *s)
if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){ if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){
av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes); av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes);
return -1; return AVERROR_INVALIDDATA;
} }
st = avformat_new_stream(s, NULL); st = avformat_new_stream(s, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment