@@ -9,9 +9,9 @@ pub enum CapturerError {
99 #[ error( "NoDevice" ) ]
1010 NoDevice ,
1111 #[ error( "DefaultConfig: {0}" ) ]
12- DefaultConfig ( # [ from ] DefaultStreamConfigError ) ,
12+ DefaultConfig ( String ) ,
1313 #[ error( "BuildStream: {0}" ) ]
14- BuildStream ( # [ from ] BuildStreamError ) ,
14+ BuildStream ( String ) ,
1515}
1616
1717pub fn create_capturer (
@@ -24,19 +24,23 @@ pub fn create_capturer(
2424 let output_device = host
2525 . default_output_device ( )
2626 . ok_or ( CapturerError :: NoDevice ) ?;
27- let supported_config = output_device. default_output_config ( ) ?;
27+ let supported_config = output_device
28+ . default_output_config ( )
29+ . map_err ( |e| CapturerError :: DefaultConfig ( e. to_string ( ) ) ) ?;
2830 let config = supported_config. clone ( ) . into ( ) ;
2931
30- let stream = output_device. build_input_stream_raw (
31- & config,
32- supported_config. sample_format ( ) ,
33- {
34- let config = config. clone ( ) ;
35- move |data, info : & InputCallbackInfo | data_callback ( data, info, & config)
36- } ,
37- error_callback,
38- None ,
39- ) ?;
32+ let stream = output_device
33+ . build_input_stream_raw (
34+ & config,
35+ supported_config. sample_format ( ) ,
36+ {
37+ let config = config. clone ( ) ;
38+ move |data, info : & InputCallbackInfo | data_callback ( data, info, & config)
39+ } ,
40+ error_callback,
41+ None ,
42+ )
43+ . map_err ( |e| CapturerError :: BuildStream ( e. to_string ( ) ) ) ?;
4044
4145 Ok ( Capturer {
4246 stream,
0 commit comments