$NetBSD: patch-ai,v 1.2 2011/07/05 03:27:22 dholland Exp $ Support png. Fix LP64 problems. --- batch_mode.c.orig 1999-10-23 13:50:35.000000000 +0000 +++ batch_mode.c @@ -154,6 +154,8 @@ static void DoStreamVideo( TV_BATCH_PARM if ( STREQ( parm->frame_fmt, "TIFF" ) ) fmt = TV_STILL_FMT_TIFF; + else if ( STREQ( parm->frame_fmt, "PNG" ) ) + fmt = TV_STILL_FMT_PNG; else if ( STREQ( parm->frame_fmt, "PPM" ) ) fmt = TV_STILL_FMT_PPM; else if ( STREQ( parm->frame_fmt, "YUV" ) ) @@ -175,6 +177,7 @@ static void DoStreamVideo( TV_BATCH_PARM if ( parm->video_target && !video2stdout ) switch ( fmt ) { case TV_STILL_FMT_TIFF : frame_ext = "tif"; break; + case TV_STILL_FMT_PNG : frame_ext = "png"; break; case TV_STILL_FMT_PPM : frame_ext = "ppm"; break; case TV_STILL_FMT_YUV : frame_ext = "yuv"; break; default: abort(); @@ -187,7 +190,7 @@ static void DoStreamVideo( TV_BATCH_PARM } /* Prepare the audio output filedesc */ - if ( parm->audio_target ) + if ( parm->audio_target ) { if ( audio2stdout ) aud_fd = 1; else @@ -197,6 +200,7 @@ static void DoStreamVideo( TV_BATCH_PARM parm->audio_target ); exit(1); } + } /* Read header */ if ( !TVRAWVIDEOHeaderRead( rf, &img, &snd, &eof ) ) { @@ -209,7 +213,8 @@ static void DoStreamVideo( TV_BATCH_PARM return; /* Sanity check raw data with save type */ - if ( ((( fmt == TV_STILL_FMT_TIFF ) || ( fmt == TV_STILL_FMT_PPM )) && + if ( ((( fmt == TV_STILL_FMT_TIFF ) || ( fmt == TV_STILL_FMT_PNG ) + || ( fmt == TV_STILL_FMT_PPM )) && ( img.pix_geom.type != TV_PIXELTYPE_RGB )) || (( fmt == TV_STILL_FMT_YUV ) && ( img.pix_geom.type != TV_PIXELTYPE_YUV )) ) { @@ -288,7 +293,7 @@ static void DoStreamVideo( TV_BATCH_PARM else { char suffix[80]; - sprintf( suffix, ".%.5ld.%s", frame_no++, frame_ext ); + sprintf( suffix, ".%.5d.%s", frame_no++, frame_ext ); sprintf( img_fname, parm->video_target, suffix ); if ( i == 0 ) {