> From: Sergey A. Maslyakov [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 23, 1999 7:13 AM
> To: Mark Taylor
> Subject: Re: [MP3 ENCODER] lame 3.29
>
>
> MT> lame input.mp3 output.mp3
> MT> will decode input.mp3 (with mpglib/mpg123) and then re-encode it.
> In my case (lame3.29/win32 compiled using guidelines by Mathew
> Hendry) it just crashes. However, it writes some data on disk
> (16'590 bytes in this case).
MSVC's open/read/close functions appear to be broken. Quick fix:
In mpglib/main.c, add after all the #includes
==========
#ifdef _MSC_VER
/* quick fix for broken MSVC open/read/close */
unsigned int msc_read( int fd, void *buf, unsigned int size ) {
unsigned int ret;
ret = fread( buf, 1, size, (FILE *)fd );
return ret;
}
#ifdef read
#undef read
#endif
#define read msc_read
#endif
==========
and in musicin.c, add after the main batch of #includes
==========
#ifdef _MSC_VER
/* quick fix for broken MSVC open/read/close */
int msc_open( const char *file, int mode ) {
FILE *f;
/* out of laziness, only support reading */
if ( mode != O_RDONLY ) {
return -1;
}
f = fopen( file, "rb" );
return f == NULL ? -1 : (int)f;
}
#ifdef open
#undef open
#endif
#define open msc_open
#endif
==========
That seems to fix it.
BTW, musicin.c never close()es the input file.
-- Mat.
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )