Changeset 82d34e6


Ignore:
Timestamp:
Aug 10, 2003, 10:07:06 PM (21 years ago)
Author:
jhawk <jhawk>
Branches:
master, debian, mac, no-cups, nodebathena, web
Children:
1db2bbb
Parents:
1282871
git-author:
jhawk <jhawk> (08/10/03 22:07:06)
git-committer:
jhawk <jhawk> (08/10/03 22:07:06)
Message:

Put under RCS.
Don't demand EXT-format, play straight URLs too based on content-type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gutenbach/debian/lib/sipbmp3-filter

    r1282871 r82d34e6  
    22# Play the data on STDIN as an audio file
    33#
    4 # $Id: sipbmp3-filter,v 1.5 2003-01-22 05:00:01 unknown Exp $
     4# $Id: sipbmp3-filter,v 1.6 2003-08-11 02:07:06 jhawk Exp $
     5# $Source: /tmp/tmp.UFBNno9997/RCS/sipbmp3-filter,v $
    56#
    67# TODO
     
    8182} elsif ($magic eq "EXT") {
    8283  # This is an external stream reference (a jered-special)
    83   &play_external_reference(\%opts);
     84  &play_external_reference(\%opts, $magic);
     85  exit 0;
     86} elsif ($magic eq "htt") {
     87  # This is an external stream reference (a jered-special)
     88  &play_external_reference(\%opts, $magic);
    8489  exit 0;
    8590} elsif ($magic eq "Ogg") {
     
    101106    # Retrieve those command line opts.
    102107    my %opts = %{shift(@_)};
     108    my $magic = shift(@_);
    103109
    104110    # External references are *not* playlists; they only support
     
    117123    my $format, $uri, $userpass;
    118124
    119     if (<STDIN> =~ /^EXT (.*)$/) {
    120       # Found the header
    121       $format = $1;
    122     } else {
    123       print ZEPHYR "Couldn't read EXT header\n";
     125    if ("$magic" eq "EXT") {
     126      if (<STDIN> =~ /^EXT (.*)$/) {
     127        # Found the header
     128        $format = $1;
     129      } else {
     130        print ZEPHYR "Couldn't read EXT header\n";
     131        close(ZEPHYR);
     132      }
     133 
     134      if (<STDIN> =~ /^(\S*)\s*(.*)$/) {
     135        # Found the URI (and optionally user:pass)
     136        $uri = $1;
     137        if ($2) {
     138        $userpass = $2;
     139        }
     140      } else {
     141        print ZEPHYR "Couldn't read URI for external reference\n";
     142        close(ZEPHYR);
     143      }
     144  } elsif ("$magic" eq "htt") {
     145      if (<STDIN> =~ /^(\S*)\s*(.*)$/) {
     146          $uri=$1;
     147          open(W3M, "/mit/sipb/bin/w3m -dump_head $uri|");
     148          $contenttype="unknown";
     149          while (<W3M>) {
     150              if ($_ =~ /^Content-Type:\s(\S*)/) {
     151                  $contenttype=$1;
     152              }
     153          }
     154             if ($contenttype eq "audio/mpeg") { $format="MP3" }
     155          elsif ($contenttype eq "audio/ogg") { $format="OGG" }
     156          else {
     157              print ZEPHYR "Unknown Content-Type $contenttype trying to /mit/sipb/bin/w3m -dump_head $uri\n";
     158              close(ZEPHYR);
     159          }
     160      } else {
     161        print ZEPHYR "Couldn't read URI for external reference\n";
     162        close(ZEPHYR);
     163      }
     164  } else {
     165      print ZEPHYR "Unknown syntax in play_external_reference(): $magic\n";
    124166      close(ZEPHYR);
    125     }
    126 
    127     if (<STDIN> =~ /^(\S*)\s*(.*)$/) {
    128       # Found the URI (and optionally user:pass)
    129       $uri = $1;
    130       if ($2) {
    131         $userpass = $2;
    132       }
    133     } else {
    134       print ZEPHYR "Couldn't read URI for external reference\n";
    135       close(ZEPHYR);
    136     }
     167  }
    137168
    138169    # Echo the rest to the zephyr
Note: See TracChangeset for help on using the changeset viewer.