Skip to content
Browse files

Makeing it iOS 6 compatibel using Net:SDP

  • Loading branch information...
1 parent f1fd87f commit 8b247119fde054d81c681f56930396ad3f121ead hendrikw82 committed
Showing with 18 additions and 14 deletions.
  1. +18 −14 shairport.pl
View
32 shairport.pl
@@ -45,6 +45,7 @@
use Digest::MD5 qw(md5 md5_hex);
use POSIX qw(:sys_wait_h setsid);
eval "use IO::Socket::INET6;";
+use Net::SDP;
my $shairportversion = "0.05";
@@ -630,20 +631,23 @@ sub conn_handle_request {
last;
};
- /^ANNOUNCE$/ && do {
- my $sdptext = $req->content;
- my @sdplines = split /[\r\n]+/, $sdptext;
- my %sdp = map { ($1, $2) if /^a=([^:]+):(.+)/ } @sdplines;
- die("no AESIV") unless my $aesiv = decode_base64($sdp{aesiv});
- die("no AESKEY") unless my $rsaaeskey = decode_base64($sdp{rsaaeskey});
- $rsa->use_pkcs1_oaep_padding;
- my $aeskey = $rsa->decrypt($rsaaeskey) || die "RSA decrypt failed";
-
- $conn->{aesiv} = $aesiv;
- $conn->{aeskey} = $aeskey;
- $conn->{fmtp} = $sdp{fmtp};
- last;
- };
+ /^ANNOUNCE$/ && do {
+ my $sdp = Net::SDP->new($req->content);
+ my $audio = $sdp->media_desc_of_type('audio');
+
+ print $audio->as_string();
+ print $audio->attribute('aesiv');
+
+ die("no AESIV") unless my $aesiv = decode_base64($audio->attribute('aesiv'));
+ die("no AESKEY") unless my $rsaaeskey = decode_base64($audio->attribute('rsaaeskey'));
+ $rsa->use_pkcs1_oaep_padding;
+ my $aeskey = $rsa->decrypt($rsaaeskey) || die "RSA decrypt failed";
+
+ $conn->{aesiv} = $aesiv;
+ $conn->{aeskey} = $aeskey;
+ $conn->{fmtp} = $audio->attribute('fmtp');
+ last;
+ };
/^SETUP$/ && do {
my $transport = $req->header('Transport');

0 comments on commit 8b24711

Please sign in to comment.
Something went wrong with that request. Please try again.