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   15393 use Method::Signatures;
  1         50404  
  1         5  
3 1     1   857 use Moo;
  1         6611  
  1         6  
4 1     1   1421 use namespace::clean;
  1         2982  
  1         4  
5              
6             # ABSTRACT: An IceCast Process
7              
8             our $VERSION = '0.3'; # 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   1017 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   527 method _build_cmd_regex() {
  0     0      
  0            
36 0           return qr:ffmpeg2theora.+--title.$self->{config}{stream}{stream}.+:;
37             }
38              
39             1;
40              
41             __END__
42              
43             =pod
44              
45             =encoding UTF-8
46              
47             =head1 NAME
48              
49             App::EventStreamr::DVswitch::Stream - An IceCast Process
50              
51             =head1 VERSION
52              
53             version 0.3
54              
55             =head1 SYNOPSIS
56              
57             This Provides a pre-configured IceCast process.
58              
59             =head1 DESCRIPTION
60              
61             This largely extends L<App::EventStreamr::Process>, provides
62             default cmds that can be overridden in the configuration.
63              
64             =head1 AUTHOR
65              
66             Leon Wright < techman@cpan.org >
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             This software is Copyright (c) 2014 by Leon Wright.
71              
72             This is free software, licensed under:
73              
74             The GNU Affero General Public License, Version 3, November 2007
75              
76             =cut