2006-05-14 00:41:56 +00:00
/***
2006-06-19 21:53:48 +00:00
This file is part of PulseAudio .
2007-01-04 13:43:45 +00:00
2007-02-13 15:35:19 +00:00
Copyright 2006 Lennart Poettering
2006-06-19 21:53:48 +00:00
PulseAudio is free software ; you can redistribute it and / or modify
2006-05-14 00:41:56 +00:00
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation ; either version 2 of the License ,
or ( at your option ) any later version .
2007-01-04 13:43:45 +00:00
2006-06-19 21:53:48 +00:00
PulseAudio is distributed in the hope that it will be useful , but
2006-05-14 00:41:56 +00:00
WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
General Public License for more details .
2007-01-04 13:43:45 +00:00
2006-05-14 00:41:56 +00:00
You should have received a copy of the GNU Lesser General Public License
2006-06-19 21:53:48 +00:00
along with PulseAudio ; if not , write to the Free Software
2006-05-14 00:41:56 +00:00
Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307
USA .
* * */
# ifdef HAVE_CONFIG_H
# include <config.h>
# endif
2006-06-19 21:53:48 +00:00
# include <pulse/xmalloc.h>
2006-05-17 16:34:18 +00:00
2006-06-19 21:53:48 +00:00
# include <pulsecore/module.h>
# include <pulsecore/modargs.h>
# include <pulsecore/log.h>
2009-01-28 00:22:28 +01:00
# include <pulsecore/core-util.h>
2006-05-14 00:41:56 +00:00
# include "module-volume-restore-symdef.h"
2007-11-09 18:25:40 +00:00
PA_MODULE_AUTHOR ( " Lennart Poettering " ) ;
2009-01-28 00:22:28 +01:00
PA_MODULE_DESCRIPTION ( " Compatibility module " ) ;
2007-11-09 18:25:40 +00:00
PA_MODULE_VERSION ( PACKAGE_VERSION ) ;
PA_MODULE_LOAD_ONCE ( TRUE ) ;
2006-05-14 00:41:56 +00:00
static const char * const valid_modargs [ ] = {
" table " ,
2007-11-21 01:30:40 +00:00
" restore_device " ,
" restore_volume " ,
2006-05-14 00:41:56 +00:00
NULL ,
} ;
2007-10-28 19:13:50 +00:00
int pa__init ( pa_module * m ) {
2006-05-14 00:41:56 +00:00
pa_modargs * ma = NULL ;
2007-11-21 01:30:40 +00:00
pa_bool_t restore_device = TRUE , restore_volume = TRUE ;
2009-01-28 00:22:28 +01:00
char * t ;
2007-01-04 13:43:45 +00:00
2007-10-28 19:13:50 +00:00
pa_assert ( m ) ;
2006-05-14 00:41:56 +00:00
if ( ! ( ma = pa_modargs_new ( m - > argument , valid_modargs ) ) ) {
2006-08-18 21:38:40 +00:00
pa_log ( " Failed to parse module arguments " ) ;
2006-05-14 00:41:56 +00:00
goto fail ;
}
2007-11-21 01:30:40 +00:00
if ( pa_modargs_get_value_boolean ( ma , " restore_device " , & restore_device ) < 0 | |
pa_modargs_get_value_boolean ( ma , " restore_volume " , & restore_volume ) < 0 ) {
pa_log ( " restore_volume= and restore_device= expect boolean arguments " ) ;
goto fail ;
}
2009-01-28 00:22:28 +01:00
pa_log_warn ( " module-volume-restore is obsolete. It has been replaced by module-stream-restore. We will now load the latter but please make sure to remove module-volume-restore from your configuration. " ) ;
2006-05-14 00:41:56 +00:00
2009-01-28 00:22:28 +01:00
t = pa_sprintf_malloc ( " restore_volume=%s restore_device=%s " , pa_yes_no ( restore_volume ) , pa_yes_no ( restore_device ) ) ;
pa_module_load ( m - > core , " module-stream-restore " , t ) ;
pa_xfree ( t ) ;
2007-11-21 01:30:40 +00:00
2009-01-28 00:22:28 +01:00
pa_module_unload_request ( m , TRUE ) ;
2006-05-14 00:41:56 +00:00
pa_modargs_free ( ma ) ;
return 0 ;
fail :
if ( ma )
pa_modargs_free ( ma ) ;
2007-01-04 13:43:45 +00:00
2006-05-14 00:41:56 +00:00
return - 1 ;
}