CVS: ffmpeg/libavformat utils.c,1.160,1.161
Update of /cvsroot/ffmpeg/ffmpeg/libavformat In directory mail:/var2/tmp/cvs-serv16066 Modified Files: utils.c Log Message: a few checks, seems i forgot to commit this Index: utils.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v retrieving revision 1.160 retrieving revision 1.161 diff -u -d -r1.160 -r1.161 --- utils.c 14 Aug 2005 15:42:40 -0000 1.160 +++ utils.c 14 Aug 2005 16:19:20 -0000 1.161 @@ -2158,6 +2158,30 @@ int ret, i; AVStream *st; + // some sanity checks + for(i=0;i<s->nb_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;
Hi, As you may know, I've tried to find the reason why libavformat-in-mencoder broke. This very commit broke it (in mencoder, I'm sure it works fine in ffmpeg itself). That is, I take a snapshot from some minutes before this commit, and apply only this patch, and MEncoder goes bye-bye. On 8/14/05, Michael Niedermayer CVS <michael at mplayerhq.hu> wrote:
Update of /cvsroot/ffmpeg/ffmpeg/libavformat In directory mail:/var2/tmp/cvs-serv16066
Modified Files: utils.c Log Message: a few checks, seems i forgot to commit this
Index: utils.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v retrieving revision 1.160 retrieving revision 1.161 diff -u -d -r1.160 -r1.161 --- utils.c 14 Aug 2005 15:42:40 -0000 1.160 +++ utils.c 14 Aug 2005 16:19:20 -0000 1.161 @@ -2158,6 +2158,30 @@ int ret, i; AVStream *st;
+ // some sanity checks + for(i=0;i<s->nb_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;
With this commit in, here is the error I get: guillaume at Sketches guillaume/sandbox/main $ ./mencoder /mnt/fatty/G/films/The\ W izard\ Of\ Oz\ \(1939\).avi -o 2.avi -of lavf -ovc lavc -oac lavc -lavcopts vcod ec=mpeg4:vbitrate=250:autoaspect:mbd=2:predia=2:dia=2:precmp=2:cmp=2:subcmp=2:pr eme=2:turbo:acodec=mp2:abitrate=56 -vf scale=320:240 -srate 22050 -af lavcresamp le=22050 -endpos 02:00 MEncoder dev-CVS-051001-11:48-4.0.2 (C) 2000-2005 MPlayer Team CPU: Advanced Micro Devices (Family: 8, Stepping: 0) Detected cache-line size is 64 bytes CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1 Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2 File not found: 'frameno.avi' Failed to open frameno.avi success: format: 0 data: 0x0 - 0x2c065580 AVI file format detected. VIDEO: [DIV3] 640x424 24bpp 29.970 fps 865.6 kbps (105.7 kbyte/s) VIDEO: [DIV3] 640x424 24bpp 29.970 fps 865.6 kbps (105.7 kbyte/s) [V] filefmt:3 fourcc:0x33564944 size:640x424 fps:29.97 ftime:=0.0334 ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.80% (ratio: 12000->176400) Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== OK, exit Opening video filter: [expand osd=1] Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1 Opening video filter: [scale w=320 h=240] ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffdivx] vfm:ffmpeg (FFmpeg DivX ;-) (MS MPEG-4 v3)) ========================================================================== VIDEO CODEC ID: 12 Building audio filter chain for 44100Hz/2ch/s16le -> 22050Hz/0ch/??... Building audio filter chain for 44100Hz/2ch/s16le -> 22050Hz/2ch/s16le... AUDIO CODEC ID: 15000, TAG: 50 Writing AVI header... [avi @ 0x854f140]dimensions not set WRITTEN HEADER zsh: floating point exception ./mencoder /mnt/fatty/G/films/The\ Wizard\ Of\ Oz \ \(1939\).avi -o 2.avi -of guillaume at Sketches guillaume/sandbox/main $ -- Reading doesn't hurt, really! -- Dominik 'Rathann' Mierzejewski
participants (2)
-
michael@mplayerhq.hu -
poirierg@gmail.com