Signed-off-by: Paul B Mahol <onemda@gmail.com>
AVStream *ast;
ast = avformat_new_stream(s, NULL);
if (!ast)
AVStream *ast;
ast = avformat_new_stream(s, NULL);
if (!ast)
+ return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
if (avio_rl32(pb) != TAG_VBHD){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
if (avio_rl32(pb) != TAG_VBHD){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
+ return AVERROR_INVALIDDATA;
}
if(avio_rb32(pb) != 32){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
}
if(avio_rb32(pb) != 32){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
+ return AVERROR_INVALIDDATA;
}
if(avio_rl16(pb) != 1){
av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
}
if(avio_rl16(pb) != 1){
av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
+ return AVERROR_INVALIDDATA;
}
width = avio_rl16(pb);
height = avio_rl16(pb);
}
width = avio_rl16(pb);
height = avio_rl16(pb);
c->frames = avio_rl16(pb);
if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
c->frames = avio_rl16(pb);
if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
+ return AVERROR_INVALIDDATA;
}
c->bits = avio_rl16(pb);
c->rate = avio_rl16(pb);
}
c->bits = avio_rl16(pb);
c->rate = avio_rl16(pb);
st = avformat_new_stream(s, NULL);
if (!st)
st = avformat_new_stream(s, NULL);
if (!st)
+ return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_VB;
st->codec->codec_tag = MKTAG('V', 'B', 'V', '1');
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_VB;
st->codec->codec_tag = MKTAG('V', 'B', 'V', '1');
c->has_audio = !!c->rate;
c->curstrm = -1;
if (c->has_audio && create_audio_stream(s, c) < 0)
c->has_audio = !!c->rate;
c->curstrm = -1;
if (c->has_audio && create_audio_stream(s, c) < 0)
+ return AVERROR(ENOMEM);
{
if (avio_rl32(pb) != TAG_SHDR){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
{
if (avio_rl32(pb) != TAG_SHDR){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
+ return AVERROR_INVALIDDATA;
}
if(avio_rb32(pb) != 8){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
}
if(avio_rb32(pb) != 8){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
+ return AVERROR_INVALIDDATA;
}
avio_skip(pb, 4); //unknown value
c->rate = avio_rl16(pb);
}
avio_skip(pb, 4); //unknown value
c->rate = avio_rl16(pb);
AVIOContext *pb = s->pb;
SIFFContext *c = s->priv_data;
uint32_t tag;
AVIOContext *pb = s->pb;
SIFFContext *c = s->priv_data;
uint32_t tag;
if (avio_rl32(pb) != TAG_SIFF)
if (avio_rl32(pb) != TAG_SIFF)
+ return AVERROR_INVALIDDATA;
avio_skip(pb, 4); //ignore size
tag = avio_rl32(pb);
if (tag != TAG_VBV1 && tag != TAG_SOUN){
av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
avio_skip(pb, 4); //ignore size
tag = avio_rl32(pb);
if (tag != TAG_VBV1 && tag != TAG_SOUN){
av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
+ return AVERROR_INVALIDDATA;
- if (tag == TAG_VBV1 && siff_parse_vbv1(s, c, pb) < 0)
- return -1;
- if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
- return -1;
+ if (tag == TAG_VBV1 && (ret = siff_parse_vbv1(s, c, pb)) < 0)
+ return ret;
+ if (tag == TAG_SOUN && (ret = siff_parse_soun(s, c, pb)) < 0)
+ return ret;
if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){
av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){
av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
+ return AVERROR_INVALIDDATA;
}
avio_skip(pb, 4); //ignore size
}
avio_skip(pb, 4); //ignore size