@@ -15,7 +15,7 @@ use tokio_uring::buf::BoundedBuf;
15
15
// protobuf stuff:
16
16
include ! ( concat!( env!( "OUT_DIR" ) , "/protos/mod.rs" ) ) ;
17
17
use crate :: mitm:: protos:: * ;
18
- use crate :: mitm:: AudioStreamType :: AUDIO_STREAM_MEDIA ;
18
+ use crate :: mitm:: AudioStreamType :: * ;
19
19
use protobuf:: text_format:: print_to_string_pretty;
20
20
use protobuf:: { Enum , Message , MessageDyn } ;
21
21
use protos:: ControlMessageType :: { self , * } ;
@@ -230,6 +230,7 @@ pub async fn pkt_modify_hook(
230
230
dpi : Option < u16 > ,
231
231
developer_mode : bool ,
232
232
disable_media_sink : bool ,
233
+ disable_tts_sink : bool ,
233
234
) -> Result < ( ) > {
234
235
if pkt. channel != 0 {
235
236
return Ok ( ( ) ) ;
@@ -268,6 +269,24 @@ pub async fn pkt_modify_hook(
268
269
) ;
269
270
}
270
271
272
+ // disable tts sink
273
+ if disable_tts_sink {
274
+ while let Some ( svc) = msg. services . iter_mut ( ) . find ( |svc| {
275
+ !svc. media_sink_service . audio_configs . is_empty ( )
276
+ && svc. media_sink_service . audio_type ( ) == AUDIO_STREAM_GUIDANCE
277
+ } ) {
278
+ svc. media_sink_service
279
+ . as_mut ( )
280
+ . unwrap ( )
281
+ . set_audio_type ( AUDIO_STREAM_SYSTEM_AUDIO ) ;
282
+ }
283
+ info ! (
284
+ "{} <yellow>{:?}</>: TTS sink disabled" ,
285
+ get_name( proxy_type) ,
286
+ control. unwrap( ) ,
287
+ ) ;
288
+ }
289
+
271
290
// disable media sink
272
291
if disable_media_sink {
273
292
msg. services
@@ -432,6 +451,7 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
432
451
dpi : Option < u16 > ,
433
452
developer_mode : bool ,
434
453
disable_media_sink : bool ,
454
+ disable_tts_sink : bool ,
435
455
) -> Result < ( ) > {
436
456
let ssl = ssl_builder ( proxy_type) . await ?;
437
457
@@ -511,6 +531,7 @@ pub async fn proxy<A: Endpoint<A> + 'static>(
511
531
dpi,
512
532
developer_mode,
513
533
disable_media_sink,
534
+ disable_tts_sink,
514
535
)
515
536
. await ?;
516
537
pkt. encrypt_payload ( & mut mem_buf, & mut server) . await ?;
0 commit comments