diff options
-rwxr-xr-x | bin/capture+encode+serve | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/bin/capture+encode+serve b/bin/capture+encode+serve index d6687cd..5e23505 100755 --- a/bin/capture+encode+serve +++ b/bin/capture+encode+serve @@ -108,14 +108,7 @@ sub cam @{ $PIPELINE{$VFORMAT}{'VENC'} }, ) ); - $factory->set_launch("( $pipeline name=$payload )"); - $factory->set_shared(TRUE); - say "media ($device): " . $factory->get_launch(); - -# $factory->set_latency(5); -#say "latency ($device): " . $factory->get_latency(); - - return $factory; + return "( $pipeline name=$payload )"; } sub mic @@ -133,7 +126,15 @@ sub mic @{ $PIPELINE{$AFORMAT}{'AENC'} }, ) ); - $factory->set_launch("( $pipeline name=$payload )"); + return "( $pipeline name=$payload )"; +} + +sub factory +{ + my @pipeline = @_; + + my $factory = Gst::RTSPMediaFactory->new(); + $factory->set_launch( join( ' ', @pipeline ) ); $factory->set_shared(TRUE); #say "media ($device): " . $factory->get_launch(); @@ -158,12 +159,18 @@ my $mounts = $server->get_mount_points(); my @mounts; for my $i ( 0 .. $#VDEVICES ) { my $mount = "/cam$i"; - $mounts->add_factory( $mount, cam( $VDEVICES[$i] ) ); + $mounts->add_factory( + $mount, + factory( cam( $VDEVICES[$i] ) ) + ); push @mounts, $mount; } for my $i ( 0 .. $#ADEVICES ) { my $mount = "/mic$i"; - $mounts->add_factory( $mount, mic( $ADEVICES[$i] ) ); + $mounts->add_factory( + $mount, + factory( mic( $ADEVICES[$i] ) ) + ); push @mounts, $mount; } |