From: Dobrica Pavlinusic Date: Sun, 6 Feb 2011 20:37:59 +0000 (+0100) Subject: gstreamer file sink X-Git-Url: http://git.rot13.org/?p=skype-conference-recorder.git;a=commitdiff_plain;h=f513dc73d0a63af2547af4a2fd7a4e6bbebbd41f gstreamer file sink --- diff --git a/SkypeAPI.pm b/SkypeAPI.pm index 26683b5..2b522cc 100644 --- a/SkypeAPI.pm +++ b/SkypeAPI.pm @@ -107,10 +107,34 @@ sub Notify { $self->Invoke('SET USERSTATUS NA'); } - if ( $string =~ m{CALL (\d+) STATUS INPROGRESS} ) { + if ( $string =~ m{CALL (\d+) STATUS RINGING} ) { + $self->Invoke("ALTER CALL $1 ANSWER"); + } elsif ( $string =~ m{CALL (\d+) STATUS INPROGRESS} ) { my $call_id = $1; - my $port = 5000; + my $port = 5000 + $call_id; + + my $gst = qq{ + gst-launch -v + tcpserversrc port=$port ! + "audio/x-raw-int,rate=16000,width=16,channels=1" ! + wavenc ! + filesink location=/tmp/$port.wav + }; + $gst =~ s{[\s\n\r]+}{ }gs; + + warn "# $gst\n"; + open(my $g, '-|', $gst) || die $!; + while(<$g>) { + warn "## $_"; + last if m/PREROLL/; + } + $self->Invoke(qq|ALTER CALL $call_id set_output port="$port"|); + } elsif ( $string =~ m{CALL (\d+) STATUS FINISHED} ) { + my $port = $1 + 5000; + my $path = "/tmp/$port.wav"; + warn "# $path ", -s $path, " bytes\n"; +# } elsif ( $string =~ m{} ) { } return 0;