# HG changeset patch # User michael # Date 1124036360 0 # Node ID 8f12a754d33018614db22e8b3ed273e77a889665 # Parent 128838bc4bb6339704788f0becedcb9c6cfcdbe7 a few checks, seems i forgot to commit this diff -r 128838bc4bb6 -r 8f12a754d330 utils.c --- a/utils.c Sun Aug 14 15:42:40 2005 +0000 +++ b/utils.c Sun Aug 14 16:19:20 2005 +0000 @@ -2158,6 +2158,30 @@ int ret, i; AVStream *st; + // some sanity checks + for(i=0;inb_streams;i++) { + st = s->streams[i]; + + switch (st->codec->codec_type) { + case CODEC_TYPE_AUDIO: + if(st->codec->sample_rate<=0){ + av_log(s, AV_LOG_ERROR, "sample rate not set\n"); + return -1; + } + break; + case CODEC_TYPE_VIDEO: + if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ //FIXME audio too? + av_log(s, AV_LOG_ERROR, "time base not set\n"); + return -1; + } + if(st->codec->width<=0 || st->codec->height<=0){ + av_log(s, AV_LOG_ERROR, "dimensions not set\n"); + return -1; + } + break; + } + } + ret = s->oformat->write_header(s); if (ret < 0) return ret;