1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-07 03:56:28 +02:00

* fixed stupid bug in stupid ConvertPrintfFormatString() function

* fixed the "waveout not closing" bug. We need to reset the waveout device
    before closing it.
This commit is contained in:
Gildas Bazin 2002-03-20 23:00:16 +00:00
parent 3939be7d47
commit 313043fe87
3 changed files with 21 additions and 9 deletions

4
BUGS
View File

@ -1,4 +1,4 @@
List of known vlc bugs $Id: BUGS,v 1.8 2002/03/20 03:12:20 ipkiss Exp $ List of known vlc bugs $Id: BUGS,v 1.9 2002/03/20 23:00:16 gbazin Exp $
Please try to keep this file up to date. Also, grep for FIXME in the Please try to keep this file up to date. Also, grep for FIXME in the
source files for more and more bugs to fix. source files for more and more bugs to fix.
@ -30,8 +30,6 @@ Audio output:
* Audio output stutters on some audio cards. For instance kwyxz's SB * Audio output stutters on some audio cards. For instance kwyxz's SB
128 with an es1371 chip. 128 with an es1371 chip.
* WaveOut doesn't close correctly under Windows 98.
Video output: Video output:

View File

@ -2,7 +2,7 @@
* waveout.c : Windows waveOut plugin for vlc * waveout.c : Windows waveOut plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: waveout.c,v 1.5 2002/03/19 12:48:01 gbazin Exp $ * $Id: waveout.c,v 1.6 2002/03/20 23:00:16 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -155,6 +155,9 @@ static int aout_SetFormat( aout_thread_t *p_aout )
if( (p_aout->p_sys->waveformat.nChannels != p_aout->i_channels) || if( (p_aout->p_sys->waveformat.nChannels != p_aout->i_channels) ||
(p_aout->p_sys->waveformat.nSamplesPerSec != p_aout->i_rate) ) (p_aout->p_sys->waveformat.nSamplesPerSec != p_aout->i_rate) )
{ {
/* Before calling waveOutClose we must reset the device */
waveOutReset( p_aout->p_sys->h_waveout );
if( waveOutClose( p_aout->p_sys->h_waveout ) != MMSYSERR_NOERROR ) if( waveOutClose( p_aout->p_sys->h_waveout ) != MMSYSERR_NOERROR )
{ {
intf_ErrMsg( "aout error: waveOutClose failed" ); intf_ErrMsg( "aout error: waveOutClose failed" );
@ -251,6 +254,9 @@ static void aout_Close( aout_thread_t *p_aout )
intf_WarnMsg( 3, "aout: waveOut aout_Close "); intf_WarnMsg( 3, "aout: waveOut aout_Close ");
/* Before calling waveOutClose we must reset the device */
waveOutReset( p_aout->p_sys->h_waveout );
/* Close the device */ /* Close the device */
if( waveOutClose( p_aout->p_sys->h_waveout ) != MMSYSERR_NOERROR ) if( waveOutClose( p_aout->p_sys->h_waveout ) != MMSYSERR_NOERROR )
{ {

View File

@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration. * interface, such as message output. See config.h for output configuration.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: intf_msg.c,v 1.46 2002/02/23 21:31:44 gbazin Exp $ * $Id: intf_msg.c,v 1.47 2002/03/20 23:00:15 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
@ -325,6 +325,11 @@ static void QueueMsg( int i_type, int i_level, char *psz_format, va_list ap )
#ifndef HAVE_VASPRINTF #ifndef HAVE_VASPRINTF
# ifdef WIN32 # ifdef WIN32
psz_temp = ConvertPrintfFormatString(psz_format); psz_temp = ConvertPrintfFormatString(psz_format);
if( !psz_temp )
{
fprintf(stderr, "intf warning: couldn't print message");
return;
}
vsprintf( psz_str, psz_temp, ap ); vsprintf( psz_str, psz_temp, ap );
free( psz_temp ); free( psz_temp );
# else # else
@ -409,7 +414,7 @@ static void FlushMsg ( void )
* ConvertPrintfFormatString: replace all occurrences of %ll with %I64 in the * ConvertPrintfFormatString: replace all occurrences of %ll with %I64 in the
* printf format string. * printf format string.
***************************************************************************** *****************************************************************************
* Win32 doesn't recognize the "%lld" format in a printf string, so we have * Win32 doesn't recognize the "%ll" format in a printf string, so we have
* to convert this string to something that win32 can handle. * to convert this string to something that win32 can handle.
* This is a REALLY UGLY HACK which won't even work in every situation, * This is a REALLY UGLY HACK which won't even work in every situation,
* but hey I don't want to put an ifdef WIN32 each time I use printf with * but hey I don't want to put an ifdef WIN32 each time I use printf with
@ -426,7 +431,10 @@ static char *ConvertPrintfFormatString( char *psz_format )
* psz_format string. Once we'll know that we'll be able to malloc the * psz_format string. Once we'll know that we'll be able to malloc the
* destination string */ * destination string */
for( i=0; i <= (strlen(psz_format) - 4); i++ ) if( strlen( psz_format ) <= 3 )
return strdup( psz_format );
for( i=0; i <= (strlen(psz_format) - 3); i++ )
{ {
if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) ) if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) )
{ {
@ -439,12 +447,12 @@ static char *ConvertPrintfFormatString( char *psz_format )
if( psz_dest == NULL ) if( psz_dest == NULL )
{ {
fprintf( stderr, "intf warning: ConvertPrintfFormatString failed\n"); fprintf( stderr, "intf warning: ConvertPrintfFormatString failed\n");
exit (errno); return NULL;
} }
/* Now build the modified string */ /* Now build the modified string */
i_counter = 0; i_counter = 0;
for( i=0; i <= (strlen(psz_format) - 4); i++ ) for( i=0; i <= (strlen(psz_format) - 3); i++ )
{ {
if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) ) if( !strncmp( (char *)(psz_format + i), "%ll", 3 ) )
{ {