@@ -23,10 +23,14 @@ use crossbeam_channel::{bounded, Receiver};
2323use glyphon:: fontdb;
2424use input:: InputInitInfo ;
2525use input:: RawDataInputOptions ;
26+ use output:: encoded_data:: EncodedDataOutput ;
27+ use output:: new_external_output;
28+ use output:: raw_data:: RawDataOutput ;
2629use output:: EncodedDataOutputOptions ;
2730use output:: OutputOptions ;
2831use output:: RawDataOutputOptions ;
2932use pipeline_output:: register_pipeline_output;
33+ use pipeline_output:: OutputInfo ;
3034use tokio:: runtime:: Runtime ;
3135use tokio:: sync:: oneshot;
3236use tracing:: { error, info, trace, warn} ;
@@ -311,9 +315,9 @@ impl Pipeline {
311315 register_pipeline_output (
312316 pipeline,
313317 output_id,
314- & register_options. output_options ,
315318 register_options. video ,
316319 register_options. audio ,
320+ |ctx, output_id| new_external_output ( ctx, output_id, register_options. output_options ) ,
317321 )
318322 }
319323
@@ -325,9 +329,13 @@ impl Pipeline {
325329 register_pipeline_output (
326330 pipeline,
327331 output_id,
328- & register_options. output_options ,
329332 register_options. video ,
330333 register_options. audio ,
334+ |ctx, output_id| {
335+ let ( output, result) =
336+ EncodedDataOutput :: new ( output_id, ctx, register_options. output_options ) ?;
337+ Ok ( ( Box :: new ( output) , result) )
338+ } ,
331339 )
332340 }
333341
@@ -339,9 +347,12 @@ impl Pipeline {
339347 register_pipeline_output (
340348 pipeline,
341349 output_id,
342- & register_options. output_options ,
343350 register_options. video ,
344351 register_options. audio ,
352+ |_ctx, _output_id| {
353+ let ( output, result) = RawDataOutput :: new ( register_options. output_options ) ?;
354+ Ok ( ( Box :: new ( output) , result) )
355+ } ,
345356 )
346357 }
347358
@@ -398,7 +409,13 @@ impl Pipeline {
398409 return Err ( RequestKeyframeError :: OutputNotRegistered ( output_id. clone ( ) ) ) ;
399410 } ;
400411
401- output. output . request_keyframe ( output_id)
412+ match output. output . video ( ) {
413+ Some ( video) => video
414+ . keyframe_request_sender
415+ . send ( ( ) )
416+ . map_err ( |_| RequestKeyframeError :: KeyframesUnsupported ( output_id. clone ( ) ) ) ,
417+ None => Err ( RequestKeyframeError :: NoVideoOutput ( output_id. clone ( ) ) ) ,
418+ }
402419 }
403420
404421 pub fn register_font ( & self , font_source : fontdb:: Source ) {
@@ -443,17 +460,18 @@ impl Pipeline {
443460 }
444461 }
445462
446- let ( Some ( resolution) , Some ( frame_format) ) = (
447- output. output . resolution ( ) ,
448- output. output . output_frame_format ( ) ,
449- ) else {
463+ let Some ( video_output) = output. output . video ( ) else {
450464 return Err ( UpdateSceneError :: AudioVideoNotMatching ( output_id) ) ;
451465 } ;
452466
453467 info ! ( ?output_id, "Update scene {:#?}" , scene_root) ;
454468
455- self . renderer
456- . update_scene ( output_id, resolution, frame_format, scene_root)
469+ self . renderer . update_scene (
470+ output_id,
471+ video_output. resolution ,
472+ video_output. frame_format ,
473+ scene_root,
474+ )
457475 }
458476
459477 fn update_audio (
@@ -500,8 +518,15 @@ impl Pipeline {
500518 self . inputs . iter ( )
501519 }
502520
503- pub fn outputs ( & self ) -> impl Iterator < Item = ( & OutputId , & PipelineOutput ) > {
504- self . outputs . iter ( )
521+ pub fn outputs ( & self ) -> impl Iterator < Item = ( & OutputId , OutputInfo ) > {
522+ self . outputs . iter ( ) . map ( |( id, output) | {
523+ (
524+ id,
525+ OutputInfo {
526+ kind : output. output . kind ( ) ,
527+ } ,
528+ )
529+ } )
505530 }
506531}
507532
0 commit comments