summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-04-26 17:36:23 +0200
committerJonas Smedegaard <dr@jones.dk>2017-04-26 17:41:00 +0200
commitb6236e761a3a2e307295a62594aa877221e05405 (patch)
tree4adf504ff916c74b21cb1d420f7ed6585775d917 /bin
parentaa0eb8a9e791a57299ff631d6096f84759a23ca3 (diff)
Factor out subroutine factory().
Diffstat (limited to 'bin')
-rwxr-xr-xbin/capture+encode+serve29
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;
}