diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-12-04 11:59:46 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-12-04 11:59:46 +0000 |
commit | 266e88a47cfcf6ffbc12aa4bbc37a524d6ad0765 (patch) | |
tree | 4573221cd71ac2e086a04f50903d78cf31fbbd84 | |
parent | b70251c0adcc256899217798ac744b440d41d237 (diff) | |
download | ffmpeg-266e88a47cfcf6ffbc12aa4bbc37a524d6ad0765.tar.gz |
mmf: return meaningful error codes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavformat/mmf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 38c6970942..4aada19ac7 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -71,7 +71,7 @@ static int mmf_write_header(AVFormatContext *s) rate = mmf_rate_code(s->streams[0]->codec->sample_rate); if(rate < 0) { av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d, supported are 4000, 8000, 11025, 22050 and 44100\n", s->streams[0]->codec->sample_rate); - return -1; + return AVERROR(EINVAL); } ffio_wfourcc(pb, "MMMD"); @@ -193,7 +193,7 @@ static int mmf_read_header(AVFormatContext *s) tag = avio_rl32(pb); if (tag != MKTAG('M', 'M', 'M', 'D')) - return -1; + return AVERROR_INVALIDDATA; avio_skip(pb, 4); /* file_size */ /* Skip some unused chunks that may or may not be present */ @@ -208,11 +208,11 @@ static int mmf_read_header(AVFormatContext *s) /* Tag = "ATRx", where "x" = track number */ if ((tag & 0xffffff) == MKTAG('M', 'T', 'R', 0)) { av_log(s, AV_LOG_ERROR, "MIDI like format found, unsupported\n"); - return -1; + return AVERROR_PATCHWELCOME; } if ((tag & 0xffffff) != MKTAG('A', 'T', 'R', 0)) { av_log(s, AV_LOG_ERROR, "Unsupported SMAF chunk %08x\n", tag); - return -1; + return AVERROR_PATCHWELCOME; } avio_r8(pb); /* format type */ @@ -221,7 +221,7 @@ static int mmf_read_header(AVFormatContext *s) rate = mmf_rate(params & 0x0f); if(rate < 0) { av_log(s, AV_LOG_ERROR, "Invalid sample rate\n"); - return -1; + return AVERROR_INVALIDDATA; } avio_r8(pb); /* wave base bit */ avio_r8(pb); /* time base d */ @@ -239,7 +239,7 @@ static int mmf_read_header(AVFormatContext *s) /* Make sure it's followed by an Awa chunk, aka wave data */ if ((tag & 0xffffff) != MKTAG('A', 'w', 'a', 0)) { av_log(s, AV_LOG_ERROR, "Unexpected SMAF chunk %08x\n", tag); - return -1; + return AVERROR_INVALIDDATA; } mmf->data_size = size; |