File Coverage

blib/lib/App/EventStreamr/DVswitch/Stream.pm
Criterion Covered Total %
statement 11 20 55.0
branch 0 6 0.0
condition n/a
subroutine 5 7 71.4
pod n/a
total 16 33 48.4


line stmt bran cond sub pod time code
1             package App::EventStreamr::DVswitch::Stream;
2 1     1   14091 use Method::Signatures;
  1         49699  
  1         5  
3 1     1   834 use Moo;
  1         5902  
  1         4  
4 1     1   1406 use namespace::clean;
  1         2853  
  1         5  
5              
6             # ABSTRACT: An IceCast Process
7              
8             our $VERSION = '0.4'; # VERSION: Generated by DZP::OurPkg:Version
9              
10              
11             extends 'App::EventStreamr::Process';
12              
13             has 'cmd' => ( is => 'ro', lazy => 1, builder => 1 );
14             has 'cmd_regex' => ( is => 'ro', lazy => 1, builder => 1 );
15             has 'id' => ( is => 'ro', default => sub { 'icecast' } );
16             has 'type' => ( is => 'ro', default => sub { 'stream' } );
17              
18 1 0   1   1071 method _build_cmd() {
  0     0      
  0            
19 0 0         my $command = $self->{config}{commands}{stream} ? $self->{config}{commands}{stream} : 'dvsink-command -h $host -p $port -- ffmpeg2theora - -f dv -F 25:2 --speedlevel 0 -v 4 --optimize -V 420 --soft-target -a 4 -c 1 -H 44100 --title $id -o - | oggfwd $shost $sport $spassword /$stream';
20            
21 0           my %cmd_vars = (
22             host => $self->{config}{mixer}{host},
23             port => $self->{config}{mixer}{port},
24             id => $self->{config}{stream}{stream},
25             shost => $self->{config}{stream}{host},
26             sport => $self->{config}{stream}{port},
27             spassword => $self->{config}{stream}{password},
28             stream => $self->{config}{stream}{stream},
29             );
30              
31 0           $command =~ s/\$(\w+)/$cmd_vars{$1}/g;
32 0           return $command;
33             }
34              
35 1 0   1   493 method _build_cmd_regex() {
  0     0      
  0            
36 0           return qr:ffmpeg2theora.+--title.$self->{config}{stream}{stream}.+:;
37             }
38              
39             with('App::EventStreamr::DVswitch::Roles::MixerWait');
40              
41             1;
42              
43             __END__
44              
45             =pod
46              
47             =encoding UTF-8
48              
49             =head1 NAME
50              
51             App::EventStreamr::DVswitch::Stream - An IceCast Process
52              
53             =head1 VERSION
54              
55             version 0.4
56              
57             =head1 SYNOPSIS
58              
59             This Provides a pre-configured IceCast process.
60              
61             =head1 DESCRIPTION
62              
63             This largely extends L<App::EventStreamr::Process>, provides
64             default cmds that can be overridden in the configuration.
65              
66             =head1 AUTHOR
67              
68             Leon Wright < techman@cpan.org >
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is Copyright (c) 2014 by Leon Wright.
73              
74             This is free software, licensed under:
75              
76             The GNU Affero General Public License, Version 3, November 2007
77              
78             =cut