@@ -4,7 +4,7 @@ pub fn start_bitstream_thread(
44 _shared_state : std:: sync:: Arc < std:: sync:: Mutex < crate :: state:: AppState > > ,
55 tx : crossbeam_channel:: Sender < crate :: audio:: DspMessage > ,
66 stop_token : std:: sync:: Arc < std:: sync:: atomic:: AtomicBool > ,
7- ) -> anyhow:: Result < ( std:: thread:: JoinHandle < ( ) > , u32 ) > {
7+ ) -> anyhow:: Result < ( std:: thread:: JoinHandle < ( ) > , u32 , String , bool ) > {
88 use anyhow:: Context ;
99
1010 println ! ( "[bitstream] Probing codec via ffmpeg-next on Linux..." ) ;
@@ -29,6 +29,8 @@ pub fn start_bitstream_thread(
2929 _ => return Err ( anyhow:: anyhow!( "Unsupported codec for bitstreaming: {:?}" , codec_id) ) ,
3030 } . to_string ( ) ;
3131
32+ let has_video = ictx. streams ( ) . best ( ffmpeg_next:: media:: Type :: Video ) . is_some ( ) ;
33+
3234 let parameters = best_audio. parameters ( ) ;
3335 let best_audio_index = best_audio. index ( ) ;
3436
@@ -193,7 +195,7 @@ pub fn start_bitstream_thread(
193195 println ! ( "[bitstream] FFmpeg thread finished on Linux." ) ;
194196 } ) ;
195197
196- Ok ( ( ffmpeg_thread, decoder_sample_rate as u32 ) )
198+ Ok ( ( ffmpeg_thread, decoder_sample_rate as u32 , codec_name , has_video ) )
197199}
198200
199201#[ cfg( not( any( target_os = "windows" , target_os = "linux" ) ) ) ]
@@ -202,7 +204,7 @@ pub fn start_bitstream_thread(
202204 _shared_state : std:: sync:: Arc < std:: sync:: Mutex < crate :: state:: AppState > > ,
203205 _tx : crossbeam_channel:: Sender < crate :: audio:: DspMessage > ,
204206 _stop_token : std:: sync:: Arc < std:: sync:: atomic:: AtomicBool > ,
205- ) -> anyhow:: Result < ( std:: thread:: JoinHandle < ( ) > , u32 ) > {
207+ ) -> anyhow:: Result < ( std:: thread:: JoinHandle < ( ) > , u32 , String , bool ) > {
206208 Err ( anyhow:: anyhow!( "Bitstream passthrough is not supported on this platform." ) )
207209}
208210#[ cfg( windows) ]
@@ -397,7 +399,7 @@ mod wasapi_bitstream {
397399
398400 // ─── Main bitstream pump ─────────────────────────────────────────
399401
400- pub fn start_bitstream_thread ( file_path : & str , _shared_state : Arc < Mutex < AppState > > , tx : Sender < DspMessage > , stop_token : Arc < AtomicBool > ) -> Result < ( std:: thread:: JoinHandle < ( ) > , u32 ) > {
402+ pub fn start_bitstream_thread ( file_path : & str , _shared_state : Arc < Mutex < AppState > > , tx : Sender < DspMessage > , stop_token : Arc < AtomicBool > ) -> Result < ( std:: thread:: JoinHandle < ( ) > , u32 , String , bool ) > {
401403 unsafe { let _ = CoInitializeEx ( None , COINIT_MULTITHREADED ) ; }
402404
403405 // ── Probe codec via ffmpeg-next ─────────────────────────────
@@ -420,9 +422,11 @@ mod wasapi_bitstream {
420422 ffmpeg_next:: codec:: Id :: EAC3 => "eac3" ,
421423 ffmpeg_next:: codec:: Id :: DTS => "dts" ,
422424 ffmpeg_next:: codec:: Id :: AC3 => "ac3" ,
423- _ => "unknown" ,
425+ _ => return Err ( anyhow :: anyhow! ( "Unsupported codec for bitstreaming: {:?}" , codec_id ) ) ,
424426 } . to_string ( ) ;
425427
428+ let has_video = ictx. streams ( ) . best ( ffmpeg_next:: media:: Type :: Video ) . is_some ( ) ;
429+
426430 let profiles = detect_codec_profile ( & codec_name) ;
427431 println ! ( "Detected codec: {}" , codec_name) ;
428432 for p in & profiles {
@@ -779,7 +783,7 @@ mod wasapi_bitstream {
779783 println ! ( "Bitstream thread finished." ) ;
780784 } ) ;
781785
782- Ok ( ( handle, decoder_sample_rate) )
786+ Ok ( ( handle, decoder_sample_rate, profile . name . to_string ( ) , has_video ) )
783787 }
784788}
785789
0 commit comments