some cleanup with the open() / close() functions

This commit is contained in:
darkeye 2002-10-19 13:31:46 +00:00
parent a83e8c8c7a
commit d4244515ae
2 changed files with 22 additions and 12 deletions

View File

@ -70,6 +70,12 @@ LameLibEncoder :: open ( void )
close();
}
// open the underlying sink
if ( !sink->open() ) {
throw Exception( __FILE__, __LINE__,
"lame lib opening underlying sink error");
}
lameGlobalFlags = lame_init();
// ugly lame returns -1 in a pointer on allocation errors
@ -246,12 +252,6 @@ LameLibEncoder :: open ( void )
lame_print_config( lameGlobalFlags);
// open the underlying sink
if ( !sink->open() ) {
throw Exception( __FILE__, __LINE__,
"lame lib opening underlying sink error");
}
return true;
}
@ -372,6 +372,8 @@ LameLibEncoder :: close ( void ) throw ( Exception )
flush();
lame_close( lameGlobalFlags);
lameGlobalFlags = 0;
sink->close();
}
}
@ -384,6 +386,9 @@ LameLibEncoder :: close ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.18 2002/10/19 13:31:46 darkeye
some cleanup with the open() / close() functions
Revision 1.17 2002/10/19 12:22:10 darkeye
return 0 immediately for write() if supplied length is 0

View File

@ -121,6 +121,12 @@ VorbisLibEncoder :: open ( void )
close();
}
// open the underlying sink
if ( !sink->open() ) {
throw Exception( __FILE__, __LINE__,
"vorbis lib opening underlying sink error");
}
vorbis_info_init( &vorbisInfo);
switch ( getOutBitrateMode() ) {
@ -180,12 +186,6 @@ VorbisLibEncoder :: open ( void )
throw Exception( __FILE__, __LINE__, "ogg stream init error", ret);
}
// open the underlying sink
if ( !sink->open() ) {
throw Exception( __FILE__, __LINE__,
"vorbis lib opening underlying sink error");
}
// create an empty vorbis_comment structure
vorbis_comment_init( &vorbisComment);
@ -356,6 +356,8 @@ VorbisLibEncoder :: close ( void ) throw ( Exception )
vorbis_info_clear( &vorbisInfo);
encoderOpen = false;
sink->close();
}
}
@ -368,6 +370,9 @@ VorbisLibEncoder :: close ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.16 2002/10/19 13:31:46 darkeye
some cleanup with the open() / close() functions
Revision 1.15 2002/10/19 12:22:10 darkeye
return 0 immediately for write() if supplied length is 0